diff --git a/frontend/web/src/components/ChatBubble.tsx b/frontend/web/src/components/ChatBubble.tsx index f45a9ce..fea5e61 100644 --- a/frontend/web/src/components/ChatBubble.tsx +++ b/frontend/web/src/components/ChatBubble.tsx @@ -7,9 +7,11 @@ interface ChatBubbleProps { content: ReactNode meta?: ReactNode pending?: boolean + /** 镜像布局:探索下钻里虚拟用户居左、被评对象居右(与常规聊天相反) */ + mirrored?: boolean } -export default function ChatBubble({ role, content, meta, pending }: ChatBubbleProps) { +export default function ChatBubble({ role, content, meta, pending, mirrored }: ChatBubbleProps) { const isUser = role === 'user' const isAgent = role === 'agent' const isSystem = role === 'system' @@ -17,8 +19,9 @@ export default function ChatBubble({ role, content, meta, pending }: ChatBubbleP const bg = isUser ? colors.chatUser : isAgent ? colors.chatAgent : colors.chatSystemError const border = isSystem ? '#ffccc7' : 'transparent' const textColor = isSystem ? '#cf1322' : colors.text - const align = isUser ? 'flex-end' : 'flex-start' - const radius = isUser ? '10px 10px 2px 10px' : '10px 10px 10px 2px' + const alignRight = isSystem ? false : isUser ? !mirrored : !!mirrored + const align = alignRight ? 'flex-end' : 'flex-start' + const radius = alignRight ? '10px 10px 2px 10px' : '10px 10px 10px 2px' const icon = isUser ? @@ -29,7 +32,7 @@ export default function ChatBubble({ role, content, meta, pending }: ChatBubbleP return (
-
+
{!isUser && icon} {label} diff --git a/frontend/web/src/components/ExplorationSection.tsx b/frontend/web/src/components/ExplorationSection.tsx index 48428e0..4ffa15a 100644 --- a/frontend/web/src/components/ExplorationSection.tsx +++ b/frontend/web/src/components/ExplorationSection.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' import { Collapse, Empty, Space, Spin, Tag } from 'antd' -import { UserOutlined, RobotOutlined } from '@ant-design/icons' +import ChatBubble from './ChatBubble' import { explorationApi, type ExplorationMessage, @@ -78,33 +78,15 @@ function SessionDetail({ session, messages }: { )} {messages && messages.map((m) => ( -
- {m.role === 'user' ? ( -
- - {m.content} -
- ) : ( -
- - {m.content} - {m.latency_ms != null && ( - {m.latency_ms}ms - )} -
- )} -
+ role={m.role === 'user' ? 'user' : 'agent'} + mirrored + content={m.content} + meta={m.role !== 'user' && m.latency_ms != null ? ( + {m.latency_ms}ms + ) : undefined} + /> ))} {experience && (