refactor(chat): drop the speaker name from the message bubble
The bubble header repeated what the avatar and the side of the bubble already say. Removing it leaves the header holding only the generating indicator, so it is rendered only while a reply is streaming. The name moves into the avatar as a clipped label rather than disappearing: the avatar's glyph is aria-hidden, so without it a screen reader would announce nothing at all for the speaker. Verified against the real stylesheet: avatar and bubble tops differ by 0px for both roles, the glyph stays centred in a 32px avatar, the label measures 1x1, and the bubble no longer contains the name. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
这个提交存在于:
父节点
0b4a7de62a
当前提交
ca65c465b9
共有 1 个文件被更改,包括 24 次插入 和 16 次删除
|
|
@ -823,25 +823,33 @@ export function ChatPanel({ fixedSlot }: ChatPanelProps) {
|
|||
className={`chat-message-row ${message.role}${message.error ? " failed" : ""}`}
|
||||
key={message.id}
|
||||
>
|
||||
<div className="chat-avatar" aria-hidden="true">
|
||||
{message.role === "user"
|
||||
? "You"
|
||||
: message.role === "assistant"
|
||||
? "A"
|
||||
: "!"}
|
||||
{/* The avatar and the bubble's side already say who is
|
||||
speaking, so the name in the header was a label repeating
|
||||
what is visible. It stays as the avatar's accessible name
|
||||
rather than disappearing for screen readers. */}
|
||||
<div className="chat-avatar">
|
||||
<span aria-hidden="true">
|
||||
{message.role === "user"
|
||||
? "You"
|
||||
: message.role === "assistant"
|
||||
? "A"
|
||||
: "!"}
|
||||
</span>
|
||||
<span className="message-action-label">
|
||||
{message.role === "user"
|
||||
? "你"
|
||||
: message.role === "assistant"
|
||||
? "AstrBot"
|
||||
: "系统"}
|
||||
</span>
|
||||
</div>
|
||||
<div className="chat-message-content">
|
||||
<div className="chat-bubble">
|
||||
<div className="chat-bubble-header">
|
||||
<span>
|
||||
{message.role === "user"
|
||||
? "你"
|
||||
: message.role === "assistant"
|
||||
? "AstrBot"
|
||||
: "系统"}
|
||||
</span>
|
||||
{message.streaming ? <small>生成中</small> : null}
|
||||
</div>
|
||||
{message.streaming ? (
|
||||
<div className="chat-bubble-header">
|
||||
<small>生成中</small>
|
||||
</div>
|
||||
) : null}
|
||||
{message.content ? (
|
||||
<MessageContent
|
||||
content={message.content}
|
||||
|
|
|
|||
正在加载…
添加表格
在新工单中引用