Skip to content

refactor: Refactor Frontend/Backend Conversation Flow for Simpler Message Processing#663

Merged
Avijit-Microsoft merged 4 commits into
devfrom
psl-pk-hist
Nov 28, 2025
Merged

refactor: Refactor Frontend/Backend Conversation Flow for Simpler Message Processing#663
Avijit-Microsoft merged 4 commits into
devfrom
psl-pk-hist

Conversation

@Pavan-Microsoft

Copy link
Copy Markdown
Contributor

Purpose

This pull request refactors the way chat messages and conversation requests are handled in the app, simplifying the data flow and removing legacy support for tracking the "last RAG response." The changes streamline how messages are passed between the frontend and backend, and clean up unused code and state properties.

Frontend state and message handling:

  • Removed all logic and state related to tracking the "last RAG response" from AppProvider.tsx, AppReducer.tsx, ActionConstants.tsx, and the chat component, including the associated reducer actions and state properties. ([[1]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-4d5ea799575b73ec4c5039fcd11d8b55d55c6e43dfb993e54a677ecc35661d72L25), [[2]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-8918bba936dfa6b9bbe5de0c46e96c396f2d25789f53fe67677f7fa8bb3749f3L31), [[3]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-8918bba936dfa6b9bbe5de0c46e96c396f2d25789f53fe67677f7fa8bb3749f3L74), [[4]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-8918bba936dfa6b9bbe5de0c46e96c396f2d25789f53fe67677f7fa8bb3749f3L190-L193), [[5]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a1136a23abe9a62b9696e982ba879fa87243fd36db98a7d7c868b3b413fa32aeL91-R91), [[6]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a1136a23abe9a62b9696e982ba879fa87243fd36db98a7d7c868b3b413fa32aeL202-L209))
  • Changed how updatedMessages are constructed in the chat component (Chat.tsx) to avoid merging with previous state and instead use only the latest relevant messages for each update. ([[1]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL76-R83), [[2]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL99-R99), [[3]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL274-R271), [[4]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL297-R294), [[5]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL316-R309), [[6]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL360-R351), [[7]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL553-R532), [[8]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL596-R575), [[9]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL615-R590), [[10]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL649-R620), [[11]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL664-R631), [[12]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL682-R643))
  • Updated the conversation request structure to send only the user's query string instead of the full messages array and last RAG response. ([[1]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL221-R221), [[2]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-a8495413a74092724ad57e37fffa0de07c14fc3a4c605214fe3dcb5ea062f67fL432-R417), [[3]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-600167695c2ed37d44d2c2e18d186e815d6bed998079e2eb934a305fa9ee1b6eL42-R42))

API and backend request structure:

  • Modified the API request payload for conversations to use a single query field instead of an array of messages and last RAG response, and updated the backend route to consume this new format. ([[1]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-5e156b02a6e78df5b2df1b438d2051f134fa18e4a259052ad0bb66acbff5673fL290-R291), [[2]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-9f272a148c254bda26deb3ec575a6fe54454afc6a327b86ebc3ae2a8a628cf55L120-R122))
  • Removed the unused historyGenerate API function and cleaned up related types and metadata fields that are no longer needed. ([[1]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-5e156b02a6e78df5b2df1b438d2051f134fa18e4a259052ad0bb66acbff5673fL435-L470), [[2]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-600167695c2ed37d44d2c2e18d186e815d6bed998079e2eb934a305fa9ee1b6eL149-L152), [[3]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/663/files#diff-600167695c2ed37d44d2c2e18d186e815d6bed998079e2eb934a305fa9ee1b6eL161-L164))

These changes make the codebase easier to maintain and ensure a more consistent flow of data between the frontend and backend.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify that the chat and update api payload sending only required info.

@Avijit-Microsoft
Avijit-Microsoft merged commit 47ed5ed into dev Nov 28, 2025
5 checks passed
@Pavan-Microsoft
Pavan-Microsoft deleted the psl-pk-hist branch November 28, 2025 09:47
@github-actions

github-actions Bot commented Dec 1, 2025

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.15.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants