When a response is streaming, in the response interceptor you can add messages
const responseInterceptor = (response) => {
if (message.text === "special") {
return deepChat.addMessage(formatSpecialMessage(response))
}
if (domContainsSpecial()) {
removeSpecial()
deepChat.addMessage(response)
}
return response;
};
So a streamed response like this:
["Foo", "special", "Bar", "Baz"]
Would generate a DeepChat output like:
1.
Foo
2.
Foo
Special
3.
Foo
Bar
4.
Foo Baz
Bar
However, I want the final output to be
Foo
Bar Baz
So the last streamed messages gets appended to the last message. Is this possible?