feat(phonic): handle user text input via generate_reply - #5
Draft
devin-ai-integration[bot] wants to merge 7 commits into
Draft
feat(phonic): handle user text input via generate_reply#5devin-ai-integration[bot] wants to merge 7 commits into
devin-ai-integration[bot] wants to merge 7 commits into
Conversation
When a user sends text (e.g. typing in a chat), the framework calls updateChatCtx with the user message followed by generateReply. Previously the Phonic plugin ignored user messages in updateChatCtx, so text input was silently dropped. This change: - Detects new user messages in updateChatCtx and stores the text - Includes the user text in the generate_reply system_message sent to the Phonic downstream service, so the LLM can see and respond to typed user input Co-Authored-By: qiong@phonic.co <qionghuang6@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-authored-by: rosetta-livekit-bot[bot] <282703043+rosetta-livekit-bot[bot]@users.noreply.github.com>
…onic-text-input Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # plugins/phonic/src/realtime/realtime_model.ts
- Demote "Received user text input" log from info to debug - Remove leftover agentName from the realtime example Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Description
The Phonic realtime plugin currently only handles audio input from users. When a user types text (e.g. via LiveKit's chat/text stream), the framework calls
updateChatCtxwith the user message followed bygenerateReply. Previously, the plugin silently ignored user messages inupdateChatCtx, so typed text input was dropped with no response.This PR adds text input support by:
updateChatCtxand storing the text as pendinggenerate_replymessage'ssystem_messagefield, so the downstream echo service sees the user's typed input and the LLM responds to itChanges Made
pendingUserTextfield toRealtimeSessionto buffer user text betweenupdateChatCtxandgenerateReplyupdateChatCtx: detect items withrole === 'user'and store their text contentsendGenerateReply: if pending user text exists, format it into thesystem_messageso the downstream LLM context includes the user's typed messageupdateChatCtxis called with only user messagesPre-Review Checklist
Testing
pnpm buildpassesAdditional Notes
The flow for text input with this change:
Link to Devin session: https://app.devin.ai/sessions/51df28f166ac4fff8cae41b88dc9bab2
Requested by: @qionghuang6