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}
|
||||
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 (
|
||||
<div
|
||||
@@ -2729,6 +2735,10 @@ function QueuedPromptStack({
|
||||
style={{ "--composer-strip-max-height": `${stripMaxHeight}px` } as CSSProperties}
|
||||
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">
|
||||
{prompts.map((prompt) => (
|
||||
<QueuedPromptRow
|
||||
|
||||
@@ -1605,8 +1605,9 @@
|
||||
"duration": "Generation time"
|
||||
},
|
||||
"queued": {
|
||||
"label": "Queued guidance",
|
||||
"guide": "Guide",
|
||||
"label": "Waiting to send",
|
||||
"hint": "Send now, or wait for the current response to finish.",
|
||||
"guide": "Send now",
|
||||
"delete": "Delete guidance",
|
||||
"edit": "Edit guidance",
|
||||
"drag": "Drag to reorder"
|
||||
|
||||
@@ -1406,8 +1406,9 @@
|
||||
"duration": "Tiempo de generación"
|
||||
},
|
||||
"queued": {
|
||||
"label": "Guía en cola",
|
||||
"guide": "Guiar",
|
||||
"label": "Pendiente de envío",
|
||||
"hint": "Envía ahora o espera a que termine la respuesta actual.",
|
||||
"guide": "Enviar ahora",
|
||||
"delete": "Eliminar guía",
|
||||
"edit": "Editar guía",
|
||||
"drag": "Arrastrar para reordenar"
|
||||
|
||||
@@ -1405,8 +1405,9 @@
|
||||
"duration": "Temps de génération"
|
||||
},
|
||||
"queued": {
|
||||
"label": "Guidage en attente",
|
||||
"guide": "Guider",
|
||||
"label": "En attente d’envoi",
|
||||
"hint": "Envoyez maintenant ou attendez la fin de la réponse en cours.",
|
||||
"guide": "Envoyer",
|
||||
"delete": "Supprimer le guidage",
|
||||
"edit": "Modifier le guidage",
|
||||
"drag": "Faire glisser pour réordonner"
|
||||
|
||||
@@ -1405,8 +1405,9 @@
|
||||
"duration": "Waktu pembuatan"
|
||||
},
|
||||
"queued": {
|
||||
"label": "Panduan antrean",
|
||||
"guide": "Pandu",
|
||||
"label": "Menunggu dikirim",
|
||||
"hint": "Kirim sekarang atau tunggu hingga respons saat ini selesai.",
|
||||
"guide": "Kirim sekarang",
|
||||
"delete": "Hapus panduan",
|
||||
"edit": "Ubah panduan",
|
||||
"drag": "Seret untuk mengurutkan"
|
||||
|
||||
@@ -1405,8 +1405,9 @@
|
||||
"duration": "生成時間"
|
||||
},
|
||||
"queued": {
|
||||
"label": "保留中のガイド",
|
||||
"guide": "ガイド",
|
||||
"label": "送信待ち",
|
||||
"hint": "今すぐ送信するか、現在の応答が終わるまで待ちます。",
|
||||
"guide": "今すぐ送信",
|
||||
"delete": "ガイドを削除",
|
||||
"edit": "ガイドを編集",
|
||||
"drag": "ドラッグして並べ替え"
|
||||
|
||||
@@ -1405,8 +1405,9 @@
|
||||
"duration": "생성 시간"
|
||||
},
|
||||
"queued": {
|
||||
"label": "대기 중인 안내",
|
||||
"guide": "안내",
|
||||
"label": "전송 대기 중",
|
||||
"hint": "지금 보내거나 현재 응답이 끝날 때까지 기다리세요.",
|
||||
"guide": "지금 보내기",
|
||||
"delete": "안내 삭제",
|
||||
"edit": "안내 수정",
|
||||
"drag": "드래그하여 순서 변경"
|
||||
|
||||
@@ -1419,8 +1419,9 @@
|
||||
"duration": "Tempo de geração"
|
||||
},
|
||||
"queued": {
|
||||
"label": "Guia em fila",
|
||||
"guide": "Guiar",
|
||||
"label": "Aguardando envio",
|
||||
"hint": "Envie agora ou aguarde a resposta atual terminar.",
|
||||
"guide": "Enviar agora",
|
||||
"delete": "Excluir guia",
|
||||
"edit": "Editar guia",
|
||||
"drag": "Arraste para reordenar"
|
||||
|
||||
@@ -1405,8 +1405,9 @@
|
||||
"duration": "Thời gian tạo"
|
||||
},
|
||||
"queued": {
|
||||
"label": "Hướng dẫn đang chờ",
|
||||
"guide": "Hướng dẫn",
|
||||
"label": "Đang chờ gửi",
|
||||
"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",
|
||||
"edit": "Sửa hướng dẫn",
|
||||
"drag": "Kéo để sắp xếp"
|
||||
|
||||
@@ -1604,8 +1604,9 @@
|
||||
"duration": "生成耗时"
|
||||
},
|
||||
"queued": {
|
||||
"label": "排队中的引导消息",
|
||||
"guide": "引导",
|
||||
"label": "等待发送",
|
||||
"hint": "立即发送,或等待当前回复结束。",
|
||||
"guide": "立即发送",
|
||||
"delete": "删除引导",
|
||||
"edit": "编辑引导",
|
||||
"drag": "拖动排序"
|
||||
|
||||
@@ -1405,8 +1405,9 @@
|
||||
"duration": "生成耗時"
|
||||
},
|
||||
"queued": {
|
||||
"label": "佇列中的引導訊息",
|
||||
"guide": "引導",
|
||||
"label": "等待傳送",
|
||||
"hint": "立即傳送,或等待目前回覆結束。",
|
||||
"guide": "立即傳送",
|
||||
"delete": "刪除引導",
|
||||
"edit": "編輯引導",
|
||||
"drag": "拖曳排序"
|
||||
|
||||
@@ -2185,7 +2185,7 @@ describe("ThreadComposer", () => {
|
||||
|
||||
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(
|
||||
<ThreadComposer
|
||||
@@ -3125,7 +3129,7 @@ describe("ThreadComposer", () => {
|
||||
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,
|
||||
|
||||
Reference in new issue
Block a user