generative-ai-js icon indicating copy to clipboard operation
generative-ai-js copied to clipboard

Prevent sending messages in chat if the previous response hasn't finished

Open hsubox76 opened this issue 2 years ago • 1 comments

Right now, if the user calls sendMessage or sendMessageStream before the last exchange has completed, we just put it in a queue (promise chain) and send it when the last response completes. This can cause unexpected output, as the user perceives that they sent two messages in a row with no response in between (history is user-user-model), whereas the backend actually responded to the first user message before seeing the second one (user-model-user). We should throw an error (or no-op and warn) to let the user know they are trying to send a message before the last response completed, and may get unexpected results.

hsubox76 avatar Dec 18 '23 22:12 hsubox76

@IvanLH Can you please assign me this issue? So I can look on the issue.

code-soubhik avatar Mar 08 '25 16:03 code-soubhik