From cce71ed084328ed98893e9bddae47239d35245ab Mon Sep 17 00:00:00 2001 From: sp mac bookpro 2605 Date: Mon, 8 Jun 2026 01:34:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20agent=E6=B6=88=E6=81=AF=E6=8C=89speaker.?= =?UTF-8?q?id=E6=98=BE=E7=A4=BA=E5=AF=B9=E5=BA=94=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E4=B8=8E=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/chat/components/messages/MessageItem.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/chat/components/messages/MessageItem.tsx b/src/pages/chat/components/messages/MessageItem.tsx index 95ecdba..fe32978 100644 --- a/src/pages/chat/components/messages/MessageItem.tsx +++ b/src/pages/chat/components/messages/MessageItem.tsx @@ -20,11 +20,12 @@ export default function MessageItem(props: { const { message, agentList, currentAgentId, highlighted, branch, busy, onRegenerate, onSwitchBranch, onCopy } = props; const speakerType = (message as any)?.speaker?.type as ('user' | 'agent' | undefined); + const speakerId = (message as any)?.speaker?.id as string | undefined; const isUser = speakerType ? speakerType === 'user' : message.role === 'user'; const bubbleRole = isUser ? 'user' : 'assistant'; // 获取回答者 Agent 信息 - const answerAgentId = message.agent_id || (!isUser ? currentAgentId : undefined); + const answerAgentId = !isUser ? (speakerType === 'agent' ? speakerId : undefined) || message.agent_id || currentAgentId : undefined; const answerAgent = answerAgentId ? agentList.find(a => a.id === answerAgentId) : undefined; const hasBranches = !!branch && branch.total > 1; const activeIdx = branch?.activeIndex ?? 0;