Skip to content

refactor(chat): consolidate slash command execution into message pipeline#230

Open
andrasbacsai wants to merge 4 commits intomainfrom
slash-command-insert-before-send
Open

refactor(chat): consolidate slash command execution into message pipeline#230
andrasbacsai wants to merge 4 commits intomainfrom
slash-command-insert-before-send

Conversation

@andrasbacsai
Copy link
Copy Markdown
Member

Summary

  • Move slash command execution from immediate handler to message sending pipeline
  • Commands now insert into chat input as /commandname instead of executing immediately, allowing users to provide arguments
  • Auto-detect and set pending command when user types space after a command name
  • Clear pending commands when input is edited or form is submitted
  • Add pendingCommands state to chat store to track selected command per session
  • Simplify usePendingAttachments hook by removing command execution logic
  • Update version to 0.1.31

Changes by File

ChatInput.tsx: Refactor command selection to insert into input rather than execute; auto-detect command when user types space after command name; clear pending command when input changes.

useMessageSending.ts: Add command resolution logic to handleSubmit; when a pending command exists, resolve it asynchronously and send resolved content plus user arguments as the message.

usePendingAttachments.ts: Remove handleCommandExecute and associated parameters; simplify to only handle attachment removal and queue management.

ChatWindow.tsx: Remove onCommandExecute prop from ChatInput; pass only essential parameters to usePendingAttachments.

chat-store.ts: Add pendingCommands state and setPendingCommand action to track slash commands per session.

- Extract pending commands state to Zustand store for session-based tracking
- Move command execution logic from usePendingAttachments to useMessageSending
- Simplify usePendingAttachments hook to focus on attachment removal
- Remove onCommandExecute callback from ChatInput and ChatWindow components
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.

1 participant