Skip to content

fix: dev to main - improve citation handling, chat message ordering and enhances chat sessions switching - #1074

Merged
Roopan-Microsoft merged 11 commits into
mainfrom
dev
Oct 28, 2026
Merged

Roopan-Microsoft merged 11 commits into
mainfrom
dev

Conversation

@Pavan-Microsoft

Copy link
Copy Markdown
Contributor

Purpose

This pull request introduces significant improvements to citation handling in RAG responses, ensures chat message ordering is consistent and robust, and enhances the user experience when switching between chat sessions in the Explore page. The most important changes are summarized below.

Backend: Citation Handling and Message Ordering

  • Replaced the _collect_citations function with a new _number_citations implementation in service.py, which accurately replaces raw citation markers in responses with sequential [N] markers and generates a deduplicated, ordered citation list. This ensures that citations are correctly linked to documents, even when markers are missing or duplicated. [1] [2] [3]
  • Improved chat message ordering in both SQLite (chat_store.py) and Cosmos DB (cosmos_service.py) backends by sorting messages using a stable, explicit order field (sort_order or order), falling back to timestamp as needed. This prevents message order issues when timestamps are tied or not unique. [1] [2]

Frontend: Explore Page Session and UI Improvements

  • Refactored chat session management in Explore.tsx to support multiple pending sessions, ensuring that typing indicators and answers are only shown for the currently active chat. This prevents UI glitches when switching sessions quickly. [1] [2] [3] [4]
  • Updated session navigation logic so that query parameters (q and source) are cleared after an auto-query is processed, preventing repeated questions on refresh or navigation.
  • Ensured that starting a new chat or loading a session updates the session reference correctly, so UI state and message updates are always applied to the correct chat. [1] [2]

These changes collectively make citation display more reliable, chat history ordering more robust, and the chat UI more responsive and accurate when handling multiple sessions.

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.

@Roopan-Microsoft
Roopan-Microsoft merged commit 19fa5a9 into main Oct 28, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants