From 79bb9bb5915ccced2656a8d8f3745d0a3e6700b8 Mon Sep 17 00:00:00 2001 From: Xubin Ren <52506698+Re-bin@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:03:30 +0800 Subject: [PATCH] fix(webui): refine automation chat review layout --- webui/proposals/automation-chat/README.md | 9 +++ .../settings/system/AutomationChatBinding.tsx | 57 +++++++++++-------- .../tests/automation-chat-binding.test.tsx | 2 + 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/webui/proposals/automation-chat/README.md b/webui/proposals/automation-chat/README.md index 5ca4268d8..61761a99c 100644 --- a/webui/proposals/automation-chat/README.md +++ b/webui/proposals/automation-chat/README.md @@ -61,6 +61,15 @@ No new execution path, agent-loop policy, dependencies, or separate CSS system are added. The dialog uses the existing Select, Dialog, Button, Textarea, channel logos, and DropdownMenu. The detail dialog owns the modal lock. Confirmation is explicit and progress stays local to that action. The page remains visible. +Chat names and platform labels use separate lines. Task instructions use the +same quiet inset surface as other app dialogs. The confirmation and detail +panel share their action spacing; narrow screens can wrap long action labels. +While choices load, the known chat stays readable and the selector reports busy +to assistive technology. Saving reserves space for both button labels and keeps +the review visible until the host confirms. There is no optimistic route change +or loading overlay. This applies the continuity principle from +[The perfect app has no loading states](https://floriankiem.com/writing/the-perfect-app-has-no-loading-states) +without treating cached choices as permission to change a route. The review keeps the selected and original chat identities across refreshes. Their display names follow current sidebar names without changing either target. If refreshed choices omit the selected chat, its name remains visible and saving diff --git a/webui/src/components/settings/system/AutomationChatBinding.tsx b/webui/src/components/settings/system/AutomationChatBinding.tsx index 47d3be7c2..5e784416f 100644 --- a/webui/src/components/settings/system/AutomationChatBinding.tsx +++ b/webui/src/components/settings/system/AutomationChatBinding.tsx @@ -29,8 +29,9 @@ function ChatIdentity({ chat, title }: { chat: AutomationChat; title: string }) {chat.channel === "websocket" ? : } - - {title}{platform} + + {title} + {platform} ; } @@ -101,7 +102,8 @@ export function AutomationChatBinding({ job, token, chatNames, onSave, children }); }}> + aria-busy={!loadError && (!data || data.revision !== job.chat_binding_revision)} + className="h-auto min-h-14 w-full py-2 disabled:opacity-100 disabled:[&>svg]:opacity-40 [&>span:first-child]:min-w-0 [&>span:first-child]:flex-1 [&>span:first-child]:text-start"> {identity((review ? draft?.target : current) ?? fallback)} @@ -129,16 +131,18 @@ export function AutomationChatBinding({ job, token, chatNames, onSave, children if (!draft) return children(

{tx("label")}

{picker(false)} -

- {job.state.pending ? tx("busy") : saved ? tx("saved", { chat: chatTitle(saved.target) }) : tx("hint")} -

- {saved && current?.id === saved.target.id && data?.chats.some(chat => chat.id === saved.previous.id && !chat.unavailable) ? ( - - ) : null} +
+

+ {job.state.pending ? tx("busy") : saved ? tx("saved", { chat: chatTitle(saved.target) }) : tx("hint")} +

+ {saved && current?.id === saved.target.id && data?.chats.some(chat => chat.id === saved.previous.id && !chat.unavailable) ? ( + + ) : null} +
{loadError ? : null} {data && data.chats.length <= (current ? 1 : 0) ?

{tx("available")}

: null}
); @@ -146,22 +150,24 @@ export function AutomationChatBinding({ job, token, chatNames, onSave, children {tx("change")} -
-
-
- {tx("previous")} +
+
+
+ {tx("previous")} {identity(draft.previous)}
-

{tx("new")}

- {picker(true)} +
+

{tx("new")}

+ {picker(true)} +

{tx("effect")}

{tx("history")}

-
+
-

{tx("message")}

+

{tx("message")}

{!draft.editingMessage ? : null} @@ -176,9 +182,12 @@ export function AutomationChatBinding({ job, token, chatNames, onSave, children

{tx("review")}

{error || targetUnavailable ?

{error || tx("unavailable")}

: null}
- - - + + + ; } diff --git a/webui/src/tests/automation-chat-binding.test.tsx b/webui/src/tests/automation-chat-binding.test.tsx index 975786b98..81153d03f 100644 --- a/webui/src/tests/automation-chat-binding.test.tsx +++ b/webui/src/tests/automation-chat-binding.test.tsx @@ -236,9 +236,11 @@ it("uses live sidebar names through loading, review, save and change-back withou const titles = { "websocket:source": "推特大战场", "websocket:target": "产品讨论" }; const { rerender } = render(); expect(await screen.findByRole("combobox", { name: "Run and reply in" })).toHaveTextContent("推特大战场"); + expect(screen.getByRole("combobox", { name: "Run and reply in" })).toHaveAttribute("aria-busy", "true"); await act(async () => resolve({ ...choices, chats: [source, webTarget] })); const control = screen.getByRole("combobox", { name: "Run and reply in" }); expect(control).toHaveTextContent("推特大战场"); + expect(control).toHaveAttribute("aria-busy", "false"); fireEvent.keyDown(control, { key: "ArrowDown" }); expect(await screen.findByRole("option", { name: /推特大战场/ })).toBeInTheDocument(); await user.click(screen.getByRole("option", { name: /产品讨论/ }));