[Demo] Add an example with streaming #118
Open
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.
I'm proposing to add an example which uses streaming via Turbo Streams / SSE since
symfony/ux-turbo
is already included, yet no demo app is using streaming.This demo does not use a custom Stimulus controller at all, but solely relies on vendor-provided
live
&turbo_stream
controllers, making it ideal for those afraid of JS :)A couple of observations made while doing this:
Symfony\AI\Agent\Chat
is not compatible at all with async/streaming flow.AssistantMessage
. Or alternatively,AssistantMessage
would need to be non-readonly (or havewithContent
) so that the message object could be created earlier and appended with content later. At the end, I didn't end up needing the IDs here since they didn't solve the "duplicate messages" (one from turbo, another from live component) problem I had at some point.