Repository navigation
studio: redesign chat composer - #5891
Conversation
Reworks the new-chat composer and the compare composer into a single rounded pill surface with a softer, lighter look. - New welcome screen with a time-of-day sloth mascot and a lighter heading. - One rounded composer surface with a soft drop shadow. The input grows inline as you type and collapses back to a single row when cleared. - Tools and attachments live in a single plus menu; the thinking control is a compact pill with a reasoning-effort submenu. - Inlined glyphs for the thinking, send, and dictate controls, kept in sync across the main and compare composers. - Toast notifications match the composer surface: no border line, the same drop shadow, and the same dark surface color, with a ring-less close button. - Dark mode: the side-menu shadow blends into the background, hovered menu rows read clearly, and their roundness matches light mode. - Composer styles use dedicated unsloth- prefixed classes so compare mode keeps its own stacked layout.
- Compare composer: keep "Preserve thinking" consistent with reasoning, matching the main composer. Enabling it now turns reasoning on, and disabling reasoning (the None option or the Thinking toggle) turns it off, so the invalid "preserve on while thinking off" state can't occur. - Guard crypto.randomUUID in the Compare action. It is undefined in non-secure contexts (HTTP over a LAN IP) and would throw; fall back to a timestamped random id, matching createNavigationNonce.
The Search and Code pills only lit up when the tool was usable right now (a model loaded and capable), so a tool turned on from the + menu showed as off in the pill while the menu showed it on. toolsEnabled is persisted and takes effect once a capable model loads, so the pill should reflect it. The pills now disable only when a loaded model lacks the capability, and otherwise reflect the selected state. Applied to the main and compare composers.
Make the "MCP Servers" heading in the chat Configuration sheet link to the MCP PR, keeping the chevron as the toggle. The label and chevron are rendered as siblings so we don't nest an <a> inside a <button>. Also add cursor-pointer to the composer pills and the thinking pill so hovering a clickable pill shows the hand cursor instead of the default arrow.
- Composer expands to two rows only once the input wraps to a second line, not on the first keystroke. Re-measure the autosize textarea on the width swap so expanding no longer leaves a stray blank row. - Light-mode composer shadow now matches Gemini's soft elevation. - Plus menu: replace Canvas with a More submenu (Canvas, Compare chat, RAG) and add Code above MCP. Active Web search/Code items use medium weight. - Compare mode: the plus side menu, Search/Code toggles, and a Compare exit pill now match single chat, with the thinking control on the right. - Projects menu entries link to their tracking PR (#5725). - Add cursor-pointer to the composer plus button.
There was a problem hiding this comment.
Code Review
This pull request refactors the chat composer UI to introduce a unified, two-row layout with a consolidated tools and attachments plus-menu, alongside an updated reasoning/thinking toggle that supports effort levels and preserve-thinking options across both single-chat and compare-chat composers. The review feedback highlights a performance optimization to prevent layout thrashing during multiline text measurement, a bug where disabling tools for Kimi models permanently overwrites user preferences due to a missing { persist: false } option, and accessibility concerns where preventing auto-focus on menu close breaks keyboard navigation.
| const inputRef = useRef<HTMLTextAreaElement>(null); | ||
| const [isMultiline, setIsMultiline] = useState(false); | ||
| useEffect(() => { | ||
| if (composerText.length === 0) { | ||
| setIsMultiline(false); | ||
| return; | ||
| } | ||
| const el = inputRef.current; | ||
| if (!el) { | ||
| return; | ||
| } | ||
| 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; | ||
| const contentHeight = el.scrollHeight - padTop - padBottom; | ||
| setIsMultiline((prev) => prev || contentHeight > lineHeight * 1.5); | ||
| }, [composerText]); |
There was a problem hiding this comment.
Calling getComputedStyle inside a useEffect that triggers on every composerText change causes layout thrashing (forced synchronous layout) on every single keystroke. This can severely degrade typing performance and cause input lag.
To optimize this, cache the measured lineHeight and padding values in a useRef so that getComputedStyle is only called once when the element is first measured.
const inputRef = useRef<HTMLTextAreaElement>(null);
const measurementsRef = useRef<{ lineHeight: number; padding: number } | null>(null);
const [isMultiline, setIsMultiline] = useState(false);
useEffect(() => {
if (composerText.length === 0) {
setIsMultiline(false);
return;
}
const el = inputRef.current;
if (!el) {
return;
}
if (!measurementsRef.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;
measurementsRef.current = { lineHeight, padding: padTop + padBottom };
}
const { lineHeight, padding } = measurementsRef.current;
const contentHeight = el.scrollHeight - padding;
setIsMultiline((prev) => prev || contentHeight > lineHeight * 1.5);
}, [composerText]);
| if (isKimiExternal && toolsEnabled) { | ||
| setToolsEnabled(false); | ||
| } |
There was a problem hiding this comment.
When disabling tools for Kimi models due to mutual exclusion with thinking, calling setToolsEnabled(false) without { persist: false } will permanently overwrite the user's persisted search preference. This differs from the correct implementation in shared-composer.tsx which uses { persist: false } to avoid mutating global preferences.
| if (isKimiExternal && toolsEnabled) { | |
| setToolsEnabled(false); | |
| } | |
| if (isKimiExternal && toolsEnabled) { | |
| setToolsEnabled(false, { persist: false }); | |
| } |
| if (isKimiExternal && next && toolsEnabled) { | ||
| setToolsEnabled(false); | ||
| } |
There was a problem hiding this comment.
When disabling tools for Kimi models due to mutual exclusion with thinking, calling setToolsEnabled(false) without { persist: false } will permanently overwrite the user's persisted search preference. Pass { persist: false } to preserve the user's global settings.
| if (isKimiExternal && next && toolsEnabled) { | |
| setToolsEnabled(false); | |
| } | |
| if (isKimiExternal && next && toolsEnabled) { | |
| setToolsEnabled(false, { persist: false }); | |
| } |
| if (isKimiExternal && next && toolsEnabled) { | ||
| setToolsEnabled(false); | ||
| } |
There was a problem hiding this comment.
When disabling tools for Kimi models due to mutual exclusion with thinking, calling setToolsEnabled(false) without { persist: false } will permanently overwrite the user's persisted search preference. Pass { persist: false } to preserve the user's global settings.
| if (isKimiExternal && next && toolsEnabled) { | |
| setToolsEnabled(false); | |
| } | |
| if (isKimiExternal && next && toolsEnabled) { | |
| setToolsEnabled(false, { persist: false }); | |
| } |
| 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()} |
There was a problem hiding this comment.
Using onCloseAutoFocus={(event) => event.preventDefault()} on the DropdownMenuContent prevents the trigger button from regaining focus when the menu is closed. This breaks keyboard navigation and accessibility (WCAG 2.1), as keyboard users will lose their focus position.
Instead of dropping focus, remove onCloseAutoFocus and handle any unwanted focus ring styles via CSS :focus-visible on the trigger button.
| 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()} | |
| className="unsloth-plus-menu w-[212px]" |
| className="unsloth-plus-menu w-[212px]" | ||
| onCloseAutoFocus={(event) => event.preventDefault()} |
There was a problem hiding this comment.
Using onCloseAutoFocus={(event) => event.preventDefault()} on the DropdownMenuContent breaks keyboard navigation and accessibility (WCAG 2.1) by dropping focus when the menu is closed.
Instead of dropping focus, remove onCloseAutoFocus and handle any unwanted focus ring styles via CSS :focus-visible on the trigger button.
| className="unsloth-plus-menu w-[212px]" | |
| onCloseAutoFocus={(event) => event.preventDefault()} | |
| className="unsloth-plus-menu w-[212px]" |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7d53d49f22
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| > | ||
| <HeadphonesIcon className="size-4.5 stroke-[1.5px]" /> | ||
| </TooltipIconButton> | ||
| <DropdownMenuItem onSelect={() => audioInputRef.current?.click()}> |
There was a problem hiding this comment.
Keep the audio input mounted while picking files
For audio-capable models, selecting this item closes the Radix dropdown immediately after onSelect, which unmounts the hidden <input> because it is rendered inside the menu content. The OS file picker then returns to a detached/unmounted input, so the onChange handler is not reliably delivered and the selected audio is lost; keep the input outside the dropdown content or prevent the menu from closing until after selection.
Useful? React with 👍 / 👎.
| typeof globalThis.crypto?.randomUUID === "function" | ||
| ? globalThis.crypto.randomUUID() | ||
| : `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`; | ||
| navigate({ to: "/chat", search: { compare: compareId } }); |
There was a problem hiding this comment.
Preserve the current chat before opening compare
When compare is opened from this new composer menu while viewing an existing thread, this path clears activeThreadId and navigates to compare without going through ChatPage.enterCompare, which is the path that saves viewBeforeCompareRef. Pressing the new Compare pill to exit then sees no saved view and falls back to /chat, so users lose their place instead of returning to the thread they started from.
Useful? React with 👍 / 👎.
- Active tool pills show an x on hover to signal click-to-disable - Plus button rotates into an x when the tools menu opens - Composer surface uses a 32px radius and a taller single-line height - Even, ChatGPT-style spacing between the plus and tool pills in both the single and compare composers - Send and mic circles resized and spaced, with the arrow centered in the circle - Chat search box gets a borderless, soft Gemini-style shadow
|
Pushed a round of composer polish on top of the redesign. Tool pills
Plus menu
Composer surface
Send and mic
Chat search
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4673957da7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| <DropdownMenuItem | ||
| className={toolsEnabled ? "text-primary font-medium" : undefined} | ||
| onSelect={() => setToolsEnabled(!toolsEnabled)} | ||
| > |
There was a problem hiding this comment.
Honor Kimi search/thinking exclusion in the menu
When the selected external provider is Kimi and the user enables Web search from this new + menu, this handler only flips toolsEnabled; unlike the visible Search pill, it does not also disable reasoning. The backend Kimi web-search path forces thinking: disabled, so the UI can leave the Think pill active while all subsequent searched Kimi turns run without thinking, which is misleading and changes results for users who enabled search through the menu.
Useful? React with 👍 / 👎.
Cross-engine checks (Chromium, Firefox, WebKit) flagged the active-pill hover x as a fixed 14px, so it popped smaller than the 19px Code icon. Fill the glyph slot instead so the x tracks whatever icon it covers.
…e composer
The single-chat composer flipped the other control off when toggling
search or thinking on Kimi, but without { persist: false }, so it
overwrote the user's saved preference. Match shared-composer and keep
the side effect session-only.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 40b424260e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| { | ||
| isReasoningProvider: | ||
| selectedExternalProvider?.isReasoningModel === true, | ||
| baseUrl: selectedExternalProvider?.baseUrl ?? null, | ||
| }, |
There was a problem hiding this comment.
Pass baseUrl when resolving Gemini thinking
When the selected provider is Gemini with a custom OpenAI-compatible base URL, this call now omits baseUrl from getExternalReasoningCapabilities. That resolver uses options.baseUrl to detect custom Gemini gateways and hide the native Gemini thinking ladder; without it, the docked composer advertises/enables thinking controls that the backend cannot honor on the OpenAI-compatible /chat/completions path, so user-selected thinking settings are misleading or silently ignored. Pass selectedExternalProvider?.baseUrl here as the shared compare composer still does.
Useful? React with 👍 / 👎.
Add scoped marker classes so the model picker trigger and every clickable element in its menu (tabs, model rows, delete, eject) show a pointer cursor; disabled items stay not-allowed.
|
Follow-up fixes pushed. Tool pills
Kimi search and thinking
Model selector
Checked the composer and model selector styles render consistently across Chromium, Firefox and WebKit. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1041e81d84
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| <DropdownMenuSeparator /> | ||
| <DropdownMenuItem | ||
| className={toolsEnabled ? "text-primary font-medium" : undefined} | ||
| onSelect={() => setToolsEnabled(!toolsEnabled)} |
There was a problem hiding this comment.
Keep Kimi search and thinking mutually exclusive in compare menu
In compare mode with a Kimi external model selected, choosing Web search from the new + menu only flips toolsEnabled, bypassing the Kimi handling used by the Search pill below that also disables reasoning. The backend Kimi web-search path sends thinking disabled, so this menu path can leave the Thinking pill checked while the request actually runs without thinking, giving users misleading state and different results when they enable search here.
Useful? React with 👍 / 👎.
The docked composer omitted baseUrl, so a custom Gemini OpenAI-compat gateway still advertised the native thinking ladder the backend cannot honor. Pass selectedExternalProvider.baseUrl like the compare composer so the resolver hides it.
- Plus side-menu items hover grey in light mode, not the green accent - Thinking pill hovers green like the Search and Code pills - The plain Thinking toggle shows an x on hover when active, matching Search and Code; the effort dropdown trigger keeps its bulb
The x filled the icon slot, so the wider Code chevron gave a bigger x than Search and Compare. Pin it to a fixed 15px, centered, so every pill's x matches.
- Accept svg, source code and many text/config files as drag-and-drop or picked attachments, matched by extension since their MIME is unreliable; html keeps its own adapter - Active (green) side-menu items keep their text and icon color on hover instead of switching to the accent color - Composer surface uses Gemini's soft centered shadow 0 0 20px rgba(0,0,0,0.04)
The inactive thinking pill has no label, so its flex row collapsed to the icon height and the hover box looked short. Reserve one text line (min-height: 1lh + padding) so it matches the Search and Code pills.
- Open the MCP servers dialog directly from the composer plus menu - Redesign the drag-and-drop affordance Gemini style, drop the badge and border, make the whole chat page a drop target - Swap in Hugeicons for the RAG, attachment chip and new project icons - Add time-based randomized welcome greetings, each matched to a fitting sloth
Bring in the Canvas/artifacts feature and fit it into the redesigned composer. - Keep the redesigned right-side controls and plus menu - Add an Artifacts pill to the expanded composer row - Wire the Canvas menu item to the artifacts toggle in both the main and compare composers - Open the MCP servers dialog directly from the MCP menu item - Keep the new artifact panel styles next to the composer styles
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d647f2b666
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| <DropdownMenuItem | ||
| className={toolsEnabled ? "text-primary font-medium" : undefined} | ||
| onSelect={() => setToolsEnabled(!toolsEnabled)} | ||
| > |
There was a problem hiding this comment.
Disable unsupported tools in the plus menu
When a model is already loaded but does not support web search (and similarly Code just below), the visible pill is disabled via the capability gate, but this menu item still toggles and persists toolsEnabled. In that context the backend drops the unsupported tool for the current turn, while the menu shows it checked and the persisted flag can unexpectedly enable web search after switching to a capable model; apply the same loaded-model capability guard here while still allowing preselection when no model is loaded.
Useful? React with 👍 / 👎.
- Label the toggle Canvas everywhere, matching the plus menu - Stop greying out the Canvas menu item; it toggles like the other items - Only show the Canvas pill in the composer row once it is turned on, since it is less central than Search and Code
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5d07c1f10
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| for (const file of files) { | ||
| aui | ||
| .composer() | ||
| .addAttachment(file) |
There was a problem hiding this comment.
Skip page drops when the composer is hidden
In compare mode each pane renders Thread hideComposer={true}, but this page-wide drop handler still consumes drops over the pane and adds files to that pane's hidden assistant-ui composer. The shared compare composer builds its send content from its own pendingImages/pendingAudio, so a user dropping an image over either compare pane gets no visible attachment and the file is not sent; guard this handler when hideComposer is true or route drops to the shared composer.
Useful? React with 👍 / 👎.
| toolsEnabled || | ||
| codeToolsEnabled || | ||
| imageToolsEnabled; |
There was a problem hiding this comment.
Include Canvas in the expansion trigger
When the user enables Canvas from the new plus menu while the single-chat composer is still one line and no other tools are active, composerExpanded remains false because it doesn't include artifactsEnabled. Since ArtifactsToggle is only rendered inside the expanded left controls, Canvas stays enabled without the visible Canvas pill or one-click disable path that this redesign expects.
Useful? React with 👍 / 👎.
left a comment
There was a problem hiding this comment.
💡 Codex Review
unsloth/studio/frontend/src/features/chat/shared-composer.tsx
Lines 762 to 767 in 0fca53c
When compare mode is the LoRA/base path, LoraCompareContent renders SharedComposer without model1/model2 props and registers handles named base/lora, so hasCompareHandles is true while isGeneralizedCompare is false. This new guard therefore rejects every LoRA compare prompt with “Pick a model in each pane to compare” instead of falling through to the existing simultaneous handle.append(content) path, making the base-vs-LoRA compare workflow unusable.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
commented
Jun 2, 2026
|
tested and works as expected. |
Speed up the composer plus icon morph from 480ms to 300ms. Add row-gap on the expanded composer line so the space between the text and the controls row stays the same whether the box expanded from wrapped text or from a toggle being on. The gap sits on the line, not the input, so the placeholder max-height clamp never crops it.
commented
Jun 3, 2026
|
Pushed a small follow-up to the composer:
|
Persisted Search/Code/Canvas/MCP toggles were surfacing the composer pill row on a fresh page load before any model was selected, so an empty composer looked different from the clean just-ejected state. Gate the composerExpanded tool checks on modelLoaded so a model-less composer stays collapsed, while saved preferences still apply the moment a model loads.
Hide the placeholder RAG entry from the composer plus menu in both single chat and compare until the feature is ready, and drop the now-unused DatabaseIcon import.
Selecting Web search, Code, Canvas or MCP from the + menu with no model loaded did nothing visible: the toggle turned on but the composer never expanded, so the pill stayed hidden. Drop the model-loaded gate from the expand check so an active tool always surfaces its pill. Align MCP with the Search/Code pattern too: grey it out only when a loaded model lacks tool support, so MCP stays toggleable and the pill stays clickable before a model is loaded instead of looking disabled.
commented
Jun 3, 2026
|
Pushed a fix for the composer tool toggles when no model is loaded. Before this, selecting Web search, Code, Canvas or MCP from the + menu with no model loaded turned the toggle on but the composer never expanded, so the pill stayed hidden. MCP was worse: it was greyed out and could not be toggled at all. Changes:
Note: tools left on from a previous session now also show on a fresh composer before a model loads, which is the intended behavior here. |
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8cb707c24a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const openProject = (projectId: string) => { | ||
| useChatRuntimeStore.getState().setActiveProjectId(projectId); | ||
| navigate({ to: "/chat", search: { project: projectId } }); |
There was a problem hiding this comment.
Clear the active thread when opening a project
When a user chooses a recent project from the composer menu while viewing an existing thread, this path switches the URL to the project landing page but leaves activeThreadId pointing at the old chat. Other project-entry paths clear the thread first; without that, the header/sidebar can continue to reflect the stale chat and later bare /chat navigation can reopen it instead of staying on a fresh project view.
Useful? React with 👍 / 👎.
Summary
Reworks the Studio chat composer (the new-chat welcome screen and the compare composer) into a single rounded pill surface with a softer, lighter look, wires the plus menu up to the real Projects and MCP features now that both have landed on main, and then carries that same visual language across the rest of Studio: consistent menus and overlays, matching light and dark corner radii, a shared elevation, unified icons, and a hand cursor on every clickable control.
MCP
Projects
Menus, dropdowns and overlays
Settings
Fine-tuning Studio (Train) page
Icons and cursors
Sidebars and run settings
Robustness
Notes
unsloth-prefixed classes, so compare mode (SharedComposer) keeps its own stacked layout.Test plan