streaming assitant template is returning this error:
Could not send message: Unexpected token 'ש', "שלום! איך "... is not valid JSON
in the widget testing mode
Solution:Jump to solution
Hey @meirk, could you please check the "Advanced Options" section, and see if "Response is a stream" is enabled?
7 Replies
Solution
Hey @meirk, could you please check the "Advanced Options" section, and see if "Response is a stream" is enabled?
We're working on making this feature a bit more streamlined, so that this toggle option won't be necessary. In the mean time, please ensure the toggle is correctly enabled/disabled as needed.
Let me know if this helps.
Yes, this solved the problem!
What is the purpose of the header key x-thread-id?
What is the purpose of the header key x-thread-id?
It returns the thread Id to the chat widget. This allows the widget to track the conversation you have with the Assistant (so if it weren't for this header, the assistant will react to every message as if it's the first message in the thread -- i.e. it will have no memory of the previous messages in the conversation).
And why the no streaming template doesnt use it?
Because the standard assistant template returns a JSON, so one of the properties returns the message, while the other returns the thread ID, like so:
But in case of a stream response it's not possible to return a JSON like that, because the response is a stream of text.
So there needs to be a different way to return the thread ID in case of a stream. Returning it through the response header is one such way.
I see.. thanks a lot