-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(copilot): add commands #2797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds slash command functionality to the copilot interface, enabling users to invoke special modes and web tools using Key Changes:
Issues Found:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant UserInput
participant SlashMenu
participant MentionMenu
participant Store
participant API
participant ClientTools
User->>UserInput: Types "/" character
UserInput->>MentionMenu: getActiveSlashQueryAtPosition()
MentionMenu-->>UserInput: Returns active slash query
UserInput->>SlashMenu: Shows slash menu
User->>SlashMenu: Types to filter or navigates with arrows
SlashMenu->>SlashMenu: Filters TOP_LEVEL_COMMANDS + WEB_COMMANDS
alt User selects Web folder
User->>SlashMenu: Presses Enter/ArrowRight on Web
SlashMenu->>SlashMenu: Opens Web submenu
User->>SlashMenu: Selects web command
else User selects top-level command
User->>SlashMenu: Presses Enter on command
end
SlashMenu->>MentionMenu: replaceActiveSlashWith(command)
SlashMenu->>UserInput: onSelectCommand(command)
UserInput->>UserInput: addContext({kind: 'slash_command'})
User->>UserInput: Presses Enter to submit
UserInput->>Store: sendMessage(message, contexts)
Store->>Store: Extract slash commands from contexts
Store->>Store: Filter out slash_command contexts
Store->>API: POST /api/copilot/chat {commands, contexts}
API->>API: Forward commands to backend
API-->>Store: Stream response with tool calls
Store->>Store: Handle tool_call events
Store->>ClientTools: Instantiate client tools (superagent, scrape, crawl, etc)
alt Tool is superagent
ClientTools->>ClientTools: Auto-execute superagent
API-->>Store: Stream subagent_text/subagent_tool_call
Store->>Store: Update subAgentBlocks
else Tool is web tool (scrape/crawl/read)
ClientTools->>ClientTools: Execute web tool
end
Store-->>UserInput: Update UI with streaming results
UserInput-->>User: Display results
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
24 files reviewed, 1 comment
|
|
||
| // Arrow navigation in slash menu | ||
| if (showSlashMenu) { | ||
| const TOP_LEVEL_COMMANDS = ['fast', 'plan', 'debug', 'research', 'deploy', 'superagent'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Command order mismatch: this array has a different order than line 512's array and the slash-menu.tsx component. Line 416 has ['fast', 'plan', 'debug', 'research', 'deploy', 'superagent'] while line 512 has ['plan', 'debug', 'fast', 'superagent', 'deploy', 'research']. This inconsistency causes arrow navigation to select the wrong command when Enter is pressed.
| const TOP_LEVEL_COMMANDS = ['fast', 'plan', 'debug', 'research', 'deploy', 'superagent'] | |
| const TOP_LEVEL_COMMANDS = ['fast', 'plan', 'debug', 'research', 'deploy', 'superagent'] |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/user-input.tsx
Line: 416:416
Comment:
**logic:** Command order mismatch: this array has a different order than line 512's array and the `slash-menu.tsx` component. Line 416 has `['fast', 'plan', 'debug', 'research', 'deploy', 'superagent']` while line 512 has `['plan', 'debug', 'fast', 'superagent', 'deploy', 'research']`. This inconsistency causes arrow navigation to select the wrong command when Enter is pressed.
```suggestion
const TOP_LEVEL_COMMANDS = ['fast', 'plan', 'debug', 'research', 'deploy', 'superagent']
```
How can I resolve this? If you propose a fix, please make it concise.
Summary
Adds slash commands, cleans up some ui for the copilot, fixes superagent
Type of Change
Testing
Manual
Checklist