Skip to content

chore: Add convesation Id for voice chat and normal chat from text input - #336

Open
NirajC3-Microsoft wants to merge 4 commits into
devfrom
psl-Add-conv-id
Open

chore: Add convesation Id for voice chat and normal chat from text input#336
NirajC3-Microsoft wants to merge 4 commits into
devfrom
psl-Add-conv-id

Conversation

@NirajC3-Microsoft

Copy link
Copy Markdown
Contributor

Purpose

This pull request implements shared Azure AI conversation tracking across both text and voice chat for chat-app and scenario-app backends. The main enhancement is the introduction of a session-based cache that maps session IDs to Azure AI conversation IDs, ensuring that each user session maintains a consistent conversation context whether interacting via text or voice. This enables better continuity and traceability in conversations, and prepares the system for more advanced features like conversation history and analytics.

The most important changes are:

Shared Conversation Cache

  • Added a global conversation_cache using TTLCache in both chat-app/backend/app/config.py and scenario-app/backend/app/config.py to map session_id to Azure AI conversation_id, shared by both text and voice subsystems. [1] [2] [3] [4]

Text Chat Integration

  • Updated send_message_legacy in both chat.py routers to retrieve or create an Azure AI conversation ID from the cache using the session_id, and to pass this conversation ID to the agent for each request, ensuring conversation continuity. [1] [2] [3] [4] [5] [6] [7] [8]

Voice Chat Integration

  • Modified voice chat session handling to propagate the session_id from the websocket connection, use it for conversation tracking, and pass it through all relevant function calls, ensuring that voice interactions use the same conversation context as text. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Foundry Agent Utilities

  • Updated call_foundry_agent in foundry_agent_utils.py to accept and use a conversation_id, retrieving or creating the corresponding Azure AI conversation as needed, and storing it in the shared cache. [1] [2] [3]

Frontend Support

  • Enhanced the frontend (EnhancedChatPanel.tsx) to include the current chat session_id as a query parameter when establishing the voice websocket connection, enabling the backend to associate the websocket with the correct conversation.

These changes together ensure seamless, session-based conversation continuity across both text and voice channels in the application.

Does this introduce a breaking change?

  • Yes
  • No

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
  • Test the code

What to Check

Verify that the following are valid

  • ...

Other Information

This comment was marked as resolved.

Copilot AI review requested due to automatic review settings August 13, 2026 06:35

This comment was marked as resolved.

Copilot AI review requested due to automatic review settings August 14, 2026 08:54

This comment was marked as resolved.

Copilot AI review requested due to automatic review settings August 14, 2026 10:01

This comment was marked as resolved.

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.

2 participants