提交图

14 提交

作者 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
0b4a7de62a fix(astrbot): resolve an attachment's type from its bytes when needed
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
An attachment downloaded and then rendered as a broken image. A blob URL
is decoded according to the blob's type, so handing the webview
application/octet-stream makes img refuse bytes that are a perfectly
good PNG — and octet-stream is exactly what the client substitutes when
the server names no type.

Prefer a concrete image type from the server, otherwise identify the
format from its leading bytes. Every signature checked is a fixed marker
at a fixed offset, so this reads no user content, and a JSON error body
served with HTTP 200 is deliberately not mistaken for an image.

Whether that was the cause is not yet established, so the alternative is
made self-diagnosing rather than guessed at. The download outcome —
status, the type the server gave, the type the bytes indicate, and the
length — is now traced, and the frontend reports why an attachment did
not render instead of leaving a bare broken-image icon: a failed
download shows its error, and a payload the browser cannot decode says
so. Both paths were previously swallowed.

Refs: N-6.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 02:29:33 +08:00
03b99efda8 feat(astrbot): summarise how stream blocks relate to the final text
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
The first capture identified the real cause of a reply appearing twice,
and it was neither candidate. All 524 frames carried a message_id and
each reply used exactly one, so the event_id fallback is not involved
and neither is the history session fallback.

AstrBot interleaves two kinds of plain frame in one reply. Frames with
streaming true are incremental deltas whose total matches the complete
frame exactly. Frames with streaming false carry whole finished blocks —
one reply had five of them totalling 915 characters against 173
streamed. map_plain appends both, so the blocks show up inline during
generation, and map_complete then replaces the accumulation with the
streamed text alone, discarding them. That is the reply appearing twice
and then collapsing, and the collapse loses content.

One thing lengths cannot settle: whether a block repeats streamed text
or carries its own. One reply had 133 block characters against 142
streamed, which looks like a repeat; another had 915 against 173, which
cannot be. The two need opposite fixes, so this adds a per-stream
summary reporting how many blocks appear in the final text and in the
streamed text, as counts and lengths only.

Also records that plugin images were never sent: no media or attachment
frame appeared in any capture, and no plain frame carried a message
chain array. The attachment path has still never received data.

Refs: N-9 (new), N-4 (root cause found), N-6 (not a client defect).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 02:08:36 +08:00
6060b968a7 feat(astrbot): record the message id value in the frame trace
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
The first capture answered the question the trace was built for and
eliminated it: all 77 plain frames of one reply carried a message_id, so
a reply splitting into two bubbles is not the event_id fallback in
F-34.

What remains depends on the value rather than its presence. If the id
changes partway through a reply then the client is correctly showing two
messages the server sent; if it stays the same then the split is ours,
in the historySessionId fallback that loads another session's history.
The id is an opaque row identifier, not content.

Also record the length of a string data payload. It separates "the
server streamed many small chunks" from "the server sent the reply in
one piece" without recording any text.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 01:54:17 +08:00
bc0948731c fix(astrbot): make the frame trace reachable by its documented filter
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
The event set an explicit target of astrbot::frame while the enabled!
guard used the default module-path target. A filter naming either one
therefore failed: naming the crate did not reach the event, and naming
the target left the guard returning false. Either way the trace emitted
nothing, which would have looked like the application producing no logs
at all and wasted a reproduction cycle.

Give the guard the same target, hoist it into a constant, and add a test
that drives the exact RUST_LOG value printed in the acceptance
instructions. The test was checked against the broken guard and fails
with empty output. A second test asserts the trace stays silent at the
default level, and both assert no payload text or attachment URL reaches
the log.

Document the capture procedure in the acceptance checklist.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 01:06:03 +08:00
e01cb5a3ba feat(astrbot): trace sse frame shapes at debug level
Two reported defects cannot be diagnosed from the code alone. A reply
sometimes renders as two bubbles during generation, which happens when a
streaming frame carries no message_id — the client then keys it by
event_id, which is unique per event. And images sent by plugins never
appear, which happens when an image frame is not followed by the
attachment_saved frame the mapper waits for. Both depend on what the
server actually sends, and picking the wrong one would produce a fix
that looks right until another conversation path hits the other.

