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: icon-only Copy and Download in the transcript, with tooltips (#11425)
Michael Hana9d3b921b5f2
diff --git a/studio/frontend/src/components/assistant-ui/icon-action-button.tsx b/studio/frontend/src/components/assistant-ui/icon-action-button.tsxnew file mode 100644index 00000000000..a94d1abf8fa--- /dev/null+++ b/studio/frontend/src/components/assistant-ui/icon-action-button.tsx@@ -0,0 +1,41 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++"use client";++import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from "@/components/ui/tooltip";+import type { ComponentProps, ReactNode } from "react";++/**+ * A transcript toolbar button: Copy, Download and the like, above a code cell or beside a+ * thinking trace's header. Icon only, because these sit in narrow headers next to each other+ * and the word only repeats what the glyph already says. The label is not dropped: it is the+ * accessible name and it is what the tooltip shows on hover.+ */+export function IconActionButton({+ label,+ children,+ ...props+}: ComponentProps<"button"> & { label: string; children: ReactNode }) {+ return (+ <Tooltip>+ <TooltipTrigger asChild={true}>+ <button+ type="button"+ className="inline-flex items-center justify-center rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"+ aria-label={label}+ {...props}+ >+ {children}+ </button>+ </TooltipTrigger>+ <TooltipContent side="top" className="tooltip-compact">+ {label}+ </TooltipContent>+ </Tooltip>+ );+}diff --git a/studio/frontend/src/components/assistant-ui/reasoning.tsx b/studio/frontend/src/components/assistant-ui/reasoning.tsxindex 6c4b5f50b97..89ffed42be5 100644--- a/studio/frontend/src/components/assistant-ui/reasoning.tsx+++ b/studio/frontend/src/components/assistant-ui/reasoning.tsx@@ -68,6 +68,7 @@ import { ChevronDownIcon } from "lucide-react";import { Tick02Icon } from "@/lib/tick-icon";import { Copy01Icon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";+import { IconActionButton } from "./icon-action-button";import {type CSSProperties,type ComponentProps,@@ -517,19 +518,16 @@ function ReasoningCopyButton({}, [reasoningText]);return (- <button- type="button"+ <IconActionButton+ label={copied ? "Copied" : "Copy reasoning"}onClick={handleCopy}- className="inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-muted-foreground transition-colors hover:text-foreground hover:bg-muted"- aria-label="Copy reasoning">{copied ? (<HugeiconsIcon icon={Tick02Icon} strokeWidth={2} className="size-3" />) : (<HugeiconsIcon icon={Copy01Icon} className="size-3" />)}- {copied ? "Copied" : "Copy"}- </button>+ </IconActionButton>);}diff --git a/studio/frontend/src/components/assistant-ui/tool-code-cell.tsx b/studio/frontend/src/components/assistant-ui/tool-code-cell.tsxindex 60c48587c3f..fdae32ab256 100644--- a/studio/frontend/src/components/assistant-ui/tool-code-cell.tsx+++ b/studio/frontend/src/components/assistant-ui/tool-code-cell.tsx@@ -11,6 +11,7 @@ import { toast } from "@/lib/toast";import { Copy01Icon, Download01Icon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";import { code as codePlugin } from "@streamdown/code";+import { IconActionButton } from "./icon-action-button";import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { Streamdown } from "streamdown";@@ -45,19 +46,13 @@ export function CopyBtn({ text }: { text: string }) {}, [text]);return (- <button- type="button"- onClick={copy}- className="inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"- aria-label="Copy to clipboard"- >+ <IconActionButton label={copied ? "Copied" : "Copy to clipboard"} onClick={copy}>{copied ? (<HugeiconsIcon icon={Tick02Icon} strokeWidth={2} className="size-3" />) : (<HugeiconsIcon icon={Copy01Icon} className="size-3" />)}- {copied ? "Copied" : "Copy"}- </button>+ </IconActionButton>);}@@ -73,15 +68,9 @@ function DownloadBtn({ code, name }: { code: string; name: string }) {}, [code, name]);return (- <button- type="button"- onClick={download}- className="inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"- aria-label="Download"- >+ <IconActionButton label="Download" onClick={download}><HugeiconsIcon icon={Download01Icon} className="size-3" />- Download- </button>+ </IconActionButton>);}diff --git a/studio/frontend/src/components/assistant-ui/tool-ui-code-execution.tsx b/studio/frontend/src/components/assistant-ui/tool-ui-code-execution.tsxindex cf770ae7626..cbb64bd2516 100644--- a/studio/frontend/src/components/assistant-ui/tool-ui-code-execution.tsx+++ b/studio/frontend/src/components/assistant-ui/tool-ui-code-execution.tsx@@ -3,20 +3,15 @@"use client";-import { copyToClipboard } from "@/lib/copy-to-clipboard";-import { stringifyToolResult } from "@/lib/strip-ansi";import {type ToolCallMessagePartComponent,useAuiState,} from "@assistant-ui/react";import { FileTextIcon, TerminalIcon } from "lucide-react";-import { Tick02Icon } from "@/lib/tick-icon";-import { Copy01Icon } from "@hugeicons/core-free-icons";-import { HugeiconsIcon } from "@hugeicons/react";import { Spinner } from "@/components/ui/spinner";import { isToolCallRunning, toolArgText } from "./tool-arg-text";-import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";+import { memo, useMemo } from "react";import { useToolAwaitingApproval } from "@/features/chat";import {ToolFallbackContent,@@ -25,6 +20,7 @@ import {} from "./tool-fallback";import { useToolActivityOpen } from "./use-tool-activity-open";import { ScrollPane } from "./scroll-pane";+import { CopyBtn } from "./tool-code-cell";/*** Renders synthetic `_toolEvent` chunks from `_stream_anthropic` for the@@ -50,7 +46,6 @@ interface CodeExecutionArgs {const MAX_COMMAND_LABEL = 80;const MAX_RESULT_DISPLAY = 10_000;-const COPY_RESET_MS = 2000;function truncateCommandLabel(text: string): string {const normalized = text.replace(/\s+/g, " ").trim();@@ -68,44 +63,6 @@ function truncateResult(text: string): string {: `${text.slice(0, MAX_RESULT_DISPLAY)}\n... (truncated)`;}-function CopyBtn({ text }: { text: string }) {- const [copied, setCopied] = useState(false);- const timer = useRef<ReturnType<typeof setTimeout> | null>(null);-- useEffect(() => {- return () => {- if (timer.current) {- clearTimeout(timer.current);- }- };- }, []);-- const copy = useCallback(async () => {- if (await copyToClipboard(text)) {- setCopied(true);- if (timer.current) {- clearTimeout(timer.current);- }- timer.current = setTimeout(() => setCopied(false), COPY_RESET_MS);- }- }, [text]);-- return (- <button- type="button"- onClick={copy}- className="inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"- aria-label="Copy to clipboard"- >- {copied ? (- <HugeiconsIcon icon={Tick02Icon} strokeWidth={2} className="size-3" />- ) : (- <HugeiconsIcon icon={Copy01Icon} className="size-3" />- )}- {copied ? "Copied" : "Copy"}- </button>- );-}export function CodeExecutionResultOutput({ result }: { result: unknown }) {const resultText = useMemo(() => (result == null ? "" : stringifyToolResult(result)),