fix: [Agentic Apps] - Two chat history titles for current chat #288
fix: [Agentic Apps] - Two chat history titles for current chat #288Tejasri-Microsoft wants to merge 2 commits intomicrosoft:devfrom
Conversation
|
@Tejasri-Microsoft please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent duplicate conversation entries in chat history and ensure conversation updates (title/id selection + persistence) behave consistently across async updates.
Changes:
- Added conversation deduplication by
idinchatHistorySliceand applied it during bulk adds and history fetch/pagination. - Updated the “save/update conversation” flow in
Chat.tsxto use the final conversation id, avoid creating duplicates, and reliablyawaitpersistence. - Removed workshop-mode-specific chart parsing branch and cleaned up related imports.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/App/src/store/chatHistorySlice.ts |
Introduces dedupeConversationsById and uses it in reducers and fetch-history fulfillment to prevent duplicates. |
src/App/src/components/Chat/Chat.tsx |
Adjusts save/update logic to pick the correct conversation id, avoid duplicate history entries, and await DB persistence; removes workshop-mode parsing branch. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This pull request improves the handling of chat conversation history in the application, with a focus on preventing duplicate conversations and ensuring correct updates to the conversation list. It also introduces minor code cleanups and improves the reliability of saving chat data.
Conversation history deduplication and update logic:
dedupeConversationsByIdutility to ensure the conversation list contains only unique conversations by ID, and integrated it into reducers and async state updates inchatHistorySlice.ts. [1] [2] [3]addNewConversationreducer to merge data if a conversation with the same ID already exists, moving the updated conversation to the top of the list.Chat component logic improvements:
Chat.tsxto check for existing conversations before adding new ones, and to use the correct conversation ID when updating or selecting conversations. [1] [2]Async data persistence:
saveToDBinChat.tsxto useawait, ensuring that chat and chart data are reliably persisted before proceeding. [1] [2] [3]Code cleanup:
Chat.tsx. [1] [2]## PurposeDoes this introduce a breaking change?
Golden Path Validation
Deployment Validation
This pull request improves the reliability and consistency of chat conversation management in the application. The main focus is on preventing duplicate conversations in the chat history, ensuring that conversation updates are handled correctly, and improving the robustness of asynchronous operations when saving chat data.
Chat history deduplication and consistency:
dedupeConversationsByIdutility function inchatHistorySlice.tsto ensure the chat history list contains only unique conversations by theirid, preventing duplicates when adding or updating conversations.addConversationsand chat history fetch reducers to usededupeConversationsById, ensuring no duplicate conversations are introduced during bulk additions or pagination. [1] [2]addNewConversationreducer to merge with existing conversations if a conversation with the sameidalready exists, updating its data and moving it to the top of the list.Chat update and save logic improvements:
Chat.tsxto check for existing conversation IDs in chat history before adding new conversations, and to always set the selected conversation ID after a successful update.saveToDBinChat.tsxto be awaited, ensuring that chat data is reliably saved before proceeding, which improves data consistency during async operations. [1] [2] [3]Code cleanup:
isWorkShopDeploymentimport and related conditional logic inChat.tsx, simplifying the parsing of chart responses. [1] [2] ] I have validated the deployment process successfully and all services are running as expected with this change.What to Check
Verify that the following are valid
Other Information