-
Notifications
You must be signed in to change notification settings - Fork 667
Chat: describe Message Streaming demo #33419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
vladaskorohodova
merged 10 commits into
DevExpress:26_1
from
vladaskorohodova:chat-streaming26_1
Apr 28, 2026
+19
−0
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4fda200
Chat: describe Message Streaming demo
vladaskorohodova 0573876
Apply suggestions from code review
vladaskorohodova f165bd6
Potential fix for pull request finding
vladaskorohodova 73b2dc6
Potential fix for pull request finding
vladaskorohodova 7e977d2
Apply suggestions from code review
vladaskorohodova 39eca32
Reduce passive voice
vladaskorohodova 244858e
Merge branch '26_1' into chat-streaming26_1
vladaskorohodova 3f309af
Apply suggestions from code review
vladaskorohodova 6bf131e
Merge branch '26_1' into chat-streaming26_1
vladaskorohodova 4c2d449
Potential fix for pull request finding
vladaskorohodova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| This demo integrates the DevExtreme Chat component with [Azure OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service) to stream AI-generated responses in real time. As the AI model produces output token by token, the Chat component renders the response incrementally inside a message bubble. A typing indicator appears while the response begins, and the send button transforms into a stop button so users can cancel an in-progress stream at any time. | ||
|
|
||
| The empty state displays custom suggestion cards. Clicking a card sends the corresponding prompt directly to the AI without extra user input. | ||
|
vladaskorohodova marked this conversation as resolved.
Outdated
|
||
|
|
||
| <!--split--> | ||
|
|
||
| ## Streaming AI Responses | ||
|
|
||
| The demo calls the Azure OpenAI Chat Completions API with `stream: true`. Incoming delta chunks are passed through a `createDelayedRenderer` queue that introduces a short display delay between chunks to produce a smooth typing effect. Each chunk is appended to a growing buffer, and the assistant message is updated in the data store with every render cycle via a `store().push` update operation. | ||
|
vladaskorohodova marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Stopping a Stream | ||
|
|
||
| An `AbortController` is created before each request and its signal is forwarded to the Azure OpenAI SDK. When the user clicks the stop button, `abortController.abort()` is called, which both cancels the HTTP request and stops the delayed renderer queue. | ||
|
vladaskorohodova marked this conversation as resolved.
Outdated
|
||
|
|
||
| The [sendButtonOptions](/Documentation/ApiReference/UI_Components/dxChat/Configuration/#sendButtonOptions) property switches the button's `action` to `'custom'` and its icon to `'stopfilled'` while streaming is active, then reverts to the default send configuration once streaming ends. | ||
|
vladaskorohodova marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Custom Empty View | ||
|
|
||
| The Chat component specifies an [emptyViewTemplate](/Documentation/ApiReference/UI_Components/dxChat/Configuration/#emptyViewTemplate) that replaces the default empty state with custom suggestion cards. Clicking a card constructs a message and calls `fetchAIResponse` directly, bypassing the text input. | ||
|
vladaskorohodova marked this conversation as resolved.
Outdated
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.