flyerhq / flutter_chat_ui

Actively maintained, community-driven chat UI implementation with an optional Firebase BaaS.
https://flyer.chat
Apache License 2.0
1.59k stars 688 forks source link

Is there any way to make messages support something like SSE? #634

Open KylinShinlyLin opened 2 weeks ago

KylinShinlyLin commented 2 weeks ago

I need to use this UI framework to create an effect similar to GPT's SSE, but I found that the current API provided by the framework doesn't seem to meet my needs. I'm wondering if there's a way to allow a specific message in the conversation to support SSE modification.

demchenkoalex commented 2 weeks ago

Hey! I am not familiar with this, could you give me some examples? like what a specific message should do?

danielwinkler commented 1 week ago

SSE will probably be abstracted into a Stream<String> in your code. I also thought it would be nice to plug in a stream to the text message, but as a workaround you can wrap the Chat widget in a StreamBuilder. From there you keep all messages the same, and the GPT message will be a text message that gets the stream snapshot data, this way it will build with the GPT effect.

The likely more efficient solution is to use a custom message, and pass in the stream as metadata. Using the customMessageBuilder you are able to build a widget that updates whenever there is an update from the stream.

demchenkoalex commented 6 days ago

Ah if this is just stream then I already have working example on v2 branch. Initial release is very soon, I am satisfied with new version quality