microsoft / sample-app-aoai-chatGPT

Sample code for a simple web chat experience through Azure OpenAI, including Azure OpenAI On Your Data.
MIT License
1.42k stars 2.13k forks source link

Responses Sent to Wrong Chat When Switching Between Chat History #942

Open santistelus opened 1 week ago

santistelus commented 1 week ago

When sending a message in a chat and switching to another chat from the history before the response is received, an error occurs. The error is that the response from the initial chat is displayed in the second chat.

Steps to reproduce the behavior:

  1. Open 2 chats, which we will call Chat A and Chat B for this example.
  2. In Chat A, send a prompt.
  3. While the response is being generated, switch to Chat B.
  4. You will notice that the original response from Chat A is displayed in Chat B.

Expected behavior Responses should only be shown in the chat where the prompt was made.

Configuration: Please provide the following

iseabock commented 4 days ago

@santistelus Can you confirm you are still experiencing this bug? Also, were you experiencing this locally or in a deployed app? Thanks.

santistelus commented 3 days ago

Hi @iseabock Yes, i am still experiencing this bug... and it is happening in both environments, locally and in a deployed app.

iseabock commented 3 days ago

@santistelus Can you make a screen recording of this? I'm having some trouble reproducing this bug.

santistelus commented 3 days ago

@iseabock Here! You may notice that I created two chats. In the first chat, I entered a prompt and then quickly switched to the second chat. Interestingly, I received the response from the first chat in the second chat.

https://github.com/microsoft/sample-app-aoai-chatGPT/assets/154442109/ca6f3f63-bde3-46e3-ad06-683944cfc854

iseabock commented 3 days ago

Thanks for the screen recording @santistelus. I suspect this may be a side effect of customizations that have been made in your app. I am not able to get the same behavior that you are getting. In the video I have provided, although I do see the "Generating answer" message when I switch the previous chat (a bug I'll fix :)) I am brought back to the second chat when the response is generated.

https://github.com/microsoft/sample-app-aoai-chatGPT/assets/994856/0249e884-828c-42d4-b523-2b669255e8cf

santistelus commented 3 days ago

I see... well do you mind sharing with me which file should i Review or any suggestions to solve this. :) Also thanks a lot for the fast reply!

iseabock commented 2 days ago

I think the files to check would be Chat.tsx and Answer.tsx and take a look at any async issues around currentChat.id and less likely but possibly answer.id. I hope that helps!