-
-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Response type should support multiple messages #191
Comments
I would also like this, but in case you haven't seen it, there's a workaround using the websocket handler. |
Hey folks, apologies for the late replies as I am currently very occupied with my current job. I wanted to offer an alternative, you could potentially intercept the incoming responses using the Let me know if this helps. |
@OvidijusParsiunas There is a gotcha with ![]()
|
Hi @nileshtrivedi. It is strange that the returned role is not respected. Could you perhaps make the last message returned by the interceptor define an explicit role? E.g. |
@OvidijusParsiunas That does not fix it. Here is the whole app in a single file. You can run this as
|
You can try this, it will correctly identify the identity. This is the document about this parameter. <deep-chat id="chat" demo="true" names='{"user":{"text":"cathy"}}'></deep-chat>
<script>
window.onload = function() {
let chatElementRef = document.getElementById('chat');
chatElementRef.responseInterceptor = (response) => {
response = [
{
"text": "Cathy, tell me a joke.",
"role": "joe"
},
{
"text": "Sure, here's one for you:\n\nWhy don't scientists trust atoms?\n\nBecause they make up everything!",
"role": "user"
}
]
console.log(JSON.stringify(response, null, 2));
response.slice(0, response.length - 1).forEach(m => chatElementRef._addMessage(m))
console.log(response[response.length - 1])
return response[response.length - 1];
};
};
</script> |
@buzhou9 Yes, deleting "stream={" simulation ": 6} " indeed fixes the names. Thanks again to both you and @OvidijusParsiunas ! 👍 |
I am using a custom chat endpoint where the request is handled by a group of agents, and therefore, the response comes as a list of messages. It looks like DeepChat is only prepared to handle a single message in the Response: https://deepchat.dev/docs/connect/#Response
It would be great if this assumption can be relaxed.
The text was updated successfully, but these errors were encountered: