fix: agent消息按speaker.id显示对应头像与名称
parent
1bee34b423
commit
cce71ed084
|
|
@ -20,11 +20,12 @@ export default function MessageItem(props: {
|
||||||
const { message, agentList, currentAgentId, highlighted, branch, busy, onRegenerate, onSwitchBranch, onCopy } = props;
|
const { message, agentList, currentAgentId, highlighted, branch, busy, onRegenerate, onSwitchBranch, onCopy } = props;
|
||||||
|
|
||||||
const speakerType = (message as any)?.speaker?.type as ('user' | 'agent' | undefined);
|
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 isUser = speakerType ? speakerType === 'user' : message.role === 'user';
|
||||||
const bubbleRole = isUser ? 'user' : 'assistant';
|
const bubbleRole = isUser ? 'user' : 'assistant';
|
||||||
|
|
||||||
// 获取回答者 Agent 信息
|
// 获取回答者 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 answerAgent = answerAgentId ? agentList.find(a => a.id === answerAgentId) : undefined;
|
||||||
const hasBranches = !!branch && branch.total > 1;
|
const hasBranches = !!branch && branch.total > 1;
|
||||||
const activeIdx = branch?.activeIndex ?? 0;
|
const activeIdx = branch?.activeIndex ?? 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue