fix(webui): clarify queued guidance state
This commit is contained in:
1 parent
6bf604d43c
commit
04d396600b
12 files changed
+54
-30
No files matched your search
@@ -2379,6 +2379,7 @@ export function ThreadComposer({
|
|||||||
prompts={queuedPrompts}
|
prompts={queuedPrompts}
|
||||||
isHero={isHero}
|
isHero={isHero}
|
||||||
label={t("thread.composer.queued.label")}
|
label={t("thread.composer.queued.label")}
|
||||||
|
hint={t("thread.composer.queued.hint")}
|
||||||
guideLabel={t("thread.composer.queued.guide")}
|
guideLabel={t("thread.composer.queued.guide")}
|
||||||
deleteLabel={t("thread.composer.queued.delete")}
|
deleteLabel={t("thread.composer.queued.delete")}
|
||||||
dragLabel={t("thread.composer.queued.drag")}
|
dragLabel={t("thread.composer.queued.drag")}
|
||||||
@@ -2688,6 +2689,7 @@ function QueuedPromptStack({
|
|||||||
prompts,
|
prompts,
|
||||||
isHero,
|
isHero,
|
||||||
label,
|
label,
|
||||||
|
hint,
|
||||||
guideLabel,
|
guideLabel,
|
||||||
deleteLabel,
|
deleteLabel,
|
||||||
dragLabel,
|
dragLabel,
|
||||||
@@ -2702,6 +2704,7 @@ function QueuedPromptStack({
|
|||||||
prompts: QueuedPrompt[];
|
prompts: QueuedPrompt[];
|
||||||
isHero: boolean;
|
isHero: boolean;
|
||||||
label: string;
|
label: string;
|
||||||
|
hint: string;
|
||||||
guideLabel: string;
|
guideLabel: string;
|
||||||
deleteLabel: string;
|
deleteLabel: string;
|
||||||
dragLabel: string;
|
dragLabel: string;
|
||||||
@@ -2713,7 +2716,10 @@ function QueuedPromptStack({
|
|||||||
onDragEnd: () => void;
|
onDragEnd: () => void;
|
||||||
onDrop: (targetId: string) => 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 (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -2729,6 +2735,10 @@ function QueuedPromptStack({
|
|||||||
style={{ "--composer-strip-max-height": `${stripMaxHeight}px` } as CSSProperties}
|
style={{ "--composer-strip-max-height": `${stripMaxHeight}px` } as CSSProperties}
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
>
|
>
|
||||||
|
<div className="flex flex-wrap items-baseline justify-between gap-x-3 gap-y-0.5 px-2 pb-1">
|
||||||
|
<span className="text-[11.5px] font-semibold text-foreground/75">{label}</span>
|
||||||
|
<span className="text-[11px] text-muted-foreground">{hint}</span>
|
||||||
|
</div>
|
||||||
<div className="flex max-h-[216px] flex-col gap-1 overflow-y-auto">
|
<div className="flex max-h-[216px] flex-col gap-1 overflow-y-auto">
|
||||||
{prompts.map((prompt) => (
|
{prompts.map((prompt) => (
|
||||||
<QueuedPromptRow
|
<QueuedPromptRow
|
||||||
|
|||||||
@@ -1605,8 +1605,9 @@
|
|||||||
"duration": "Generation time"
|
"duration": "Generation time"
|
||||||
},
|
},
|
||||||
"queued": {
|
"queued": {
|
||||||
"label": "Queued guidance",
|
"label": "Waiting to send",
|
||||||
"guide": "Guide",
|
"hint": "Send now, or wait for the current response to finish.",
|
||||||
|
"guide": "Send now",
|
||||||
"delete": "Delete guidance",
|
"delete": "Delete guidance",
|
||||||
"edit": "Edit guidance",
|
"edit": "Edit guidance",
|
||||||
"drag": "Drag to reorder"
|
"drag": "Drag to reorder"
|
||||||
|
|||||||
@@ -1406,8 +1406,9 @@
|
|||||||
"duration": "Tiempo de generación"
|
"duration": "Tiempo de generación"
|
||||||
},
|
},
|
||||||
"queued": {
|
"queued": {
|
||||||
"label": "Guía en cola",
|
"label": "Pendiente de envío",
|
||||||
"guide": "Guiar",
|
"hint": "Envía ahora o espera a que termine la respuesta actual.",
|
||||||
|
"guide": "Enviar ahora",
|
||||||
"delete": "Eliminar guía",
|
"delete": "Eliminar guía",
|
||||||
"edit": "Editar guía",
|
"edit": "Editar guía",
|
||||||
"drag": "Arrastrar para reordenar"
|
"drag": "Arrastrar para reordenar"
|
||||||
|
|||||||
@@ -1405,8 +1405,9 @@
|
|||||||
"duration": "Temps de génération"
|
"duration": "Temps de génération"
|
||||||
},
|
},
|
||||||
"queued": {
|
"queued": {
|
||||||
"label": "Guidage en attente",
|
"label": "En attente d’envoi",
|
||||||
"guide": "Guider",
|
"hint": "Envoyez maintenant ou attendez la fin de la réponse en cours.",
|
||||||
|
"guide": "Envoyer",
|
||||||
"delete": "Supprimer le guidage",
|
"delete": "Supprimer le guidage",
|
||||||
"edit": "Modifier le guidage",
|
"edit": "Modifier le guidage",
|
||||||
"drag": "Faire glisser pour réordonner"
|
"drag": "Faire glisser pour réordonner"
|
||||||
|
|||||||
@@ -1405,8 +1405,9 @@
|
|||||||
"duration": "Waktu pembuatan"
|
"duration": "Waktu pembuatan"
|
||||||
},
|
},
|
||||||
"queued": {
|
"queued": {
|
||||||
"label": "Panduan antrean",
|
"label": "Menunggu dikirim",
|
||||||
"guide": "Pandu",
|
"hint": "Kirim sekarang atau tunggu hingga respons saat ini selesai.",
|
||||||
|
"guide": "Kirim sekarang",
|
||||||
"delete": "Hapus panduan",
|
"delete": "Hapus panduan",
|
||||||
"edit": "Ubah panduan",
|
"edit": "Ubah panduan",
|
||||||
"drag": "Seret untuk mengurutkan"
|
"drag": "Seret untuk mengurutkan"
|
||||||
|
|||||||
@@ -1405,8 +1405,9 @@
|
|||||||
"duration": "生成時間"
|
"duration": "生成時間"
|
||||||
},
|
},
|
||||||
"queued": {
|
"queued": {
|
||||||
"label": "保留中のガイド",
|
"label": "送信待ち",
|
||||||
"guide": "ガイド",
|
"hint": "今すぐ送信するか、現在の応答が終わるまで待ちます。",
|
||||||
|
"guide": "今すぐ送信",
|
||||||
"delete": "ガイドを削除",
|
"delete": "ガイドを削除",
|
||||||
"edit": "ガイドを編集",
|
"edit": "ガイドを編集",
|
||||||
"drag": "ドラッグして並べ替え"
|
"drag": "ドラッグして並べ替え"
|
||||||
|
|||||||
@@ -1405,8 +1405,9 @@
|
|||||||
"duration": "생성 시간"
|
"duration": "생성 시간"
|
||||||
},
|
},
|
||||||
"queued": {
|
"queued": {
|
||||||
"label": "대기 중인 안내",
|
"label": "전송 대기 중",
|
||||||
"guide": "안내",
|
"hint": "지금 보내거나 현재 응답이 끝날 때까지 기다리세요.",
|
||||||
|
"guide": "지금 보내기",
|
||||||
"delete": "안내 삭제",
|
"delete": "안내 삭제",
|
||||||
"edit": "안내 수정",
|
"edit": "안내 수정",
|
||||||
"drag": "드래그하여 순서 변경"
|
"drag": "드래그하여 순서 변경"
|
||||||
|
|||||||
@@ -1419,8 +1419,9 @@
|
|||||||
"duration": "Tempo de geração"
|
"duration": "Tempo de geração"
|
||||||
},
|
},
|
||||||
"queued": {
|
"queued": {
|
||||||
"label": "Guia em fila",
|
"label": "Aguardando envio",
|
||||||
"guide": "Guiar",
|
"hint": "Envie agora ou aguarde a resposta atual terminar.",
|
||||||
|
"guide": "Enviar agora",
|
||||||
"delete": "Excluir guia",
|
"delete": "Excluir guia",
|
||||||
"edit": "Editar guia",
|
"edit": "Editar guia",
|
||||||
"drag": "Arraste para reordenar"
|
"drag": "Arraste para reordenar"
|
||||||
|
|||||||
@@ -1405,8 +1405,9 @@
|
|||||||
"duration": "Thời gian tạo"
|
"duration": "Thời gian tạo"
|
||||||
},
|
},
|
||||||
"queued": {
|
"queued": {
|
||||||
"label": "Hướng dẫn đang chờ",
|
"label": "Đang chờ gửi",
|
||||||
"guide": "Hướng dẫn",
|
"hint": "Gửi ngay hoặc chờ phản hồi hiện tại hoàn tất.",
|
||||||
|
"guide": "Gửi ngay",
|
||||||
"delete": "Xóa hướng dẫn",
|
"delete": "Xóa hướng dẫn",
|
||||||
"edit": "Sửa hướng dẫn",
|
"edit": "Sửa hướng dẫn",
|
||||||
"drag": "Kéo để sắp xếp"
|
"drag": "Kéo để sắp xếp"
|
||||||
|
|||||||
@@ -1604,8 +1604,9 @@
|
|||||||
"duration": "生成耗时"
|
"duration": "生成耗时"
|
||||||
},
|
},
|
||||||
"queued": {
|
"queued": {
|
||||||
"label": "排队中的引导消息",
|
"label": "等待发送",
|
||||||
"guide": "引导",
|
"hint": "立即发送,或等待当前回复结束。",
|
||||||
|
"guide": "立即发送",
|
||||||
"delete": "删除引导",
|
"delete": "删除引导",
|
||||||
"edit": "编辑引导",
|
"edit": "编辑引导",
|
||||||
"drag": "拖动排序"
|
"drag": "拖动排序"
|
||||||
|
|||||||
@@ -1405,8 +1405,9 @@
|
|||||||
"duration": "生成耗時"
|
"duration": "生成耗時"
|
||||||
},
|
},
|
||||||
"queued": {
|
"queued": {
|
||||||
"label": "佇列中的引導訊息",
|
"label": "等待傳送",
|
||||||
"guide": "引導",
|
"hint": "立即傳送,或等待目前回覆結束。",
|
||||||
|
"guide": "立即傳送",
|
||||||
"delete": "刪除引導",
|
"delete": "刪除引導",
|
||||||
"edit": "編輯引導",
|
"edit": "編輯引導",
|
||||||
"drag": "拖曳排序"
|
"drag": "拖曳排序"
|
||||||
|
|||||||
@@ -2185,7 +2185,7 @@ describe("ThreadComposer", () => {
|
|||||||
|
|
||||||
expect(screen.getByTestId("composer-session-mention-Plan")).toHaveTextContent("@Plan");
|
expect(screen.getByTestId("composer-session-mention-Plan")).toHaveTextContent("@Plan");
|
||||||
fireEvent.keyDown(input, { key: "Enter" });
|
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, {
|
expect(onSend).toHaveBeenCalledWith("@Plan", undefined, {
|
||||||
sessionMentions: [{
|
sessionMentions: [{
|
||||||
@@ -2891,8 +2891,12 @@ describe("ThreadComposer", () => {
|
|||||||
expect(onSend).not.toHaveBeenCalled();
|
expect(onSend).not.toHaveBeenCalled();
|
||||||
expect(input).toHaveValue("");
|
expect(input).toHaveValue("");
|
||||||
expect(screen.getByText("keep the UI minimal")).toBeInTheDocument();
|
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(
|
expect(onSend).toHaveBeenCalledWith(
|
||||||
"keep the UI minimal",
|
"keep the UI minimal",
|
||||||
@@ -3079,14 +3083,14 @@ describe("ThreadComposer", () => {
|
|||||||
fireEvent.change(input, { target: { value: "second follow-up" } });
|
fireEvent.change(input, { target: { value: "second follow-up" } });
|
||||||
fireEvent.keyDown(input, { key: "Enter" });
|
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("composer-status-strip");
|
||||||
expect(queue).toHaveClass("mx-3");
|
expect(queue).toHaveClass("mx-3");
|
||||||
expect(queue.parentElement?.className).toContain("group/composer");
|
expect(queue.parentElement?.className).toContain("group/composer");
|
||||||
expect(within(queue).getByText("first follow-up")).toBeInTheDocument();
|
expect(within(queue).getByText("first follow-up")).toBeInTheDocument();
|
||||||
expect(within(queue).getByText("second 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: "Edit guidance" })).toHaveLength(2);
|
||||||
expect(within(queue).getAllByRole("button", { name: "Guide" })).toHaveLength(2);
|
expect(within(queue).getAllByRole("button", { name: "Send now" })).toHaveLength(2);
|
||||||
|
|
||||||
rerender(
|
rerender(
|
||||||
<ThreadComposer
|
<ThreadComposer
|
||||||
@@ -3125,7 +3129,7 @@ describe("ThreadComposer", () => {
|
|||||||
expect(onSend).toHaveBeenLastCalledWith("second follow-up");
|
expect(onSend).toHaveBeenLastCalledWith("second follow-up");
|
||||||
});
|
});
|
||||||
expect(onSend).toHaveBeenCalledTimes(2);
|
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 () => {
|
it("lets users edit queued guidance before it is sent", async () => {
|
||||||
@@ -3158,7 +3162,7 @@ describe("ThreadComposer", () => {
|
|||||||
expect(focusedSelections).toEqual([true]);
|
expect(focusedSelections).toEqual([true]);
|
||||||
expect(textarea.selectionStart).toBe("rough follow-up".length);
|
expect(textarea.selectionStart).toBe("rough follow-up".length);
|
||||||
expect(input).toHaveValue("rough follow-up");
|
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.change(input, { target: { value: "polished follow-up" } });
|
||||||
fireEvent.keyDown(input, { key: "Enter" });
|
fireEvent.keyDown(input, { key: "Enter" });
|
||||||
|
|
||||||
@@ -3260,14 +3264,14 @@ describe("ThreadComposer", () => {
|
|||||||
fireEvent.keyDown(input, { key: "Enter" });
|
fireEvent.keyDown(input, { key: "Enter" });
|
||||||
|
|
||||||
expect(onSend).not.toHaveBeenCalled();
|
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.getByText("look at this")).toBeInTheDocument();
|
||||||
expect(screen.queryByTestId("composer-chip")).not.toBeInTheDocument();
|
expect(screen.queryByTestId("composer-chip")).not.toBeInTheDocument();
|
||||||
|
|
||||||
fireEvent.click(screen.getByRole("button", { name: "Edit guidance" }));
|
fireEvent.click(screen.getByRole("button", { name: "Edit guidance" }));
|
||||||
expect(input).toHaveValue("look at this");
|
expect(input).toHaveValue("look at this");
|
||||||
expect(screen.getByTestId("composer-chip")).toHaveTextContent("draft.png");
|
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" });
|
fireEvent.keyDown(input, { key: "Enter" });
|
||||||
rerender(
|
rerender(
|
||||||
@@ -3479,7 +3483,7 @@ describe("ThreadComposer", () => {
|
|||||||
expect(await screen.findByText("remember this edited follow-up")).toBeInTheDocument();
|
expect(await screen.findByText("remember this edited follow-up")).toBeInTheDocument();
|
||||||
fireEvent.keyDown(screen.getByLabelText("Message input"), { key: "Enter" });
|
fireEvent.keyDown(screen.getByLabelText("Message input"), { key: "Enter" });
|
||||||
expect(onSend).not.toHaveBeenCalled();
|
expect(onSend).not.toHaveBeenCalled();
|
||||||
fireEvent.click(screen.getByRole("button", { name: "Guide" }));
|
fireEvent.click(screen.getByRole("button", { name: "Send now" }));
|
||||||
expect(onSend).toHaveBeenCalledWith(
|
expect(onSend).toHaveBeenCalledWith(
|
||||||
"remember this edited follow-up",
|
"remember this edited follow-up",
|
||||||
undefined,
|
undefined,
|
||||||
|
|||||||
Reference in new issue
Block a user