提交图

17 提交

作者 SHA1 备注 提交日期
529357523c feat(chat): follow the newest message in the conversation
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
The message list had no scroll code at all. Opening a conversation
landed at the top of the history, and every message sent or received
appeared below the fold, so reading a reply meant scrolling down by
hand each time.

Scroll to the tail when the rendered messages change and when the slot
or session changes. Following stops as soon as the reader scrolls more
than 80px away from the bottom and resumes when they return, so reading
back through history is not interrupted by an arriving delta.

scrollTo carries the smooth behaviour but is not universally available —
jsdom has none — so it falls back to assigning scrollTop.

Refs: F-44 (audit P2-28).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 02:21:30 +08:00
fa48a21e65 fix(chat): repair the message row layout and action buttons
Three defects reported from real-machine testing, all rooted in the same
few conflicting CSS blocks, so they are fixed together — separating them
would leave intermediate states that render worse than either end.

The action buttons showed wrapped vertical text inside a 2rem box.
styles.css already defined .message-action-label, a clip-rect
screen-reader-only class clearly written for these buttons, but nothing
in the tree ever used it: ChatPanel rendered a bare span. Wire the class
up so the buttons are icon-only, and drop the border so they read as
plain icons rather than pills.

.chat-message-actions and its buttons were defined five times across the
stylesheet, three of those styling them as bordered pills that the final
block then partially overrode. Remove .chat-message-actions button from
the three pill rule groups and the small-screen grid rule, leaving one
definition next to .message-action-icon. .chat-runtime-actions and
.chat-stop-button keep the pill treatment; they are different controls.

The avatar rendered below its bubble instead of beside it.
.chat-message-row used align-items: flex-end, and .chat-message-content
is taller than the bubble because the action bar reserves a row, so the
avatar was pinned to the bottom of that taller box. Align to the top.

Removing visibility: hidden from the hidden action bar also closes F-40
(audit P2-24): visibility removed the buttons from the tab order, so
:focus-within could never fire and a keyboard user could never reveal
them. Opacity alone keeps them focusable.

Verified against the real stylesheet in a browser: avatar and bubble
tops differ by 0px, the button computes to 34x34 with 0px border, the
label measures 1x1, and focusing a button takes the bar from opacity 0
to 1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 00:59:11 +08:00
49dccc5eac fix(chat): scope draft, attachments, and errors per slot
The composer draft, the pending attachment list and the error banner
were single values shared by both slots. Uploading on companion and
then switching to operations routed the companion instance's
attachment ids into the operations instance, the operations error
banner stayed visible on the companion tab, and a half-typed message
followed the user across tabs.

Make all three Record<ChatSlot, ...>, mirroring the sending,
unreadCounts and storedSessions state that was already per slot. Every
asynchronous action now pins its slot at the start, so an upload or a
send that resolves after the user switched tabs still lands on the slot
it belonged to.

Splitting the error state is required rather than incidental. refresh()
runs every 500ms and wrote the shared error on failure and cleared it on
success, so any send or upload error was silently wiped within half a
second. The polling failure describes the IPC channel rather than a
slot, so it keeps its own runtimeError; slotError is owned solely by
user actions and takes precedence when both are present.

All three new tests were checked against a mutation that reads the
companion slot regardless of selection, and all three fail under it.

Refs: F-16 (audit P1-11).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 00:28:27 +08:00
124cf32fa2 fix(ui): release tauri event listeners on unmount
All four listen() call sites assigned the resolved unregister function
unconditionally. When the effect was cleaned up before the promise
settled, that assignment landed on a dead closure and the listener was
never unregistered. React StrictMode mounts, cleans up and mounts again,
so the first listener leaked on every development mount. In ChatPanel
that meant applyRuntimeEvents ran twice per event and, because a delta
is appended to the existing content, every character of a streamed reply
was doubled.

Track whether the effect is still live and unregister immediately when
the promise settles late. Each site also gains a catch, since these were
all bare void listen(...).then(...) chains — a rejected listen, such as
the missing desktop-pet capability, became an unhandled rejection rather
than anything observable.

The listener mock in src/test/setup.ts resolved eagerly, which made the
race impossible to express. Replace it with a controllable double in
src/test/tauriEvent.ts that defers resolution until the test asks for
it, tracks each registration separately, and only dispatches to handlers
that have not been unregistered. The registry is plain module state, so
setup.ts resets it after each test.

ChatPanel had no test file; this adds one. Both new tests were checked
against a mutation restoring the old assignment, and both fail under it.

Refs: F-15 (audit P1-10).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 00:23:42 +08:00
828f7c586d fix(chat): accept null in runtime event contracts
Rust serializes `Option<String>` without `skip_serializing_if`, so absent
fields arrive as `null`. Zod's `.optional()` accepts only `undefined`, so
`safeParse` failed and three chains silently died:

- `boundRuntimeEventSchema.sessionId/messageId`: desktop-v1 and mock events
  carry no session id, so every one of them was discarded; AstrBot error and
  heartbeat frames were discarded too.
- `remoteChatSessionSchema.displayName/updatedAt`: one null field threw for
  the whole array, leaving the remote session list permanently empty.
- `astrbotModelOptionSchema.name`: a null name failed capability parsing,
  which permanently disabled the file upload button.

The sibling `slotRuntimeSnapshotSchema` in the same file already used
`.nullish()` throughout, which is what makes this look like a miss during the
de-enveloping change rather than a deliberate choice.

`formatSessionTime` widens with it: `updatedAt` is now `string | null` and the
existing falsy guard already handled null.

Refs P1-7a / F-06.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 22:31:44 +08:00
e8d9dbc8f6 refactor(ui): share ipc error formatting
Tauri rejects `invoke` with the deserialized Rust error value, which for
`RuntimeCommandError { code, message }` is a plain object rather than an
`Error`. Nine call sites used `reason instanceof Error ? reason.message :
String(reason)`, so every send, reconnect, stop, and settings failure showed
the user `[object Object]`.

`ProfileManager` already had a correct implementation; this lifts it into
`src/lib/errorMessage.ts` and routes the other call sites through it. The
module also exports `isCancelledError`, which a later batch needs to tell a
deliberate stop apart from a real failure.

Refs P1-16 / F-08.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 22:31:16 +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
02dfb618b9 refactor(ui): complete desktop frontend redesign 2026-07-22 00:27:06 +08:00
ea332257ac feat(chat): advance Q10-Q15 experience
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-21 15:25:11 +08:00
ceb7512bf2 feat(desktop): complete Q9 chat and stability increment
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-21 14:43:14 +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
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
9f235a34e2 feat(chat): add main layout focus modes
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 12:30:12 +08:00
e0b48c0a5c feat(chat): persist sessions and unread state
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 12:25:08 +08:00
2e84ea52e9 feat(connection): auto-connect configured slots
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 12:01:18 +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