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: redesign chat composer (#5891)
Michael Han37fd76a02fb7
diff --git a/studio/backend/main.py b/studio/backend/main.pyindex d5016980bae..10fbbfddf0a 100644--- a/studio/backend/main.py+++ b/studio/backend/main.py@@ -515,7 +515,7 @@ class SecurityHeadersMiddleware(BaseHTTPMiddleware):response.headers.setdefault("Referrer-Policy", "no-referrer")response.headers.setdefault("Permissions-Policy",- "camera=(), microphone=(), geolocation=()",+ "camera=(), microphone=(self), geolocation=()",)response.headers["server"] = "unsloth-studio"return responsediff --git a/studio/backend/tests/test_middleware.py b/studio/backend/tests/test_middleware.pyindex 85b82f10118..5e5b5a3c3b6 100644--- a/studio/backend/tests/test_middleware.py+++ b/studio/backend/tests/test_middleware.py@@ -260,7 +260,10 @@ class TestSecurityHeadersMiddleware:assert r.headers["x-frame-options"] == "DENY"assert r.headers["x-content-type-options"] == "nosniff"assert r.headers["referrer-policy"] == "no-referrer"- assert "camera=()" in r.headers["permissions-policy"]+ permissions_policy = r.headers["permissions-policy"]+ assert "camera=()" in permissions_policy+ assert "microphone=(self)" in permissions_policy+ assert "geolocation=()" in permissions_policyassert r.headers["server"] == "unsloth-studio"def test_internal_nonce_header_is_spliced_into_csp_and_stripped(self, main_module):diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsxindex 16292bd6e49..941c2e8a74d 100644--- a/studio/frontend/src/components/app-sidebar.tsx+++ b/studio/frontend/src/components/app-sidebar.tsx@@ -46,12 +46,12 @@ import { useAnimatedThemeToggle } from "@/components/ui/animated-theme-toggler";import { cn } from "@/lib/utils";import {ChefHatIcon,- ColumnInsertIcon,CursorInfo02Icon,Delete02Icon,DownloadSquare01Icon,Edit03Icon,FolderAddIcon,+ FolderExportIcon,Folder01Icon,Globe02Icon,HelpCircleIcon,@@ -192,6 +192,7 @@ function NavItem({onClick,children,dataTour,+ className,}: {icon: typeof ZapIcon;label: string;@@ -200,9 +201,10 @@ function NavItem({onClick: () => void;children?: ReactNode;dataTour?: string;+ className?: string;}) {return (- <SidebarMenuItem>+ <SidebarMenuItem className={className}><div className="relative"><SidebarMenuButtontooltip={label}@@ -210,7 +212,7 @@ function NavItem({onClick={onClick}isActive={active}data-tour={dataTour}- className="sidebar-nav-btn h-[33px] rounded-[10px] gap-[8.5px] px-2.5 font-medium group-data-[collapsible=icon]:!w-[32px] group-data-[collapsible=icon]:!rounded-[10px] group-data-[collapsible=icon]:mx-auto"+ className="sidebar-nav-btn h-[33px] rounded-[11px] gap-[8.5px] px-2.5 font-medium group-data-[collapsible=icon]:!w-[32px] group-data-[collapsible=icon]:!rounded-[10px] group-data-[collapsible=icon]:mx-auto"><HugeiconsIcon icon={icon} strokeWidth={1.75} className="size-icon! shrink-0 group-hover/menu-button:animate-icon-pop" /><span className="text-[14.5px] leading-[19px] tracking-nav">{label}</span>@@ -550,7 +552,7 @@ export function AppSidebar() {? "sidebar-row-action group-hover/project-chat-item:opacity-100 group-hover/project-chat-item:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto": "sidebar-row-action group-hover/recent-item:opacity-100 group-hover/recent-item:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto";const buttonClass = cn(- "sidebar-nav-btn h-[33px] cursor-pointer rounded-[10px] pr-4 text-[14.5px] leading-[19px] tracking-nav font-medium",+ "sidebar-nav-btn h-[33px] cursor-pointer rounded-[11px] pr-4 text-[14.5px] leading-[19px] tracking-nav font-medium",variant === "project" ? "pl-[37px]" : "pl-2.5",variant === "project"? "group-hover/project-chat-item:pr-8 group-has-[.sidebar-row-action[data-state=open]]/project-chat-item:pr-8"@@ -599,9 +601,9 @@ export function AppSidebar() {</DropdownMenuTrigger><DropdownMenuContentside="bottom"- align="end"- sideOffset={4}- className="app-user-menu menu-soft-surface menu-flat-destructive ring-0 w-44 py-2 font-heading rounded-[14px] border-0"+ align="start"+ sideOffset={6}+ className="unsloth-plus-menu menu-flat-destructive w-52"><DropdownMenuItem onSelect={() => openRenameChat(item)}><HugeiconsIcon icon={Edit03Icon} strokeWidth={1.75} className="size-icon" />@@ -609,13 +611,13 @@ export function AppSidebar() {</DropdownMenuItem><DropdownMenuSub><DropdownMenuSubTrigger>- <HugeiconsIcon icon={Folder01Icon} strokeWidth={1.75} className="size-icon" />+ <HugeiconsIcon icon={FolderExportIcon} strokeWidth={1.75} className="size-icon" /><span>Move to project</span></DropdownMenuSubTrigger><DropdownMenuSubContentsideOffset={8}alignOffset={-4}- className="app-user-menu menu-soft-surface menu-flat-destructive ring-0 w-56 py-2 font-heading rounded-[14px] border-0"+ className="unsloth-plus-menu w-52"><DropdownMenuItemonSelect={() => {@@ -754,25 +756,6 @@ export function AppSidebar() {disabled={chatDisabled}onClick={() => openNewChat(null)}/>- <NavItem- icon={ColumnInsertIcon}- label={t("shell.navigation.compare")}- active={- !!search.compare &&- !chatItems.some((i) => i.id === search.compare)- }- disabled={chatDisabled}- dataTour="chat-compare"- onClick={() => {- if (chatDisabled) return;- setActiveThreadId(null);- navigate({- to: "/chat",- search: { compare: createNavigationNonce() },- });- closeMobileIfOpen();- }}- /><NavItemicon={Search01Icon}label={t("shell.navigation.search")}@@ -813,6 +796,22 @@ export function AppSidebar() {closeMobileIfOpen();}}/>+ {/* Train has its own labelled section when expanded; surface it as+ a plain icon here only while the sidebar is collapsed. */}+ <NavItem+ icon={TestTubeOutlineIcon}+ label={t("shell.navigation.train")}+ active={+ pathname === "/studio" || pathname.startsWith("/studio/")+ }+ disabled={chatOnly}+ onClick={() => {+ if (chatOnly) return;+ navigate({ to: "/studio" });+ closeMobileIfOpen();+ }}+ className="hidden group-data-[collapsible=icon]:block"+ /></SidebarMenu></SidebarGroupContent></SidebarGroup>@@ -822,7 +821,7 @@ export function AppSidebar() {<SidebarGroupLabel className={cn("sidebar-sticky-label sidebar-sticky-label-following", scrolled && "is-scrolled")} asChild><CollapsibleTrigger className="cursor-pointer flex w-full items-center gap-1 group/sb-collap">{t("shell.navigation.train")}- <ChevronDown className="size-3.5 opacity-0 transition-[transform,opacity] duration-200 group-hover/sb-collap:opacity-100 group-focus-visible/sb-collap:opacity-100 data-[state=open]:rotate-0 [[data-state=closed]_&]:rotate-[-90deg]" />+ <ChevronDown className="size-3.5 opacity-0 transition-[transform,opacity] duration-200 group-hover/sb-collap:opacity-100 group-focus-visible/sb-collap:opacity-100 data-[state=open]:rotate-0 [[data-state=closed]_&]:rotate-[-90deg] [[data-state=closed]_&]:opacity-100" /></CollapsibleTrigger></SidebarGroupLabel><CollapsibleContent>@@ -871,7 +870,7 @@ export function AppSidebar() {<SidebarGroupLabel className={cn("sidebar-sticky-label sidebar-sticky-label-following", scrolled && "is-scrolled")} asChild><CollapsibleTrigger className="cursor-pointer flex w-full items-center gap-1 group/sb-collap">{t("shell.navigation.recents")}- <ChevronDown className="size-3.5 opacity-0 transition-[transform,opacity] duration-200 group-hover/sb-collap:opacity-100 group-focus-visible/sb-collap:opacity-100 data-[state=open]:rotate-0 [[data-state=closed]_&]:rotate-[-90deg]" />+ <ChevronDown className="size-3.5 opacity-0 transition-[transform,opacity] duration-200 group-hover/sb-collap:opacity-100 group-focus-visible/sb-collap:opacity-100 data-[state=open]:rotate-0 [[data-state=closed]_&]:rotate-[-90deg] [[data-state=closed]_&]:opacity-100" /></CollapsibleTrigger></SidebarGroupLabel><CollapsibleContent>@@ -893,7 +892,7 @@ export function AppSidebar() {<SidebarGroupLabel className={cn("sidebar-sticky-label sidebar-sticky-label-following", scrolled && "is-scrolled")} asChild><CollapsibleTrigger className="cursor-pointer flex w-full items-center gap-1 group/sb-collap">{t("shell.navigation.recents")}- <ChevronDown className="size-3.5 opacity-0 transition-[transform,opacity] duration-200 group-hover/sb-collap:opacity-100 group-focus-visible/sb-collap:opacity-100 data-[state=open]:rotate-0 [[data-state=closed]_&]:rotate-[-90deg]" />+ <ChevronDown className="size-3.5 opacity-0 transition-[transform,opacity] duration-200 group-hover/sb-collap:opacity-100 group-focus-visible/sb-collap:opacity-100 data-[state=open]:rotate-0 [[data-state=closed]_&]:rotate-[-90deg] [[data-state=closed]_&]:opacity-100" /></CollapsibleTrigger></SidebarGroupLabel><CollapsibleContent>@@ -917,7 +916,7 @@ export function AppSidebar() {><SidebarMenuButtonisActive={isActiveRun}- className="sidebar-nav-btn h-auto flex-col items-start gap-0.5 py-[5px] rounded-[10px] pl-2.5 pr-7 text-[14.5px] tracking-nav font-medium"+ className="sidebar-nav-btn h-auto flex-col items-start gap-0.5 py-[5px] rounded-[11px] pl-2.5 pr-7 text-[14.5px] tracking-nav font-medium"onClick={() => {setSelectedHistoryRunId(run.id);closeMobileIfOpen();@@ -1007,14 +1006,14 @@ export function AppSidebar() {<SidebarMenuButtonsize="lg"aria-label={t("shell.accountMenu", { name: displayTitle })}- className="sidebar-nav-btn !h-[40px] gap-[8px] px-2 py-[5px] rounded-[10px]"+ className="sidebar-nav-btn !h-[44px] gap-[9px] px-2 py-[3px] rounded-[14px]"><div className="shrink-0"><UserAvatarname={displayTitle}imageUrl={avatarDataUrl}size="sm"- className="!size-[30px]"+ className="!size-[32px]"/></div><div className="flex flex-col gap-0.5 leading-tight group-data-[collapsible=icon]:hidden">@@ -1026,8 +1025,9 @@ export function AppSidebar() {</DropdownMenuTrigger><DropdownMenuContentside="top"- align="start"- className="app-user-menu menu-soft-surface-up ring-0 w-[15rem] py-2.5 font-heading rounded-[14px] border-0"+ align="center"+ sideOffset={6}+ className="app-user-menu menu-soft-surface-up ring-0 w-[16rem] px-1.5 py-2.5 font-heading rounded-[20px] border-0"><DropdownMenuGroup><DropdownMenuItemdiff --git a/studio/frontend/src/components/assistant-ui/attachment.tsx b/studio/frontend/src/components/assistant-ui/attachment.tsxindex d814490c1de..a96dd7a4e1c 100644--- a/studio/frontend/src/components/assistant-ui/attachment.tsx+++ b/studio/frontend/src/components/assistant-ui/attachment.tsx@@ -24,7 +24,9 @@ import {useAui,useAuiState,} from "@assistant-ui/react";-import { FileText, PlusIcon, XIcon } from "lucide-react";+import { File02Icon } from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";+import { PlusIcon, XIcon } from "lucide-react";import {type FC,type PropsWithChildren,@@ -134,7 +136,11 @@ const AttachmentThumb: FC = () => {return (<div className="flex h-full w-full items-center justify-center">- <FileText className="size-6 text-muted-foreground" />+ <HugeiconsIcon+ icon={File02Icon}+ strokeWidth={2}+ className="size-6 text-muted-foreground"+ /></div>);};diff --git a/studio/frontend/src/components/assistant-ui/audio-player.tsx b/studio/frontend/src/components/assistant-ui/audio-player.tsxindex 6b99de83741..8836eddff50 100644--- a/studio/frontend/src/components/assistant-ui/audio-player.tsx+++ b/studio/frontend/src/components/assistant-ui/audio-player.tsx@@ -4,7 +4,9 @@"use client";import { Button } from "@/components/ui/button";-import { DownloadIcon, PauseIcon, PlayIcon } from "lucide-react";+import { PauseIcon, PlayIcon } from "lucide-react";+import { Download01Icon } from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";import { type FC, useRef, useState } from "react";interface AudioPlayerProps {@@ -110,7 +112,7 @@ export const AudioPlayer: FC<AudioPlayerProps> = ({ src }) => {onClick={handleDownload}title="Download audio">- <DownloadIcon className="size-3.5" />+ <HugeiconsIcon icon={Download01Icon} className="size-3.5" /></Button></div>);diff --git a/studio/frontend/src/components/assistant-ui/image.tsx b/studio/frontend/src/components/assistant-ui/image.tsxindex a2e3f30dc14..3cd7ecaaf5d 100644--- a/studio/frontend/src/components/assistant-ui/image.tsx+++ b/studio/frontend/src/components/assistant-ui/image.tsx@@ -15,13 +15,14 @@ import type {import { type VariantProps, cva } from "class-variance-authority";import {CopyIcon,- DownloadIcon,ImageIcon,ImageOffIcon,Loader2Icon,RefreshCwIcon,ShieldAlertIcon,} from "lucide-react";+import { Download01Icon } from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";import {type ComponentProps,type PropsWithChildren,@@ -427,7 +428,7 @@ function ImageActions({ part, onRegenerate, className }: ImageActionsProps) {aria-label="Download image"className="inline-flex size-7 items-center justify-center rounded hover:bg-muted">- <DownloadIcon className="size-4" />+ <HugeiconsIcon icon={Download01Icon} className="size-4" /></button><buttontype="button"diff --git a/studio/frontend/src/components/assistant-ui/markdown-text.tsx b/studio/frontend/src/components/assistant-ui/markdown-text.tsxindex 8cb33d0ed2c..107672d9381 100644--- a/studio/frontend/src/components/assistant-ui/markdown-text.tsx+++ b/studio/frontend/src/components/assistant-ui/markdown-text.tsx@@ -8,11 +8,10 @@ import { copyToClipboard } from "@/lib/copy-to-clipboard";import { preprocessLaTeX } from "@/lib/latex";import { openLink } from "@/lib/open-link";import { INTERNAL, useAuiState, useMessagePartText } from "@assistant-ui/react";-import { Copy01Icon, Tick02Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon, Download01Icon, Tick02Icon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";import { createMathPlugin } from "@streamdown/math";import { mermaid } from "@streamdown/mermaid";-import { DownloadIcon } from "lucide-react";import { useEffect, useMemo, useRef, useState } from "react";import { Block, type BlockProps, Streamdown } from "streamdown";import { createCodePlugin } from "./code-plugin";@@ -279,7 +278,7 @@ function CodeBlockActions({downloadTextFile(getCodeFilename(language), source);}}>- <DownloadIcon className="size-icon" />+ <HugeiconsIcon icon={Download01Icon} className="size-icon" /></button></div></div>diff --git a/studio/frontend/src/components/assistant-ui/model-selector.tsx b/studio/frontend/src/components/assistant-ui/model-selector.tsxindex 0fcbefdabdc..f8a3ce4e200 100644--- a/studio/frontend/src/components/assistant-ui/model-selector.tsx+++ b/studio/frontend/src/components/assistant-ui/model-selector.tsx@@ -146,7 +146,7 @@ function ModelSelectorTrigger({type="button"data-tour={dataTour}className={cn(- "flex min-w-0 items-center gap-2 transition-colors",+ "unsloth-model-selector-trigger flex min-w-0 items-center gap-2 transition-colors",variant === "outline" &&"rounded-[10px] border border-border/60 hover:bg-[#ececec] dark:hover:bg-[#2d2e32]",variant === "ghost" && "rounded-[10px] hover:bg-[#ececec] dark:hover:bg-[#2d2e32]",@@ -246,7 +246,7 @@ function ModelSelectorContent({align="start"data-tour={dataTour}className={cn(- "menu-soft-surface ring-0 w-[min(440px,calc(100vw-1rem))] max-w-[calc(100vw-1rem)] min-w-0 gap-0 p-2",+ "unsloth-model-selector-menu menu-soft-surface ring-0 w-[min(440px,calc(100vw-1rem))] max-w-[calc(100vw-1rem)] min-w-0 gap-0 p-3",className,)}>diff --git a/studio/frontend/src/components/assistant-ui/model-selector/pickers.tsx b/studio/frontend/src/components/assistant-ui/model-selector/pickers.tsxindex ea40c260c56..2d715bf8dee 100644--- a/studio/frontend/src/components/assistant-ui/model-selector/pickers.tsx+++ b/studio/frontend/src/components/assistant-ui/model-selector/pickers.tsx@@ -38,11 +38,11 @@ import {import { cn, formatCompact } from "@/lib/utils";import type { VramFitStatus } from "@/lib/vram";import { checkVramFit, estimateLoadingVram } from "@/lib/vram";-import { Add01Icon, Cancel01Icon, Folder02Icon, Search01Icon } from "@hugeicons/core-free-icons";+import { Add01Icon, Cancel01Icon, Download01Icon, Folder02Icon, Search01Icon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";import { FolderBrowser } from "./folder-browser";import { ModelDeleteAction } from "./model-delete-action";-import { ChevronDownIcon, ChevronRightIcon, DownloadIcon, StarIcon } from "lucide-react";+import { ChevronDownIcon, ChevronRightIcon, StarIcon } from "lucide-react";import {type ReactNode,useCallback,@@ -145,8 +145,8 @@ function ModelRow({type="button"onClick={onClick}className={cn(- "flex w-full items-center gap-2 rounded-[6px] px-2.5 py-1.5 text-left text-sm transition-colors hover:bg-[#ececec] dark:hover:bg-[#2e3035]",- selected && "bg-[#ececec] dark:bg-[#2e3035]",+ "flex w-full items-center gap-2 rounded-[8px] px-2.5 py-1.5 text-left text-sm transition-colors hover:bg-[#ececec] dark:hover:bg-[#3a3d44]",+ selected && "bg-[#ececec] dark:bg-[#3a3d44]",)}><span@@ -385,7 +385,7 @@ function GgufVariantExpander({handleVariantClick(v.quant, v.downloaded, v.size_bytes)}className={cn(- "flex min-w-0 flex-1 items-center justify-between gap-2 rounded-[6px] px-2.5 py-1 text-left text-sm transition-colors hover:bg-[#ececec] dark:hover:bg-[#2e3035]",+ "flex min-w-0 flex-1 items-center justify-between gap-2 rounded-[8px] px-2.5 py-1 text-left text-sm transition-colors hover:bg-[#ececec] dark:hover:bg-[#3a3d44]",)}><span className="min-w-0 flex-1 truncate font-mono text-xs">@@ -925,7 +925,7 @@ export function HubModelPicker({(!chatOnly && cachedModels.length > 0)) ? (<><ListLabel- icon={<DownloadIcon className="size-3" />}+ icon={<HugeiconsIcon icon={Download01Icon} className="size-3" />}collapsed={downloadedCollapsed}onToggle={() => setDownloadedCollapsed((v) => !v)}>Downloaded</ListLabel>diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsxindex b323996072e..83057074ba1 100644--- a/studio/frontend/src/components/assistant-ui/thread.tsx+++ b/studio/frontend/src/components/assistant-ui/thread.tsx@@ -2,11 +2,9 @@// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0import {- ComposerAddAttachment,ComposerAttachments,UserMessageAttachments,} from "@/components/assistant-ui/attachment";-import { CodeToggleIcon } from "@/components/assistant-ui/code-toggle-icon";import {GeneratedImageOverlayProvider,useGeneratedImageOverlay,@@ -40,15 +38,23 @@ import {DropdownMenu,DropdownMenuContent,DropdownMenuItem,+ DropdownMenuLabel,+ DropdownMenuSeparator,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";import { sentAudioNames } from "@/features/chat/api/chat-adapter";+import { useChatProjects } from "@/features/chat/hooks/use-chat-projects";+import { NewProjectDialog } from "@/features/chat/components/new-project-dialog";import { parseExternalModelId } from "@/features/chat/external-providers";import { McpComposerButton } from "@/features/chat/mcp-composer-button";import { getExternalReasoningCapabilities } from "@/features/chat/provider-capabilities";import { useChatRuntimeStore } from "@/features/chat/stores/chat-runtime-store";import { useExternalProvidersStore } from "@/features/chat/stores/external-providers-store";import { deleteThreadMessage } from "@/features/chat/utils/delete-thread-message";+import { useUserProfileStore } from "@/features/profile/stores/user-profile-store";import { applyQwenThinkingParams } from "@/features/chat/utils/qwen-params";import { isTauri } from "@/lib/api-base";import { AUDIO_ACCEPT, MAX_AUDIO_SIZE, fileToBase64 } from "@/lib/audio-utils";@@ -69,44 +75,58 @@ import {useAuiState,} from "@assistant-ui/react";import { flushResourcesSync } from "@assistant-ui/tap";+import {+ AttachmentIcon,+ CodeIcon,+ Copy01Icon,+ Delete02Icon,+ Download01Icon,+ Edit03Icon,+ Folder01Icon,+ FolderAddIcon,+ Image03Icon,+ McpServerIcon,+ PencilRulerIcon,+ Tick02Icon,+} from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";+import { useNavigate } from "@tanstack/react-router";import {ArrowDownIcon,ArrowUpIcon,+ CheckIcon,ChevronLeftIcon,ChevronRightIcon,- DownloadIcon,- FileTextIcon,+ Columns2Icon,GlobeIcon,HeadphonesIcon,- LightbulbIcon,- LightbulbOffIcon,- MicIcon,MoreHorizontalIcon,+ PlusIcon,RefreshCwIcon,SquareIcon,TerminalIcon,XIcon,} from "lucide-react";-import {- Copy01Icon,- Delete02Icon,- Edit03Icon,- Image03Icon,- Tick02Icon,-} from "@hugeicons/core-free-icons";-import { HugeiconsIcon } from "@hugeicons/react";import {type ChangeEvent,type ComponentProps,type CompositionEvent,type FC,type KeyboardEvent,+ type DragEvent as ReactDragEvent,+ type ReactNode,+ createContext,useCallback,+ useContext,useEffect,useRef,useState,} from "react";+// True while a file is dragged anywhere over the chat page (not just the+// composer), so the composer can show its "Drop files here" affordance.+const PageDragContext = createContext(false);+export const Thread: FC<{hideComposer?: boolean;hideWelcome?: boolean;@@ -125,8 +145,55 @@ export const Thread: FC<{const activeThreadId = useChatRuntimeStore((s) => s.activeThreadId);const threadId = targetThreadId ?? activeThreadId ?? null;+ // Page-wide drag-and-drop: dropping a file anywhere on the chat page (not+ // just on the composer) attaches it and shows the composer drop affordance.+ // The composer's own dropzone still handles drops on the box itself; its+ // handler calls preventDefault, so the page handler skips them (no double-add).+ const aui = useAui();+ const [pageDragging, setPageDragging] = useState(false);+ const dragDepth = useRef(0);+ const hasFiles = (e: ReactDragEvent) =>+ Array.from(e.dataTransfer?.types ?? []).includes("Files");+ const onDragEnter = (e: ReactDragEvent) => {+ if (isTauri || !hasFiles(e)) return;+ dragDepth.current += 1;+ setPageDragging(true);+ };+ const onDragOver = (e: ReactDragEvent) => {+ if (isTauri || !hasFiles(e)) return;+ e.preventDefault();+ };+ const onDragLeave = (e: ReactDragEvent) => {+ if (isTauri || !hasFiles(e)) return;+ dragDepth.current = Math.max(0, dragDepth.current - 1);+ if (dragDepth.current === 0) setPageDragging(false);+ };+ const onDrop = (e: ReactDragEvent) => {+ if (isTauri) return;+ dragDepth.current = 0;+ setPageDragging(false);+ // Compare panes hide this composer and use the shared composer's own+ // dropzone, so don't capture drops into a hidden composer here.+ if (hideComposer) return;+ // Drops on the composer box are handled by its own dropzone, which calls+ // preventDefault; skip those here so the file isn't added twice.+ if (e.defaultPrevented) return;+ const files = Array.from(e.dataTransfer.files);+ if (files.length === 0) return;+ e.preventDefault();+ for (const file of files) {+ aui+ .composer()+ .addAttachment(file)+ .catch(() => {+ // Adapter shows its own toast (e.g. "Load a model before adding images").+ });+ }+ };+return (<GeneratedImageOverlayProvider key={threadId ?? "default"} threadId={threadId}>+ <PageDragContext.Provider value={pageDragging}><ThreadPrimitive.RootclassName="aui-root aui-thread-root @container relative flex min-h-0 min-w-0 flex-1 basis-0 flex-col overflow-hidden"style={{@@ -134,6 +201,10 @@ export const Thread: FC<{["--thread-content-max-width" as string]:"calc(var(--thread-max-width) - 1.5rem)",}}+ onDragEnter={onDragEnter}+ onDragOver={onDragOver}+ onDragLeave={onDragLeave}+ onDrop={onDrop}><IntentAwareScrollProvider value={autoScrollContext}><ThreadPrimitive.Viewport@@ -199,6 +270,7 @@ export const Thread: FC<{)}</IntentAwareScrollProvider></ThreadPrimitive.Root>+ </PageDragContext.Provider></GeneratedImageOverlayProvider>);};@@ -250,7 +322,7 @@ const GeneratedImageViewportOverlay: FC<{ hideComposer?: boolean }> = ({}aria-label="Download generated image">- <DownloadIcon className="size-3.5" />+ <HugeiconsIcon icon={Download01Icon} className="size-3.5" /></Button><Buttontype="button"@@ -314,7 +386,11 @@ const ThreadComposerDock: FC<{/><div className="relative px-5 pb-2"><div className="pointer-events-auto mx-auto w-full max-w-(--thread-max-width)">- <ComposerAnimated disabled={disabled} threadId={threadId} />+ <ComposerAnimated+ disabled={disabled}+ threadId={threadId}+ menuSide="top"+ /></div><p className="composer-footer-note">LLMs can make mistakes. Double-check responses.@@ -348,38 +424,81 @@ const ThreadScrollToBottom: FC = () => {);};+const pickRandom = <T,>(arr: T[]): T =>+ arr[Math.floor(Math.random() * arr.length)];++// Each greeting carries the sloth picture that best fits it, so a given line+// always shows the same mascot. Greeting varies by local time; name-bearing+// lines drop the name when none is set.+type Welcome = { text: string; sloth: string };+const DEFAULT_WELCOME: Welcome = {+ text: "What’s on your mind today?",+ sloth: "sloth magnify final.png",+};++function buildWelcome(hour: number, name: string): Welcome {+ const g = (text: string, sloth: string): Welcome => ({ text, sloth });+ // Use the name on roughly a third of the lines per time of day: only the+ // direct salutations where it reads most naturally. Everything else stays+ // name-free so the greeting doesn't feel repetitive.+ const base: Welcome[] = [+ g(name ? `Good to see you, ${name}.` : "Good to see you.", "large sloth wave.png"),+ g("Ready when you are.", "large sloth thumbs.png"),+ DEFAULT_WELCOME,+ g("How can I help?", "sloth sir large.png"),+ ];+ if (hour >= 4 && hour < 9) {+ const morning = g(name ? `Good morning, ${name}` : "Good morning", "large sloth drink.png");+ return pickRandom([...base, morning]);+ }+ if (hour >= 17 && hour < 23) {+ const evening: Welcome[] = [+ g(name ? `Good evening, ${name}` : "Good evening", "sloth shy large.png"),+ g("What’s on for tonight?", "large sloth glasses.png"),+ ];+ // Lean toward an evening line, but a base greeting can still appear.+ return pickRandom(Math.random() < 0.75 ? evening : base);+ }+ if (hour >= 23 || hour < 4) {+ return pickRandom([+ g("Night owl mode?", "large sloth glasses.png"),+ g("Late night ideas?", "large sloth yay.png"),+ g("Up late with an idea?", "large sloth heart.png"),+ g(name ? `The night shift begins, ${name}` : "The night shift begins", "large sloth drink.png"),+ ]);+ }+ return pickRandom(base);+}+const ThreadWelcome: FC<{hideComposer?: boolean;threadId?: string | null;}> = ({ hideComposer, threadId }) => {- const [currentEmoji, setCurrentEmoji] = useState("large sloth drink.png");+ const displayName = useUserProfileStore((s) => s.displayName);+ const [welcome, setWelcome] = useState<Welcome>(DEFAULT_WELCOME);useEffect(() => {- const hour = new Date().getHours();- if (hour >= 6 && hour < 12) setCurrentEmoji("large sloth drink.png");- else if (hour >= 12 && hour < 17)- setCurrentEmoji("sloth magnify final.png");- else if (hour >= 17 && hour < 21) setCurrentEmoji("sloth shy large.png");- else setCurrentEmoji("unsloth-gem.png");- }, []);+ // First name only, for a natural greeting; blank falls back to no name.+ const name = displayName.trim().split(/\s+/)[0] ?? "";+ setWelcome(buildWelcome(new Date().getHours(), name));+ }, [displayName]);- const currentEmojiSrc =- currentEmoji === "unsloth-gem.png"- ? `/${currentEmoji}`- : `/Sloth emojis/${currentEmoji}`;+ const currentEmojiSrc = `/Sloth emojis/${welcome.sloth}`;return (<div className="aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col">- <div className="aui-thread-welcome-center flex w-full grow flex-col items-center justify-center pb-[48px]">- <div className="aui-thread-welcome-message flex w-full flex-col justify-center gap-6 px-4">- <div className="flex flex-col items-center gap-2 text-center">- <img src={currentEmojiSrc} alt="Sloth mascot" className="size-20" />- <h1 className="aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in font-heading font-semibold text-2xl tracking-[0em] duration-200">- Chat with your model+ <div className="aui-thread-welcome-center flex w-full grow flex-col items-center justify-start pt-[28vh]">+ <div className="aui-thread-welcome-message flex w-full flex-col justify-center gap-9 px-4">+ {/* Center the whole greeting (sloth + title) over the composer. */}+ <div className="flex flex-row items-center justify-center gap-[15px]">+ <img+ src={currentEmojiSrc}+ alt="Sloth mascot"+ className="size-[44px] -translate-y-[2px]"+ />+ <h1 className="aui-thread-welcome-message-inner unsloth-welcome-title fade-in slide-in-from-bottom-1 animate-in text-3xl tracking-[-0.02em] duration-200">+ {welcome.text}</h1>- <p className="aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 -mt-1 animate-in font-heading font-normal text-muted-foreground text-sm delay-75 duration-200">- Run GGUFs, safetensors, vision and audio models- </p></div>{!hideComposer && <ComposerAnimated threadId={threadId} />}</div>@@ -403,15 +522,12 @@ const ComposerAnimated: FC<{disabled?: boolean;placeholder?: string;threadId?: string | null;-}> = ({ disabled, placeholder, threadId }) => {+ menuSide?: "top" | "bottom";+}> = ({ disabled, threadId, menuSide }) => {return (- <div className="relative mx-auto min-w-0 w-full max-w-(--thread-max-width)">+ <div className="relative mx-auto min-w-0 w-full max-w-[46rem]"><div className="relative z-10 w-full">- <Composer- disabled={disabled}- placeholder={placeholder}- threadId={threadId}- />+ <Composer disabled={disabled} threadId={threadId} menuSide={menuSide} /></div></div>);@@ -445,12 +561,30 @@ const Composer: FC<{disabled?: boolean;placeholder?: string;threadId?: string | null;-}> = ({ disabled, placeholder = "Send a message...", threadId }) => {+ menuSide?: "top" | "bottom";+}> = ({ disabled, threadId, menuSide }) => {const aui = useAui();+ const pageDragging = useContext(PageDragContext);const { overlay, closeOverlay } = useGeneratedImageOverlay();const setImageToolsEnabled = useChatRuntimeStore((s) => s.setImageToolsEnabled,);+ const toolsEnabled = useChatRuntimeStore((s) => s.toolsEnabled);+ const codeToolsEnabled = useChatRuntimeStore((s) => s.codeToolsEnabled);+ const imageToolsEnabled = useChatRuntimeStore((s) => s.imageToolsEnabled);+ const supportsBuiltinImageGeneration = useChatRuntimeStore(+ (s) => s.supportsBuiltinImageGeneration,+ );+ const artifactsEnabled = useChatRuntimeStore((s) => s.artifactsEnabled);+ const mcpEnabledForChat = useChatRuntimeStore((s) => s.mcpEnabledForChat);+ // With more than 4 pills showing, collapse them to icons only to cut clutter.+ // Search and Code always show; Images, Canvas and MCP are conditional.+ const pillsCompact =+ 2 ++ (supportsBuiltinImageGeneration ? 1 : 0) ++ (artifactsEnabled ? 1 : 0) ++ (mcpEnabledForChat ? 1 : 0) >+ 4;const activeThreadId = useChatRuntimeStore((s) => s.activeThreadId);const setPendingImageEditReference = useChatRuntimeStore((s) => s.setPendingImageEditReference,@@ -458,6 +592,37 @@ const Composer: FC<{const { inputProps, isComposing, isComposingRef } =useImeComposerInputHandlers();const composerText = useAuiState(({ composer }) => composer.text);+ // Expand only once the input wraps to a second line, not on first keystroke.+ // Latch until cleared so it can't flip-flop at the wrap boundary.+ const inputRef = useRef<HTMLTextAreaElement>(null);+ // Cache line metrics so getComputedStyle runs once, not on every keystroke.+ const lineMetricsRef = useRef<{ lineHeight: number; padding: number } | null>(+ null,+ );+ const [isMultiline, setIsMultiline] = useState(false);+ useEffect(() => {+ if (composerText.length === 0) {+ setIsMultiline(false);+ lineMetricsRef.current = null;+ return;+ }+ // Latched on: stays until the text clears, so skip re-measuring.+ if (isMultiline) return;+ const el = inputRef.current;+ if (!el) {+ return;+ }+ if (!lineMetricsRef.current) {+ const cs = getComputedStyle(el);+ const lineHeight = Number.parseFloat(cs.lineHeight) || 24;+ const padTop = Number.parseFloat(cs.paddingTop) || 0;+ const padBottom = Number.parseFloat(cs.paddingBottom) || 0;+ lineMetricsRef.current = { lineHeight, padding: padTop + padBottom };+ }+ const { lineHeight, padding } = lineMetricsRef.current;+ const contentHeight = el.scrollHeight - padding;+ if (contentHeight > lineHeight * 1.5) setIsMultiline(true);+ }, [composerText, isMultiline]);const hasAttachments = useAuiState(({ composer }) => composer.attachments.length > 0,);@@ -472,6 +637,58 @@ const Composer: FC<{const referenceThreadId = threadId ?? activeThreadId ?? null;const hasSendableContent =composerText.trim().length > 0 || hasAttachments || hasPendingAudio;+ // Two-row layout shows once the input wraps or a tool is on. Tools pre-select+ // before a model loads, so an active toggle expands the composer either way.+ const composerExpanded =+ isMultiline ||+ hasAttachments ||+ hasPendingAudio ||+ toolsEnabled ||+ codeToolsEnabled ||+ imageToolsEnabled ||+ artifactsEnabled ||+ mcpEnabledForChat;+ // react-textarea-autosize re-measures only on value change or window resize,+ // not on the width swap from expanding, so it keeps the taller height and+ // leaves a stray blank row. Nudge a resize whenever the input width changes.+ useEffect(() => {+ const el = inputRef.current;+ if (!el || typeof ResizeObserver === "undefined") {+ return;+ }+ let lastWidth = -1;+ const pending: Array<ReturnType<typeof setTimeout>> = [];+ const observer = new ResizeObserver((entries) => {+ const width = Math.round(entries[0]?.contentRect.width ?? 0);+ // Width changes only; reacting to autosize's height change would loop.+ if (width === lastWidth) {+ return;+ }+ lastWidth = width;+ // Re-measure after layout settles. An immediate dispatch races autosize's+ // own measurement (stale pre-expand width); 0ms + 64ms wins it, no flash.+ while (pending.length) {+ clearTimeout(pending.pop());+ }+ for (const delay of [0, 64]) {+ pending.push(+ setTimeout(() => {+ window.dispatchEvent(new Event("resize"));+ }, delay),+ );+ }+ });+ observer.observe(el);+ return () => {+ while (pending.length) {+ clearTimeout(pending.pop());+ }+ observer.disconnect();+ };+ }, []);+ // Docked composer opens upward; the centered welcome composer opens downward+ // by default and only flips up via collision detection when it would not fit.+ const effectiveMenuSide = menuSide ?? "bottom";const shouldBlockSend = useCallback(() =>!hasSendableContent || isComposingRef.current || hasPendingAttachments,@@ -545,28 +762,54 @@ const Composer: FC<{<ComposerAttachments /><PendingAudioChip /><ToolStatusDisplay />- <ComposerPrimitive.Input- placeholder={overlay ? "Type your edits for your image" : placeholder}- className="aui-composer-input composer-input"- minRows={1}- maxRows={12}- autoFocus={!disabled}- disabled={disabled}- aria-label={overlay ? "Image edit instructions" : "Message input"}- // dir="auto": browser picks LTR/RTL from the first strong char;- // no effect on Latin / CJK / Devanagari.- dir="auto"- {...inputProps}- />- <ComposerAction- disabled={- disabled ||- !hasSendableContent ||- isComposing ||- hasPendingAttachments- }- shouldBlockSend={shouldBlockSend}- />+ <div+ className="unsloth-composer-line"+ data-expanded={composerExpanded ? "true" : "false"}+ >+ <div+ className="unsloth-composer-left"+ data-pill-compact={pillsCompact ? "true" : undefined}+ >+ <ComposerToolsMenu side={effectiveMenuSide} />+ {composerExpanded ? (+ <>+ <WebSearchToggle />+ <CodeToolsToggle />+ <ImagesToggle />+ {artifactsEnabled ? <ArtifactsToggle /> : null}+ {mcpEnabledForChat ? (+ <McpComposerButton side={effectiveMenuSide} />+ ) : null}+ </>+ ) : null}+ </div>+ <ComposerPrimitive.Input+ placeholder={+ overlay ? "Type your edits for your image" : "Ask anything"+ }+ ref={inputRef}+ className="aui-composer-input unsloth-composer-input"+ minRows={1}+ maxRows={12}+ autoFocus={!disabled}+ disabled={disabled}+ aria-label={overlay ? "Image edit instructions" : "Message input"}+ // dir="auto": browser picks LTR/RTL from the first strong char;+ // no effect on Latin / CJK / Devanagari.+ dir="auto"+ {...inputProps}+ />+ <ComposerRightControls+ disabled={+ disabled ||+ !hasSendableContent ||+ isComposing ||+ hasPendingAttachments+ }+ shouldBlockSend={shouldBlockSend}+ menuSide={effectiveMenuSide}+ />+ </div></>);@@ -579,12 +822,30 @@ const Composer: FC<{{isTauri ? (// Phase 1 native model drops own Tauri local-path drops. Restore browser// attachment drops in Tauri when Phase 1d adds attachment-token bridging.- <div className="aui-composer-attachment-dropzone chat-composer-surface">+ <div className="aui-composer-attachment-dropzone unsloth-composer-surface">{composerContent}</div>) : (- <ComposerPrimitive.AttachmentDropzone className="aui-composer-attachment-dropzone chat-composer-surface data-[dragging=true]:border-ring data-[dragging=true]:bg-accent/50">+ <ComposerPrimitive.AttachmentDropzone className="group/dropzone aui-composer-attachment-dropzone unsloth-composer-surface relative">{composerContent}+ {/* Gemini-style drop affordance: shown only while a file is dragged+ over the composer. Absolutely positioned + pointer-events-none so+ the dashed outline adds no layout shift and the drop still lands. */}+ <div+ className={cn(+ "aui-composer-drop-overlay pointer-events-none absolute inset-0 z-20 flex flex-col items-center justify-center gap-1 overflow-hidden rounded-[32px] bg-background/90 opacity-0 backdrop-blur-sm transition-opacity duration-150 group-data-[dragging=true]/dropzone:opacity-100 dark:bg-card/90",+ pageDragging && "opacity-100",+ )}+ >+ <HugeiconsIcon+ icon={AttachmentIcon}+ strokeWidth={2}+ className="size-6 text-primary"+ />+ <span className="text-sm font-medium text-primary">+ Drop files here+ </span>+ </div></ComposerPrimitive.AttachmentDropzone>)}</ComposerPrimitive.Root>@@ -715,8 +976,8 @@ function useImeComposerInputHandlers() {};}-const ComposerAudioUpload: FC = () => {- const audioInputRef = useRef<HTMLInputElement>(null);+// Audio upload row, only for audio-input models.+const ComposerAudioMenuItem: FC = () => {const setPendingAudio = useChatRuntimeStore((s) => s.setPendingAudio);const activeModel = useChatRuntimeStore((s) => {const checkpoint = s.params.checkpoint;@@ -738,41 +999,91 @@ const ComposerAudioUpload: FC = () => {[setPendingAudio],);+ // Build the input on document.body, not in the menu: selecting the item+ // closes the dropdown, which would unmount a menu-rendered input before the+ // OS picker returns and drop the file.+ const pickAudio = useCallback(() => {+ const input = document.createElement("input");+ input.type = "file";+ input.accept = AUDIO_ACCEPT;+ input.hidden = true;+ document.body.appendChild(input);+ input.onchange = () => {+ const file = input.files?.[0];+ if (file) handleAudioFile(file);+ document.body.removeChild(input);+ };+ input.oncancel = () => {+ if (!input.files || input.files.length === 0) {+ document.body.removeChild(input);+ }+ };+ input.click();+ }, [handleAudioFile]);+if (!activeModel?.hasAudioInput) {return null;}return (- <>- <input- ref={audioInputRef}- type="file"- accept={AUDIO_ACCEPT}- className="hidden"- onChange={(e) => {- const file = e.target.files?.[0];- if (file) {- handleAudioFile(file);- }- e.target.value = "";- }}- />- <TooltipIconButton- tooltip="Upload audio"- side="bottom"- variant="ghost"- size="icon"- className="size-8.5 rounded-full p-1 text-muted-foreground hover:bg-muted-foreground/15"- onClick={() => audioInputRef.current?.click()}- aria-label="Upload audio"- >- <HeadphonesIcon className="size-4.5 stroke-[1.5px]" />- </TooltipIconButton>- </>+ <DropdownMenuItem onSelect={() => pickAudio()}>+ <HeadphonesIcon />+ Upload audio+ </DropdownMenuItem>);};-const ReasoningToggle: FC = () => {+// Phosphor microphone. Inlined to avoid a new icon dependency.+const MicIcon: FC<{ className?: string }> = ({ className }) => (+ <svg+ className={className}+ viewBox="0 0 256 256"+ fill="currentColor"+ xmlns="http://www.w3.org/2000/svg"+ aria-hidden={true}+ >+ <path d="M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V232a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z" />+ </svg>+);++// HugeIcons arrow-down-01 (stroke-standard): straight-line chevron.+const ArrowDownStandardIcon: FC<{ className?: string }> = ({ className }) => (+ <svg+ className={className}+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth={1.5}+ strokeLinecap="round"+ strokeLinejoin="round"+ xmlns="http://www.w3.org/2000/svg"+ aria-hidden={true}+ >+ <path d="M5.99977 9.00005L11.9998 15L17.9998 9" />+ </svg>+);++// svgrepo.com lightbulb (filled, with base).+const BulbIcon: FC<{ className?: string }> = ({ className }) => (+ <svg+ className={className}+ viewBox="-10.24 -10.24 1044.48 1044.48"+ fill="currentColor"+ stroke="currentColor"+ strokeWidth={16.384}+ xmlns="http://www.w3.org/2000/svg"+ aria-hidden={true}+ >+ <path d="M511.984 0c-198.032 0-353.12 161.104-353.12 359.136 0 149.2 73.28 220.256 131.185 272.128 37.28 33.424 62.368 53.552 62.368 78.352v54.255c0 1.392.193 2.752.368 4.128h-.72v92.624c.016 97.712 63.2 163.376 161.072 163.376 94.464 0 158.944-65.664 158.944-163.376V768h-.928c.176-1.376.416-2.736.416-4.128v-54.255c0-37.76 28.032-60.592 70.528-97.696 57.504-50.208 123.023-112.688 123.023-252.784C865.136 161.104 710.016 0 511.983 0zm-1.215 960c-59.904 0-94.689-37.152-94.689-99.376l-.463-42.672C438.64 825.824 470 832 512 832c41.424 0 72.848-6.624 96.08-14.768v43.392c0 63.152-35.247 99.376-97.312 99.376zm189.248-396.288c-43.472 37.968-92.433 77.216-92.433 145.904v40.432c-15.183 8.48-43.183 18.56-96.127 18.56-55.569 0-81.92-9.856-95.024-17.473V709.6c0-54.608-42.688-89.297-83.68-126.017-54.32-48.672-109.873-103.84-109.873-224.464-.015-162.72 126.385-295.12 289.104-295.12 162.752 0 289.152 132.4 289.152 295.137 0 111.024-48.463 158.576-101.12 204.576z" />+ </svg>+);++// Same bulb in every state; greyed by the pill's muted color when off.+const ThinkIcon: FC = () => <BulbIcon className="size-[15.5px]" />;++const ReasoningToggle: FC<{ side?: "top" | "bottom" }> = ({+ side = "bottom",+}) => {const modelLoaded = useChatRuntimeStore((s) => !!s.params.checkpoint && !s.modelLoading,);@@ -806,6 +1117,11 @@ const ReasoningToggle: FC = () => {const isKimiExternal = selectedExternalProvider?.providerType === "kimi";const toolsEnabled = useChatRuntimeStore((s) => s.toolsEnabled);const setToolsEnabled = useChatRuntimeStore((s) => s.setToolsEnabled);+ const supportsPreserveThinking = useChatRuntimeStore(+ (s) => s.supportsPreserveThinking,+ );+ const preserveThinking = useChatRuntimeStore((s) => s.preserveThinking);+ const setPreserveThinking = useChatRuntimeStore((s) => s.setPreserveThinking);const effectiveExternalModelId =selectedExternalProvider?.providerType === "openrouter" &&externalSelection?.modelId === "openrouter/free" &&@@ -820,6 +1136,7 @@ const ReasoningToggle: FC = () => {{isReasoningProvider:selectedExternalProvider?.isReasoningModel === true,+ // Lets the resolver detect custom Gemini OAI-compat gateways.baseUrl: selectedExternalProvider?.baseUrl ?? null,},)@@ -855,71 +1172,143 @@ const ReasoningToggle: FC = () => {};const effortLabel = formatEffortLabel(reasoningEffort);- if (effectiveReasoningStyle === "reasoning_effort") {+ // Only rendered for models that can reason.+ if (!effectiveSupportsReasoning) {+ return null;+ }++ const isEffort = effectiveReasoningStyle === "reasoning_effort";+ // Dropdown when there are effort levels or preserve-thinking; else a toggle.+ const useDropdown = isEffort || supportsPreserveThinking;+ const activeLook = isEffort+ ? reasoningLockedOn || (effectiveReasoningVisualEnabled && !disabled)+ : reasoningLockedOn || (effectiveReasoningEnabled && !disabled);++ if (useDropdown) {return (<DropdownMenu><DropdownMenuTrigger asChild={true}><buttontype="button"disabled={disabled}- className={cn(- "flex items-center gap-1.5 rounded-full px-1.5 py-1.5 text-[13px] font-medium text-muted-foreground/70 transition-colors",- disabled- ? "cursor-not-allowed opacity-40"- : effectiveReasoningVisualEnabled- ? "text-primary hover:bg-primary/10 dark:hover:bg-white/[0.08]"- : "hover:bg-primary/10 dark:hover:bg-white/[0.08]",- )}+ className="unsloth-thinking-pill"+ data-active={activeLook ? "true" : "false"}aria-label={thinkEffortAriaLabel({modelLoaded,reasoningDisabled: disabled,reasoningEffort,})}>- {effectiveReasoningVisualEnabled ? (- <LightbulbIcon className="size-3.5" />- ) : (- <LightbulbOffIcon className="size-3.5" />- )}- <span>- Think: {effectiveReasoningVisualEnabled ? effortLabel : "None"}- </span>+ <ThinkIcon />+ {activeLook ? (+ <span>{isEffort ? `Thinking · ${effortLabel}` : "Thinking"}</span>+ ) : null}+ <ArrowDownStandardIcon className="size-[15px]" /></button></DropdownMenuTrigger>- <DropdownMenuContent align="end">- {effectiveSupportsReasoningOff && (- <DropdownMenuItem- onSelect={() => {- setReasoningEnabled(false);- applyQwenThinkingParams(false);- }}- >- None- {!effectiveReasoningVisualEnabled ? " \u2713" : ""}- </DropdownMenuItem>- )}- {effectiveReasoningEffortLevels- .filter((level) => level !== "none")- .map((level) => (+ <DropdownMenuContent+ side={side}+ align="end"+ avoidCollisions={true}+ className="unsloth-plus-menu unsloth-thinking-menu min-w-0 w-[160px]"+ >+ {isEffort ? (+ <>+ {effectiveSupportsReasoningOff && (+ <DropdownMenuItem+ onSelect={() => {+ setReasoningEnabled(false);+ applyQwenThinkingParams(false);+ // Preserve thinking needs thinking on, so turn it off too.+ setPreserveThinking(false);+ }}+ >+ <CheckIcon+ className={cn(+ "unsloth-tick size-4",+ effectiveReasoningVisualEnabled && "opacity-0",+ )}+ />+ None+ </DropdownMenuItem>+ )}+ {effectiveReasoningEffortLevels+ .filter((level) => level !== "none")+ .map((level) => (+ <DropdownMenuItem+ key={level}+ onSelect={() => {+ setReasoningEffort(level);+ setReasoningEnabled(true);+ applyQwenThinkingParams(true);+ // Kimi's $web_search builtin forbids thinking, so+ // enabling thinking flips the Search pill off.+ if (isKimiExternal && toolsEnabled) {+ setToolsEnabled(false, { persist: false });+ }+ }}+ >+ <CheckIcon+ className={cn(+ "unsloth-tick size-4",+ !(+ effectiveReasoningVisualEnabled &&+ reasoningEffort === level+ ) && "opacity-0",+ )}+ />+ {formatEffortLabel(level)}+ </DropdownMenuItem>+ ))}+ </>+ ) : (+ effectiveSupportsReasoningOff &&+ !reasoningLockedOn && (<DropdownMenuItem- key={level}onSelect={() => {- setReasoningEffort(level);- setReasoningEnabled(true);- applyQwenThinkingParams(true);- // Kimi's $web_search builtin forbids thinking, so- // enabling thinking flips the Search pill off.- if (isKimiExternal && toolsEnabled) {- setToolsEnabled(false);+ const next = !reasoningEnabled;+ setReasoningEnabled(next);+ applyQwenThinkingParams(next);+ // Preserve thinking cannot run without thinking.+ if (!next) setPreserveThinking(false);+ if (isKimiExternal && next && toolsEnabled) {+ setToolsEnabled(false, { persist: false });}}}>- {formatEffortLabel(level)}- {effectiveReasoningVisualEnabled && reasoningEffort === level- ? " \u2713"- : ""}+ <CheckIcon+ className={cn(+ "unsloth-tick size-4",+ !effectiveReasoningEnabled && "opacity-0",+ )}+ />+ Thinking</DropdownMenuItem>- ))}+ )+ )}+ {supportsPreserveThinking && (+ <DropdownMenuItem+ disabled={disabled}+ onSelect={(e) => {+ e.preventDefault();+ const next = !preserveThinking;+ setPreserveThinking(next);+ // Preserve thinking requires thinking on.+ if (next) {+ setReasoningEnabled(true);+ applyQwenThinkingParams(true);+ }+ }}+ >+ <CheckIcon+ className={cn(+ "unsloth-tick size-4",+ !preserveThinking && "opacity-0",+ )}+ />+ Preserve thinking+ </DropdownMenuItem>+ )}</DropdownMenuContent></DropdownMenu>);@@ -940,18 +1329,13 @@ const ReasoningToggle: FC = () => {const next = !reasoningEnabled;setReasoningEnabled(next);applyQwenThinkingParams(next);- // Mutual exclusion with the Search pill on Kimi — see the- // dropdown branch above and shared-composer for the same rule.+ // Mutually exclusive with Search on Kimi (see dropdown branch).if (isKimiExternal && next && toolsEnabled) {- setToolsEnabled(false);+ setToolsEnabled(false, { persist: false });}}}- className="composer-pill-btn"- data-active={- reasoningLockedOn || (effectiveReasoningEnabled && !disabled)- ? "true"- : "false"- }+ className="unsloth-thinking-pill"+ data-active={activeLook ? "true" : "false"}aria-label={thinkToggleAriaLabel({reasoningLockedOn,modelLoaded,@@ -959,53 +1343,21 @@ const ReasoningToggle: FC = () => {effectiveReasoningEnabled,})}>- {reasoningLockedOn || (effectiveReasoningEnabled && !disabled) ? (- <LightbulbIcon className="size-3.5" />- ) : (- <LightbulbOffIcon className="size-3.5" />- )}- <span>Think</span>+ <PillGlyph>+ <ThinkIcon />+ </PillGlyph>+ {activeLook ? <span>Thinking</span> : null}</button>);};-const PreserveThinkingToggle: FC = () => {- const modelLoaded = useChatRuntimeStore(- (s) => !!s.params.checkpoint && !s.modelLoading,- );- const supportsPreserveThinking = useChatRuntimeStore(- (s) => s.supportsPreserveThinking,- );- const preserveThinking = useChatRuntimeStore((s) => s.preserveThinking);- const setPreserveThinking = useChatRuntimeStore((s) => s.setPreserveThinking);- if (!supportsPreserveThinking) return null;- const disabled = !modelLoaded;- return (- <button- type="button"- disabled={disabled}- onClick={() => setPreserveThinking(!preserveThinking)}- className={cn(- "flex items-center gap-1.5 rounded-full px-1.5 py-1.5 text-[13px] font-medium text-muted-foreground/70 transition-colors",- disabled- ? "cursor-not-allowed opacity-40"- : preserveThinking- ? "cursor-pointer text-primary hover:bg-primary/10 dark:hover:bg-white/[0.08]"- : "cursor-pointer hover:bg-primary/10 dark:hover:bg-white/[0.08]",- )}- aria-label={- preserveThinking ? "Disable preserve think" : "Enable preserve think"- }- >- {preserveThinking && !disabled ? (- <LightbulbIcon className="size-3.5" />- ) : (- <LightbulbOffIcon className="size-3.5" />- )}- <span>Preserve Think</span>- </button>- );-};+// Tool icon plus an X overlay the CSS reveals on hover when the pill is active.+const PillGlyph: FC<{ children: ReactNode }> = ({ children }) => (+ <span className="composer-pill-glyph">+ {children}+ <XIcon className="composer-pill-x" />+ </span>+);const WebSearchToggle: FC = () => {const modelLoaded = useChatRuntimeStore(@@ -1034,7 +1386,9 @@ const WebSearchToggle: FC = () => {? externalProviders.find((p) => p.id === externalSelection.providerId): undefined;const isKimiExternal = selectedExternalProvider?.providerType === "kimi";- const disabled = !modelLoaded || !(supportsTools || supportsBuiltinWebSearch);+ // Disable only when a loaded model lacks the capability; with no model the+ // tool can still be pre-selected and reflected, matching the + menu.+ const disabled = modelLoaded && !(supportsTools || supportsBuiltinWebSearch);return (<button@@ -1048,7 +1402,7 @@ const WebSearchToggle: FC = () => {// the two pills mutually exclusive so the visible state always// matches what the backend ends up sending.if (isKimiExternal) {- setReasoningEnabled(!next);+ setReasoningEnabled(!next, { persist: false });applyQwenThinkingParams(!next);}}}@@ -1056,7 +1410,9 @@ const WebSearchToggle: FC = () => {data-active={toolsEnabled && !disabled ? "true" : "false"}aria-label={toolsEnabled ? "Disable web search" : "Enable web search"}>- <GlobeIcon className="size-3.5" />+ <PillGlyph>+ <GlobeIcon className="size-[15px]" />+ </PillGlyph><span>Search</span></button>);@@ -1077,8 +1433,9 @@ const CodeToolsToggle: FC = () => {);const codeToolsEnabled = useChatRuntimeStore((s) => s.codeToolsEnabled);const setCodeToolsEnabled = useChatRuntimeStore((s) => s.setCodeToolsEnabled);- const disabled =- !modelLoaded || !(supportsTools || supportsBuiltinCodeExecution);+ // Disable only when a loaded model lacks the capability; with no model the+ // tool can still be pre-selected and reflected, matching the + menu.+ const disabled = modelLoaded && !(supportsTools || supportsBuiltinCodeExecution);return (<button@@ -1091,7 +1448,13 @@ const CodeToolsToggle: FC = () => {codeToolsEnabled ? "Disable code execution" : "Enable code execution"}>- <CodeToggleIcon className="size-3.5" />+ <PillGlyph>+ <HugeiconsIcon+ icon={CodeIcon}+ className="size-[18.5px]"+ strokeWidth={2}+ />+ </PillGlyph><span>Code</span></button>);@@ -1129,31 +1492,36 @@ const ImagesToggle: FC = () => {: "Enable image generation"}>- <HugeiconsIcon icon={Image03Icon} className="size-3.5" strokeWidth={2} />+ <PillGlyph>+ <HugeiconsIcon icon={Image03Icon} className="size-3.5" strokeWidth={2} />+ </PillGlyph><span>Images</span></button>);};const ArtifactsToggle: FC = () => {- const modelLoaded = useChatRuntimeStore(- (s) => !!s.params.checkpoint && !s.modelLoading,- );const artifactsEnabled = useChatRuntimeStore((s) => s.artifactsEnabled);const setArtifactsEnabled = useChatRuntimeStore((s) => s.setArtifactsEnabled);- const disabled = !modelLoaded;+ // Canvas is opt-in; the pill only shows once it is toggled on from the menu.+ if (!artifactsEnabled) return null;return (<buttontype="button"- disabled={disabled}- onClick={() => setArtifactsEnabled(!artifactsEnabled)}+ onClick={() => setArtifactsEnabled(false)}className="composer-pill-btn"- data-active={artifactsEnabled && !disabled ? "true" : "false"}- aria-label={artifactsEnabled ? "Disable artifacts" : "Enable artifacts"}+ data-active="true"+ aria-label="Disable canvas">- <FileTextIcon className="size-3.5" />- <span>Artifacts</span>+ <PillGlyph>+ <HugeiconsIcon+ icon={PencilRulerIcon}+ className="size-[15.5px]"+ strokeWidth={2}+ />+ </PillGlyph>+ <span>Canvas</span></button>);};@@ -1215,84 +1583,309 @@ const ToolStatusDisplay: FC = () => {</div>);};+// Plus menu: attachment and workflow actions. Opens downward in the centered+// welcome composer; the docked composer passes side="top" to open upward.+const ComposerToolsMenu: FC<{ side?: "top" | "bottom" }> = ({+ side = "bottom",+}) => {+ const navigate = useNavigate();+ const toolsEnabled = useChatRuntimeStore((s) => s.toolsEnabled);+ const setToolsEnabled = useChatRuntimeStore((s) => s.setToolsEnabled);+ const codeToolsEnabled = useChatRuntimeStore((s) => s.codeToolsEnabled);+ const setCodeToolsEnabled = useChatRuntimeStore((s) => s.setCodeToolsEnabled);+ const artifactsEnabled = useChatRuntimeStore((s) => s.artifactsEnabled);+ const setArtifactsEnabled = useChatRuntimeStore((s) => s.setArtifactsEnabled);+ const mcpEnabledForChat = useChatRuntimeStore((s) => s.mcpEnabledForChat);+ const setMcpEnabledForChat = useChatRuntimeStore(+ (s) => s.setMcpEnabledForChat,+ );+ // Capability gating, mirroring the visible pills so menu and pills agree on+ // what a loaded model supports (a tool the backend drops must not look on).+ const modelLoaded = useChatRuntimeStore(+ (s) => !!s.params.checkpoint && !s.modelLoading,+ );+ const checkpoint = useChatRuntimeStore((s) => s.params.checkpoint);+ const supportsTools = useChatRuntimeStore((s) => s.supportsTools);+ const supportsBuiltinWebSearch = useChatRuntimeStore(+ (s) => s.supportsBuiltinWebSearch,+ );+ const supportsBuiltinCodeExecution = useChatRuntimeStore(+ (s) => s.supportsBuiltinCodeExecution,+ );+ const supportsBuiltinImageGeneration = useChatRuntimeStore(+ (s) => s.supportsBuiltinImageGeneration,+ );+ const imageToolsEnabled = useChatRuntimeStore((s) => s.imageToolsEnabled);+ const setImageToolsEnabled = useChatRuntimeStore(+ (s) => s.setImageToolsEnabled,+ );+ const setReasoningEnabled = useChatRuntimeStore((s) => s.setReasoningEnabled);+ const connectionsEnabled = useExternalProvidersStore(+ (s) => s.connectionsEnabled,+ );+ const externalProvidersAll = useExternalProvidersStore((s) => s.providers);+ const externalProviders = connectionsEnabled ? externalProvidersAll : [];+ const externalSelection = parseExternalModelId(checkpoint);+ const selectedExternalProvider =+ externalSelection != null+ ? externalProviders.find((p) => p.id === externalSelection.providerId)+ : undefined;+ const isKimiExternal = selectedExternalProvider?.providerType === "kimi";+ // Disable only when a loaded model lacks the capability; with no model the+ // tool can still be pre-selected, matching the pill logic above.+ const searchDisabled =+ modelLoaded && !(supportsTools || supportsBuiltinWebSearch);+ const codeDisabled =+ modelLoaded && !(supportsTools || supportsBuiltinCodeExecution);+ const imageDisabled = !modelLoaded;+ // Like Search/Code: disabled only when a loaded model lacks tool support.+ const mcpDisabled = modelLoaded && !supportsTools;+ // Three most recently updated projects for the quick-access submenu.+ const { projects } = useChatProjects();+ const recentProjects = [...projects]+ .sort((a, b) => b.updatedAt - a.updatedAt)+ .slice(0, 3);+ const openProject = (projectId: string) => {+ useChatRuntimeStore.getState().setActiveProjectId(projectId);+ navigate({ to: "/chat", search: { project: projectId } });+ };++ const startCompare = useCallback(() => {+ const store = useChatRuntimeStore.getState();+ store.setActiveThreadId(null);+ store.setContextUsage(null);+ // crypto.randomUUID is undefined in non-secure contexts (HTTP over a LAN IP).+ const compareId =+ typeof globalThis.crypto?.randomUUID === "function"+ ? globalThis.crypto.randomUUID()+ : `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;+ navigate({ to: "/chat", search: { compare: compareId } });+ }, [navigate]);-const ComposerAction: FC<{+ const [newProjectOpen, setNewProjectOpen] = useState(false);++ return (+ <>+ <DropdownMenu>+ <DropdownMenuTrigger asChild={true}>+ <button+ type="button"+ aria-label="Tools and attachments"+ className="unsloth-composer-plus"+ >+ <PlusIcon className="size-[22px] stroke-[1.75px]" />+ </button>+ </DropdownMenuTrigger>+ <DropdownMenuContent+ side={side}+ align="start"+ sideOffset={2}+ avoidCollisions={true}+ className="unsloth-plus-menu w-[212px]"+ // Don't refocus the + on close; the restored focus showed a stray+ // focus-visible ring.+ onCloseAutoFocus={(event) => event.preventDefault()}+ >+ <ComposerPrimitive.AddAttachment asChild={true}>+ <DropdownMenuItem>+ <HugeiconsIcon icon={AttachmentIcon} strokeWidth={2} />+ Add photos & files+ </DropdownMenuItem>+ </ComposerPrimitive.AddAttachment>+ <ComposerAudioMenuItem />+ <DropdownMenuItem+ disabled={searchDisabled}+ className={+ toolsEnabled && !searchDisabled+ ? "text-primary font-medium"+ : undefined+ }+ onSelect={() => {+ const next = !toolsEnabled;+ setToolsEnabled(next);+ // Mirror the Search pill: Kimi forbids search + thinking together.+ if (isKimiExternal) {+ setReasoningEnabled(!next, { persist: false });+ applyQwenThinkingParams(!next);+ }+ }}+ >+ <GlobeIcon />+ Web search+ {toolsEnabled && !searchDisabled ? (+ <CheckIcon className="ml-auto" />+ ) : null}+ </DropdownMenuItem>+ <DropdownMenuItem+ disabled={codeDisabled}+ className={+ codeToolsEnabled && !codeDisabled+ ? "text-primary font-medium"+ : undefined+ }+ onSelect={() => setCodeToolsEnabled(!codeToolsEnabled)}+ >+ <HugeiconsIcon+ icon={CodeIcon}+ strokeWidth={2}+ className="size-[1.175rem]!"+ />+ Code+ {codeToolsEnabled && !codeDisabled ? (+ <CheckIcon className="ml-auto" />+ ) : null}+ </DropdownMenuItem>+ {supportsBuiltinImageGeneration && (+ <DropdownMenuItem+ disabled={imageDisabled}+ className={+ imageToolsEnabled && !imageDisabled+ ? "text-primary font-medium"+ : undefined+ }+ onSelect={() => setImageToolsEnabled(!imageToolsEnabled)}+ >+ <HugeiconsIcon icon={Image03Icon} strokeWidth={2} />+ Images+ {imageToolsEnabled && !imageDisabled ? (+ <CheckIcon className="ml-auto" />+ ) : null}+ </DropdownMenuItem>+ )}+ <DropdownMenuSeparator />+ <DropdownMenuItem+ className={artifactsEnabled ? "text-primary font-medium" : undefined}+ onSelect={() => setArtifactsEnabled(!artifactsEnabled)}+ >+ <HugeiconsIcon icon={PencilRulerIcon} strokeWidth={2} />+ Canvas+ {artifactsEnabled ? <CheckIcon className="ml-auto" /> : null}+ </DropdownMenuItem>+ <DropdownMenuItem+ disabled={mcpDisabled}+ className={+ mcpEnabledForChat && !mcpDisabled+ ? "text-primary font-medium"+ : undefined+ }+ onSelect={() => setMcpEnabledForChat(!mcpEnabledForChat)}+ >+ <HugeiconsIcon icon={McpServerIcon} strokeWidth={2} />+ MCP+ {mcpEnabledForChat && !mcpDisabled ? (+ <CheckIcon className="ml-auto" />+ ) : null}+ </DropdownMenuItem>+ {/* RAG hidden temporarily */}+ <DropdownMenuItem onSelect={() => startCompare()}>+ <Columns2Icon />+ Compare chat+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>+ <HugeiconsIcon icon={Folder01Icon} strokeWidth={2} />+ Projects+ </DropdownMenuSubTrigger>+ <DropdownMenuSubContent className="unsloth-plus-menu w-[200px]">+ <DropdownMenuItem onSelect={() => setNewProjectOpen(true)}>+ <HugeiconsIcon icon={FolderAddIcon} strokeWidth={2} />+ New project+ </DropdownMenuItem>+ <DropdownMenuLabel>Recents</DropdownMenuLabel>+ {recentProjects.length > 0 ? (+ recentProjects.map((project) => (+ <DropdownMenuItem+ key={project.id}+ onSelect={() => openProject(project.id)}+ >+ <HugeiconsIcon icon={Folder01Icon} strokeWidth={2} />+ <span className="truncate">{project.name}</span>+ </DropdownMenuItem>+ ))+ ) : (+ <DropdownMenuItem disabled={true}>+ No recent projects+ </DropdownMenuItem>+ )}+ </DropdownMenuSubContent>+ </DropdownMenuSub>+ </DropdownMenuContent>+ </DropdownMenu>+ <NewProjectDialog+ open={newProjectOpen}+ onOpenChange={setNewProjectOpen}+ />+ </>+ );+};++const ComposerRightControls: FC<{disabled?: boolean;shouldBlockSend?: () => boolean;-}> = ({ disabled, shouldBlockSend }) => {+ menuSide?: "top" | "bottom";+}> = ({ disabled, shouldBlockSend, menuSide }) => {return (- <div className="aui-composer-action-wrapper composer-action-wrapper">- <div className="flex items-center gap-0.5">- <ComposerAddAttachment />- <ComposerAudioUpload />- <ReasoningToggle />- <PreserveThinkingToggle />- <WebSearchToggle />- <CodeToolsToggle />- <ImagesToggle />- <ArtifactsToggle />- <McpComposerButton />- </div>- <div className="flex items-center gap-1">- <ComposerPrimitive.If dictation={false}>- <ComposerPrimitive.Dictate asChild={true}>- <TooltipIconButton- tooltip="Dictate"- aria-label="Dictate"- variant="ghost"- className="size-8 rounded-full text-muted-foreground"- >- <MicIcon className="size-4" />- </TooltipIconButton>- </ComposerPrimitive.Dictate>- </ComposerPrimitive.If>- <ComposerPrimitive.If dictation={true}>- <ComposerPrimitive.StopDictation asChild={true}>- <TooltipIconButton- tooltip="Stop dictation"- aria-label="Stop dictation"- variant="ghost"- className="size-8 rounded-full text-destructive"- >- <SquareIcon className="size-3 animate-pulse fill-current" />- </TooltipIconButton>- </ComposerPrimitive.StopDictation>- </ComposerPrimitive.If>- <AuiIf condition={({ thread }) => !thread.isRunning}>- <ComposerPrimitive.Send asChild={true}>- <TooltipIconButton- tooltip="Send message"- side="bottom"- type="submit"- variant="default"- size="icon"- disabled={disabled}- onClick={(event) => {- if (shouldBlockSend?.()) {- event.preventDefault();- }- }}- className="aui-composer-send size-8 rounded-full"- aria-label="Send message"- >- <ArrowUpIcon className="aui-composer-send-icon size-4" />- </TooltipIconButton>- </ComposerPrimitive.Send>- </AuiIf>- <AuiIf condition={({ thread }) => thread.isRunning}>- <ComposerPrimitive.Cancel asChild={true}>- <Button- type="button"- variant="default"- size="icon"- className="aui-composer-cancel size-8 rounded-full"- aria-label="Stop generating"- >- <SquareIcon className="aui-composer-cancel-icon size-3 fill-current" />- </Button>- </ComposerPrimitive.Cancel>- </AuiIf>- </div>+ <div className="aui-composer-action-wrapper flex shrink-0 items-center gap-1.5">+ <ReasoningToggle side={menuSide} />+ <ComposerPrimitive.If dictation={false}>+ <ComposerPrimitive.Dictate asChild={true}>+ <TooltipIconButton+ tooltip="Dictate"+ aria-label="Dictate"+ variant="ghost"+ className="size-8 rounded-full text-foreground"+ >+ <MicIcon className="size-5" />+ </TooltipIconButton>+ </ComposerPrimitive.Dictate>+ </ComposerPrimitive.If>+ <ComposerPrimitive.If dictation={true}>+ <ComposerPrimitive.StopDictation asChild={true}>+ <TooltipIconButton+ tooltip="Stop dictation"+ aria-label="Stop dictation"+ variant="ghost"+ className="size-8 rounded-full text-destructive"+ >+ <SquareIcon className="size-3 animate-pulse fill-current" />+ </TooltipIconButton>+ </ComposerPrimitive.StopDictation>+ </ComposerPrimitive.If>+ <AuiIf condition={({ thread }) => !thread.isRunning}>+ <ComposerPrimitive.Send asChild={true}>+ <TooltipIconButton+ tooltip="Send message"+ side="bottom"+ type="submit"+ variant="default"+ size="icon"+ disabled={disabled}+ onClick={(event) => {+ if (shouldBlockSend?.()) {+ event.preventDefault();+ }+ }}+ className="aui-composer-send ml-1.5 size-8 rounded-full"+ aria-label="Send message"+ >+ <ArrowUpIcon className="aui-composer-send-icon size-[21px] stroke-2" />+ </TooltipIconButton>+ </ComposerPrimitive.Send>+ </AuiIf>+ <AuiIf condition={({ thread }) => thread.isRunning}>+ <ComposerPrimitive.Cancel asChild={true}>+ <Button+ type="button"+ variant="default"+ size="icon"+ className="aui-composer-cancel ml-1.5 size-8 rounded-full"+ aria-label="Stop generating"+ >+ <SquareIcon className="aui-composer-cancel-icon size-3 fill-current" />+ </Button>+ </ComposerPrimitive.Cancel>+ </AuiIf></div>);};@@ -1474,11 +2067,11 @@ const AssistantActionBar: FC = () => {side="bottom"align="start"onCloseAutoFocus={(e) => e.preventDefault()}- className="aui-action-bar-more-content z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md"+ className="aui-action-bar-more-content z-50 min-w-32 overflow-hidden rounded-md [--radius:1.1rem] bg-popover p-1 text-popover-foreground shadow-[0_2px_8px_-2px_rgba(27,27,31,0.16)] dark:shadow-none"><ActionBarPrimitive.ExportMarkdown asChild={true}><ActionBarMorePrimitive.Item className="aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground">- <DownloadIcon strokeWidth={1.75} className="size-icon" />+ <HugeiconsIcon icon={Download01Icon} strokeWidth={1.75} className="size-icon" />Export as Markdown</ActionBarMorePrimitive.Item></ActionBarPrimitive.ExportMarkdown>diff --git a/studio/frontend/src/components/assistant-ui/tool-ui-image-generation.tsx b/studio/frontend/src/components/assistant-ui/tool-ui-image-generation.tsxindex a9919708d0e..c0ced3b8444 100644--- a/studio/frontend/src/components/assistant-ui/tool-ui-image-generation.tsx+++ b/studio/frontend/src/components/assistant-ui/tool-ui-image-generation.tsx@@ -6,7 +6,9 @@import { Button } from "@/components/ui/button";import { cn } from "@/lib/utils";import type { ToolCallMessagePartComponent } from "@assistant-ui/react";-import { DownloadIcon, ImageIcon, PencilIcon } from "lucide-react";+import { ImageIcon, PencilIcon } from "lucide-react";+import { Download01Icon } from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";import type { CSSProperties, MouseEvent } from "react";import { memo, useCallback, useEffect, useRef, useState } from "react";import { useGeneratedImageOverlay } from "./generated-image-overlay-context";@@ -374,7 +376,7 @@ const ImageGenerationToolUIImpl: ToolCallMessagePartComponent = ({onClick={handleDownload}aria-label="Download generated image">- <DownloadIcon className="size-4" />+ <HugeiconsIcon icon={Download01Icon} className="size-4" /></Button></div></div>diff --git a/studio/frontend/src/components/ui/combobox.tsx b/studio/frontend/src/components/ui/combobox.tsxindex 4fe310b7886..53d77415e5a 100644--- a/studio/frontend/src/components/ui/combobox.tsx+++ b/studio/frontend/src/components/ui/combobox.tsx@@ -1,6 +1,6 @@-// SPDX-License-Identifier: AGPL-3.0-only-// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0-+// 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";/* eslint-disable react-refresh/only-export-components */@@ -143,10 +143,10 @@ function ComboboxInput({);}-function ComboboxContent({- className,- side = "bottom",- sideOffset = 6,+function ComboboxContent({+ className,+ side = "bottom",+ sideOffset = 6,align = "start",alignOffset = 0,anchor,@@ -162,23 +162,23 @@ function ComboboxContent({const dialogContainer = useDialogPortalContainer();return (<ComboboxPrimitive.Portal container={container ?? dialogContainer ?? undefined}>- <ComboboxPrimitive.Positioner- side={side}- sideOffset={sideOffset}- align={align}- alignOffset={alignOffset}- anchor={anchor}- className="isolate z-[120] pointer-events-auto"- >- <ComboboxPrimitive.Popup- data-slot="combobox-content"- data-chips={!!anchor}- className={cn(- "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 shadow-border ring-1 ring-border *:data-[slot=input-group]:bg-input/30 max-h-72 min-w-36 overflow-hidden rounded-xl corner-squircle duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-9 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:shadow-none group/combobox-content relative pointer-events-auto max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) data-[chips=true]:min-w-(--anchor-width)",- className,- )}- {...props}- />+ <ComboboxPrimitive.Positioner+ side={side}+ sideOffset={sideOffset}+ align={align}+ alignOffset={alignOffset}+ anchor={anchor}+ className="isolate z-[120] pointer-events-auto"+ >+ <ComboboxPrimitive.Popup+ data-slot="combobox-content"+ data-chips={!!anchor}+ className={cn(+ "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:bg-input/30 max-h-72 min-w-36 overflow-hidden rounded-xl corner-squircle duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-9 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:shadow-none group/combobox-content relative pointer-events-auto max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) data-[chips=true]:min-w-(--anchor-width)",+ className,+ )}+ {...props}+ /></ComboboxPrimitive.Positioner></ComboboxPrimitive.Portal>);diff --git a/studio/frontend/src/components/ui/dropdown-menu.tsx b/studio/frontend/src/components/ui/dropdown-menu.tsxindex 9102e5c9456..0f67194ee38 100644--- a/studio/frontend/src/components/ui/dropdown-menu.tsx+++ b/studio/frontend/src/components/ui/dropdown-menu.tsx@@ -1,6 +1,6 @@-// SPDX-License-Identifier: AGPL-3.0-only-// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0-+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0+import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";import type * as React from "react";@@ -46,7 +46,7 @@ function DropdownMenuContent({sideOffset={sideOffset}align={align}className={cn(- "data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 shadow-border ring-1 ring-border bg-popover text-popover-foreground min-w-48 rounded-lg p-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto data-[state=closed]:overflow-hidden",+ "data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-popover text-popover-foreground min-w-48 rounded-lg p-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto data-[state=closed]:overflow-hidden",className,)}{...props}@@ -244,7 +244,7 @@ function DropdownMenuSubContent({<DropdownMenuPrimitive.SubContentdata-slot="dropdown-menu-sub-content"className={cn(- "data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 shadow-border ring-1 ring-border bg-popover text-popover-foreground min-w-36 rounded-lg p-1 duration-100 z-50 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden",+ "data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-popover text-popover-foreground min-w-36 rounded-lg p-1 duration-100 z-50 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden",className,)}{...props}diff --git a/studio/frontend/src/components/ui/popover.tsx b/studio/frontend/src/components/ui/popover.tsxindex e2031a0b107..a3fdac21000 100644--- a/studio/frontend/src/components/ui/popover.tsx+++ b/studio/frontend/src/components/ui/popover.tsx@@ -1,6 +1,6 @@-// SPDX-License-Identifier: AGPL-3.0-only-// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0-+// 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 { Popover as PopoverPrimitive } from "radix-ui";@@ -33,7 +33,7 @@ function PopoverContent({align={align}sideOffset={sideOffset}className={cn(- "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 shadow-border ring-1 ring-border flex flex-col gap-4 rounded-lg p-4 text-sm duration-100 z-50 w-72 origin-(--radix-popover-content-transform-origin) outline-hidden",+ "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 flex flex-col gap-4 rounded-lg p-4 text-sm duration-100 z-50 w-72 origin-(--radix-popover-content-transform-origin) outline-hidden",className,)}{...props}diff --git a/studio/frontend/src/components/ui/select.tsx b/studio/frontend/src/components/ui/select.tsxindex 4044c164e5b..03c584fdd11 100644--- a/studio/frontend/src/components/ui/select.tsx+++ b/studio/frontend/src/components/ui/select.tsx@@ -125,7 +125,7 @@ function SelectContent({data-slot="select-content"data-align-trigger={position === "item-aligned"}className={cn(- "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 shadow-border ring-1 ring-border min-w-36 rounded-xl p-1 corner-squircle duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto ",+ "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 min-w-36 rounded-xl p-1 corner-squircle duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto ",position === "popper" &&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",className,diff --git a/studio/frontend/src/components/ui/sonner.tsx b/studio/frontend/src/components/ui/sonner.tsxindex bf6d4970b0d..6380a7bfc8c 100644--- a/studio/frontend/src/components/ui/sonner.tsx+++ b/studio/frontend/src/components/ui/sonner.tsx@@ -63,7 +63,8 @@ const Toaster = ({ ...props }: ToasterProps) => {{"--normal-bg": "var(--popover)","--normal-text": "var(--popover-foreground)",- "--normal-border": "var(--border)",+ // No border line; elevation comes from the composer's drop shadow.+ "--normal-border": "transparent","--border-radius": "var(--radius)",// Pin the close button inside the toast's top-right corner.// Sonner defaults to the left/outside edge, so keep the horizontaldiff --git a/studio/frontend/src/components/ui/tabs.tsx b/studio/frontend/src/components/ui/tabs.tsxindex 07167ddf364..1fa82745737 100644--- a/studio/frontend/src/components/ui/tabs.tsx+++ b/studio/frontend/src/components/ui/tabs.tsx@@ -1,6 +1,6 @@-// SPDX-License-Identifier: AGPL-3.0-only-// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0-+// 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";/* eslint-disable react-refresh/only-export-components */@@ -54,7 +54,7 @@ export const tabsListVariants = cva(variants: {variant: {default: "bg-muted",- line: "gap-1 bg-transparent",+ line: "gap-2 bg-transparent group-data-horizontal/tabs:h-auto",},},defaultVariants: {@@ -95,8 +95,10 @@ export function TabsTrigger({className={cn("gap-1.5 rounded-xl corner-squircle border border-transparent px-2 py-1 text-sm font-medium group-data-vertical/tabs:px-2.5 group-data-vertical/tabs:py-1.5 [&_svg:not([class*='size-'])]:size-4 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap transition-colors group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",+ // Line variant is a roomier pill (no underline); padding overrides px-2 py-1.+ "group-data-[variant=line]/tabs-list:px-3.5 group-data-[variant=line]/tabs-list:py-2.5","data-active:text-foreground dark:data-active:text-foreground",- "after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",+ "after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5",className,)}{...props}@@ -104,7 +106,7 @@ export function TabsTrigger({{isActive && (<motion.spanlayoutId={`tab-bg-${ctx.id}`}- className="absolute inset-0 rounded-xl bg-background dark:bg-input/30 dark:border dark:border-input"+ className="absolute inset-0 rounded-xl bg-background dark:bg-input/30 dark:border dark:border-input group-data-[variant=line]/tabs-list:bg-[#ececec] dark:group-data-[variant=line]/tabs-list:bg-[#2d2f33] dark:group-data-[variant=line]/tabs-list:border-0"transition={{type: "spring",stiffness: 500,diff --git a/studio/frontend/src/features/chat/adapters/studio-web-speech-dictation-adapter.ts b/studio/frontend/src/features/chat/adapters/studio-web-speech-dictation-adapter.tsnew file mode 100644index 00000000000..a679e8ed836--- /dev/null+++ b/studio/frontend/src/features/chat/adapters/studio-web-speech-dictation-adapter.ts@@ -0,0 +1,230 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import type { DictationAdapter } from "@assistant-ui/react";+import { toast } from "sonner";++const getSpeechRecognitionAPI = (): SpeechRecognitionConstructor | undefined => {+ if (typeof window === "undefined") return undefined;+ return window.SpeechRecognition ?? window.webkitSpeechRecognition;+};++const stopStream = (stream: MediaStream | null) => {+ stream?.getTracks().forEach((track) => track.stop());+};++const describeMediaError = (error: unknown): string => {+ if (!(error instanceof DOMException)) {+ return "Dictation could not access the microphone.";+ }+ if (error.name === "NotAllowedError") {+ return "Microphone access is blocked. Allow microphone access for this Studio page, then try again.";+ }+ if (error.name === "NotFoundError") {+ return "No microphone was found for dictation.";+ }+ if (error.name === "NotReadableError") {+ return "The microphone is already in use or unavailable.";+ }+ return error.message || "Dictation could not access the microphone.";+};++const describeSpeechError = (error: string, message?: string): string => {+ if (error === "not-allowed") {+ return "Speech recognition was blocked by the browser. Check microphone permissions for this Studio page.";+ }+ if (error === "service-not-allowed") {+ return "Speech recognition is blocked by the browser speech service.";+ }+ if (error === "network") {+ return "Speech recognition could not reach the browser speech service.";+ }+ if (error === "language-not-supported") {+ return "Speech recognition does not support the current language.";+ }+ return message || `Speech recognition failed: ${error}`;+};++export class StudioWebSpeechDictationAdapter implements DictationAdapter {+ private readonly language: string;+ private readonly continuous: boolean;+ private readonly interimResults: boolean;++ constructor(+ options: {+ language?: string;+ continuous?: boolean;+ interimResults?: boolean;+ } = {},+ ) {+ this.language = options.language ?? navigator.language ?? "en-US";+ this.continuous = options.continuous ?? true;+ this.interimResults = options.interimResults ?? true;+ }++ static isSupported(): boolean {+ return (+ typeof window !== "undefined" &&+ window.isSecureContext &&+ getSpeechRecognitionAPI() !== undefined &&+ navigator.mediaDevices?.getUserMedia !== undefined+ );+ }++ listen(): DictationAdapter.Session {+ const SpeechRecognitionAPI = getSpeechRecognitionAPI();+ if (!SpeechRecognitionAPI || !navigator.mediaDevices?.getUserMedia) {+ throw new Error("Speech recognition is not supported in this browser.");+ }++ const recognition = new SpeechRecognitionAPI();+ recognition.lang = this.language;+ recognition.continuous = this.continuous;+ recognition.interimResults = this.interimResults;++ const speechStartCallbacks = new Set<() => void>();+ const speechEndCallbacks = new Set<(result: DictationAdapter.Result) => void>();+ const speechCallbacks = new Set<(result: DictationAdapter.Result) => void>();++ let stream: MediaStream | null = null;+ let finalTranscript = "";+ let ended = false;+ let started = false;+ let resolveEnded: (() => void) | null = null;+ const endedPromise = new Promise<void>((resolve) => {+ resolveEnded = resolve;+ });++ const session: DictationAdapter.Session = {+ status: { type: "starting" },++ stop: async () => {+ if (!ended && started) {+ recognition.stop();+ } else if (!ended) {+ finish("stopped");+ }+ await endedPromise;+ },++ cancel: () => {+ if (!ended && started) {+ recognition.abort();+ } else if (!ended) {+ finish("cancelled");+ }+ },++ onSpeechStart: (callback) => {+ speechStartCallbacks.add(callback);+ return () => {+ speechStartCallbacks.delete(callback);+ };+ },++ onSpeechEnd: (callback) => {+ speechEndCallbacks.add(callback);+ return () => {+ speechEndCallbacks.delete(callback);+ };+ },++ onSpeech: (callback) => {+ speechCallbacks.add(callback);+ return () => {+ speechCallbacks.delete(callback);+ };+ },+ };++ const finish = (reason: "stopped" | "cancelled" | "error") => {+ if (ended) return;+ ended = true;+ session.status = { type: "ended", reason };+ stopStream(stream);+ stream = null;+ if (finalTranscript) {+ for (const callback of speechEndCallbacks) {+ callback({ transcript: finalTranscript });+ }+ finalTranscript = "";+ }+ resolveEnded?.();+ };++ recognition.addEventListener("start", () => {+ session.status = { type: "running" };+ });++ recognition.addEventListener("speechstart", () => {+ for (const callback of speechStartCallbacks) callback();+ });++ recognition.addEventListener("result", (event) => {+ const speechEvent = event as SpeechRecognitionEvent;+ for (let i = speechEvent.resultIndex; i < speechEvent.results.length; i++) {+ const result = speechEvent.results[i];+ if (!result) continue;+ const transcript = result[0]?.transcript ?? "";+ if (result.isFinal) {+ finalTranscript += transcript;+ for (const callback of speechCallbacks) {+ callback({ transcript, isFinal: true });+ }+ } else {+ for (const callback of speechCallbacks) {+ callback({ transcript, isFinal: false });+ }+ }+ }+ });++ recognition.addEventListener("end", () => {+ finish("stopped");+ });++ recognition.addEventListener("error", (event) => {+ const errorEvent = event as SpeechRecognitionErrorEvent;+ if (errorEvent.error === "aborted") {+ finish("cancelled");+ return;+ }+ const description = describeSpeechError(errorEvent.error, errorEvent.message);+ console.error("Dictation error:", errorEvent.error, errorEvent.message);+ toast.error(description);+ finish("error");+ });++ void (async () => {+ try {+ stream = await navigator.mediaDevices.getUserMedia({+ audio: { echoCancellation: true, noiseSuppression: true },+ });+ if (ended) {+ stopStream(stream);+ stream = null;+ return;+ }+ const audioTrack = stream.getAudioTracks()[0];+ if (!audioTrack || audioTrack.readyState !== "live") {+ throw new DOMException("No live microphone track is available.", "NotFoundError");+ }+ try {+ recognition.start(audioTrack);+ } catch (error) {+ // Older engines expose only start(); retry without the experimental track overload.+ console.debug("Dictation start(audioTrack) failed; retrying start().", error);+ recognition.start();+ }+ started = true;+ } catch (error) {+ const description = describeMediaError(error);+ console.error("Dictation microphone error:", error);+ toast.error(description);+ finish("error");+ }+ })();++ return session;+ }+}diff --git a/studio/frontend/src/features/chat/api/chat-api.ts b/studio/frontend/src/features/chat/api/chat-api.tsindex 85b3be7dea1..7a71850d663 100644--- a/studio/frontend/src/features/chat/api/chat-api.ts+++ b/studio/frontend/src/features/chat/api/chat-api.ts@@ -306,7 +306,9 @@ export async function listChatThreads(const qs = params.toString();const response = await authFetch(`/api/chat/threads${qs ? `?${qs}` : ""}`);const data = await parseJsonOrThrow<{ threads: ThreadRecord[] }>(response);- return data.threads;+ // Always hand back an array: an older or misbehaving backend may omit the+ // field or send a non-array, which would crash list consumers.+ return Array.isArray(data.threads) ? data.threads : [];}export async function getChatThread(@@ -370,7 +372,9 @@ export async function listChatProjects(const qs = params.toString();const response = await authFetch(`/api/chat/projects${qs ? `?${qs}` : ""}`);const data = await parseJsonOrThrow<{ projects: ProjectRecord[] }>(response);- return data.projects;+ // Always hand back an array: an older or misbehaving backend may omit the+ // field or send a non-array, which would crash list consumers.+ return Array.isArray(data.projects) ? data.projects : [];}export async function getChatProject(diff --git a/studio/frontend/src/features/chat/artifacts/artifact-surface.tsx b/studio/frontend/src/features/chat/artifacts/artifact-surface.tsxindex 8de3f7861d6..b4ddf38aaa6 100644--- a/studio/frontend/src/features/chat/artifacts/artifact-surface.tsx+++ b/studio/frontend/src/features/chat/artifacts/artifact-surface.tsx@@ -15,11 +15,12 @@ import { cn } from "@/lib/utils";import {CheckIcon,CopyIcon,- DownloadIcon,EyeIcon,Maximize2Icon,XIcon,} from "lucide-react";+import { Download01Icon } from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";import {type KeyboardEvent,useEffect,@@ -266,7 +267,7 @@ export function ArtifactSurface({onClick={() => downloadTextFile(filename, artifact.code)}aria-label="Download artifact HTML">- <DownloadIcon className="size-4" />+ <HugeiconsIcon icon={Download01Icon} className="size-4" /></Button><Buttontype="button"diff --git a/studio/frontend/src/features/chat/chat-page.tsx b/studio/frontend/src/features/chat/chat-page.tsxindex d793b7697bd..834d0baf340 100644--- a/studio/frontend/src/features/chat/chat-page.tsx+++ b/studio/frontend/src/features/chat/chat-page.tsx@@ -388,6 +388,7 @@ const CompareContent = memo(function CompareContent({onFoldersChange,onModelsChange,deleteDisabled,+ onExitCompare,}: {pairId: string;projectId?: string | null;@@ -397,11 +398,16 @@ const CompareContent = memo(function CompareContent({onFoldersChange?: () => void;onModelsChange?: (deletedModel?: DeletedModelRef) => void;deleteDisabled?: boolean;+ onExitCompare?: () => void;}): ReactElement {const isLoraCompare = useIsLoraCompare();return isLoraCompare ? (- <LoraCompareContent pairId={pairId} projectId={projectId} />+ <LoraCompareContent+ pairId={pairId}+ onExitCompare={onExitCompare}+ projectId={projectId}+ />) : (<GeneralCompareContentpairId={pairId}@@ -412,6 +418,7 @@ const CompareContent = memo(function CompareContent({onFoldersChange={onFoldersChange}onModelsChange={onModelsChange}deleteDisabled={deleteDisabled}+ onExitCompare={onExitCompare}/>);});@@ -512,8 +519,13 @@ function CompareShell({/** Fast path: same model, adapter on/off, simultaneous generation. */const LoraCompareContent = memo(function LoraCompareContent({pairId,+ onExitCompare,projectId,-}: { pairId: string; projectId?: string | null }): ReactElement {+}: {+ pairId: string;+ onExitCompare?: () => void;+ projectId?: string | null;+}): ReactElement {const handlesRef = useRef<Record<string, CompareHandle>>({});const [baseThreadId, setBaseThreadId] = useState<string>();const [loraThreadId, setLoraThreadId] = useState<string>();@@ -539,7 +551,12 @@ const LoraCompareContent = memo(function LoraCompareContent({return (<CompareShellhandlesRef={handlesRef}- composer={<SharedComposer handlesRef={handlesRef} />}+ composer={+ <SharedComposer+ handlesRef={handlesRef}+ onExitCompare={onExitCompare}+ />+ }><><ComparePane@@ -639,6 +656,7 @@ const GeneralCompareContent = memo(function GeneralCompareContent({onFoldersChange,onModelsChange,deleteDisabled,+ onExitCompare,}: {pairId: string;projectId?: string | null;@@ -648,6 +666,7 @@ const GeneralCompareContent = memo(function GeneralCompareContent({onFoldersChange?: () => void;onModelsChange?: (deletedModel?: DeletedModelRef) => void;deleteDisabled?: boolean;+ onExitCompare?: () => void;}): ReactElement {const handlesRef = useRef<Record<string, CompareHandle>>({});const [model1ThreadId, setModel1ThreadId] = useState<string>();@@ -712,6 +731,7 @@ const GeneralCompareContent = memo(function GeneralCompareContent({handlesRef={handlesRef}model1={model1}model2={model2}+ onExitCompare={onExitCompare}/>}>@@ -1067,6 +1087,15 @@ export function ChatPage(): ReactElement {const [modelSelectorOpen, setModelSelectorOpen] = useState(false);const [modelSelectorLocked, setModelSelectorLocked] = useState(false);const viewBeforeCompareRef = useRef<ChatSearch | null>(null);+ // Tracks the latest non-compare view so exiting compare can restore it even+ // when compare was opened from a path that does not set viewBeforeCompareRef+ // (e.g. the composer + menu).+ const lastNonCompareViewRef = useRef<ChatSearch | null>(null);+ useEffect(() => {+ if (!search.compare) {+ lastNonCompareViewRef.current = { ...search };+ }+ }, [search]);const inferenceParams = useChatRuntimeStore((state) => state.params);const setInferenceParams = useChatRuntimeStore((state) => state.setParams);const activeGgufVariant = useChatRuntimeStore(@@ -1768,8 +1797,7 @@ export function ChatPage(): ReactElement {() => setSettingsOpen(false),[setSettingsOpen],);- const { setPinned, isMobile } = useSidebar();- const openSidebar = useCallback(() => setPinned(true), [setPinned]);+ const { isMobile } = useSidebar();const enterCompare = useCallback(() => {viewBeforeCompareRef.current = { ...search };@@ -1785,8 +1813,14 @@ export function ChatPage(): ReactElement {}, [currentProjectId, navigate, search]);const exitCompare = useCallback(() => {- const saved = viewBeforeCompareRef.current;- if (!saved) return;+ // Prefer the explicit save; fall back to the last non-compare view so the+ // composer + menu path also returns to where the user started.+ const saved = viewBeforeCompareRef.current ?? lastNonCompareViewRef.current;+ // No saved view (compare opened by direct URL); fall back to a fresh chat.+ if (!saved) {+ navigate({ to: "/chat" });+ return;+ }viewBeforeCompareRef.current = null;navigate({ to: "/chat", search: saved });// Restore usage from the last assistant message, but only if it@@ -2038,7 +2072,6 @@ export function ChatPage(): ReactElement {closeModelSelector,openSettings,closeSettings,- openSidebar,enterCompare,exitCompare,}),@@ -2050,7 +2083,6 @@ export function ChatPage(): ReactElement {exitCompare,openModelSelector,openSettings,- openSidebar,],);@@ -2256,6 +2288,7 @@ export function ChatPage(): ReactElement {onFoldersChange={refreshLocalModels}onModelsChange={refreshModelLists}deleteDisabled={modelOperationInProgress}+ onExitCompare={exitCompare}/>)}diff --git a/studio/frontend/src/features/chat/chat-settings-sheet.tsx b/studio/frontend/src/features/chat/chat-settings-sheet.tsxindex 90c2185db3a..bddcb02c69f 100644--- a/studio/frontend/src/features/chat/chat-settings-sheet.tsx+++ b/studio/frontend/src/features/chat/chat-settings-sheet.tsx@@ -723,18 +723,17 @@ export function ChatSettingsPanel({const settingsContent = (<>- <div- ref={settingsScrollRef}- className="relative h-full overflow-y-auto"- >- <div className="sticky top-0 z-10 flex h-[48px] items-start gap-2 bg-panel-surface pl-[18px] pr-[16px] pt-[11px]">+ <div className="flex h-full min-h-0 flex-col">+ {/* Header sits outside the scroll area so the scrollbar never shifts the+ close button. */}+ <div className="flex h-[48px] shrink-0 items-start gap-2 bg-panel-surface pl-[18px] pr-[16px] pt-[11px]">{isMobile ? (- <span className="flex h-[34px] flex-1 items-center text-[15px] font-semibold tracking-[0em] dark:tracking-[0.015em] text-nav-fg">+ <span className="flex h-[34px] flex-1 items-center text-[16px] font-semibold tracking-[0em] dark:tracking-[0.015em] text-nav-fg">Run settings</span>) : (<>- <span className="flex h-[34px] flex-1 items-center text-[15px] font-semibold tracking-[0em] dark:tracking-[0.015em] text-nav-fg">+ <span className="flex h-[34px] flex-1 items-center text-[16px] font-semibold tracking-[0em] dark:tracking-[0.015em] text-nav-fg">Run settings</span><Tooltip>@@ -764,6 +763,10 @@ export function ChatSettingsPanel({)}</div>+ <div+ ref={settingsScrollRef}+ className="run-settings-scroll relative min-h-0 flex-1 overflow-y-auto"+ ><div className="px-[18px] pt-3">{hasModelContent && (<CollapsibleSection label="Model" defaultOpen={true} first>@@ -1373,6 +1376,7 @@ export function ChatSettingsPanel({) : null}</div></div>+ </div><Dialogopen={systemPromptEditorOpen}onOpenChange={(nextOpen) => {diff --git a/studio/frontend/src/features/chat/components/chat-search-dialog.tsx b/studio/frontend/src/features/chat/components/chat-search-dialog.tsxindex 676dcc23d59..3d867b07f75 100644--- a/studio/frontend/src/features/chat/components/chat-search-dialog.tsx+++ b/studio/frontend/src/features/chat/components/chat-search-dialog.tsx@@ -64,7 +64,7 @@ export function ChatSearchDialog() {<CommandDialogopen={isOpen}onOpenChange={setOpen}- className="corner-squircle top-[25%] w-[635px] max-w-[calc(100%-2rem)] gap-0 p-0 sm:max-w-[635px] border-0 ring-0 shadow-[0_10px_34px_rgba(0,0,0,0.12)] dark:border dark:border-border dark:ring-0 dark:shadow-none"+ className="chat-search-surface corner-squircle top-[25%] w-[635px] max-w-[calc(100%-2rem)] gap-0 p-0 sm:max-w-[635px]"overlayClassName="bg-transparent"><Command className="rounded-4xl p-0" filter={chatSearchFilter}>@@ -87,7 +87,7 @@ export function ChatSearchDialog() {<HugeiconsIcon icon={Cancel01Icon} strokeWidth={2} className="size-4" /></button></div>- <CommandList className="cmd-native-scrollbar max-h-[420px] p-1">+ <CommandList className="cmd-native-scrollbar hover-scrollbar max-h-[420px] p-1"><CommandEmpty className="py-6 text-center text-xs text-muted-foreground">{loading? "Loading…"diff --git a/studio/frontend/src/features/chat/components/new-project-dialog.tsx b/studio/frontend/src/features/chat/components/new-project-dialog.tsxnew file mode 100644index 00000000000..38b0983e10a--- /dev/null+++ b/studio/frontend/src/features/chat/components/new-project-dialog.tsx@@ -0,0 +1,97 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import { useNavigate } from "@tanstack/react-router";+import { useState } from "react";++import { Button } from "@/components/ui/button";+import {+ Dialog,+ DialogContent,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from "@/components/ui/dialog";+import { Input } from "@/components/ui/input";+import { toast } from "@/lib/toast";++import { createChatProject } from "../hooks/use-chat-projects";+import { useChatRuntimeStore } from "../stores/chat-runtime-store";++// Create-project dialog usable from the composer + menu. Creating opens the new+// project straight away rather than dropping the user on the projects list.+export function NewProjectDialog({+ open,+ onOpenChange,+}: {+ open: boolean;+ onOpenChange: (open: boolean) => void;+}) {+ const navigate = useNavigate();+ const [name, setName] = useState("");++ async function commitCreate() {+ const trimmed = name.trim();+ if (!trimmed) return;+ try {+ const project = await createChatProject(trimmed);+ onOpenChange(false);+ setName("");+ const runtime = useChatRuntimeStore.getState();+ runtime.setActiveThreadId(null);+ runtime.setActiveProjectId(project.id);+ navigate({ to: "/chat", search: { project: project.id } });+ } catch (err) {+ toast.error("Failed to create project", {+ description: err instanceof Error ? err.message : undefined,+ });+ }+ }++ return (+ <Dialog+ open={open}+ onOpenChange={(next) => {+ if (!next) setName("");+ onOpenChange(next);+ }}+ >+ <DialogContent className="corner-squircle border border-border/60 bg-background/98 shadow-none sm:max-w-md">+ <DialogHeader>+ <DialogTitle>New project</DialogTitle>+ </DialogHeader>+ <Input+ value={name}+ onChange={(e) => setName(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === "Enter") {+ e.preventDefault();+ void commitCreate();+ }+ }}+ autoFocus={true}+ maxLength={120}+ placeholder="Project name"+ aria-label="Project name"+ className="focus-visible:border-input focus-visible:ring-0"+ />+ <DialogFooter className="flex-wrap gap-2 sm:justify-end">+ <Button+ type="button"+ variant="ghost"+ onClick={() => onOpenChange(false)}+ >+ Cancel+ </Button>+ <Button+ type="button"+ onClick={() => void commitCreate()}+ disabled={!name.trim()}+ >+ Create+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+}diff --git a/studio/frontend/src/features/chat/hooks/use-chat-projects.ts b/studio/frontend/src/features/chat/hooks/use-chat-projects.tsindex fe0dfa9e659..3f0d46982d7 100644--- a/studio/frontend/src/features/chat/hooks/use-chat-projects.ts+++ b/studio/frontend/src/features/chat/hooks/use-chat-projects.ts@@ -21,9 +21,11 @@ export function useChatProjects(): {isLoading: boolean;hasLoaded: boolean;} {- const [projects, setProjects] = useState<ProjectRecord[]>(cachedProjects);- const [isLoading, setIsLoading] = useState(cachedProjects.length === 0);- const [hasLoaded, setHasLoaded] = useState(cachedProjects.length > 0);+ // Stay null-safe even if the cache was poisoned by a bad response.+ const cached = Array.isArray(cachedProjects) ? cachedProjects : [];+ const [projects, setProjects] = useState<ProjectRecord[]>(cached);+ const [isLoading, setIsLoading] = useState(cached.length === 0);+ const [hasLoaded, setHasLoaded] = useState(cached.length > 0);useEffect(() => {let cancelled = false;@@ -32,8 +34,8 @@ export function useChatProjects(): {if (!cancelled) setIsLoading(true);try {const next = await listStoredChatProjects({ includeArchived: false });- cachedProjects = next;- if (!cancelled) setProjects(next);+ cachedProjects = Array.isArray(next) ? next : [];+ if (!cancelled) setProjects(cachedProjects);} catch (error) {if (isExpectedBackgroundChatStorageError(error)) {return;diff --git a/studio/frontend/src/features/chat/hooks/use-pill-activation-order.ts b/studio/frontend/src/features/chat/hooks/use-pill-activation-order.tsnew file mode 100644index 00000000000..e159101a7f3--- /dev/null+++ b/studio/frontend/src/features/chat/hooks/use-pill-activation-order.ts@@ -0,0 +1,30 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import { useEffect, useState } from "react";++// Tracks which of the given keys are active and the order in which each became+// active, so opt-in composer pills (Canvas, MCP) render in the order they were+// toggled on rather than a fixed order.+export function usePillActivationOrder(states: Record<string, boolean>): string[] {+ const [order, setOrder] = useState<string[]>(() =>+ Object.keys(states).filter((key) => states[key]),+ );+ // Re-run only when the active/inactive set changes, not on every render.+ const signature = Object.keys(states)+ .map((key) => `${key}:${states[key] ? 1 : 0}`)+ .join(",");+ useEffect(() => {+ setOrder((prev) => {+ const next = prev.filter((key) => states[key]);+ for (const key of Object.keys(states)) {+ if (states[key] && !next.includes(key)) next.push(key);+ }+ const unchanged =+ next.length === prev.length && next.every((key, i) => key === prev[i]);+ return unchanged ? prev : next;+ });+ // states is read fresh inside; signature captures its boolean values.+ }, [signature]);+ return order;+}diff --git a/studio/frontend/src/features/chat/mcp-composer-button.tsx b/studio/frontend/src/features/chat/mcp-composer-button.tsxindex b98be8bf69c..92d2c319a60 100644--- a/studio/frontend/src/features/chat/mcp-composer-button.tsx+++ b/studio/frontend/src/features/chat/mcp-composer-button.tsx@@ -1,13 +1,10 @@// SPDX-License-Identifier: AGPL-3.0-only// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0-import {- Cancel01Icon,- McpServerIcon,- Tick02Icon,-} from "@hugeicons/core-free-icons";+import { McpServerIcon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";-import { useCallback, useEffect, useState } from "react";+import { CheckIcon } from "lucide-react";+import { type FC, useCallback, useEffect, useState } from "react";import { toast } from "sonner";import {@@ -23,7 +20,6 @@ import {TooltipContent,TooltipTrigger,} from "@/components/ui/tooltip";-import { cn } from "@/lib/utils";import {type McpServerConfig,@@ -34,6 +30,23 @@ import {import { ChatMcpServersDialog } from "./chat-mcp-servers-dialog";import { useChatRuntimeStore } from "./stores/chat-runtime-store";+// Matches the Thinking pill chevron so the affordance reads the same.+const ArrowDownStandardIcon: FC<{ className?: string }> = ({ className }) => (+ <svg+ className={className}+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth={1.5}+ strokeLinecap="round"+ strokeLinejoin="round"+ xmlns="http://www.w3.org/2000/svg"+ aria-hidden={true}+ >+ <path d="M5.99977 9.00005L11.9998 15L17.9998 9" />+ </svg>+);+type McpPreset = {id: string;displayName: string; // stored row name@@ -76,7 +89,11 @@ function normalizeMcpUrl(url: string): string {// Static, so it is not rebuilt on every render.const PRESET_URLS = new Set(MCP_PRESETS.map((p) => normalizeMcpUrl(p.url)));-export function McpComposerButton() {+export function McpComposerButton({+ side = "bottom",+}: {+ side?: "top" | "bottom";+} = {}) {const modelLoaded = useChatRuntimeStore((s) => !!s.params.checkpoint && !s.modelLoading,);@@ -93,32 +110,20 @@ export function McpComposerButton() {const [pendingUrl, setPendingUrl] = useState<string | null>(null);const [hintKey, setHintKey] = useState<string | null>(null);- // mcp_enabled only applies on the local tool-capable send path; grey out otherwise.- const usable = modelLoaded && supportsTools;-- // Keep the per-chat flag in step with whether any server is enabled. Reads the- // store directly so the callback stays stable (no refetch loop on mount).- const reconcileFlag = useCallback(- (rows: McpServerConfig[]) => {- const anyEnabled = rows.some((s) => s.is_enabled);- const current = useChatRuntimeStore.getState().mcpEnabledForChat;- if (anyEnabled && !current) setMcpEnabledForChat(true);- else if (!anyEnabled && current) setMcpEnabledForChat(false);- },- [setMcpEnabledForChat],- );+ // Grey out only when a loaded model lacks tool support; with no model yet MCP+ // can still be pre-selected, matching the other composer tools.+ const usable = !modelLoaded || supportsTools;const refresh = useCallback(async () => {try {const rows = await listMcpServers();setServers(rows);- reconcileFlag(rows);} catch {// Keep prior state if the list call fails.}- }, [reconcileFlag]);+ }, []);- // Initial load reconciles the pill with already-enabled servers (also on open).+ // Load the server list on mount and whenever the menu opens.useEffect(() => {void refresh();}, [refresh]);@@ -206,27 +211,12 @@ export function McpComposerButton() {? () => setHintKey((k) => (k === opts.key ? null : k)): undefined}- className={cn(- "group/mcp relative flex items-center justify-between gap-2",- opts.enabled &&- "bg-emerald-500/10 data-[highlighted]:bg-emerald-500/20",- )}+ className={+ opts.enabled ? "relative text-primary font-medium" : "relative"+ }><span className="truncate">{opts.label}</span>- {opts.enabled ? (- <span className="flex size-4 shrink-0 items-center justify-center text-emerald-600 dark:text-emerald-400">- <HugeiconsIcon- icon={Tick02Icon}- className="size-4 group-data-[highlighted]/mcp:hidden"- strokeWidth={2}- />- <HugeiconsIcon- icon={Cancel01Icon}- className="hidden size-4 text-foreground group-data-[highlighted]/mcp:block"- strokeWidth={2}- />- </span>- ) : null}+ {opts.enabled ? <CheckIcon className="ml-auto" /> : null}{opts.hint ? (<Tooltip open={hintKey === opts.key}><TooltipTrigger asChild={true}>@@ -260,28 +250,21 @@ export function McpComposerButton() {><HugeiconsIconicon={McpServerIcon}- className="size-3.5"+ className="size-[15px]"strokeWidth={2}/><span>MCP</span>+ <ArrowDownStandardIcon className="composer-pill-caret size-[15px]" /></button></DropdownMenuTrigger>- <DropdownMenuContent align="start" className="w-64">- <div className="flex items-center justify-between pr-1">- <DropdownMenuLabel>MCP Servers</DropdownMenuLabel>- <button- type="button"- aria-label="Close"- onClick={() => setMenuOpen(false)}- className="rounded-md p-1 text-muted-foreground hover:bg-accent hover:text-foreground"- >- <HugeiconsIcon- icon={Cancel01Icon}- className="size-3.5"- strokeWidth={2}- />- </button>- </div>+ <DropdownMenuContent+ side={side}+ align="start"+ sideOffset={2}+ avoidCollisions={true}+ className="unsloth-plus-menu mcp-menu w-[232px]"+ >+ <DropdownMenuLabel>MCP Servers</DropdownMenuLabel>{MCP_PRESETS.map((preset) => {const norm = normalizeMcpUrl(preset.url);return renderRow({@@ -330,7 +313,7 @@ export function McpComposerButton() {><HugeiconsIconicon={McpServerIcon}- className="size-3.5"+ className="size-[15px]"strokeWidth={2}/><span>MCP</span>diff --git a/studio/frontend/src/features/chat/runtime-provider.tsx b/studio/frontend/src/features/chat/runtime-provider.tsxindex 32b591d8808..979d28a952d 100644--- a/studio/frontend/src/features/chat/runtime-provider.tsx+++ b/studio/frontend/src/features/chat/runtime-provider.tsx@@ -14,7 +14,6 @@ import {type PendingAttachment,type ThreadHistoryAdapter,type ThreadMessage,- WebSpeechDictationAdapter,type unstable_RemoteThreadListAdapter,useAui,useAuiEvent,@@ -34,6 +33,7 @@ import {} from "react";import { extractText, getDocumentProxy } from "unpdf";import { toast } from "sonner";+import { StudioWebSpeechDictationAdapter } from "./adapters/studio-web-speech-dictation-adapter";import { createOpenAIStreamAdapter } from "./api/chat-adapter";import {loadConnectionsEnabled,@@ -190,7 +190,21 @@ class PDFAttachmentAdapter implements AttachmentAdapter {}class TextAttachmentAdapter implements AttachmentAdapter {- accept = "text/plain,text/markdown,text/csv,text/xml,text/json,text/css";+ // MIME is unreliable for source files, so also match by extension+ // (assistant-ui's fileMatchesAccept supports ".ext" entries). Covers+ // svg, code, config and other plain-text formats; html keeps its own+ // adapter below.+ accept = [+ "text/plain,text/markdown,text/csv,text/xml,text/json,text/css",+ "application/json,application/xml,image/svg+xml",+ ".txt,.text,.log,.md,.markdown,.mdx,.rst,.csv,.tsv",+ ".json,.jsonl,.ndjson,.xml,.yaml,.yml,.toml,.ini,.cfg,.conf,.env,.properties",+ ".css,.scss,.sass,.less,.svg",+ ".js,.jsx,.mjs,.cjs,.ts,.tsx,.py,.pyi,.ipynb,.rb,.php,.go,.rs,.java,.kt,.kts,.scala,.swift",+ ".c,.h,.cc,.cpp,.hpp,.cxx,.cs,.m,.mm",+ ".sh,.bash,.zsh,.fish,.ps1,.bat,.lua,.pl,.pm,.r,.jl,.dart,.vue,.svelte,.astro",+ ".sql,.graphql,.gql,.proto,.tf,.tfvars,.gradle,.dockerfile,.makefile,.cmake,.diff,.patch",+ ].join(",");async add({ file }: { file: File }): Promise<PendingAttachment> {return {@@ -962,8 +976,8 @@ function useStudioRuntimeAdapters(const dictation = useMemo(() =>- WebSpeechDictationAdapter.isSupported()- ? new WebSpeechDictationAdapter()+ StudioWebSpeechDictationAdapter.isSupported()+ ? new StudioWebSpeechDictationAdapter(): undefined,[],);diff --git a/studio/frontend/src/features/chat/shared-composer.tsx b/studio/frontend/src/features/chat/shared-composer.tsxindex 0165a3930ed..1717152ba04 100644--- a/studio/frontend/src/features/chat/shared-composer.tsx+++ b/studio/frontend/src/features/chat/shared-composer.tsx@@ -2,7 +2,6 @@// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";-import { CodeToggleIcon } from "@/components/assistant-ui/code-toggle-icon";import {thinkEffortAriaLabel,thinkToggleAriaLabel,@@ -13,6 +12,11 @@ import {DropdownMenu,DropdownMenuContent,DropdownMenuItem,+ DropdownMenuLabel,+ DropdownMenuSeparator,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";import { applyQwenThinkingParams } from "@/features/chat/utils/qwen-params";@@ -23,27 +27,36 @@ import { getImageInputUnavailableReason } from "./utils/image-input-support";import { useAui } from "@assistant-ui/react";import {ArrowUpIcon,- DownloadIcon,- FileTextIcon,+ CheckIcon,+ Columns2Icon,GlobeIcon,HeadphonesIcon,- LightbulbIcon,- LightbulbOffIcon,- MicIcon,PlusIcon,SquareIcon,XIcon,} from "lucide-react";-import { Image03Icon } from "@hugeicons/core-free-icons";+import {+ AttachmentIcon,+ CodeIcon,+ Download01Icon,+ Folder01Icon,+ FolderAddIcon,+ Image03Icon,+ McpServerIcon,+ PencilRulerIcon,+} from "@hugeicons/core-free-icons";+import { useNavigate } from "@tanstack/react-router";import { HugeiconsIcon } from "@hugeicons/react";import { toast } from "@/lib/toast";+import { McpComposerButton } from "./mcp-composer-button";+import { NewProjectDialog } from "./components/new-project-dialog";+import { useChatProjects } from "./hooks/use-chat-projects";import { loadModel, validateModel } from "./api/chat-api";import {parseExternalModelId,providerTypeSupportsVision,} from "./external-providers";import { useExternalProvidersStore } from "./stores/external-providers-store";-import { McpComposerButton } from "./mcp-composer-button";import {type ReasoningEffort,useChatRuntimeStore,@@ -52,11 +65,11 @@ import {getExternalReasoningCapabilities,providerSupportsBuiltinCodeExecution,providerSupportsBuiltinImageGeneration,- providerSupportsBuiltinWebSearch,providerSupportsBuiltinWebFetch,} from "./provider-capabilities";import {type CompositionEvent,+ type FC,type KeyboardEvent,type MutableRefObject,type ReactElement,@@ -77,9 +90,9 @@ export type CompareMessagePart =export interface CompareHandle {append: (content: CompareMessagePart[]) => void;/** Append a user message without triggering generation. */- appendMessage: (content: CompareMessagePart[]) => Promise<string | null>;+ appendMessage: (content: CompareMessagePart[]) => void;/** Trigger generation on the current thread (after appendMessage). */- startRun: (parentId?: string | null) => void;+ startRun: () => void;cancel: () => void;isRunning: () => boolean;/** Returns a promise that resolves when the current or next run finishes. */@@ -88,7 +101,49 @@ export interface CompareHandle {const IMAGE_ACCEPT = "image/jpeg,image/png,image/webp,image/gif";const MAX_IMAGE_SIZE = 20 * 1024 * 1024;-const COMPARE_APPEND_MESSAGE_TIMEOUT_MS = 10_000;++// Inlined to avoid a new icon dependency. Kept in sync with the main composer.+const ArrowDownStandardIcon: FC<{ className?: string }> = ({ className }) => (+ <svg+ className={className}+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth={1.5}+ strokeLinecap="round"+ strokeLinejoin="round"+ xmlns="http://www.w3.org/2000/svg"+ aria-hidden={true}+ >+ <path d="M5.99977 9.00005L11.9998 15L17.9998 9" />+ </svg>+);++const MicIcon: FC<{ className?: string }> = ({ className }) => (+ <svg+ className={className}+ viewBox="0 0 256 256"+ fill="currentColor"+ xmlns="http://www.w3.org/2000/svg"+ aria-hidden={true}+ >+ <path d="M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V232a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z" />+ </svg>+);++const BulbIcon: FC<{ className?: string }> = ({ className }) => (+ <svg+ className={className}+ viewBox="-10.24 -10.24 1044.48 1044.48"+ fill="currentColor"+ stroke="currentColor"+ strokeWidth={16.384}+ xmlns="http://www.w3.org/2000/svg"+ aria-hidden={true}+ >+ <path d="M511.984 0c-198.032 0-353.12 161.104-353.12 359.136 0 149.2 73.28 220.256 131.185 272.128 37.28 33.424 62.368 53.552 62.368 78.352v54.255c0 1.392.193 2.752.368 4.128h-.72v92.624c.016 97.712 63.2 163.376 161.072 163.376 94.464 0 158.944-65.664 158.944-163.376V768h-.928c.176-1.376.416-2.736.416-4.128v-54.255c0-37.76 28.032-60.592 70.528-97.696 57.504-50.208 123.023-112.688 123.023-252.784C865.136 161.104 710.016 0 511.983 0zm-1.215 960c-59.904 0-94.689-37.152-94.689-99.376l-.463-42.672C438.64 825.824 470 832 512 832c41.424 0 72.848-6.624 96.08-14.768v43.392c0 63.152-35.247 99.376-97.312 99.376zm189.248-396.288c-43.472 37.968-92.433 77.216-92.433 145.904v40.432c-15.183 8.48-43.183 18.56-96.127 18.56-55.569 0-81.92-9.856-95.024-17.473V709.6c0-54.608-42.688-89.297-83.68-126.017-54.32-48.672-109.873-103.84-109.873-224.464-.015-162.72 126.385-295.12 289.104-295.12 162.752 0 289.152 132.4 289.152 295.137 0 111.024-48.463 158.576-101.12 204.576z" />+ </svg>+);function isNativeComposing(event: Event) {return "isComposing" in event && (event as InputEvent).isComposing === true;@@ -232,7 +287,6 @@ export function RegisterCompareHandle({}): ReactElement | null {const handlesRef = useContext(CompareHandlesContext);const aui = useAui();- const pendingAppendWaitersRef = useRef<Set<() => void>>(new Set());useEffect(() => {if (!handlesRef) {@@ -245,76 +299,19 @@ export function RegisterCompareHandle({aui.thread().append({ role: "user", content, createdAt: new Date() } as never),- appendMessage: (content) => {- const thread = aui.thread();- const beforeIds = new Set(- thread.getState().messages.map((message) => message.id),- );- thread.append({- role: "user",- content,- createdAt: new Date(),- startRun: false,- } as never);-- const findAppendedUserMessageId = () => {- const messages = thread.getState().messages;- for (let index = messages.length - 1; index >= 0; index -= 1) {- const message = messages[index];- if (beforeIds.has(message.id) || message.role !== "user") {- continue;- }- return message.id;- }- return null;- };-- const appendedId = findAppendedUserMessageId();- if (appendedId) {- return Promise.resolve(appendedId);- }-- return new Promise<string | null>((resolve) => {- const startedAt = Date.now();- let settled = false;- let timer: number | null = null;- let cancel: (() => void) | null = null;- const cleanup = () => {- if (timer !== null) {- window.clearTimeout(timer);- timer = null;- }- if (cancel) {- pendingAppendWaitersRef.current.delete(cancel);- }- };- const finish = (messageId: string | null) => {- if (settled) return;- settled = true;- cleanup();- resolve(messageId);- };- cancel = () => finish(null);- const poll = () => {- timer = null;- const messageId = findAppendedUserMessageId();- if (- messageId ||- Date.now() - startedAt >= COMPARE_APPEND_MESSAGE_TIMEOUT_MS- ) {- finish(messageId);- return;- }- timer = window.setTimeout(poll, 16);- };- pendingAppendWaitersRef.current.add(cancel);- timer = window.setTimeout(poll, 0);- });- },- startRun: (parentId) => {+ appendMessage: (content) =>+ aui+ .thread()+ .append({+ role: "user",+ content,+ createdAt: new Date(),+ startRun: false,+ } as never),+ startRun: () => {const msgs = aui.thread().getState().messages;- const fallbackId = msgs.length > 0 ? msgs[msgs.length - 1].id : null;- aui.thread().startRun({ parentId: parentId ?? fallbackId });+ const lastId = msgs.length > 0 ? msgs[msgs.length - 1].id : null;+ aui.thread().startRun({ parentId: lastId });},cancel: () => aui.thread().cancelRun(),isRunning: () => aui.thread().getState().isRunning,@@ -332,10 +329,6 @@ export function RegisterCompareHandle({}),};return () => {- for (const cancel of pendingAppendWaitersRef.current) {- cancel();- }- pendingAppendWaitersRef.current.clear();delete currentHandles[name];};}, [handlesRef, name, aui]);@@ -381,15 +374,37 @@ type CompareModelSelection = {ggufVariant?: string;};+// Tool icon plus an X overlay the CSS reveals on hover when the pill is active.+function PillGlyph({ children }: { children: ReactNode }) {+ return (+ <span className="composer-pill-glyph">+ {children}+ <XIcon className="composer-pill-x" />+ </span>+ );+}+export function SharedComposer({handlesRef,model1,model2,+ onExitCompare,}: {handlesRef: CompareHandles;model1?: CompareModelSelection;model2?: CompareModelSelection;+ onExitCompare?: () => void;}): ReactElement {+ const navigate = useNavigate();+ // Exit compare. Uses the parent's restore handler, or a fresh chat when+ // compare was opened by direct URL.+ const handleExitCompare = useCallback(() => {+ if (onExitCompare) {+ onExitCompare();+ return;+ }+ navigate({ to: "/chat" });+ }, [navigate, onExitCompare]);const [text, setText] = useState("");const [running, setRunning] = useState(false);const [comparing, setComparing] = useState(false);@@ -400,6 +415,7 @@ export function SharedComposer({} | null>(null);const [dragging, setDragging] = useState(false);const [isComposing, setIsComposing] = useState(false);+ const [newProjectOpen, setNewProjectOpen] = useState(false);const textareaRef = useRef<HTMLTextAreaElement>(null);const composingRef = useRef(false);const stuckImeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);@@ -452,6 +468,19 @@ export function SharedComposer({);const artifactsEnabled = useChatRuntimeStore((s) => s.artifactsEnabled);const setArtifactsEnabled = useChatRuntimeStore((s) => s.setArtifactsEnabled);+ const mcpEnabledForChat = useChatRuntimeStore((s) => s.mcpEnabledForChat);+ const setMcpEnabledForChat = useChatRuntimeStore(+ (s) => s.setMcpEnabledForChat,+ );+ // Three most recently updated projects for the quick-access submenu.+ const { projects } = useChatProjects();+ const recentProjects = [...projects]+ .sort((a, b) => b.updatedAt - a.updatedAt)+ .slice(0, 3);+ const openProject = (projectId: string) => {+ useChatRuntimeStore.getState().setActiveProjectId(projectId);+ navigate({ to: "/chat", search: { project: projectId } });+ };const webFetchToolsEnabled = useChatRuntimeStore((s) => s.webFetchToolsEnabled,);@@ -530,6 +559,10 @@ export function SharedComposer({const reasoningDisabled = !modelLoaded || !effectiveSupportsReasoning;const showReasoningControl =effectiveSupportsReasoning || effectiveReasoningAlwaysOn;+ const isEffort = effectiveReasoningStyle === "reasoning_effort";+ const thinkingActiveLook = isEffort+ ? reasoningLockedOn || (effectiveReasoningVisualEnabled && !reasoningDisabled)+ : reasoningLockedOn || (effectiveReasoningEnabled && !reasoningDisabled);// Two-pill gating: Search pill lights up when the runtime has either// a local tool runtime (supportsTools, gives us our Code/python + local// web_search) OR a server-side web_search the provider runs for us@@ -569,24 +602,34 @@ export function SharedComposer({// and gate strictly on the provider builtin support.const isGeminiImageTier =isExternalGemini && supportsBuiltinImageGeneration;+ // Disable only when a loaded model lacks the capability; with no model the+ // tool can still be pre-selected and reflected, matching the + menu.const searchDisabled =- !modelLoaded ||+ modelLoaded &&(isGeminiImageTier? !supportsBuiltinWebSearch: !(supportsTools || supportsBuiltinWebSearch));const codeDisabled =- !modelLoaded ||- (isGeminiImageTier- ? true- : !(supportsTools || supportsBuiltinCodeExecution)) ||+ (modelLoaded &&+ (isGeminiImageTier+ ? true+ : !(supportsTools || supportsBuiltinCodeExecution))) ||imageModeDisablesCode;// Images pill is only ever lit on OpenAI cloud's Responses-API models// and Gemini Nano Banana family. No local tool runtime fallback.const showImagePill = supportsBuiltinImageGeneration;- const artifactDisabled = !modelLoaded;// Fetch pill: Anthropic-only (web_fetch_20250910 / web_fetch_20260209).const webFetchDisabled = !modelLoaded || !supportsBuiltinWebFetch;const showWebFetchPill = supportsBuiltinWebFetch;+ // With more than 4 pills showing, collapse them to icons only to cut clutter.+ // Compare, Search and Code always show; the rest are conditional.+ const pillsCompact =+ 3 ++ (showImagePill ? 1 : 0) ++ (showWebFetchPill ? 1 : 0) ++ (artifactsEnabled ? 1 : 0) ++ (mcpEnabledForChat ? 1 : 0) >+ 4;// Backwards-compatible alias for any other call site that may still// reference `toolsDisabled` (rare; both pills used it before).const toolsDisabled = codeDisabled;@@ -770,8 +813,6 @@ export function SharedComposer({: null;function modelDisplayName(id: string): string {- const external = parseExternalModelId(id);- if (external) return external.modelId;const parts = id.split("/");return parts[parts.length - 1] || id;}@@ -780,76 +821,6 @@ export function SharedComposer({async function ensureModelLoaded(sel: CompareModelSelection,): Promise<string> {- const external = parseExternalModelId(sel.id);- if (external) {- const externalStore = useExternalProvidersStore.getState();- if (!externalStore.connectionsEnabled) {- throw new Error(- "Connections are disabled. Turn on Enable connections in Settings -> Connections to use hosted models.",- );- }- const provider = externalStore.providers.find(- (p) => p.id === external.providerId,- );- if (!provider) {- throw new Error(- "Connection not found. Open Settings -> Connections and add it again.",- );- }-- const reasoningCaps = getExternalReasoningCapabilities(- provider.providerType,- external.modelId,- {- isReasoningProvider: provider.isReasoningModel === true,- baseUrl: provider.baseUrl ?? null,- },- );- const supportsBuiltinWebSearch = providerSupportsBuiltinWebSearch(- provider.providerType,- external.modelId,- provider.baseUrl,- );- const supportsBuiltinCodeExecution =- providerSupportsBuiltinCodeExecution(- provider.providerType,- external.modelId,- provider.baseUrl,- );- const supportsBuiltinImageGeneration =- providerSupportsBuiltinImageGeneration(- provider.providerType,- external.modelId,- provider.baseUrl,- );- const supportsBuiltinWebFetch = providerSupportsBuiltinWebFetch(- provider.providerType,- );- const currentStore = useChatRuntimeStore.getState();- currentStore.setCheckpoint(sel.id, null);- useChatRuntimeStore.setState({- activeGgufVariant: null,- ggufContextLength: null,- ggufMaxContextLength: null,- ggufNativeContextLength: null,- activeNativePathToken: null,- supportsReasoning: reasoningCaps.supportsReasoning,- reasoningAlwaysOn: reasoningCaps.reasoningAlwaysOn,- reasoningStyle: reasoningCaps.reasoningStyle,- supportsReasoningOff: reasoningCaps.supportsReasoningOff,- reasoningEffortLevels: reasoningCaps.reasoningEffortLevels,- supportsPreserveThinking: false,- supportsTools: false,- supportsBuiltinWebSearch,- supportsBuiltinCodeExecution,- supportsBuiltinImageGeneration,- supportsBuiltinWebFetch,- loadedIsMultimodal:- providerTypeSupportsVision(provider.providerType) === true,- });- return "external";- }-const currentStore = useChatRuntimeStore.getState();const isAlreadyActive =currentStore.params.checkpoint === sel.id &&@@ -932,19 +903,9 @@ export function SharedComposer({const handle1 = handlesRef.current["model1"];const handle2 = handlesRef.current["model2"];- // Show user messages immediately on both sides and keep the ids- // so delayed model loads can start the run from the intended turn.- const [parentId1, parentId2] = await Promise.all([- handle1 ? handle1.appendMessage(content) : Promise.resolve(null),- handle2 ? handle2.appendMessage(content) : Promise.resolve(null),- ]);- if ((handle1 && !parentId1) || (handle2 && !parentId2)) {- toast.error("Compare failed", {- description:- "The prompt could not be added to both compare panes. Try sending it again.",- });- return;- }+ // Show user messages immediately on both sides+ if (handle1) handle1.appendMessage(content);+ if (handle2) handle2.appendMessage(content);const name1 = model1?.id ? modelDisplayName(model1.id) : "";const name2 = model2?.id ? modelDisplayName(model2.id) : "";@@ -966,7 +927,7 @@ export function SharedComposer({duration: Infinity,});const done = handle1.waitForRunEnd();- handle1.startRun(parentId1);+ handle1.startRun();await done;}@@ -989,7 +950,7 @@ export function SharedComposer({duration: Infinity,});const done = handle2.waitForRunEnd();- handle2.startRun(parentId2);+ handle2.startRun();await done;}@@ -1050,7 +1011,7 @@ export function SharedComposer({return (<div- className={`chat-composer-surface ${dragging ? "border-ring bg-accent/50" : ""}`}+ className="chat-composer-surface"onDragOver={(e) => {if (isTauri) return;e.preventDefault();@@ -1066,6 +1027,17 @@ export function SharedComposer({addFiles(e.dataTransfer.files);}}>+ {/* Gemini-style drop affordance, mirrored from the single composer. */}+ <div+ className={`pointer-events-none absolute inset-0 z-20 flex flex-col items-center justify-center gap-1 overflow-hidden rounded-[32px] bg-background/90 backdrop-blur-sm transition-opacity duration-150 dark:bg-card/90 ${dragging ? "opacity-100" : "opacity-0"}`}+ >+ <HugeiconsIcon+ icon={AttachmentIcon}+ strokeWidth={2}+ className="size-6 text-primary"+ />+ <span className="text-sm font-medium text-primary">Drop files here</span>+ </div>{(pendingImages.length > 0 || pendingAudio) && (<div className="mb-2 flex w-full flex-row flex-wrap items-center gap-2 px-1.5 pt-0.5 pb-1">{pendingImages.map(({ id, file }) => (@@ -1126,7 +1098,10 @@ export function SharedComposer({dir="auto"/><div className="composer-action-wrapper">- <div className="flex items-center gap-0.5">+ <div+ className="flex items-center gap-0.5"+ data-pill-compact={pillsCompact ? "true" : undefined}+ ><inputref={fileInputRef}type="file"@@ -1138,209 +1113,189 @@ export function SharedComposer({e.target.value = "";}}/>- <TooltipIconButton- tooltip="Add Attachment"- side="bottom"- variant="ghost"- size="icon"- className="size-8.5 rounded-full p-1 font-semibold text-xs hover:bg-muted-foreground/15 dark:hover:bg-muted-foreground/30"- onClick={() => {- // The picker accepts both image and audio. Don't gate the- // button on image-availability — addFiles still filters- // image files per-file when the loaded model can't take- // them, while audio attach always works.- fileInputRef.current?.click();+ <input+ ref={audioInputRef}+ type="file"+ accept={AUDIO_ACCEPT}+ className="hidden"+ onChange={(e) => {+ addFiles(e.target.files);+ e.target.value = "";}}- aria-label="Add Attachment"- >- <PlusIcon className="size-5 stroke-[1.5px]" />- </TooltipIconButton>- {activeModel?.hasAudioInput && (- <>- <input- ref={audioInputRef}- type="file"- accept={AUDIO_ACCEPT}- className="hidden"- onChange={(e) => {- addFiles(e.target.files);- e.target.value = "";- }}- />- <TooltipIconButton- tooltip="Upload audio"- side="bottom"- variant="ghost"- size="icon"- className="size-8.5 rounded-full p-1 text-muted-foreground hover:bg-muted-foreground/15"- onClick={() => audioInputRef.current?.click()}- aria-label="Upload audio"- >- <HeadphonesIcon className="size-4.5 stroke-[1.5px]" />- </TooltipIconButton>- </>- )}- {showReasoningControl ? (- effectiveReasoningStyle === "reasoning_effort" ? (- <DropdownMenu>- <DropdownMenuTrigger asChild={true}>- <button- type="button"- disabled={reasoningDisabled}- className={cn(- "flex items-center gap-1.5 rounded-full px-1.5 py-1.5 text-[13px] font-medium text-muted-foreground/70 transition-colors",- reasoningDisabled- ? "cursor-not-allowed opacity-40"- : effectiveReasoningVisualEnabled- ? "text-primary hover:bg-primary/10 dark:hover:bg-white/[0.08]"- : "hover:bg-primary/10 dark:hover:bg-white/[0.08]",- )}- aria-label={thinkEffortAriaLabel({- modelLoaded,- reasoningDisabled,- reasoningEffort,- })}- >- {effectiveReasoningVisualEnabled ? (- <LightbulbIcon className="size-3.5" />- ) : (- <LightbulbOffIcon className="size-3.5" />- )}- <span>- Think:{" "}- {effectiveReasoningVisualEnabled- ? formatReasoningEffortLabel(- reasoningEffort,- externalSelection?.modelId,- )- : formatReasoningDisabledLabel(- effectiveSupportsReasoningOff,- isExternalOpenAIReasoning,- checkpoint,- )}- </span>- </button>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- {effectiveSupportsReasoningOff && (- <DropdownMenuItem- onSelect={() => {- setReasoningEnabled(false);- applyQwenThinkingParams(false);- }}- >- {formatReasoningDisabledLabel(- effectiveSupportsReasoningOff,- isExternalOpenAIReasoning,- checkpoint,- )}- {!effectiveReasoningVisualEnabled ? " \u2713" : ""}- </DropdownMenuItem>- )}- {effectiveReasoningEffortLevels- .filter((level) => level !== "none")- .map((level) => (- <DropdownMenuItem- key={level}- onSelect={() => {- setReasoningEffort(level);- setReasoningEnabled(true);- applyQwenThinkingParams(true);- // Mutual exclusion: turning thinking on for a- // Kimi model forces the web_search builtin off.- if (isKimiExternal && toolsEnabled) {- setToolsEnabled(false, { persist: false });- }- }}- >- {formatReasoningEffortLabel(- level,- externalSelection?.modelId,- )}- {effectiveReasoningVisualEnabled &&- reasoningEffort === level- ? " \u2713"- : ""}- </DropdownMenuItem>- ))}- </DropdownMenuContent>- </DropdownMenu>- ) : (+ />+ <NewProjectDialog+ open={newProjectOpen}+ onOpenChange={setNewProjectOpen}+ />+ {/* Same + side menu as the single-chat composer (ComposerToolsMenu),+ wired to the compare composer's own file/audio inputs and tools. */}+ <DropdownMenu>+ <DropdownMenuTrigger asChild={true}><buttontype="button"- disabled={reasoningDisabled || reasoningLockedOn}- aria-disabled={reasoningDisabled || reasoningLockedOn}- title={- reasoningLockedOn- ? "This model requires reasoning to stay on."+ aria-label="Tools and attachments"+ className="unsloth-composer-plus"+ >+ <PlusIcon className="size-[22px] stroke-[1.75px]" />+ </button>+ </DropdownMenuTrigger>+ <DropdownMenuContent+ side="top"+ align="start"+ sideOffset={2}+ avoidCollisions={true}+ className="unsloth-plus-menu w-[212px]"+ onCloseAutoFocus={(event) => event.preventDefault()}+ >+ <DropdownMenuItem onSelect={() => fileInputRef.current?.click()}>+ <HugeiconsIcon icon={AttachmentIcon} strokeWidth={2} />+ Add photos & files+ </DropdownMenuItem>+ {activeModel?.hasAudioInput && (+ <DropdownMenuItem+ onSelect={() => audioInputRef.current?.click()}+ >+ <HeadphonesIcon />+ Upload audio+ </DropdownMenuItem>+ )}+ <DropdownMenuItem+ disabled={searchDisabled}+ className={+ toolsEnabled && !searchDisabled+ ? "text-primary font-medium": undefined}- onClick={() => {- if (reasoningLockedOn) return;- const next = !reasoningEnabled;- setReasoningEnabled(next);- applyQwenThinkingParams(next);- // Mutual exclusion: Kimi's $web_search builtin- // requires thinking off, so turning thinking on flips- // the Search pill off (and vice versa).- if (isKimiExternal && next && toolsEnabled) {- setToolsEnabled(false, { persist: false });+ onSelect={() => {+ const next = !toolsEnabled;+ setToolsEnabled(next);+ // Mirror the Search pill: Kimi forbids search + thinking together.+ if (isKimiExternal) {+ setReasoningEnabled(!next, { persist: false });+ applyQwenThinkingParams(!next);}}}- className={cn(- "flex items-center gap-1.5 rounded-full px-1.5 py-1.5 text-[13px] font-medium text-muted-foreground/70 transition-colors",- reasoningLockedOn- ? "cursor-not-allowed text-primary"- : reasoningDisabled- ? "cursor-not-allowed opacity-40"- : effectiveReasoningEnabled- ? "cursor-pointer text-primary hover:bg-primary/10 dark:hover:bg-white/[0.08]"- : "cursor-pointer hover:bg-primary/10 dark:hover:bg-white/[0.08]",- )}- aria-label={thinkToggleAriaLabel({- reasoningLockedOn,- modelLoaded,- reasoningDisabled,- effectiveReasoningEnabled,- })}>- {reasoningLockedOn ||- (effectiveReasoningEnabled && !reasoningDisabled) ? (- <LightbulbIcon className="size-3.5" />- ) : (- <LightbulbOffIcon className="size-3.5" />- )}- <span>Think</span>- </button>- )- ) : null}- {supportsPreserveThinking && (- <button- type="button"- disabled={!modelLoaded}- onClick={() => setPreserveThinking(!preserveThinking)}- className={cn(- "flex items-center gap-1.5 rounded-full px-1.5 py-1.5 text-[13px] font-medium text-muted-foreground/70 transition-colors",- !modelLoaded- ? "cursor-not-allowed opacity-40"- : preserveThinking- ? "cursor-pointer text-primary hover:bg-primary/10 dark:hover:bg-white/[0.08]"- : "cursor-pointer hover:bg-primary/10 dark:hover:bg-white/[0.08]",- )}- aria-label={- preserveThinking- ? "Disable preserve think"- : "Enable preserve think"- }- >- {preserveThinking && modelLoaded ? (- <LightbulbIcon className="size-3.5" />- ) : (- <LightbulbOffIcon className="size-3.5" />+ <GlobeIcon />+ Web search+ {toolsEnabled && !searchDisabled ? (+ <CheckIcon className="ml-auto" />+ ) : null}+ </DropdownMenuItem>+ <DropdownMenuItem+ disabled={codeDisabled}+ className={+ codeToolsEnabled && !codeDisabled+ ? "text-primary font-medium"+ : undefined+ }+ onSelect={() => setCodeToolsEnabled(!codeToolsEnabled)}+ >+ <HugeiconsIcon+ icon={CodeIcon}+ strokeWidth={2}+ className="size-[1.175rem]!"+ />+ Code+ {codeToolsEnabled && !codeDisabled ? (+ <CheckIcon className="ml-auto" />+ ) : null}+ </DropdownMenuItem>+ {showImagePill && (+ <DropdownMenuItem+ disabled={imageDisabled}+ className={+ imageToolsEnabled && !imageDisabled+ ? "text-primary font-medium"+ : undefined+ }+ onSelect={() => setImageToolsEnabled(!imageToolsEnabled)}+ >+ <HugeiconsIcon icon={Image03Icon} strokeWidth={2} />+ Images+ {imageToolsEnabled && !imageDisabled ? (+ <CheckIcon className="ml-auto" />+ ) : null}+ </DropdownMenuItem>)}- <span>Preserve Think</span>- </button>- )}+ <DropdownMenuSeparator />+ <DropdownMenuItem+ className={+ artifactsEnabled ? "text-primary font-medium" : undefined+ }+ onSelect={() => setArtifactsEnabled(!artifactsEnabled)}+ >+ <HugeiconsIcon icon={PencilRulerIcon} strokeWidth={2} />+ Canvas+ {artifactsEnabled ? <CheckIcon className="ml-auto" /> : null}+ </DropdownMenuItem>+ <DropdownMenuItem+ disabled={!supportsTools}+ className={+ mcpEnabledForChat ? "text-primary font-medium" : undefined+ }+ onSelect={() => setMcpEnabledForChat(!mcpEnabledForChat)}+ >+ <HugeiconsIcon icon={McpServerIcon} strokeWidth={2} />+ MCP+ {mcpEnabledForChat ? <CheckIcon className="ml-auto" /> : null}+ </DropdownMenuItem>+ {/* RAG hidden temporarily */}+ {/* Always active: this menu only renders in compare mode.+ Ticked like Web search/Code; click toggles it off. */}+ <DropdownMenuItem+ className="text-primary font-medium"+ onSelect={handleExitCompare}+ >+ <Columns2Icon />+ Compare chat+ <CheckIcon className="ml-auto" />+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>+ <HugeiconsIcon icon={Folder01Icon} strokeWidth={2} />+ Projects+ </DropdownMenuSubTrigger>+ <DropdownMenuSubContent className="unsloth-plus-menu w-[200px]">+ <DropdownMenuItem onSelect={() => setNewProjectOpen(true)}>+ <HugeiconsIcon icon={FolderAddIcon} strokeWidth={2} />+ New project+ </DropdownMenuItem>+ <DropdownMenuLabel>Recents</DropdownMenuLabel>+ {recentProjects.length > 0 ? (+ recentProjects.map((project) => (+ <DropdownMenuItem+ key={project.id}+ onSelect={() => openProject(project.id)}+ >+ <HugeiconsIcon icon={Folder01Icon} strokeWidth={2} />+ <span className="truncate">{project.name}</span>+ </DropdownMenuItem>+ ))+ ) : (+ <DropdownMenuItem disabled={true}>+ No recent projects+ </DropdownMenuItem>+ )}+ </DropdownMenuSubContent>+ </DropdownMenuSub>+ </DropdownMenuContent>+ </DropdownMenu>+ {/* Active in compare mode; sits first. Click to exit back to single chat. */}+ <button+ type="button"+ onClick={handleExitCompare}+ className="composer-pill-btn"+ data-active="true"+ data-keep-label="true"+ aria-label="Exit compare chat"+ >+ <PillGlyph>+ <Columns2Icon className="size-[14px]" />+ </PillGlyph>+ <span>Compare</span>+ </button><buttontype="button"disabled={searchDisabled}@@ -1348,10 +1303,8 @@ export function SharedComposer({const next = !toolsEnabled;setToolsEnabled(next);// Kimi's $web_search builtin requires thinking=disabled- // (https://platform.kimi.ai/docs/guide/use-web-search).- // Toggle the Think pill off when Search comes on, and- // back on when Search goes off — mutual exclusion that- // mirrors what the backend enforces.+ // (https://platform.kimi.ai/docs/guide/use-web-search). Toggle+ // the Think pill off when Search is on, mirroring the backend.if (isKimiExternal) {setReasoningEnabled(!next, { persist: false });applyQwenThinkingParams(!next);@@ -1363,7 +1316,9 @@ export function SharedComposer({toolsEnabled ? "Disable web search" : "Enable web search"}>- <GlobeIcon className="size-3.5" />+ <PillGlyph>+ <GlobeIcon className="size-[15px]" />+ </PillGlyph><span>Search</span></button><button@@ -1378,7 +1333,13 @@ export function SharedComposer({: "Enable code execution"}>- <CodeToggleIcon className="size-3.5" />+ <PillGlyph>+ <HugeiconsIcon+ icon={CodeIcon}+ className="size-[18.5px]"+ strokeWidth={2}+ />+ </PillGlyph><span>Code</span></button>{showImagePill && (@@ -1396,30 +1357,16 @@ export function SharedComposer({: "Enable image generation"}>- <HugeiconsIcon- icon={Image03Icon}- className="size-3.5"- strokeWidth={2}- />+ <PillGlyph>+ <HugeiconsIcon+ icon={Image03Icon}+ className="size-3.5"+ strokeWidth={2}+ />+ </PillGlyph><span>Images</span></button>)}- <button- type="button"- disabled={artifactDisabled}- onClick={() => setArtifactsEnabled(!artifactsEnabled)}- className="composer-pill-btn"- data-active={- artifactsEnabled && !artifactDisabled ? "true" : "false"- }- aria-label={- artifactsEnabled ? "Disable artifacts" : "Enable artifacts"- }- >- <FileTextIcon className="size-3.5" />- <span>Artifacts</span>- </button>- <McpComposerButton />{showWebFetchPill && (<buttontype="button"@@ -1433,12 +1380,213 @@ export function SharedComposer({webFetchToolsEnabled ? "Disable URL fetch" : "Enable URL fetch"}>- <DownloadIcon className="size-3.5" />+ <PillGlyph>+ <HugeiconsIcon icon={Download01Icon} className="size-3.5" />+ </PillGlyph><span>Fetch</span></button>)}+ {artifactsEnabled ? (+ <button+ type="button"+ onClick={() => setArtifactsEnabled(false)}+ className="composer-pill-btn"+ data-active="true"+ aria-label="Disable canvas"+ >+ <PillGlyph>+ <HugeiconsIcon+ icon={PencilRulerIcon}+ className="size-[15.5px]"+ strokeWidth={2}+ />+ </PillGlyph>+ <span>Canvas</span>+ </button>+ ) : null}+ {mcpEnabledForChat ? <McpComposerButton side="top" /> : null}</div>- <div className="flex items-center gap-1">+ {/* mr-0.5 matches the send button inset from the edge in normal chat;+ gap-1.5 matches its control spacing. */}+ <div className="ml-auto mr-0.5 flex items-center gap-1.5">+ {showReasoningControl ? (+ isEffort || supportsPreserveThinking ? (+ <DropdownMenu>+ <DropdownMenuTrigger asChild={true}>+ <button+ type="button"+ disabled={reasoningDisabled}+ className="unsloth-thinking-pill"+ data-active={thinkingActiveLook ? "true" : "false"}+ aria-label={thinkEffortAriaLabel({+ modelLoaded,+ reasoningDisabled,+ reasoningEffort,+ })}+ >+ <BulbIcon className="size-[15.5px]" />+ {thinkingActiveLook ? (+ <span>+ {isEffort+ ? `Thinking · ${formatReasoningEffortLabel(+ reasoningEffort,+ externalSelection?.modelId,+ )}`+ : "Thinking"}+ </span>+ ) : null}+ <ArrowDownStandardIcon className="size-[15px]" />+ </button>+ </DropdownMenuTrigger>+ <DropdownMenuContent+ side="top"+ align="end"+ className="unsloth-plus-menu min-w-44"+ >+ {isEffort ? (+ <>+ {effectiveSupportsReasoningOff && (+ <DropdownMenuItem+ onSelect={() => {+ setReasoningEnabled(false);+ applyQwenThinkingParams(false);+ // Preserve thinking needs thinking on, so turn it off too.+ setPreserveThinking(false);+ }}+ >+ <CheckIcon+ className={cn(+ "unsloth-tick size-4",+ effectiveReasoningVisualEnabled && "opacity-0",+ )}+ />+ {formatReasoningDisabledLabel(+ effectiveSupportsReasoningOff,+ isExternalOpenAIReasoning,+ checkpoint,+ )}+ </DropdownMenuItem>+ )}+ {effectiveReasoningEffortLevels+ .filter((level) => level !== "none")+ .map((level) => (+ <DropdownMenuItem+ key={level}+ onSelect={() => {+ setReasoningEffort(level);+ setReasoningEnabled(true);+ applyQwenThinkingParams(true);+ // Mutual exclusion: turning thinking on for a+ // Kimi model forces the web_search builtin off.+ if (isKimiExternal && toolsEnabled) {+ setToolsEnabled(false, { persist: false });+ }+ }}+ >+ <CheckIcon+ className={cn(+ "unsloth-tick size-4",+ !(+ effectiveReasoningVisualEnabled &&+ reasoningEffort === level+ ) && "opacity-0",+ )}+ />+ {formatReasoningEffortLabel(+ level,+ externalSelection?.modelId,+ )}+ </DropdownMenuItem>+ ))}+ </>+ ) : (+ effectiveSupportsReasoningOff &&+ !reasoningLockedOn && (+ <DropdownMenuItem+ onSelect={() => {+ const next = !reasoningEnabled;+ setReasoningEnabled(next);+ applyQwenThinkingParams(next);+ // Preserve thinking cannot run without thinking.+ if (!next) setPreserveThinking(false);+ if (isKimiExternal && next && toolsEnabled) {+ setToolsEnabled(false, { persist: false });+ }+ }}+ >+ <CheckIcon+ className={cn(+ "unsloth-tick size-4",+ !effectiveReasoningEnabled && "opacity-0",+ )}+ />+ Thinking+ </DropdownMenuItem>+ )+ )}+ {supportsPreserveThinking && (+ <DropdownMenuItem+ disabled={!modelLoaded}+ onSelect={(e) => {+ e.preventDefault();+ const next = !preserveThinking;+ setPreserveThinking(next);+ // Preserve thinking requires thinking on.+ if (next) {+ setReasoningEnabled(true);+ applyQwenThinkingParams(true);+ }+ }}+ >+ <CheckIcon+ className={cn(+ "unsloth-tick size-4",+ !preserveThinking && "opacity-0",+ )}+ />+ Preserve thinking+ </DropdownMenuItem>+ )}+ </DropdownMenuContent>+ </DropdownMenu>+ ) : (+ <button+ type="button"+ disabled={reasoningDisabled || reasoningLockedOn}+ aria-disabled={reasoningDisabled || reasoningLockedOn}+ title={+ reasoningLockedOn+ ? "This model requires reasoning to stay on."+ : undefined+ }+ onClick={() => {+ if (reasoningLockedOn) return;+ const next = !reasoningEnabled;+ setReasoningEnabled(next);+ applyQwenThinkingParams(next);+ // Mutual exclusion: Kimi's $web_search builtin+ // requires thinking off, so turning thinking on flips+ // the Search pill off (and vice versa).+ if (isKimiExternal && next && toolsEnabled) {+ setToolsEnabled(false, { persist: false });+ }+ }}+ className="unsloth-thinking-pill"+ data-active={thinkingActiveLook ? "true" : "false"}+ aria-label={thinkToggleAriaLabel({+ reasoningLockedOn,+ modelLoaded,+ reasoningDisabled,+ effectiveReasoningEnabled,+ })}+ >+ <PillGlyph>+ <BulbIcon className="size-[15.5px]" />+ </PillGlyph>+ {thinkingActiveLook ? <span>Thinking</span> : null}+ </button>+ )+ ) : null}{dictationSupported && (<>{!isDictating ? (@@ -1473,7 +1621,7 @@ export function SharedComposer({type="button"variant="default"size="icon"- className="size-8 rounded-full"+ className="ml-1.5 size-8 rounded-full"onClick={stop}><SquareIcon className="size-3 fill-current" />@@ -1484,12 +1632,12 @@ export function SharedComposer({side="bottom"variant="default"size="icon"- className="size-8 rounded-full"+ className="ml-1.5 size-8 rounded-full"onClick={send}disabled={!canSend}aria-label="Send message">- <ArrowUpIcon className="size-4" />+ <ArrowUpIcon className="size-[22px] stroke-2" /></TooltipIconButton>)}</div>diff --git a/studio/frontend/src/features/chat/tour/steps.tsx b/studio/frontend/src/features/chat/tour/steps.tsxindex e222fdc8a08..e4f37685cc6 100644--- a/studio/frontend/src/features/chat/tour/steps.tsx+++ b/studio/frontend/src/features/chat/tour/steps.tsx@@ -9,7 +9,6 @@ export function buildChatTourSteps({closeModelSelector,openSettings,closeSettings,- openSidebar,enterCompare,exitCompare,}: {@@ -18,7 +17,6 @@ export function buildChatTourSteps({closeModelSelector: () => void;openSettings: () => void;closeSettings: () => void;- openSidebar: () => void;enterCompare: () => void;exitCompare: () => void;}): TourStep[] {@@ -64,33 +62,22 @@ export function buildChatTourSteps({];if (canCompare) {- steps.push(- {- id: "compare-btn",- target: "chat-compare",- title: "Compare mode",- body: (- <>- Compare any two models side-by-side.- Pick a different model for each side and see how they respond to the same prompt.- </>- ),- onEnter: openSidebar,- },- {- id: "compare-view",- target: "chat-compare-view",- title: "Side-by-side threads",- body: (- <>- Same prompt, 2 threads. If LoRA is worse than base, it’s usually- data formatting, too many epochs, or a bad checkpoint choice.- </>- ),- onEnter: enterCompare,- onExit: exitCompare,- },- );+ // Compare now lives in the + menu, so there is no sidebar button to anchor+ // to; the view step enters compare on its own and explains it.+ steps.push({+ id: "compare-view",+ target: "chat-compare-view",+ title: "Side-by-side threads",+ body: (+ <>+ Compare any two models side-by-side, available from the + menu. Same+ prompt, 2 threads. If LoRA is worse than base, it’s usually data+ formatting, too many epochs, or a bad checkpoint choice.+ </>+ ),+ onEnter: enterCompare,+ onExit: exitCompare,+ });}return steps;diff --git a/studio/frontend/src/features/profile/components/profile-personalization-panel.tsx b/studio/frontend/src/features/profile/components/profile-personalization-panel.tsxindex ed590f226e8..3b9b60e5dd6 100644--- a/studio/frontend/src/features/profile/components/profile-personalization-panel.tsx+++ b/studio/frontend/src/features/profile/components/profile-personalization-panel.tsx@@ -7,7 +7,8 @@ import { Label } from "@/components/ui/label";import { getAuthToken } from "@/features/auth";import { useT } from "@/i18n";import { toastError, toastSuccess } from "@/shared/toast";-import { Camera } from "lucide-react";+import { Camera01Icon } from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";import { useMemo, useRef, useState } from "react";import { decodeJwtSubject } from "../utils/jwt-subject";import { resizeImageFileToDataUrl } from "../utils/resize-image-file";@@ -117,10 +118,10 @@ export function ProfilePersonalizationPanel() {<buttontype="button"onClick={() => fileInputRef.current?.click()}- className="absolute right-0 bottom-0 -translate-x-[15.625%] -translate-y-[15.625%] flex size-8 items-center justify-center rounded-full border border-border bg-background text-foreground shadow-sm transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"+ className="absolute right-0 bottom-0 -translate-x-[15.625%] -translate-y-[15.625%] flex size-8 items-center justify-center rounded-full border border-border bg-background text-foreground shadow-[0_2px_8px_-2px_rgba(27,27,31,0.16)] transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"aria-label={t("settings.profile.changePicture")}>- <Camera className="size-3.5" strokeWidth={2} />+ <HugeiconsIcon icon={Camera01Icon} className="size-3.5" strokeWidth={2} /></button></div>diff --git a/studio/frontend/src/features/settings/settings-dialog.tsx b/studio/frontend/src/features/settings/settings-dialog.tsxindex b6f2463b680..a1048b202ea 100644--- a/studio/frontend/src/features/settings/settings-dialog.tsx+++ b/studio/frontend/src/features/settings/settings-dialog.tsx@@ -128,8 +128,10 @@ export function SettingsDialog() {// Cap at 820px but shrink to the viewport so we don't clip// on iPad-portrait widths (640-820px) where the fixed// `w-[820px]` overflows by 26px on each side.- "!max-w-[min(820px,calc(100vw-2rem))] h-[560px] w-[min(820px,calc(100vw-2rem))] p-0 overflow-hidden",- "shadow-border rounded-xl border-border",+ "settings-surface !max-w-[min(820px,calc(100vw-2rem))] h-[560px] w-[min(820px,calc(100vw-2rem))] p-0 overflow-hidden",+ // Soft shadow only, no outline ring. Pin --radius to the light value+ // so the corner rounding is the same in dark mode.+ "shadow-border rounded-xl ring-0 [--radius:1.1rem]","max-sm:h-dvh max-sm:w-dvw max-sm:!max-w-none max-sm:rounded-none",)}>@@ -138,7 +140,10 @@ export function SettingsDialog() {{t("settings.dialog.description")}</DialogDescription><div className="flex h-full min-h-0 max-sm:flex-col">- <aside className="font-heading flex w-[216px] shrink-0 flex-col border-r border-border bg-muted/20 p-2 max-sm:w-full max-sm:border-r-0 max-sm:border-b">+ <aside className="font-heading flex w-[216px] shrink-0 flex-col border-r border-border bg-muted/20 p-2 dark:border-r-0 max-sm:w-full max-sm:border-r-0 max-sm:border-b max-sm:border-border">+ <h2 className="pl-3 pr-2.5 pt-3.5 pb-3.5 text-[19px] font-semibold text-foreground max-sm:hidden">+ {t("settings.dialog.title")}+ </h2><nav className="flex flex-col gap-0.5 max-sm:flex-row max-sm:overflow-x-auto">{TABS.map((tab) => {const active = activeTab === tab.id;@@ -151,7 +156,7 @@ export function SettingsDialog() {type="button"onClick={() => setActiveTab(tab.id)}className={cn(- "relative flex h-[32px] items-center gap-2.5 rounded-[8px] px-2.5 text-[14.5px] leading-[19px] tracking-nav font-medium transition-colors",+ "relative flex h-[32px] items-center gap-2.5 rounded-[11px] pl-3 pr-2.5 text-[14.5px] leading-[19px] tracking-nav font-medium transition-colors","max-sm:shrink-0","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",active@@ -162,7 +167,7 @@ export function SettingsDialog() {{active && (<motion.spanlayoutId="settings-active-pill"- className="absolute inset-0 rounded-[8px] bg-[#ececec] dark:bg-[#2d2f33]"+ className="absolute inset-0 rounded-[11px] bg-[#ececec] dark:bg-[#2d2f33]"transition={reduced? { duration: 0 }@@ -198,12 +203,12 @@ export function SettingsDialog() {<buttontype="button"onClick={closeDialog}- className="absolute top-3 right-3 z-10 flex size-7 items-center justify-center rounded-[8px] text-[#383835] dark:text-[#c7c7c4] transition-colors hover:bg-[#ececec] dark:hover:bg-[#2d2f33] hover:text-black dark:hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ className="absolute top-3 right-3 z-10 flex size-7 items-center justify-center rounded-full text-[#383835] dark:text-[#c7c7c4] transition-colors hover:bg-[#ececec] dark:hover:bg-[#2d2f33] hover:text-black dark:hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"aria-label={t("settings.dialog.closeAriaLabel")}><HugeiconsIcon icon={Cancel01Icon} className="size-4" /></button>- <div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto p-6 [scrollbar-gutter:stable]">+ <div className="hover-scrollbar flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto p-6 [scrollbar-gutter:stable]">{renderTab(activeTab)}</div></main>diff --git a/studio/frontend/src/features/settings/tabs/chat-tab.tsx b/studio/frontend/src/features/settings/tabs/chat-tab.tsxindex 4e528eabb14..e37d56e2f73 100644--- a/studio/frontend/src/features/settings/tabs/chat-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/chat-tab.tsx@@ -19,7 +19,7 @@ import {useChatRuntimeStore,} from "@/features/chat";import { useT } from "@/i18n";-import { Delete02Icon, Download02Icon } from "@hugeicons/core-free-icons";+import { Delete02Icon, Download01Icon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";import { useEffect, useState } from "react";import { SettingsRow } from "../components/settings-row";@@ -165,7 +165,7 @@ export function ChatTab() {onClick={handleExport}disabled={exporting || count === 0}>- <HugeiconsIcon icon={Download02Icon} className="size-3.5 mr-1.5" />+ <HugeiconsIcon icon={Download01Icon} className="size-3.5 mr-1.5" />{exporting? t("settings.chat.exportingAction"): t("settings.chat.exportAction")}diff --git a/studio/frontend/src/features/studio/studio-page.tsx b/studio/frontend/src/features/studio/studio-page.tsxindex 53191fa3050..d5368fba58b 100644--- a/studio/frontend/src/features/studio/studio-page.tsx+++ b/studio/frontend/src/features/studio/studio-page.tsx@@ -177,7 +177,7 @@ export function StudioPage(): ReactElement {</div>) : (<Tabs value={activeTab} onValueChange={handleTabChange}>- <div className="flex items-center gap-3">+ <div className="flex items-center gap-3 pb-3">{selectedHistoryRunId && activeTab === "history" && (<Buttonvariant="ghost"diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.cssindex 12d63aac884..70dee1dcd70 100644--- a/studio/frontend/src/index.css+++ b/studio/frontend/src/index.css@@ -258,7 +258,8 @@--sidebar-border: #2d2d2f;--sidebar-ring: #17b88b;--destructive-foreground: oklch(1 0 0);- --radius: 0.625rem;+ /* Match light's radius so every rounded-* element is the same in both themes. */+ --radius: 1.1rem;--font-sans: "Inter Variable", ui-sans-serif, sans-serif, system-ui;--font-serif: Source Serif 4, serif;--font-mono: JetBrains Mono, monospace;@@ -584,7 +585,7 @@}.sidebar-sticky-label {- @apply rounded-none bg-sidebar pt-0 pb-[8px] pl-[18px] pr-4 text-[14.5px]! leading-[17px] font-medium normal-case focus-visible:ring-0! focus-visible:outline-none transition-shadow duration-150;+ @apply rounded-none bg-sidebar pt-0 pb-[8px] pl-[18px] pr-4 text-[14px]! leading-[17px] font-medium normal-case focus-visible:ring-0! focus-visible:outline-none transition-shadow duration-150;/* Muted section-header gray, matching Gemini's "Notebooks"/"Recents".Lightened from #5f6368 so the label reads as a header, clearlylighter than the near-black nav items. */@@ -764,13 +765,13 @@.app-user-menu [data-slot="dropdown-menu-item"],.app-user-menu [data-slot="dropdown-menu-sub-trigger"] {- height: 32px;- padding: 0 0.625rem !important;- gap: 8.5px !important;- border-radius: 10px;+ height: 36px;+ padding: 0 0.75rem !important;+ gap: 9.5px !important;+ border-radius: 12px;font-weight: 500;- font-size: 14.5px;- line-height: 19px;+ font-size: 15px;+ line-height: 20px;letter-spacing: 0;color: var(--nav-fg);}@@ -835,6 +836,59 @@--tw-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);}+ /* Settings dialog: no shadow in dark mode. */+ .dark .settings-surface.shadow-border {+ box-shadow: none;+ }++ /* App-wide: every clickable control shows the hand cursor. Disabled ones+ (native :disabled, aria-disabled, Radix data-disabled) keep the default. */+ button:not(:disabled):not([aria-disabled="true"]),+ summary,+ label[for],+ select:not(:disabled),+ a[href],+ :is(+ [role="button"],+ [role="tab"],+ [role="switch"],+ [role="radio"],+ [role="checkbox"],+ [role="menuitem"],+ [role="menuitemcheckbox"],+ [role="menuitemradio"],+ [role="option"],+ [role="combobox"],+ [role="link"]+ ):not([aria-disabled="true"]):not([data-disabled]):not(:disabled) {+ cursor: pointer;+ }++ /* Model selector: pointer cursor on every clickable element. */+ .unsloth-model-selector-trigger,+ .unsloth-model-selector-menu button {+ cursor: pointer;+ }++ .unsloth-model-selector-trigger:disabled,+ .unsloth-model-selector-menu button:disabled {+ cursor: not-allowed;+ }++ /* Chat search box: borderless, soft Gemini-style elevation. */+ .chat-search-surface {+ border: none;+ /* Pin to the dark --radius so the corners are the same (less round) in+ both themes; rounded-4xl here and on the inner Command follow this. */+ --radius: 0.625rem;+ /* Match the chat box: soft elevation in light, none in dark. */+ box-shadow: 0 2px 8px -2px rgba(27, 27, 31, 0.16);+ }++ .dark .chat-search-surface {+ box-shadow: none;+ }+.menu-soft-surface,.menu-soft-surface-up {--menu-soft-edge: rgba(0, 0, 0, 0.14);@@ -858,31 +912,125 @@--menu-soft-shadow: rgba(0, 0, 0, 0.28);}+ /* Model selector: drop the inset edge ring, keep the soft drop shadow.+ Pin --radius to the light value so the corners match in both themes. */+ .unsloth-model-selector-menu.menu-soft-surface {+ --radius: 1.1rem;+ box-shadow: 0 var(--menu-soft-offset-y) var(--menu-soft-blur)+ var(--menu-soft-spread) var(--menu-soft-shadow);+ }++ .dark .unsloth-model-selector-menu.menu-soft-surface {+ box-shadow: none;+ }++ /* Every dropdown/menu/select/popover: borderless, chatbox shadow in light,+ none in dark. !important so it also overrides the bespoke menu shadows. */+ [data-slot="dropdown-menu-content"],+ [data-slot="dropdown-menu-sub-content"],+ [data-slot="select-content"],+ [data-slot="combobox-content"],+ [data-slot="popover-content"] {+ box-shadow: 0 2px 8px -2px rgba(27, 27, 31, 0.16) !important;+ }+ /* Dark: keep the chat-box dropdown shadow so menus don't merge into a+ same-color surface (e.g. a menu overlapping the composer). */+ .dark [data-slot="dropdown-menu-content"],+ .dark [data-slot="dropdown-menu-sub-content"],+ .dark [data-slot="select-content"],+ .dark [data-slot="combobox-content"],+ .dark [data-slot="popover-content"] {+ box-shadow: 0 4px 14px var(--background) !important;+ }++ /* Context menus (chat, run, project): drop the inset edge ring, keep the soft shadow. */+ .app-user-menu.menu-soft-surface {+ box-shadow: 0 var(--menu-soft-offset-y) var(--menu-soft-blur)+ var(--menu-soft-spread) var(--menu-soft-shadow);+ }++ /* Account menu: drop the inset edge ring and use the composer's soft shadow. */+ .app-user-menu.menu-soft-surface-up {+ box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.09);+ }+ .dark .app-user-menu.menu-soft-surface-up {+ box-shadow: 0 8px 28px -6px rgba(0, 0, 0, 0.28);+ }+.chat-composer-surface {- @apply relative flex w-full flex-col rounded-[24px] bg-background dark:bg-card px-1 pt-2 outline-none transition-shadow;+ @apply relative flex w-full flex-col rounded-[32px] bg-background dark:bg-card px-1 pt-2 outline-none transition-shadow;font-family: var(--font-sans);- border: 1px solid oklch(0.93 0 0 / 1);background-clip: padding-box;- box-shadow:- 0 1px 2px oklch(0 0 0 / 0.04),- 0 6px 14px oklch(0 0 0 / 0.05),- 0 18px 40px oklch(0 0 0 / 0.05);+ box-shadow: 0 2px 8px -2px rgba(27, 27, 31, 0.16);}.dark .chat-composer-surface {- border-color: #34363a;- box-shadow: 0 -6px 36px -14px rgba(0, 0, 0, 0.15);+ background-color: #2a2a2c;+ box-shadow: none;}.composer-pill-btn {- @apply flex cursor-pointer items-center gap-1.5 rounded-full px-1.5 py-1.5 text-[13px] font-medium text-muted-foreground/70 transition-colors hover:bg-primary/10 dark:hover:bg-white/[0.08] disabled:cursor-not-allowed disabled:opacity-40;+ @apply flex cursor-pointer items-center gap-1.5 rounded-full py-1.5 pl-2 pr-2.5 text-[14px] font-medium text-muted-foreground/70 transition-colors hover:bg-primary/10 dark:hover:bg-white/[0.08] disabled:cursor-not-allowed disabled:opacity-40;}++ /* Icon-only (compact) pills drop their label, so make the button a square+ and center the glyph; the rounded-full hover highlight then reads as a+ circle around the icon rather than a wide rounded rectangle. */+ [data-pill-compact="true"] .composer-pill-btn:not([data-keep-label]) {+ @apply size-8 justify-center px-0;+ }+.composer-pill-btn[data-active="true"] {color: var(--primary);}+ /* With more than 4 tools on, drop pill labels to icons only to cut clutter.+ Compare keeps its label via data-keep-label. */+ [data-pill-compact="true"]+ .composer-pill-btn:not([data-keep-label])+ > span:not(.composer-pill-glyph) {+ display: none;+ }++ /* Drop the MCP dropdown caret when collapsed so the icon is not squished. */+ [data-pill-compact="true"]+ .composer-pill-btn:not([data-keep-label])+ .composer-pill-caret {+ display: none;+ }++ /* Fixed-width icon slot so every pill's icon occupies the same space and+ the labels line up on an even rhythm, regardless of icon size. */+ .composer-pill-glyph {+ @apply relative inline-flex w-[19px] shrink-0 items-center justify-center transition-opacity;+ }++ /* On hover the icon swaps for an X inside a soft circle (ChatGPT-style),+ filling the icon slot so every pill's X is identical and centered. */+ .composer-pill-x {+ @apply pointer-events-none absolute inset-0 m-auto size-[19px] rounded-full bg-primary/15 p-[3px] opacity-0 transition-opacity dark:bg-white/[0.14];+ }++ /* Icon-only (compact) pills are too small for the circle, so show a bare x. */+ [data-pill-compact="true"]+ .composer-pill-btn:not([data-keep-label])+ .composer-pill-x {+ @apply size-[15px] bg-transparent p-0 dark:bg-transparent;+ }++ /* Hovering an active pill swaps the icon for an X (click to turn off). */+ .composer-pill-btn[data-active="true"]:hover .composer-pill-glyph > :not(.composer-pill-x),+ .unsloth-thinking-pill[data-active="true"]:hover .composer-pill-glyph > :not(.composer-pill-x) {+ @apply opacity-0;+ }++ .composer-pill-btn[data-active="true"]:hover .composer-pill-x,+ .unsloth-thinking-pill[data-active="true"]:hover .composer-pill-x {+ @apply opacity-100;+ }+.composer-input {- @apply mt-2 mb-1 mx-3 min-h-12 w-[calc(100%-1.5rem)] resize-none overflow-y-auto bg-transparent pl-5 pr-4 pt-2 pb-3 text-sm font-[450] outline-none placeholder:text-muted-foreground focus-visible:ring-0;+ @apply mt-2 mb-1 mx-3 min-h-12 w-[calc(100%-1.5rem)] resize-none overflow-y-auto bg-transparent pl-2 pr-4 pt-2 pb-3 text-sm font-[450] outline-none placeholder:text-muted-foreground focus-visible:ring-0;}.composer-action-wrapper {@@ -894,6 +1042,254 @@font-family: var(--font-sans);}+ /* Pill composer; own classes so compare-mode keeps its stacked layout. */+ .unsloth-composer-surface {+ @apply relative flex w-full flex-col rounded-[32px] bg-background dark:bg-card px-3 py-3 outline-none transition-shadow;+ font-family: var(--font-sans);+ background-clip: padding-box;+ /* Gemini search pill: soft, centered shadow, no downward offset. */+ box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.09);+ }++ .unsloth-composer-surface:focus-within {+ box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.09);+ }++ .dark .unsloth-composer-surface {+ background-color: #2a2a2c;+ box-shadow: none;+ }++ /* Keep the expand/collapse width swap instant. A transition on width (e.g.+ the reduced-motion blanket rule) makes getComputedStyle().width lag a+ frame, so autosize measures the stale width and leaves a stray blank row. */+ .unsloth-composer-line,+ .unsloth-composer-line .unsloth-composer-input,+ .unsloth-composer-left {+ transition-property: none !important;+ }++ /* Composer row: one centered line when empty; two rows (input over controls)+ when filled, so the textarea never remounts. */+ .unsloth-composer-line {+ @apply flex w-full flex-wrap items-center gap-0.5 px-1;+ }++ .unsloth-composer-left {+ @apply flex shrink-0 items-center gap-0.5;+ order: 1;+ /* Pull the plus button closer to the composer edge. */+ margin-left: -0.25rem;+ }++ .unsloth-composer-line .unsloth-composer-input {+ order: 2;+ }++ .unsloth-composer-line .aui-composer-action-wrapper {+ order: 3;+ margin-left: auto;+ /* Inset the send circle from the edge, Gemini-style. */+ margin-right: -0.125rem;+ }++ .unsloth-composer-line[data-expanded="true"] .unsloth-composer-input {+ order: 1;+ flex-basis: 100%;+ width: 100%;+ /* Sits close to the left edge, near the plus. */+ padding-left: 0.375rem;+ padding-top: 0.5rem;+ padding-bottom: 0.5rem;+ }++ /* Two-row gap between text and controls. On the line, not the input, so+ the placeholder max-height clamp never crops it like padding would. */+ .unsloth-composer-line[data-expanded="true"] {+ row-gap: 0.75rem;+ }++ .unsloth-composer-line[data-expanded="true"] .unsloth-composer-left {+ order: 2;+ }++ /* Empty (placeholder shown): clamp back to one row. max-height beats the+ autosize textarea's inline !important height, so a cleared message leaves+ no stale tall box or stray scrollbar. */+ .unsloth-composer-input:placeholder-shown {+ max-height: 40px !important;+ overflow-y: hidden !important;+ }++ .unsloth-composer-input {+ @apply min-h-[40px] min-w-0 flex-1 resize-none overflow-y-auto bg-transparent pl-0.5 pr-2 py-2 text-[15px] font-[450] leading-6 outline-none placeholder:text-muted-foreground focus-visible:ring-0;+ }++ .unsloth-composer-plus {+ @apply flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full text-foreground transition-colors hover:bg-muted-foreground/15 disabled:cursor-not-allowed disabled:opacity-40;+ }++ .unsloth-composer-plus[data-state="open"] {+ @apply bg-muted-foreground/15;+ /* Radix's modal menu sets body pointer-events:none; re-enable on the open+ trigger so the cursor and click-to-close work. */+ pointer-events: auto;+ cursor: pointer;+ }++ /* Open menu rotates the plus 45deg into an x. Ease-in-out for a smooth+ spin; keep it at 45deg so it never passes back through a "+". */+ .unsloth-composer-plus svg {+ transition: transform 300ms cubic-bezier(0.65, 0, 0.35, 1);+ will-change: transform;+ }++ .unsloth-composer-plus[data-state="open"] svg {+ transform: rotate(45deg);+ }++ /* Keyboard focus shows a subtle brand ring, not the browser's blue outline;+ mouse clicks (no :focus-visible) stay ring-free. */+ .composer-pill-btn:focus-visible,+ .unsloth-thinking-pill:focus-visible,+ .unsloth-composer-plus:focus-visible {+ outline: none;+ box-shadow: 0 0 0 2px color-mix(in oklab, var(--ring) 45%, transparent);+ }++ /* Set Hellix explicitly; .aui-thread-root resets --font-heading to sans. */+ .unsloth-welcome-title {+ font-family: "Hellix", "Space Grotesk Variable", var(--font-sans);+ font-weight: 500;+ }++ /* Right-side Thinking pill (toggle or dropdown). pl-2 matches the left+ pills so the hover X is not pushed in too far. */+ .unsloth-thinking-pill {+ @apply inline-flex shrink-0 cursor-pointer items-center gap-1 rounded-full py-1.5 pl-2 pr-2.5 text-[14px] font-medium text-muted-foreground transition-colors hover:bg-primary/10 dark:hover:bg-white/[0.08] disabled:cursor-not-allowed disabled:opacity-40;+ /* Reserve a text line so the icon-only (inactive) pill matches the+ text pills' height instead of collapsing to the icon. */+ min-height: calc(1lh + 0.75rem);+ }++ .unsloth-thinking-pill[data-active="true"] {+ color: var(--primary);+ }++ .unsloth-thinking-pill[data-state="open"] {+ @apply bg-muted-foreground/10;+ /* See .unsloth-composer-plus: re-enable pointer-events on the open trigger. */+ pointer-events: auto;+ cursor: pointer;+ }++ /* Smaller tick for selected Thinking options. */+ .unsloth-tick {+ width: 0.8rem !important;+ height: 0.8rem !important;+ }++ /* Soft elevation; [data-slot] outranks the component ring-1, dropping the border. */+ .unsloth-plus-menu[data-slot] {+ /* Pin radius so dark matches light (rounded-lg resolves smaller in dark). */+ border-radius: 18px;+ padding-top: 0.5rem;+ padding-bottom: 0.5rem;+ box-shadow:+ 0 1px 2px oklch(0 0 0 / 0.04),+ 0 6px 18px oklch(0 0 0 / 0.08);+ }++ /* MCP menu is wider (232px), so nudge the radius up so it reads as round as+ the narrower + menu (18 * 232/212 ~= 20px). */+ .unsloth-plus-menu.mcp-menu[data-slot] {+ border-radius: 20px;+ }++ .dark .unsloth-plus-menu[data-slot] {+ background-color: #2a2a2c;+ /* Shadow tinted to the page bg so it blends, not a dark halo. */+ box-shadow: 0 4px 14px var(--background);+ }++ /* Compact items; also applied to portaled sub-content. */+ .unsloth-plus-menu :is(+ [data-slot="dropdown-menu-item"],+ [data-slot="dropdown-menu-sub-trigger"]+ ) {+ @apply gap-3 pl-4 pr-3 py-2 text-[14px];+ cursor: pointer;+ /* Pin hover-box radius so dark matches light (same as the container). */+ border-radius: 1.1rem;+ }++ .unsloth-plus-menu [data-slot="dropdown-menu-label"] {+ @apply pl-4 pr-3 py-1.5 text-[12px];+ }++ /* Active (green) items keep their primary text and icon color on hover. */+ .unsloth-plus-menu [data-slot="dropdown-menu-item"].text-primary:is(:hover, :focus, :focus-visible, [data-highlighted]),+ .unsloth-plus-menu [data-slot="dropdown-menu-item"].text-primary:is(:hover, :focus, :focus-visible, [data-highlighted]) svg {+ color: var(--primary) !important;+ }++ /* Light hover: neutral grey, not the green accent. */+ .unsloth-plus-menu :is(+ [data-slot="dropdown-menu-item"],+ [data-slot="dropdown-menu-sub-trigger"]+ ):is(:hover, :focus, :focus-visible, [data-highlighted], [data-state="open"]) {+ background-color: rgba(0, 0, 0, 0.06) !important;+ }++ /* Dark hover: the accent nearly matches the surface, so use a clear overlay. */+ .dark .unsloth-plus-menu :is(+ [data-slot="dropdown-menu-item"],+ [data-slot="dropdown-menu-sub-trigger"]+ ):is(:hover, :focus, :focus-visible, [data-highlighted], [data-state="open"]) {+ background-color: rgba(255, 255, 255, 0.08) !important;+ }++ /* Hover tints only the background; the item and every descendant (text, icons,+ labels) keep their resting color, overriding Radix's focus:**:text-accent-+ foreground. The active green rule above still wins via higher specificity. */+ .unsloth-plus-menu :is(+ [data-slot="dropdown-menu-item"],+ [data-slot="dropdown-menu-sub-trigger"]+ ):is(:hover, :focus, :focus-visible, [data-highlighted], [data-state="open"]),+ .unsloth-plus-menu :is(+ [data-slot="dropdown-menu-item"],+ [data-slot="dropdown-menu-sub-trigger"]+ ):is(:hover, :focus, :focus-visible, [data-highlighted], [data-state="open"]) * {+ color: inherit !important;+ }++ .unsloth-plus-menu :is(+ [data-slot="dropdown-menu-item"],+ [data-slot="dropdown-menu-sub-trigger"]+ )+ svg {+ width: 1.05rem;+ height: 1.05rem;+ }++ /* Destructive items keep red text and a red-tinted hover, not the grey one. */+ .unsloth-plus-menu [data-slot="dropdown-menu-item"][data-variant="destructive"],+ .unsloth-plus-menu [data-slot="dropdown-menu-item"][data-variant="destructive"] * {+ color: var(--destructive) !important;+ }+ .unsloth-plus-menu [data-slot="dropdown-menu-item"][data-variant="destructive"]:is(:hover, :focus, :focus-visible, [data-highlighted]) {+ background-color: color-mix(in oklab, var(--destructive) 10%, transparent) !important;+ }++ /* Thinking menu: tighter gap; nowrap keeps "Preserve thinking" on one line+ so the menu sizes to its content. */+ .unsloth-thinking-menu :is(+ [data-slot="dropdown-menu-item"],+ [data-slot="dropdown-menu-sub-trigger"]+ ) {+ @apply gap-1.5 pl-2.5 pr-2.5;+ white-space: nowrap;+ }.artifact-panel-shell {box-shadow: 0 2px 8px -2px rgba(27, 27, 31, 0.16);}@@ -1223,7 +1619,8 @@}}-/* Lighter shadow + tighter vertical padding than Sonner's defaults; !important because Sonner injects its base rules at runtime. */+/* No border line; same drop shadow as the composer (.unsloth-composer-surface).+ !important because Sonner injects its base rules at runtime. */[data-sonner-toast][data-styled='true'] {padding: 12px 18px !important;box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;@@ -1263,7 +1660,8 @@/* Boost shadow on dark surfaces; mirrors .shadow-border / .menu-soft-surface pattern. */.dark [data-sonner-toast][data-styled='true'] {- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;+ background-color: #2a2a2c !important;+ box-shadow: none !important;}/* Selectable toast text; non-selectable toast buttons. */@@ -1349,6 +1747,86 @@background: oklch(0.67 0 0 / 0.5);}+/* Composer textarea: keep the scroll thumb faint until the user hovers or+ drags the thumb itself, so a tall draft never shows a heavy dark rail. */+.composer-input,+.unsloth-composer-input {+ scrollbar-color: oklch(0.5 0 0 / 0.16) transparent;+}++.composer-input::-webkit-scrollbar-thumb,+.unsloth-composer-input::-webkit-scrollbar-thumb {+ background: oklch(0.5 0 0 / 0.16);+}++.composer-input::-webkit-scrollbar-thumb:hover,+.unsloth-composer-input::-webkit-scrollbar-thumb:hover,+.composer-input::-webkit-scrollbar-thumb:active,+.unsloth-composer-input::-webkit-scrollbar-thumb:active {+ background: oklch(0.5 0 0 / 0.45);+}++.dark .composer-input,+.dark .unsloth-composer-input {+ scrollbar-color: oklch(0.72 0 0 / 0.18) transparent;+}++.dark .composer-input::-webkit-scrollbar-thumb,+.dark .unsloth-composer-input::-webkit-scrollbar-thumb {+ background: oklch(0.72 0 0 / 0.18);+}++.dark .composer-input::-webkit-scrollbar-thumb:hover,+.dark .unsloth-composer-input::-webkit-scrollbar-thumb:hover,+.dark .composer-input::-webkit-scrollbar-thumb:active,+.dark .unsloth-composer-input::-webkit-scrollbar-thumb:active {+ background: oklch(0.72 0 0 / 0.5);+}++/* Sidebars, settings and search: hide the scroll thumb at rest and reveal it+ only while the area is hovered, so the rail never sits visible over content. */+.sidebar-scroll-fade,+.run-settings-scroll,+.hover-scrollbar {+ scrollbar-color: transparent transparent;+}++.sidebar-scroll-fade::-webkit-scrollbar-thumb,+.run-settings-scroll::-webkit-scrollbar-thumb,+.hover-scrollbar::-webkit-scrollbar-thumb {+ background: transparent;+}++.sidebar-scroll-fade:hover,+.run-settings-scroll:hover,+.hover-scrollbar:hover {+ scrollbar-color: oklch(0.5 0 0 / 0.4) transparent;+}++.sidebar-scroll-fade:hover::-webkit-scrollbar-thumb,+.run-settings-scroll:hover::-webkit-scrollbar-thumb,+.hover-scrollbar:hover::-webkit-scrollbar-thumb {+ background: oklch(0.5 0 0 / 0.4);+}++.dark .sidebar-scroll-fade:hover,+.dark .run-settings-scroll:hover,+.dark .hover-scrollbar:hover {+ scrollbar-color: oklch(0.72 0 0 / 0.4) transparent;+}++.dark .sidebar-scroll-fade:hover::-webkit-scrollbar-thumb,+.dark .run-settings-scroll:hover::-webkit-scrollbar-thumb,+.dark .hover-scrollbar:hover::-webkit-scrollbar-thumb {+ background: oklch(0.72 0 0 / 0.4);+}++/* Run settings: always reserve the scrollbar gutter so the header close+ button keeps its position whether or not the scrollbar is showing. */+.run-settings-scroll {+ scrollbar-gutter: stable;+}+/* Chat viewport: solid track matching sidebar so the scrollbar reads as afull-height rail flush to the right edge, without a separate decorative strip. */.aui-thread-viewport {@@ -1429,7 +1907,12 @@transform: none !important;background: var(--popover) !important;color: var(--popover-foreground) !important;- border-color: var(--border) !important;+ border-color: transparent !important;+}++/* Keep the (borderless) close button blended with the dark toast surface. */+.dark [data-sonner-toast][data-styled="true"] [data-close-button] {+ background: #2a2a2c !important;}[data-sonner-toast][data-styled="true"] [data-close-button] svg {@@ -1438,7 +1921,7 @@[data-sonner-toast][data-styled="true"]:hover [data-close-button]:hover {background: var(--muted) !important;color: var(--popover-foreground) !important;- border-color: var(--border) !important;+ border-color: transparent !important;}.generated-image-loading-card {@@ -1522,4 +2005,10 @@animation-duration: 1850ms !important;animation-iteration-count: infinite !important;}++ /* Keep the plus/x morph animating under reduced motion (small rotation,+ like the spinners above). */+ .unsloth-composer-plus svg {+ transition-duration: 300ms !important;+ }}diff --git a/studio/frontend/src/speech-recognition.d.ts b/studio/frontend/src/speech-recognition.d.tsindex 181a77fea18..dc7234ce919 100644--- a/studio/frontend/src/speech-recognition.d.ts+++ b/studio/frontend/src/speech-recognition.d.ts@@ -28,6 +28,11 @@ interface SpeechRecognitionEvent extends Event {readonly results: SpeechRecognitionResultList;}+interface SpeechRecognitionErrorEvent extends Event {+ readonly error: string;+ readonly message: string;+}+interface SpeechRecognition extends EventTarget {continuous: boolean;interimResults: boolean;@@ -35,7 +40,7 @@ interface SpeechRecognition extends EventTarget {onresult: ((event: SpeechRecognitionEvent) => void) | null;onerror: ((event: Event) => void) | null;onend: (() => void) | null;- start(): void;+ start(audioTrack?: MediaStreamTrack): void;stop(): void;abort(): void;}@@ -49,4 +54,4 @@ interface Window {webkitSpeechRecognition?: SpeechRecognitionConstructor;}-declare var SpeechRecognition: SpeechRecognitionConstructor | undefined;+declare const SpeechRecognition: SpeechRecognitionConstructor | undefined;diff --git a/tests/studio/playwright_chat_ui.py b/tests/studio/playwright_chat_ui.pyindex 845451919cd..b1279e64b91 100644--- a/tests/studio/playwright_chat_ui.py+++ b/tests/studio/playwright_chat_ui.py@@ -1115,7 +1115,25 @@ with sync_playwright() as p:step("sidebar nav: New Chat -> Compare -> Search -> Recipes")click_nav("New Chat", r"/chat")shoot("11-new-chat")- click_nav("Compare", r"/chat\?") # /chat?compare=...+ # Compare moved into the composer + menu (Tools and attachments).+ plus_btn = page.get_by_role(+ "button", name = re.compile(r"Tools and attachments", re.I)+ ).first+ if plus_btn.count() > 0:+ plus_btn.click(force = True)+ page.wait_for_timeout(400)+ compare_item = page.get_by_role(+ "menuitem", name = re.compile(r"Compare chat", re.I)+ ).first+ if compare_item.count() > 0:+ compare_item.click(force = True)+ page.wait_for_timeout(800)+ if not re.search(r"/chat\?", page.url):+ soft_fail(f"'Compare chat' didn't open compare; current: {page.url}")+ else:+ soft_fail("composer + menu: 'Compare chat' item not found")+ else:+ soft_fail("composer + menu: plus button not found")shoot("12-compare")# Search opens a dialog (not a route change).search_btn = page.get_by_role("button", name = re.compile(r"^search$", re.I)).firstdiff --git a/tests/studio/playwright_extra_ui.py b/tests/studio/playwright_extra_ui.pyindex 1f507c9f331..0ac9f67a7e6 100644--- a/tests/studio/playwright_extra_ui.py+++ b/tests/studio/playwright_extra_ui.py@@ -327,17 +327,23 @@ with sync_playwright() as p:# 1. Compare tab.# ─────────────────────────────────────────────────────step("Compare tab: send to two panes")- # The Compare nav lives in the sidebar; click it.- compare_nav = page.locator('[data-tour="chat-compare"]').first- if compare_nav.count() == 0:- compare_nav = page.get_by_role(- "button",- name = re.compile(r"^\s*Compare\s*$", re.I),+ # Compare moved into the composer + menu (Tools and attachments).+ compare_opened = False+ plus_btn = page.get_by_role(+ "button", name = re.compile(r"Tools and attachments", re.I)+ ).first+ if plus_btn.count() > 0:+ plus_btn.click(force = True)+ page.wait_for_timeout(400)+ compare_item = page.get_by_role(+ "menuitem", name = re.compile(r"Compare chat", re.I)).first- if compare_nav.count() == 0:+ if compare_item.count() > 0:+ compare_item.click(force = True)+ compare_opened = True+ if not compare_opened:soft_fail("Compare nav not found")else:- compare_nav.click()page.wait_for_timeout(1500)shoot("02-compare-opened")# Compare view's container.