Python: ChatKit sample fixes (#2174)

* sample fixes

* Update thread naming
This commit is contained in:
Evan Mattson
2025-11-14 08:02:31 +09:00
committed by GitHub
Unverified
parent 15d0bda8a2
commit a75590eb9b
5 changed files with 151 additions and 67 deletions
+11 -2
View File
@@ -60,8 +60,17 @@ class MyChatKitServer(ChatKitServer[dict[str, Any]]):
if input_user_message is None:
return
# Convert ChatKit message to Agent Framework format
agent_messages = await simple_to_agent_input(input_user_message)
# Load full thread history to maintain conversation context
thread_items_page = await self.store.load_thread_items(
thread_id=thread.id,
after=None,
limit=1000,
order="asc",
context=context,
)
# Convert all ChatKit messages to Agent Framework format
agent_messages = await simple_to_agent_input(thread_items_page.data)
# Run the agent and stream responses
response_stream = agent.run_stream(agent_messages)