比较提交
没有共同的提交。2ba07bda9d4901800ebefbe24bfab0f8af431437 和 0b4a7de62a067e529662ded7a8bd8b89eb7cf435 的历史完全不同。
2ba07bda9d
...
0b4a7de62a
共有 2 个文件被更改,包括 16 次插入 和 75 次删除
|
|
@ -529,16 +529,6 @@ impl AstrBotClient {
|
||||||
bytes = bytes.len(),
|
bytes = bytes.len(),
|
||||||
"astrbot attachment download"
|
"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))
|
Ok((mime_type, bytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -802,39 +792,6 @@ thread_local! {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FrameTrace {
|
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) {
|
fn observe(&mut self, line: &str) {
|
||||||
if !tracing::enabled!(target: FRAME_TRACE_TARGET, tracing::Level::DEBUG) {
|
if !tracing::enabled!(target: FRAME_TRACE_TARGET, tracing::Level::DEBUG) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -857,14 +814,6 @@ impl FrameTrace {
|
||||||
self.blocks.push(text.to_owned());
|
self.blocks.push(text.to_owned());
|
||||||
}
|
}
|
||||||
(Some("complete"), Some(final_text)) => self.report(final_text),
|
(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);
|
trace_frame_fields(&value);
|
||||||
|
|
|
||||||
|
|
@ -823,33 +823,25 @@ 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}
|
||||||
>
|
>
|
||||||
{/* The avatar and the bubble's side already say who is
|
<div className="chat-avatar" aria-hidden="true">
|
||||||
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"
|
{message.role === "user"
|
||||||
? "You"
|
? "You"
|
||||||
: message.role === "assistant"
|
: message.role === "assistant"
|
||||||
? "A"
|
? "A"
|
||||||
: "!"}
|
: "!"}
|
||||||
</span>
|
</div>
|
||||||
<span className="message-action-label">
|
<div className="chat-message-content">
|
||||||
|
<div className="chat-bubble">
|
||||||
|
<div className="chat-bubble-header">
|
||||||
|
<span>
|
||||||
{message.role === "user"
|
{message.role === "user"
|
||||||
? "你"
|
? "你"
|
||||||
: message.role === "assistant"
|
: message.role === "assistant"
|
||||||
? "AstrBot"
|
? "AstrBot"
|
||||||
: "系统"}
|
: "系统"}
|
||||||
</span>
|
</span>
|
||||||
|
{message.streaming ? <small>生成中</small> : null}
|
||||||
</div>
|
</div>
|
||||||
<div className="chat-message-content">
|
|
||||||
<div className="chat-bubble">
|
|
||||||
{message.streaming ? (
|
|
||||||
<div className="chat-bubble-header">
|
|
||||||
<small>生成中</small>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{message.content ? (
|
{message.content ? (
|
||||||
<MessageContent
|
<MessageContent
|
||||||
content={message.content}
|
content={message.content}
|
||||||
|
|
|
||||||
正在加载…
添加表格
在新工单中引用