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>
这个提交存在于:
YokiiroBW 2026-07-27 02:37:36 +08:00
父节点 0b4a7de62a
当前提交 ca65c465b9

查看文件

@ -823,25 +823,33 @@ export function ChatPanel({ fixedSlot }: ChatPanelProps) {
className={`chat-message-row ${message.role}${message.error ? " failed" : ""}`} className={`chat-message-row ${message.role}${message.error ? " failed" : ""}`}
key={message.id} key={message.id}
> >
<div className="chat-avatar" aria-hidden="true"> {/* The avatar and the bubble's side already say who is
{message.role === "user" speaking, so the name in the header was a label repeating
? "You" what is visible. It stays as the avatar's accessible name
: message.role === "assistant" rather than disappearing for screen readers. */}
? "A" <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>
<div className="chat-message-content"> <div className="chat-message-content">
<div className="chat-bubble"> <div className="chat-bubble">
<div className="chat-bubble-header"> {message.streaming ? (
<span> <div className="chat-bubble-header">
{message.role === "user" <small>生成中</small>
? "你" </div>
: message.role === "assistant" ) : null}
? "AstrBot"
: "系统"}
</span>
{message.streaming ? <small>生成中</small> : null}
</div>
{message.content ? ( {message.content ? (
<MessageContent <MessageContent
content={message.content} content={message.content}