feat(phonic): handle user text input via generate_reply - #3
Draft
devin-ai-integration[bot] wants to merge 4 commits into
Draft
feat(phonic): handle user text input via generate_reply#3devin-ai-integration[bot] wants to merge 4 commits into
devin-ai-integration[bot] wants to merge 4 commits into
Conversation
When a user sends text (e.g. typing in a chat), the framework calls update_chat_ctx with the user message followed by generate_reply. Previously the Phonic plugin ignored user messages in update_chat_ctx, so text input was silently dropped. This change: - Detects new user messages in update_chat_ctx 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:
|
say() drives speech directly and supersedes any buffered user text turn, so drop _pending_user_text to avoid it leaking into a later generate_reply. Addresses the cancellation edge case flagged in review. Co-authored-by: Cursor <cursoragent@cursor.com>
…onic-text-input Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # livekit-plugins/livekit-plugins-phonic/livekit/plugins/phonic/realtime/realtime_model.py
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
The Phonic realtime plugin currently only handles audio input. When a user types text (via LiveKit's chat/text stream), the framework calls
update_chat_ctxwith the user message followed bygenerate_reply. Previously, user-role messages inupdate_chat_ctxwere silently ignored — typed input was dropped with no response.This adds text input support:
The
_pending_user_textbridges the gap betweenupdate_chat_ctx(where the framework delivers user text) and_send_generate_reply(where we can pass it to the downstream echo service via thesystem_messagefield ofgenerate_reply).Python counterpart of Phonic-Co/livekit-agents-js#5.
Link to Devin session: https://app.devin.ai/sessions/51df28f166ac4fff8cae41b88dc9bab2
Requested by: @qionghuang6