From 04d396600b34e005996d7e7296cc8f3f1c19a3d5 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Mon, 21 Sep 2026 16:57:09 +0800 Subject: [PATCH] fix(webui): clarify queued guidance state --- .../src/components/thread/ThreadComposer.tsx | 12 +++++++++- webui/src/i18n/locales/en/common.json | 5 +++-- webui/src/i18n/locales/es/common.json | 5 +++-- webui/src/i18n/locales/fr/common.json | 5 +++-- webui/src/i18n/locales/id/common.json | 5 +++-- webui/src/i18n/locales/ja/common.json | 5 +++-- webui/src/i18n/locales/ko/common.json | 5 +++-- webui/src/i18n/locales/pt-BR/common.json | 5 +++-- webui/src/i18n/locales/vi/common.json | 5 +++-- webui/src/i18n/locales/zh-CN/common.json | 5 +++-- webui/src/i18n/locales/zh-TW/common.json | 5 +++-- webui/src/tests/thread-composer.test.tsx | 22 +++++++++++-------- 12 files changed, 54 insertions(+), 30 deletions(-) diff --git a/webui/src/components/thread/ThreadComposer.tsx b/webui/src/components/thread/ThreadComposer.tsx index e16d4e8a3..bfb32d903 100644 --- a/webui/src/components/thread/ThreadComposer.tsx +++ b/webui/src/components/thread/ThreadComposer.tsx @@ -2379,6 +2379,7 @@ export function ThreadComposer({ prompts={queuedPrompts} isHero={isHero} label={t("thread.composer.queued.label")} + hint={t("thread.composer.queued.hint")} guideLabel={t("thread.composer.queued.guide")} deleteLabel={t("thread.composer.queued.delete")} dragLabel={t("thread.composer.queued.drag")} @@ -2688,6 +2689,7 @@ function QueuedPromptStack({ prompts, isHero, label, + hint, guideLabel, deleteLabel, dragLabel, @@ -2702,6 +2704,7 @@ function QueuedPromptStack({ prompts: QueuedPrompt[]; isHero: boolean; label: string; + hint: string; guideLabel: string; deleteLabel: string; dragLabel: string; @@ -2713,7 +2716,10 @@ function QueuedPromptStack({ onDragEnd: () => void; onDrop: (targetId: string) => void; }) { - const stripMaxHeight = Math.min(240, 14 + prompts.length * 34 + Math.max(0, prompts.length - 1) * 4); + const stripMaxHeight = Math.min( + 320, + 96 + prompts.length * 34 + Math.max(0, prompts.length - 1) * 4, + ); return (
+
+ {label} + {hint} +
{prompts.map((prompt) => ( { expect(screen.getByTestId("composer-session-mention-Plan")).toHaveTextContent("@Plan"); fireEvent.keyDown(input, { key: "Enter" }); - fireEvent.click(screen.getByRole("button", { name: "Guide" })); + fireEvent.click(screen.getByRole("button", { name: "Send now" })); expect(onSend).toHaveBeenCalledWith("@Plan", undefined, { sessionMentions: [{ @@ -2891,8 +2891,12 @@ describe("ThreadComposer", () => { expect(onSend).not.toHaveBeenCalled(); expect(input).toHaveValue(""); expect(screen.getByText("keep the UI minimal")).toBeInTheDocument(); + expect(screen.getByText("Waiting to send")).toBeInTheDocument(); + expect(screen.getByText( + "Send now, or wait for the current response to finish.", + )).toBeInTheDocument(); - fireEvent.click(screen.getByRole("button", { name: "Guide" })); + fireEvent.click(screen.getByRole("button", { name: "Send now" })); expect(onSend).toHaveBeenCalledWith( "keep the UI minimal", @@ -3079,14 +3083,14 @@ describe("ThreadComposer", () => { fireEvent.change(input, { target: { value: "second follow-up" } }); fireEvent.keyDown(input, { key: "Enter" }); - const queue = screen.getByRole("group", { name: "Queued guidance" }); + const queue = screen.getByRole("group", { name: "Waiting to send" }); expect(queue).toHaveClass("composer-status-strip"); expect(queue).toHaveClass("mx-3"); expect(queue.parentElement?.className).toContain("group/composer"); expect(within(queue).getByText("first follow-up")).toBeInTheDocument(); expect(within(queue).getByText("second follow-up")).toBeInTheDocument(); expect(within(queue).getAllByRole("button", { name: "Edit guidance" })).toHaveLength(2); - expect(within(queue).getAllByRole("button", { name: "Guide" })).toHaveLength(2); + expect(within(queue).getAllByRole("button", { name: "Send now" })).toHaveLength(2); rerender( { expect(onSend).toHaveBeenLastCalledWith("second follow-up"); }); expect(onSend).toHaveBeenCalledTimes(2); - expect(screen.queryByRole("group", { name: "Queued guidance" })).not.toBeInTheDocument(); + expect(screen.queryByRole("group", { name: "Waiting to send" })).not.toBeInTheDocument(); }); it("lets users edit queued guidance before it is sent", async () => { @@ -3158,7 +3162,7 @@ describe("ThreadComposer", () => { expect(focusedSelections).toEqual([true]); expect(textarea.selectionStart).toBe("rough follow-up".length); expect(input).toHaveValue("rough follow-up"); - expect(screen.queryByRole("group", { name: "Queued guidance" })).not.toBeInTheDocument(); + expect(screen.queryByRole("group", { name: "Waiting to send" })).not.toBeInTheDocument(); fireEvent.change(input, { target: { value: "polished follow-up" } }); fireEvent.keyDown(input, { key: "Enter" }); @@ -3260,14 +3264,14 @@ describe("ThreadComposer", () => { fireEvent.keyDown(input, { key: "Enter" }); expect(onSend).not.toHaveBeenCalled(); - expect(screen.getByRole("group", { name: "Queued guidance" })).toBeInTheDocument(); + expect(screen.getByRole("group", { name: "Waiting to send" })).toBeInTheDocument(); expect(screen.getByText("look at this")).toBeInTheDocument(); expect(screen.queryByTestId("composer-chip")).not.toBeInTheDocument(); fireEvent.click(screen.getByRole("button", { name: "Edit guidance" })); expect(input).toHaveValue("look at this"); expect(screen.getByTestId("composer-chip")).toHaveTextContent("draft.png"); - expect(screen.queryByRole("group", { name: "Queued guidance" })).not.toBeInTheDocument(); + expect(screen.queryByRole("group", { name: "Waiting to send" })).not.toBeInTheDocument(); fireEvent.keyDown(input, { key: "Enter" }); rerender( @@ -3479,7 +3483,7 @@ describe("ThreadComposer", () => { expect(await screen.findByText("remember this edited follow-up")).toBeInTheDocument(); fireEvent.keyDown(screen.getByLabelText("Message input"), { key: "Enter" }); expect(onSend).not.toHaveBeenCalled(); - fireEvent.click(screen.getByRole("button", { name: "Guide" })); + fireEvent.click(screen.getByRole("button", { name: "Send now" })); expect(onSend).toHaveBeenCalledWith( "remember this edited follow-up", undefined,