feat(voice): add send/edit/cancel confirmation buttons for voice transcription#135
Open
DovyLive173 wants to merge 3 commits into
Open
feat(voice): add send/edit/cancel confirmation buttons for voice transcription#135DovyLive173 wants to merge 3 commits into
DovyLive173 wants to merge 3 commits into
Conversation
…scription Replace the auto-send flow for voice messages with an interactive confirmation step. After transcription, the user now sees a message with inline buttons to Send, Edit, or Cancel the recognized text. - New stt-confirm.ts handler with showSttConfirmation, callback handling, and text/voice re-recording during edit - Interaction guard allows voice messages during expectedInput='mixed' for STT custom interactions (re-recording during edit) - Bot index registers the new callback and text handlers - i18n strings added for all supported languages (en/de/es/fr/ru/zh) - Voice handler tests updated to verify confirmation flow - Unused processPrompt dependency removed from voice.ts
… with code block for easy copy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the auto-send flow for voice transcriptions with an interactive confirmation step. After transcription, the user now sees a message with inline buttons to Send, Edit, or Cancel the recognized text before it is sent to OpenCode.
Changes
New file:
src/bot/handlers/stt-confirm.tsshowSttConfirmation()— displays the recognized text with Send/Edit/Cancel inline keyboardhandleSttConfirmCallback()— handles button callbacks:STT_NOTE_PROMPTand forwards toprocessUserPromptexpectedInput: "mixed"(accepts both text and a new voice recording) and prompts the user to send correctionshandleSttEditText()— receives corrected text (or a re-recording routed through the voice handler) and sends it to OpenCode viaprocessUserPromptModified:
src/bot/handlers/voice.tsprocessPromptcall andprocessPromptdep injection in favor ofshowSttConfirmationFilePartInputimport andprocessPromptoption fromVoiceMessageDepsModified:
src/interaction/guard.tsexpectedInput === "mixed"block: added an exception to allowinputType === "other"(voice/audio messages) when the active interaction is a custom STT interaction (kind === "custom"withsttTranscriptmetadata). This enables re-recording during edit without being blocked by the guard.Modified:
src/bot/index.tshandleSttConfirmCallbackin the callback query handler chainhandleSttEditTextbeforeprocessUserPromptin the text handler to intercept edited texti18n
stt.confirm_message,stt.confirm_send,stt.confirm_edit,stt.confirm_cancel,stt.confirm_sending,stt.confirm_edit_prompt,stt.confirm_edit_sending,stt.confirm_cancelled,stt.confirm_inactive) to all supported languages: en, de, es, fr, ru, zhTests
tests/bot/handlers/voice.test.ts:processPromptcallsHow it works
Testing
npm run build— passesnpm run lint— passes (0 warnings)npm test— passes (942 tests, 111 files, all passing)