feat(chat): enhance message streaming logic for tool responses#89
Open
Gourav-InfoTech wants to merge 1 commit intoYourGPT:betafrom
Open
feat(chat): enhance message streaming logic for tool responses#89Gourav-InfoTech wants to merge 1 commit intoYourGPT:betafrom
Gourav-InfoTech wants to merge 1 commit intoYourGPT:betafrom
Conversation
- Introduced a mechanism to handle post-tool text streaming when a message:delta is received without a preceding message:start, allowing for live updates. - Added a guard to prevent duplicate insertion of assistant messages that follow tool results, ensuring proper message flow. - Improved debug logging for better traceability of streaming state changes. This update refines the chat experience by ensuring that tool responses are integrated seamlessly into the conversation flow.
|
@Gourav-InfoTech is attempting to deploy a commit to the Delta4 Infotech Team on Vercel. A member of the Team first needs to authorize it. |
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
Fixes a bug where post-tool text responses (e.g. after websearch/webanswer builtin tools) would either appear all-at-once instead of streaming live, or appear as duplicate messages when both the streaming path and the
donehandler inserted the same content.Changes
message:deltachunks that arrive with no activestreamState(server-side tools like websearch that skipmessage:start) and auto-initialize a new assistant message so post-tool text streams livepostToolTextStreamedflag to signal that post-tool text was already delivered via the live-streaming path, preventing thedonehandler from inserting a duplicateseenToolResulttracking in thedone.messagesloop to correctly distinguish pre-tool assistant text (skip — already streamed) from post-tool assistant text (insert only if not already streamed)if/continuechain into a properif/else if/elseblock for clarityType of Change
Testing
Checklist