obsidian-copilot icon indicating copy to clipboard operation
obsidian-copilot copied to clipboard

"New Chat" button does not work when a user types too fast/too many and encounter 429s

Open petery789 opened this issue 1 year ago • 2 comments

Describe the bug After "New Chat" button, whose tooltip says "unsaved history will be lost", is clicked, the conversation continues and chatbot responds with answers to the prior user inputs. Maybe this is expected, but I would think it's better to cancel/discard on-the-fly responses from remote model providers

To Reproduce

  1. Use OPENROUTE.AI model, chat mode
  2. Start a new chat. Open developer tools, go to Network or Console tab as long as you can see 429 errors
  3. Start to type anything and enter "Enter". Repeat, quickly
  4. when you start to see a couple 429s, click "New Chat"
  5. Observe that the conversation continues..

Expected behavior I'd guess the system retries for 429 responses and tries to handle them when successful, when you are not clicking "New Chat". However, when I click "New Chat", I'd expect all prior messages would be discarded and a fresh new conversation is started.

Screenshots

https://github.com/logancyang/obsidian-copilot/assets/8389897/4a182c00-9c99-42ae-be4f-0c686934ef3f

Additional context

petery789 avatar Feb 05 '24 07:02 petery789

I see, it doesn't need fast and many inputs, New Chat doesn't disrupt any bot response right now. I think from this there are at least 2 issues:

  1. User shouldn't be able to send a new message before the bot finishes (to avoid 429)
  2. New Chat should disrupt all calls, basically it should first call the Stop button's handler and then clears the chat history.

This is a good first issue too.

logancyang avatar Feb 05 '24 08:02 logancyang

Created this one to separate it from the 429 issue https://github.com/logancyang/obsidian-copilot/issues/293

logancyang avatar Feb 15 '24 04:02 logancyang