fix(chat): 修复 avatar 传对象导致 React 渲染报错

avatar 属性类型是 ReactNode,不是 props 对象,
改为直接传 JSX 元素作为头像。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
huangjianwu
2026-03-23 15:30:15 +08:00
parent b18277a3a0
commit fea376d1cb

View File

@@ -164,19 +164,21 @@ export default function ChatPanel({ taskId, mode, onModeChange }: ChatPanelProps
() => ({
user: {
placement: 'end' as const,
avatar: {
icon: <UserRound className="h-4 w-4" />,
style: { background: '#3b82f6' },
},
avatar: (
<div className="flex h-7 w-7 items-center justify-center rounded-full bg-blue-500 text-white">
<UserRound className="h-4 w-4" />
</div>
),
variant: 'filled' as const,
styles: { content: { background: '#3b82f6', color: '#fff' } },
},
ai: {
placement: 'start' as const,
avatar: {
icon: <Bot className="h-4 w-4" />,
style: { background: '#6b7280' },
},
avatar: (
<div className="flex h-7 w-7 items-center justify-center rounded-full bg-neutral-500 text-white">
<Bot className="h-4 w-4" />
</div>
),
variant: 'outlined' as const,
},
}),