Speech engine example#233
Merged
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit a264bb5. Configure here.
|
|
||
| if (history.length > 0 || attempt === 4) { | ||
| initialHistoryByConversation.set(conversationId, history); | ||
| return history; |
There was a problem hiding this comment.
Empty history cached permanently prevents later retrieval
Medium Severity
loadInitialHistory caches empty results on the final retry attempt (attempt === 4). Once cached, the early-return on has(conversationId) means subsequent onTranscript calls for the same conversation always return the cached empty array, even if the voice history link POST completes successfully afterward. This permanently drops typed chat context for the voice session whenever the link is delayed beyond the ~320ms retry window.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit a264bb5. Configure here.
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.


Note
Medium Risk
Adds a new Next.js example that introduces a standalone Speech Engine WebSocket server, OpenAI-backed response generation, and file-backed chat-history linking, increasing operational and dependency surface area. Risk is contained to the new example, but it touches realtime voice session flows and env/secret handling patterns.
Overview
Adds a new Speech Engine quickstart example (Next.js). The repo now includes
speech-engine/nextjs/quickstartwith docs, a generatorPROMPT.md, and asetup.shthat seeds from the Next.js template while adding@elevenlabs/react,@elevenlabs/elevenlabs-js,openai,dotenv,tsx, and alivekit-clientpin.The generated
example/introduces (1) a standaloneserver.mtsthat attachesspeechEngine.attach(..., "/ws")and streams OpenAI Responses API output back to ElevenLabs, (2) API routes for typed chat (/api/chat), WebRTC tokens (/api/token), and a demo-only file-backed voice-history bridge (/api/voice-history*), and (3) a single-page UI that can switch between typed chat and live voice while preserving context.Docs and repo indices are updated to list the new example and add
/speech-engineto the scaffold reference matrix.Reviewed by Cursor Bugbot for commit 8c33ec1. Bugbot is set up for automated code reviews on this repo. Configure here.