比较提交

..

2 提交

作者 SHA1 备注 提交日期
2ba07bda9d fix(astrbot): name the wrong-endpoint case instead of calling it a bad image
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
The capture settled why an attachment rendered as a broken image:
HTTP 200, Content-Type text/html, 201 bytes. AstrBot answers an unknown
/api/v1 path with its dashboard shell rather than a 404, so a wrong
download endpoint arrives looking like a successful download of an
undecodable file. The status check passed it and the type sniffer
correctly refused to call it an image, which left the user reading
"not a decodable image format" for what is really a wrong URL.

Reject an HTML body outright and say so. GET /api/v1/files/{id}/content
is a guess — upload posts to /api/v1/file, singular — and the protocol
review records the file endpoints as never tested.

Also trace the shape of the reference the media frame carries, which
the client currently discards in favour of the id from
attachment_saved. Scheme, whether it looks like a path, and the file
extension are recorded; the reference itself is not.

Refs: N-6.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 02:37:52 +08:00
ca65c465b9 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>
2026-07-27 02:37:36 +08:00
共有 2 个文件被更改,包括 75 次插入 和 16 次删除

查看文件

@ -529,6 +529,16 @@ impl AstrBotClient {
bytes = bytes.len(),
"astrbot attachment download"
);
// A short HTML body served with 200 is a web page, not a file. AstrBot
// answers an unknown `/api/v1/...` path with its dashboard shell rather
// than a 404, so a wrong endpoint arrives here looking like success.
if mime_type.starts_with("text/html") {
return Err(AstrBotClientError::ApiStatus(
"服务器在附件地址上返回了网页而不是文件,下载端点可能不正确。".into(),
));
}
Ok((mime_type, bytes))
}
@ -792,6 +802,39 @@ thread_local! {
}
impl FrameTrace {
/// Structural description of an attachment reference.
///
/// The media frame carries a string the client currently discards, and the
/// id taken from `attachment_saved` resolves to a web page. Whether that
/// string is a URL, a path, or a bare name decides how the attachment
/// should be fetched. Records the scheme, whether it looks like a path, and
/// the file extension — a format marker — but not the reference itself.
fn reference_shape(text: &str) -> String {
let scheme = if text.starts_with("http://") {
"http"
} else if text.starts_with("https://") {
"https"
} else if text.starts_with("file://") {
"file"
} else if text.starts_with('/') {
"absolute-path"
} else if text.starts_with('[') {
"bracketed"
} else {
"bare"
};
let extension = text
.rsplit_once('.')
.map(|(_, tail)| tail)
.filter(|tail| tail.len() <= 5 && tail.chars().all(|c| c.is_ascii_alphanumeric()))
.unwrap_or("<none>");
format!(
"scheme={scheme} has_separator={} extension={extension} len={}",
text.contains('/'),
text.chars().count()
)
}
fn observe(&mut self, line: &str) {
if !tracing::enabled!(target: FRAME_TRACE_TARGET, tracing::Level::DEBUG) {
return;
@ -814,6 +857,14 @@ impl FrameTrace {
self.blocks.push(text.to_owned());
}
(Some("complete"), Some(final_text)) => self.report(final_text),
(Some("image" | "record" | "file" | "video"), Some(reference)) => {
tracing::debug!(
target: FRAME_TRACE_TARGET,
media_type = frame_type.unwrap_or("<absent>"),
reference = Self::reference_shape(reference).as_str(),
"astrbot media reference"
);
}
_ => {}
}
trace_frame_fields(&value);

查看文件

@ -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}