feat: 切换对话时恢复对应的Agent显示

This commit is contained in:
2026-04-12 17:06:39 +08:00
parent 051fd5c1c8
commit 6adeb9b371
2 changed files with 28 additions and 4 deletions

View File

@@ -546,14 +546,20 @@ async def websocket_endpoint(websocket: WebSocket, user_id: str):
if conversation:
messages = conv_service.get_messages(conversation.id)
# 获取对话使用的Agent ID
conv_agent_id = conversation.current_agent_id
await websocket.send_json({
"type": "history",
"conversation_id": current_conversation_id,
"agent_id": conv_agent_id, # 返回对话的Agent ID
"messages": [
{
"role": m.role,
"content": m.content,
"thinking_content": m.thinking_content,
"agent_id": m.agent_id, # 每条消息的Agent ID
"source": m.source,
"created_at": m.created_at.isoformat()
}