Log the shape of every SSE frame: its type, whether message_id and
session_id are present, the streaming flag, and the key names inside
data. No payload text is recorded, so this is safe to leave enabled in
the field. Off unless RUST_LOG selects debug, and gated on
tracing::enabled! so a disabled level costs one atomic read rather than
a JSON parse.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 00:59:31 +08:00
6e81a3a7ae fix(astrbot): scope stream event ids and fix the transport layer
Combines the P0 event-id fix with the three transport fixes that rewrite the
same stream loop; they are not separable in these two files.

fix(astrbot): scope stream event ids per request (P0-1 / F-01)
  `AstrBotStreamMapper` restarts its sequence at zero for every stream, but
  `seen_event_ids` lives on the client and outlives a request. Event ids were
  built from `server_instance_id + sequence` alone, so the second message on a
  connection replayed the first message's ids and every one of its events was
  discarded as a duplicate: the assistant's reply never reached the UI or the
  database. Ids now carry a per-request `stream_id`.

fix(protocol): serialize model options in camelCase (P1-7b / F-07)
  `AstrBotModelOption` had no `rename_all`, so the frontend's `isDefault` was
  always undefined and no model was preselected.

fix(net): stop total timeouts from killing streams (P1-1 / F-10)
  `Client::timeout` runs from the start of the request until the body is
  finished and keeps counting while `bytes_stream()` is consumed. The 30s
  desktop-v1 budget therefore tore the long-lived SSE connection down every 30
  seconds no matter how healthy it was — heartbeats could not keep it alive —
  and the 120s AstrBot budget cut off any generation longer than two minutes.
  Streaming now uses a separate client with no total deadline, detecting a
  stalled peer with `read_timeout` (which resets on every successful read) plus
  a TCP keepalive. REST endpoints keep their total deadline.

fix(astrbot): decode sse bytes on line boundaries (P1-3 / F-11)
  Decoding each network chunk with `String::from_utf8_lossy` corrupted any
  character straddling a chunk boundary. For CJK text that is one replacement
  character per unlucky chunk, persisted into the message. The stream is now
  split into lines at the byte level and only complete lines are decoded.

fix(astrbot): finalize streams on cancel and error (P2-2 / F-13)
  Cancellation and every error path returned without a `MessageCompleted`
  event, leaving the row `streaming = 1` so it rendered as "generating" again
  after a restart. All exit paths now finalize with `Cancelled` or `Error` and
  keep the text received so far. Cancelling also no longer flips the connection
  to Disconnected and back, which was a visible flicker (P3-4 / F-56).

Hardening found while reviewing the above: a 64 MiB per-response ceiling
(removing the total timeout removed the only bound on a response, and
`read_timeout` cannot replace it), and a cursor-based line buffer instead of
draining from the front, which was quadratic in the chunk size.

Tests drive a real `AstrBotClient` against a hand-rolled HTTP/1.1 chunked-SSE
server on a raw `TcpListener`: byte-exact control over chunk boundaries and
dropping a socket mid-body without the terminal chunk are not expressible
through an HTTP framework, and both are needed here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 23:12:56 +08:00
d100da324d fix(chat): prevent duplicate history on session switch
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-22 02:52:31 +08:00
5de8bfab03 fix(chat): flatten runtime event payloads
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-21 14:55:49 +08:00
74fe19f7e4 feat(auth): handle jwt expiry and relogin state
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 16:52:29 +08:00
7dae4898cb feat(pet): separate remote identity and add paper pet window
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 16:28:42 +08:00
06e0b411ea feat(chat): add remote session navigation
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 14:32:07 +08:00
bcaebee6f3 feat(chat): add model and attachment interfaces
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 13:30:29 +08:00
3d1d962461 feat(chat): add AstrBot dual-slot chat foundation
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 11:31:41 +08:00