Closed m1nka closed 2 months ago
You can try returning an HTML fragment containing text content and adding styles to it to achieve the desired effect, which only requires the use of HTML attributes.
The response given by @buzhou9 is a great one!
Unfortunately Deep Chat does not allow the server to stream text
and html
at the same time as it is a very unnatural use-case and something that is difficult to parse/render for the same message. However, I can see that for your use-case you want to add the html
message as a separate message, so as an alternative to the @buzhou9 suggestion, you can also try to listen to when the stream has finished and add the suggestion message manually. Details on how to do that are listed in the following issue
Let me know if this helps. Thanks!
Hi, I will be closing this issue since there has been no further communication. Thanks!
We want to display a server reponse together with some custom button. So our goal is to display something like this:
We can successfully send either
html
ortext
, but we cannot send both in the same response. This would be extremely helpful since with AI agents we need to give an anwer to the user and then present some options to reply.If we send a stream back with
text
andhtml
at the same time like this (server-side code):the
html
is just ignored. And if we sendtext
first (which works fine) and somehtml
at the endwe get a Deepchat error:
Is this a bug? How can we work around this? We need to provide the user with a
text
answer and custom elements.Thanks a lot!