mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-09-07 16:46:39 +08:00
fix(chat): 修复消息气泡左右布局不生效
- Bubble.List 的角色配置属性名是 role(单数)而非 roles - 用户消息:右侧蓝色填充气泡 + 蓝色头像 - AI 回复:左侧描边气泡 + 灰色头像 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
d8fbceaadf
commit
b18277a3a0
@@ -1,6 +1,5 @@
|
|||||||
import { useState, useEffect, useCallback, useMemo } from 'react'
|
import { useState, useEffect, useCallback, useMemo } from 'react'
|
||||||
import { Bubble, Sender } from '@ant-design/x'
|
import { Bubble, Sender } from '@ant-design/x'
|
||||||
import type { BubbleProps } from '@ant-design/x'
|
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { Badge } from '@/components/ui/badge'
|
import { Badge } from '@/components/ui/badge'
|
||||||
import { Loader2, Trash2, ChevronDown, ChevronUp, BookOpen, UserRound, Bot, Maximize2, Minimize2 } from 'lucide-react'
|
import { Loader2, Trash2, ChevronDown, ChevronUp, BookOpen, UserRound, Bot, Maximize2, Minimize2 } from 'lucide-react'
|
||||||
@@ -161,22 +160,24 @@ export default function ChatPanel({ taskId, mode, onModeChange }: ChatPanelProps
|
|||||||
}, [messages, loading])
|
}, [messages, loading])
|
||||||
|
|
||||||
// Bubble 角色配置
|
// Bubble 角色配置
|
||||||
const roles: BubbleProps['roles'] = useMemo(
|
const roles = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
user: {
|
user: {
|
||||||
placement: 'end',
|
placement: 'end' as const,
|
||||||
avatar: {
|
avatar: {
|
||||||
icon: <UserRound className="h-4 w-4" />,
|
icon: <UserRound className="h-4 w-4" />,
|
||||||
style: { background: '#3b82f6' },
|
style: { background: '#3b82f6' },
|
||||||
},
|
},
|
||||||
|
variant: 'filled' as const,
|
||||||
|
styles: { content: { background: '#3b82f6', color: '#fff' } },
|
||||||
},
|
},
|
||||||
ai: {
|
ai: {
|
||||||
placement: 'start',
|
placement: 'start' as const,
|
||||||
avatar: {
|
avatar: {
|
||||||
icon: <Bot className="h-4 w-4" />,
|
icon: <Bot className="h-4 w-4" />,
|
||||||
style: { background: '#6b7280' },
|
style: { background: '#6b7280' },
|
||||||
},
|
},
|
||||||
typing: { step: 5, interval: 50 },
|
variant: 'outlined' as const,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
[],
|
[],
|
||||||
@@ -261,7 +262,7 @@ export default function ChatPanel({ taskId, mode, onModeChange }: ChatPanelProps
|
|||||||
) : (
|
) : (
|
||||||
<Bubble.List
|
<Bubble.List
|
||||||
items={bubbleItems}
|
items={bubbleItems}
|
||||||
roles={roles}
|
role={roles}
|
||||||
style={{ height: '100%' }}
|
style={{ height: '100%' }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user