From aeb9fea64c513e4c32b38294cd993409c86d0dfe Mon Sep 17 00:00:00 2001 From: Aska Date: Mon, 7 Sep 2026 15:07:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20=E6=9D=A5=E6=BA=90=E5=B0=8F?= =?UTF-8?q?=E5=AD=97=E6=8C=89=E6=B6=88=E6=81=AF=E8=A7=92=E8=89=B2=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E8=AF=AD=E4=B9=89=E2=80=94=E2=80=94=E7=94=A8=E6=88=B7?= =?UTF-8?q?'=E6=9D=A5=E8=87=AA',=E5=A5=B9'=E5=8F=91=E9=80=81=E8=87=B3'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SourceLabel 加 role: user 消息显示'来自 '(她收到,来自主人端), assistant 消息显示'发送至 '(她回复到的端) - 修复: 之前她发的消息也标'来自 web:chrome:...' 语义错误,不是她来自用户设备 - 4 处调用点传 message.role; 前端 build 绿 --- frontend/web/src/components/chat.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/frontend/web/src/components/chat.tsx b/frontend/web/src/components/chat.tsx index cc7a476..54384fb 100644 --- a/frontend/web/src/components/chat.tsx +++ b/frontend/web/src/components/chat.tsx @@ -120,11 +120,14 @@ function statusLabel(status: ToolStatus): string { * concrete client the message came from, e.g. "来自 web:chrome:a1b2c3". Rendered * only when a deviceId is present, so legacy/unlabelled messages stay clean. The * Web client defaults to this label; other clients decide themselves. */ -function SourceLabel({ deviceId }: { deviceId?: string }): React.ReactNode { +function SourceLabel({ deviceId, role }: { deviceId?: string; role?: string }): React.ReactNode { if (!deviceId) return null; + // A user message is received FROM a client; an assistant reply goes TO the + // client that prompted it. Semantic direction differs — "来自" vs "发送至". + const dir = role === "assistant" ? "发送至" : "来自"; return (
- 来自 {deviceId} + {dir} {deviceId}
); } @@ -213,7 +216,7 @@ function AssistantParaBubble({ {full && message.mood ? (
心情 · {message.mood}
) : null} - {full ? : null} + {full ? : null} {full ? : null} {full ? : null} {full ? message.tools?.map((t, i) => ) : null} @@ -245,7 +248,7 @@ function UserParaBubble({ ) : null} {renderContent(text)} - {full ? : null} + {full ? : null} ); } @@ -319,7 +322,7 @@ function UserBubble({ message, mode }: { message: ChatMessage; mode: Mode }): Re ) : null} {body} - + ); @@ -345,7 +348,7 @@ function AssistantBubble({ {message.mood ? (
心情 · {message.mood}
) : null} - + {message.tools?.map((t, i) => )}