Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: show one composer button while a reply streams (#15248)
Michael Han5e6115540903
diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsxindex 6f598553e32..a8db7688de7 100644--- a/studio/frontend/src/components/assistant-ui/thread.tsx+++ b/studio/frontend/src/components/assistant-ui/thread.tsx@@ -7823,22 +7823,24 @@ const ComposerRightControls: FC<{<AuiIf condition={({ thread }) => thread.isRunning}>{/* Classed so the narrow-screen rules can treat this like thesibling send/stop buttons; it is the flex item, not the button. */}+ {/* With a draft only the stop shortcut stops the reply. */}<div className="aui-composer-run-controls ml-1.5 flex items-center gap-1.5">- <ComposerPrimitive.Cancel asChild={true}>- <Button- type="button"- variant="primary"- size="icon"- className="aui-composer-cancel size-9 rounded-full"- aria-label="Stop generating"- // Cancel only ends the reply; handlePromptQueueRunState then- // dispatches the next queued prompt. stop() ends the run.- onClick={stop}- >- <SquareIcon className="size-3 fill-current" />- </Button>- </ComposerPrimitive.Cancel>- {!queueDisabled ? (+ {queueDisabled ? (+ <ComposerPrimitive.Cancel asChild={true}>+ <Button+ type="button"+ variant="primary"+ size="icon"+ className="aui-composer-cancel size-9 rounded-full"+ aria-label="Stop generating"+ // Cancel only ends the reply; handlePromptQueueRunState then+ // dispatches the next queued prompt. stop() ends the run.+ onClick={stop}+ >+ <SquareIcon className="size-3 fill-current" />+ </Button>+ </ComposerPrimitive.Cancel>+ ) : (<TooltipIconButtontooltip={followUpTooltip}side="bottom"@@ -7851,7 +7853,7 @@ const ComposerRightControls: FC<{><ArrowUpIcon className="unsloth-send-icon aui-composer-send-icon size-[calc(21px*var(--ui-space-scale,1))] stroke-2" /></TooltipIconButton>- ) : null}+ )}</div></AuiIf>)}diff --git a/studio/frontend/tests/composer-stop-queue.test.ts b/studio/frontend/tests/composer-stop-queue.test.tsindex e817255bc37..d34d4f3f2d5 100644--- a/studio/frontend/tests/composer-stop-queue.test.ts+++ b/studio/frontend/tests/composer-stop-queue.test.ts@@ -12,7 +12,7 @@ function composerSource(): Promise<string> {);}-test("stop stays available when the running composer can queue", async () => {+test("the running composer shows one action: Queue with a draft, else Stop", async () => {const source = await composerSource();const start = source.indexOf("<AuiIf condition={({ thread }) => thread.isRunning}>",@@ -22,26 +22,17 @@ test("stop stays available when the running composer can queue", async () => {const end = source.indexOf("</AuiIf>", start);assert.ok(end > start, "the running composer controls must be closed");const controls = source.slice(start, end);- const stopLabel = 'aria-label="Stop generating"';- const queueGuard = "{!queueDisabled ?";- const stopIndex = controls.indexOf(stopLabel);- const queueGuardIndex = controls.indexOf(queueGuard);- assert.ok(stopIndex >= 0, "the running composer must expose Stop generating");+ const guardIndex = controls.indexOf("{queueDisabled ? (");+ const stopIndex = controls.indexOf('aria-label="Stop generating"');+ const queueIndex = controls.indexOf("aria-label={followUpLabel}");+ assert.ok(guardIndex >= 0, "Stop and Queue must be one exclusive choice");assert.ok(- queueGuardIndex > stopIndex,- "queue availability must be evaluated after the independent stop action",- );- assert.doesNotMatch(- controls,- /\{queueDisabled \?/,- "Stop and Queue must not share an exclusive queueDisabled ternary",- );- assert.match(- controls.slice(queueGuardIndex),- /aria-label=\{followUpLabel\}/,- "the follow-up action must remain available when the draft is queueable",+ guardIndex < stopIndex && stopIndex < queueIndex,+ "Stop shows with nothing to queue, Queue once the draft is queueable",);+ assert.doesNotMatch(controls, /\{!queueDisabled \?/);+const stopButton = controls.match(/<Button[\s\S]*?aria-label="Stop generating"[\s\S]*?>/,);@@ -52,3 +43,11 @@ test("stop stays available when the running composer can queue", async () => {"stop must still end the prompt queue run, not only the active reply",);});++test("the stop shortcut still works while the draft hides the Stop button", async () => {+ const source = await composerSource();+ assert.match(+ source,+ /useShortcut\(\s*"stopGeneration",[\s\S]*?enabled: chatActive && \(threadRunning \|\| isResearchActive\)/,+ );+});