mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: Fix CopilotStudioAgent to reuse conversation ID from existing session (#5299)
* Fix CopilotStudioAgent to reuse existing conversation on session (#5285) CopilotStudioAgent unconditionally called _start_new_conversation() in both _run_impl and _run_stream_impl, ignoring any existing service_session_id on the session. Add a guard to only start a new conversation when there is no existing service_session_id, matching the pattern used by other agents. Also fix pre-existing pyright reportMissingImports errors for orjson in file_history_provider samples. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Revert out-of-scope sample file changes Remove unrelated orjson type-ignore comment changes from sample files that were outside the scope of the conversation-ID reuse fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <copilot@github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
5777ed26e6
commit
495e1dad6b
@@ -244,7 +244,8 @@ class CopilotStudioAgent(BaseAgent):
|
||||
"""Non-streaming implementation of run."""
|
||||
if not session:
|
||||
session = self.create_session()
|
||||
session.service_session_id = await self._start_new_conversation()
|
||||
if not session.service_session_id:
|
||||
session.service_session_id = await self._start_new_conversation()
|
||||
|
||||
input_messages = normalize_messages(messages)
|
||||
|
||||
@@ -271,7 +272,8 @@ class CopilotStudioAgent(BaseAgent):
|
||||
nonlocal session
|
||||
if not session:
|
||||
session = self.create_session()
|
||||
session.service_session_id = await self._start_new_conversation()
|
||||
if not session.service_session_id:
|
||||
session.service_session_id = await self._start_new_conversation()
|
||||
|
||||
input_messages = normalize_messages(messages)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user