Skip to content

[Feat] Vision-based autocomplete with KB grounding#1130

Merged
MODSetter merged 22 commits into
MODSetter:devfrom
CREDO23:feat/vision-autocomplete
Apr 5, 2026
Merged

[Feat] Vision-based autocomplete with KB grounding#1130
MODSetter merged 22 commits into
MODSetter:devfrom
CREDO23:feat/vision-autocomplete

Conversation

@CREDO23

@CREDO23 CREDO23 commented Apr 4, 2026

Copy link
Copy Markdown
Collaborator

Description

Add vision-based autocomplete that captures the user's screen on Cmd+Shift+Space, analyzes it with a Vision LLM, searches the knowledge base for relevant context, and streams a writing suggestion in a floating tooltip at the cursor position. Accepting a suggestion pastes it into the active app via the clipboard.

API Changes

  • This PR includes API changes
    • POST /api/v1/autocomplete/vision/stream — new SSE endpoint for vision autocomplete
    • vision_llm_id added to search space LLM preferences (read/update)

Change Type

  • New feature

Testing Performed

  • Tested locally
  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

High-level PR Summary

This PR introduces a vision-based autocomplete feature that captures screenshots when the user presses Cmd+Shift+Space, analyzes them using a Vision LLM to understand context, searches the knowledge base for relevant information, and streams intelligent writing suggestions in a floating tooltip at the cursor position. The implementation spans backend API endpoints for vision autocomplete with SSE streaming, database schema updates to store vision LLM preferences per search space, desktop app integration with native screenshot capture and macOS permissions handling, and UI components for managing autocomplete settings and displaying suggestions. The feature requires macOS accessibility and screen recording permissions to inject accepted suggestions into the active application via clipboard.

⏱️ Estimated Review Time: 1-3 hours

💡 Review Order Suggestion
Order File Path
1 surfsense_backend/alembic/versions/119_add_vision_llm_id_to_search_spaces.py
2 surfsense_backend/app/db.py
3 surfsense_backend/app/schemas/new_llm_config.py
4 surfsense_backend/app/routes/search_spaces_routes.py
5 surfsense_backend/app/services/llm_service.py
6 surfsense_backend/app/routes/autocomplete_routes.py
7 surfsense_backend/app/services/vision_autocomplete_service.py
8 surfsense_backend/app/routes/__init__.py
9 surfsense_desktop/package.json
10 surfsense_desktop/.npmrc
11 surfsense_desktop/electron-builder.yml
12 surfsense_desktop/pnpm-lock.yaml
13 surfsense_desktop/scripts/build-electron.mjs
14 surfsense_desktop/src/modules/permissions.ts
15 surfsense_desktop/src/modules/platform.ts
16 surfsense_desktop/src/ipc/channels.ts
17 surfsense_desktop/src/ipc/handlers.ts
18 surfsense_desktop/src/modules/autocomplete/screenshot.ts
19 surfsense_desktop/src/modules/autocomplete/suggestion-window.ts
20 surfsense_desktop/src/modules/autocomplete/index.ts
21 surfsense_desktop/src/modules/window.ts
22 surfsense_desktop/src/main.ts
23 surfsense_desktop/src/preload.ts
24 surfsense_web/types/window.d.ts
25 surfsense_web/contracts/types/new-llm-config.types.ts
26 surfsense_web/app/desktop/suggestion/suggestion.css
27 surfsense_web/app/desktop/suggestion/layout.tsx
28 surfsense_web/app/desktop/suggestion/page.tsx
29 surfsense_web/app/desktop/permissions/page.tsx
30 surfsense_web/app/dashboard/[search_space_id]/user-settings/components/DesktopContent.tsx
31 surfsense_web/components/settings/llm-role-manager.tsx
32 surfsense_web/components/settings/user-settings-dialog.tsx
33 surfsense_web/components/editor-panel/editor-panel.tsx
34 surfsense_web/components/layout/ui/tabs/DocumentTabContent.tsx
⚠️ Inconsistent Changes Detected
File Path Warning
surfsense_web/components/editor-panel/editor-panel.tsx Contains what appears to be a duplicate/leftover line from refactoring unrelated to vision autocomplete functionality
surfsense_web/components/layout/ui/tabs/DocumentTabContent.tsx Contains what appears to be a duplicate/leftover line from refactoring unrelated to vision autocomplete functionality

Need help? Join our Discord

Analyze latest changes

CREDO23 added 22 commits April 2, 2026 13:18
@vercel

vercel Bot commented Apr 4, 2026

Copy link
Copy Markdown

@CREDO23 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@recurseml recurseml Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on 92d75ad..a180bf5

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (34)

surfsense_backend/alembic/versions/119_add_vision_llm_id_to_search_spaces.py
surfsense_backend/app/db.py
surfsense_backend/app/routes/__init__.py
surfsense_backend/app/routes/autocomplete_routes.py
surfsense_backend/app/routes/search_spaces_routes.py
surfsense_backend/app/schemas/new_llm_config.py
surfsense_backend/app/services/llm_service.py
surfsense_backend/app/services/vision_autocomplete_service.py
surfsense_desktop/.npmrc
surfsense_desktop/electron-builder.yml
surfsense_desktop/package.json
surfsense_desktop/pnpm-lock.yaml
surfsense_desktop/scripts/build-electron.mjs
surfsense_desktop/src/ipc/channels.ts
surfsense_desktop/src/ipc/handlers.ts
surfsense_desktop/src/main.ts
surfsense_desktop/src/modules/autocomplete/index.ts
surfsense_desktop/src/modules/autocomplete/screenshot.ts
surfsense_desktop/src/modules/autocomplete/suggestion-window.ts
surfsense_desktop/src/modules/permissions.ts
surfsense_desktop/src/modules/platform.ts
surfsense_desktop/src/modules/window.ts
surfsense_desktop/src/preload.ts
surfsense_web/app/dashboard/[search_space_id]/user-settings/components/DesktopContent.tsx
surfsense_web/app/desktop/permissions/page.tsx
surfsense_web/app/desktop/suggestion/layout.tsx
surfsense_web/app/desktop/suggestion/page.tsx
surfsense_web/app/desktop/suggestion/suggestion.css
surfsense_web/components/editor-panel/editor-panel.tsx
surfsense_web/components/layout/ui/tabs/DocumentTabContent.tsx
surfsense_web/components/settings/llm-role-manager.tsx
surfsense_web/components/settings/user-settings-dialog.tsx
surfsense_web/contracts/types/new-llm-config.types.ts
surfsense_web/types/window.d.ts

@MODSetter
MODSetter merged commit 74bf3df into MODSetter:dev Apr 5, 2026
6 of 10 checks passed

@recurseml recurseml Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on a180bf5..a180bf5

✨ No files to analyze

@recurseml recurseml Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on a180bf5..a180bf5

✨ No files to analyze

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants