Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(chat): label queued actions that stop the running turn

leonongoing0a18d611401e
diff --git a/src/components/ComposerQueuedMessages.test.ts b/src/components/ComposerQueuedMessages.test.ts
index 7fec099cb3..0d3d4cf19c 100644
--- a/src/components/ComposerQueuedMessages.test.ts
+++ b/src/components/ComposerQueuedMessages.test.ts
@@ -134,14 +134,16 @@ describe("QueuedComposerMessages", () => {
expect(withoutEdit).not.toContain("Edit queued message");
});
- it("says the fallback Steer stops the running turn when the engine cannot steer live", () => {
+ it("shows Stop and send on the button when the engine cannot steer live", () => {
const base = { items: oneItem, onSteer: () => undefined, onCancel: () => undefined } as const;
const liveMarkup = renderToStaticMarkup(createElement(QueuedComposerMessages, base));
expect(liveMarkup).toContain("aria-label=\"Steer queued message now\"");
const interruptMarkup = renderToStaticMarkup(
createElement(QueuedComposerMessages, { ...base, steerInterrupts: true }),
);
- expect(interruptMarkup).toContain("aria-label=\"Stop the running turn and send this message now\"");
+ expect(interruptMarkup).toContain(">Stop and send</button>");
+ expect(interruptMarkup).toContain('aria-label="Stop and send"');
+ expect(interruptMarkup).toContain('title="Stop the running turn and send this message now"');
expect(interruptMarkup).not.toContain("aria-label=\"Steer queued message now\"");
});
@@ -174,10 +176,24 @@ describe("QueuedComposerMessages", () => {
onCancel: () => undefined,
}),
);
- expect(markup).toContain("aria-label=\"Stop the running turn and send the next queued message now\"");
+ expect(markup).toContain(">Stop and send next</button>");
+ expect(markup).toContain('aria-label="Stop and send next"');
+ expect(markup).toContain('title="Stop the running turn and send the next queued message now"');
expect(markup).not.toContain("aria-label=\"Steer the next queued message now\"");
});
+ it("shows Stop and send all when the action will stop the turn and drain the direct queue", () => {
+ const markup = renderToStaticMarkup(createElement(QueuedComposerMessages, {
+ items: [{ queueId: "q1", text: "first" }, { queueId: "q2", text: "second" }],
+ onSteer: () => undefined,
+ onCancel: () => undefined,
+ steerInterrupts: true,
+ }));
+ expect(markup).toContain(">Stop and send all</button>");
+ expect(markup).toContain('aria-label="Stop and send all"');
+ expect(markup).toContain('title="Stop the running turn and send all 2 queued messages now"');
+ });
+
it("puts the queue-level Steer action on the head only and keeps every delete distinct", () => {
const markup = renderToStaticMarkup(
createElement(QueuedComposerMessages, {
diff --git a/src/components/ComposerQueuedMessages.tsx b/src/components/ComposerQueuedMessages.tsx
index 7768c957c9..f776d6fd19 100644
--- a/src/components/ComposerQueuedMessages.tsx
+++ b/src/components/ComposerQueuedMessages.tsx
@@ -68,11 +68,15 @@ export function QueuedComposerMessages({
const multiple = items.length > 1;
const steerLabel = steering
? t("composer.queued.steering")
- : multiple
- ? steerMode === "all"
- ? t("composer.queued.steerAll")
- : t("composer.queued.steerNext")
- : t("composer.queued.steer");
+ : steerInterrupts
+ ? multiple
+ ? t(steerMode === "all" ? "composer.queued.stopAndSendAll" : "composer.queued.stopAndSendNext")
+ : t("composer.queued.stopAndSend")
+ : multiple
+ ? steerMode === "all"
+ ? t("composer.queued.steerAll")
+ : t("composer.queued.steerNext")
+ : t("composer.queued.steer");
const steerDescription = steerInterrupts
? multiple
? steerMode === "all"
@@ -122,7 +126,7 @@ export function QueuedComposerMessages({
type="button"
onClick={onSteer}
disabled={steering}
- aria-label={steering ? t("composer.queued.steeringAria") : steerDescription}
+ aria-label={steering ? t("composer.queued.steeringAria") : steerInterrupts ? steerLabel : steerDescription}
title={steerDescription}
className="flex h-7 shrink-0 items-center gap-1 rounded-lg px-2 text-[13px] font-medium text-ink-secondary outline-none hover:bg-raised-hover hover:text-ink focus-visible:ring-2 focus-visible:ring-accent/60 disabled:cursor-wait disabled:opacity-60"
>
diff --git a/src/locales/en.json b/src/locales/en.json
index 676994cb67..ca32f1ce03 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -2935,6 +2935,9 @@
"composer.queued.steerAll": "Steer all",
"composer.queued.steerNext": "Steer next",
"composer.queued.steer": "Steer",
+ "composer.queued.stopAndSend": "Stop and send",
+ "composer.queued.stopAndSendAll": "Stop and send all",
+ "composer.queued.stopAndSendNext": "Stop and send next",
"composer.queued.steerAllHint": "Steer all {count} queued messages now",
"composer.queued.steerNextHint": "Steer the next queued message now",
"composer.queued.steerHint": "Steer queued message now",