Skip to content

Commit 2e43b3c

Browse files
committed
Standardize "INAUDIBLE" response handling to uppercase and add user warning modal
- when `apps/editor/src/views/panel/backend/message-handlers/handle-voice-input.ts` returns INAUDIBLE, show auto closing modal
1 parent 0de3628 commit 2e43b3c

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎apps/editor/src/constants/instructions.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ These files contain the core greeting logic and module exports.
5454
</system>`
5555

5656
export const voice_input_instructions =
57-
'Respond with a transcription of the following audio recording or text "(inaudible)", and nothing else.'
57+
'Respond with a transcription of the following audio recording or text "INAUDIBLE", and nothing else.'

‎apps/editor/src/views/panel/backend/message-handlers/handle-voice-input.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,15 @@ const stop_recording = async (panel_provider: PanelProvider) => {
239239
})
240240

241241
if (result?.response) {
242-
panel_provider.add_text_at_cursor_position(result.response)
242+
if (result.response.trim().toUpperCase() === 'INAUDIBLE') {
243+
panel_provider.send_message({
244+
command: 'SHOW_AUTO_CLOSING_MODAL',
245+
title: 'Inaudible voice input',
246+
type: 'warning'
247+
})
248+
} else {
249+
panel_provider.add_text_at_cursor_position(result.response)
250+
}
243251
}
244252
} catch (error: any) {
245253
if (axios.isCancel(error)) {

0 commit comments

Comments
 (0)