Skip to content

fix(stt): match dictionary echo against truncated Groq prompt#1229

Open
stantheman0128 wants to merge 1 commit into
OpenWhispr:mainfrom
stantheman0128:fix/dict-echo-truncated
Open

fix(stt): match dictionary echo against truncated Groq prompt#1229
stantheman0128 wants to merge 1 commit into
OpenWhispr:mainfrom
stantheman0128:fix/dict-echo-truncated

Conversation

@stantheman0128

Copy link
Copy Markdown

Summary

Groq (and custom Groq endpoints) truncate the custom dictionary prompt to about 890 characters before STT. The dictionary-echo filter still compared transcripts against the full dictionary, so a truncated echo could miss the filter and paste into the focused field.

This change:

  • extracts truncateDictionaryPrompt next to the echo matcher
  • lets isDictionaryEcho take the prompt that was actually sent
  • uses that prompt on the BYOK / Groq transcription path after truncation

AI assistance

Assisted by Cursor / Grok. Human author: Stan Shih (stantheman0128). I reviewed the diff and verification output.

Verification / Evidence

` ext
node --test test/helpers/dictionaryEchoFilter.test.js

18 pass, 0 fail (includes truncated-prompt echo case)

npx tsc --noEmit -p src

exit 0

npm run lint

exit 0

`

Live note: truncation logic was already present for Groq; the bug was echo matching against the unsent full dictionary.

Test plan

  • Unit tests for truncate + echo against sent prompt
  • Manual: large custom dictionary + silent dictation on Groq should not paste truncated dictionary text

Groq truncates custom dictionary prompts to ~890 chars, but the echo
filter still compared against the full dictionary, so truncated echoes
could slip through as paste. Pass the prompt that was actually sent.

Co-authored-by: Cursor <cursoragent@cursor.com>
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