Cognigy / SocketClient

A JavaScript client that can be used to connect to Cognigy.AI Socket Endpoints
Other
8 stars 3 forks source link

Emitting 'stop' signal by client to abort an incoming message stream #39

Open kaziller opened 6 months ago

kaziller commented 6 months ago

Hi there, this is probably more a feature request rather than an issue. And it has not directly related to the SocketClient itself.

Proposal

Being able to emit a 'stop' signal so that the server stops streaming a message and the "finalPing" Signal is been sent earlier.

Reason

Sometimes the answer is taking a bit too long and/or the user realizes during response stream that the answer is not correct or the question has to be refined. In order not to wait until the whole message has been sent to the client, the client should be able to abort the request and fire another request right after.

Current workaround

In order to abort an incoming stream we are currently disconnecting the socket client and reconnecting it again. With that we can guarantee that we have another socket session and the previous answer will not continue to be streamed to the new socket client. Draw back is that it takes time to disconnect and connect the client. Also we are not sure if this is really good practice to do it like that.

Are there maybe other solutions already in place?

Thank you for your help!

kaziller commented 6 months ago

Another draw back to mention is that with this workaround I ll most probably lose the whole previous conversation context. So I f I want to follow up on something I have already asked, then the assistant will not know the conversation history.