feat(dashbot): enable streaming responses in dashbot (#1202)#1344
Open
AbdelrahmanELBORGY wants to merge 1 commit intofoss42:mainfrom
Open
feat(dashbot): enable streaming responses in dashbot (#1202)#1344AbdelrahmanELBORGY wants to merge 1 commit intofoss42:mainfrom
AbdelrahmanELBORGY wants to merge 1 commit intofoss42:mainfrom
Conversation
feat(dashbot): enable streaming and fix raw JSON leakage in UI (foss42#1202) - Added comprehensive streaming tests to verify partial JSON chunk parsing. - Updated existing Dashbot tests to support the new typed message architecture.
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.
PR Description
This PR resolves #1202 by fully wiring up and enabling real-time streaming AI responses in Dashbot. This significantly improves the perceived responsiveness of the chat interface, eliminating the sluggish experience of waiting for the entire payload to generate.
Key Implementation Details:
chat_viewmodel.dartto utilizestream: trueand implemented the correspondingstreamChat()method inChatRemoteRepositoryto yield chunks over SSE.FormatExceptionerrors from mid-stream JSON chunks, this PR implements the Partial extraction approach:StringBufferand Regex-based parser progressively extract theexplanationtext as chunks arrive, feeding it tocurrentStreamingResponsefor a seamless real-time typing effect.actionsarray is safely deferred until the stream is fully closed, guaranteeing logical integrity and preventing mid-stream crashes.Visual Proof
Related Issues
Checklist
mainbranch before making this PRflutter test test/dashbot/) and all relevant tests are passingAdded/updated tests?
Streaming Testsgroup inchat_viewmodel_test.dart.explanationtokens are extracted progressively from partial chunks.actionsare only parsed after the stream is fully closed.OS on which you have developed and tested the feature?