Skip to content

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.

Studio: Deep research sits under Tools in the + menu (#13959)

Michael Han260d89bdf170
diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsx
index 71edbf7ca90..f4189d2ac19 100644
--- a/studio/frontend/src/components/assistant-ui/thread.tsx
+++ b/studio/frontend/src/components/assistant-ui/thread.tsx
@@ -7268,6 +7268,7 @@ const ComposerToolsMenu: FC<{
};
const { pinned: pinnedPlusItems, overflow: overflowPlusItems } =
splitPlusMenuItems(plusOrder, plusPins);
+ const deepResearchWithTools = pinnedPlusItems.includes("deepResearch");
return (
<>
@@ -7361,6 +7362,7 @@ const ComposerToolsMenu: FC<{
/>
) : null}
</DropdownMenuItem>
+ {deepResearchWithTools ? plusMenuNodes.deepResearch : null}
{supportsBuiltinImageGeneration && (
<DropdownMenuItem
disabled={imageDisabled}
@@ -7384,9 +7386,11 @@ const ComposerToolsMenu: FC<{
)}
<DropdownMenuSeparator />
{isDictating ? <BypassPermissionsMenuItem /> : null}
- {pinnedPlusItems.map((id) => (
- <Fragment key={id}>{plusMenuNodes[id]}</Fragment>
- ))}
+ {pinnedPlusItems
+ .filter((id) => id !== "deepResearch")
+ .map((id) => (
+ <Fragment key={id}>{plusMenuNodes[id]}</Fragment>
+ ))}
<DropdownMenuSub>
<DropdownMenuSubTrigger>
<MoreHorizontalIcon className="size-4" />
diff --git a/studio/frontend/src/features/chat/index.ts b/studio/frontend/src/features/chat/index.ts
index 75ccf8fe9f5..026b6d588df 100644
--- a/studio/frontend/src/features/chat/index.ts
+++ b/studio/frontend/src/features/chat/index.ts
@@ -315,6 +315,7 @@ export {
export {
PLUS_MENU_ORDER,
normalizePlusMenuOrder,
+ keepSavedSlot,
splitPlusMenuItems,
usePlusMenuPrefsStore,
type PlusMenuItemId,
diff --git a/studio/frontend/src/features/chat/stores/plus-menu-prefs-store.ts b/studio/frontend/src/features/chat/stores/plus-menu-prefs-store.ts
index be5cb33b45e..0668fb0c98d 100644
--- a/studio/frontend/src/features/chat/stores/plus-menu-prefs-store.ts
+++ b/studio/frontend/src/features/chat/stores/plus-menu-prefs-store.ts
@@ -66,6 +66,19 @@ export function normalizePlusMenuOrder(saved: unknown): PlusMenuItemId[] {
return order;
}
+/** `ids` with `fixed` put back at its index in `saved`: an item the list doesn't move (Deep research)
+ * still orders the More submenu when switched off, so a move of another item must not shift it. */
+export function keepSavedSlot(
+ ids: readonly PlusMenuItemId[],
+ saved: readonly PlusMenuItemId[],
+ fixed: PlusMenuItemId,
+): PlusMenuItemId[] {
+ const rest = ids.filter((id) => id !== fixed);
+ const at = saved.indexOf(fixed);
+ const index = at < 0 ? 0 : Math.min(at, rest.length);
+ return [...rest.slice(0, index), fixed, ...rest.slice(index)];
+}
+
export function splitPlusMenuItems(
order: readonly PlusMenuItemId[],
pins: Record<PlusMenuItemId, boolean>,
diff --git a/studio/frontend/src/features/settings/components/chat-menu-order-list.tsx b/studio/frontend/src/features/settings/components/chat-menu-order-list.tsx
index c1772596f20..3eb1eda1164 100644
--- a/studio/frontend/src/features/settings/components/chat-menu-order-list.tsx
+++ b/studio/frontend/src/features/settings/components/chat-menu-order-list.tsx
@@ -2,7 +2,7 @@
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import { Switch } from "@/components/ui/switch";
-import { type PlusMenuItemId, usePlusMenuPrefsStore } from "@/features/chat";
+import { type PlusMenuItemId, keepSavedSlot, usePlusMenuPrefsStore } from "@/features/chat";
import { useT } from "@/i18n";
import {
AttachmentIcon,
@@ -28,6 +28,26 @@ function FixedRow({ icon, label }: { icon: IconSvgElement; label: string }) {
);
}
+function ToggleRow({ id, meta }: { id: PlusMenuItemId; meta: ItemMeta }) {
+ const pinned = usePlusMenuPrefsStore((s) => s.pins[id]);
+ const togglePin = usePlusMenuPrefsStore((s) => s.togglePin);
+ return (
+ <div data-menu-item={id} className="flex h-9 items-center gap-2.5 rounded-lg px-2">
+ <span className="size-4 shrink-0" aria-hidden="true" />
+ <span className="flex size-4 items-center justify-center text-foreground/80 [&_svg]:size-4">
+ {meta.icon}
+ </span>
+ <span className="text-ui-13 text-foreground">{meta.label}</span>
+ <Switch className="ml-auto" aria-label={meta.label} checked={pinned} onCheckedChange={() => togglePin(id)} />
+ </div>
+ );
+}
+
+const FIXED_TOGGLE: PlusMenuItemId = "deepResearch";
+// The stored order keeps every id; only the draggable ones are shown and moved here.
+const withFixed = (ids: PlusMenuItemId[]): PlusMenuItemId[] =>
+ keepSavedSlot(ids, usePlusMenuPrefsStore.getState().order, FIXED_TOGGLE);
+
function MovableRow({
id,
meta,
@@ -83,7 +103,7 @@ function MovableRow({
e.preventDefault();
const next = [...order];
next.splice(to, 0, ...next.splice(index, 1));
- setOrder(next);
+ setOrder(withFixed(next));
}}
className="flex size-4 shrink-0 cursor-grab touch-none items-center justify-center text-muted-foreground active:cursor-grabbing"
>
@@ -123,10 +143,10 @@ export function ChatMenuOrderList({
draftRef.current = ids;
setDraftState(ids);
};
- const shown = draft ?? order;
+ const shown = (draft ?? order).filter((id) => id !== FIXED_TOGGLE);
const drop = () => {
if (draftRef.current) {
- setOrder(draftRef.current);
+ setOrder(withFixed(draftRef.current));
}
setDraft(null);
};
@@ -141,6 +161,7 @@ export function ChatMenuOrderList({
/>
<FixedRow icon={InternetIcon} label={t("settings.chat.menu.webSearch")} />
<FixedRow icon={CodeIcon} label={t("settings.chat.menu.tools")} />
+ <ToggleRow id={FIXED_TOGGLE} meta={items[FIXED_TOGGLE]} />
<div className="mx-2 my-1 border-t border-border/70" />
<Reorder.Group
ref={listRef}
diff --git a/studio/frontend/tests/chat-menu-order.test.ts b/studio/frontend/tests/chat-menu-order.test.ts
index 7b51fe95815..656e9a75772 100644
--- a/studio/frontend/tests/chat-menu-order.test.ts
+++ b/studio/frontend/tests/chat-menu-order.test.ts
@@ -11,6 +11,7 @@ const { store } = installLocalStorageFake();
const {
PLUS_MENU_ORDER,
PLUS_MENU_PINS_STORAGE_KEY,
+ keepSavedSlot,
normalizePlusMenuOrder,
splitPlusMenuItems,
usePlusMenuPrefsStore,
@@ -86,7 +87,38 @@ test("dragging a chat menu row stays inside the list and saves the order once, o
// Swaps go to a local draft; the persisted store (read by both + menus) only takes the drop.
assert.match(src, /onReorder=\{\(ids: PlusMenuItemId\[\]\) => setDraft\(ids\)\}/);
assert.match(src, /onDragEnd=\{onDrop\}/);
- assert.match(src, /if \(draftRef\.current\) \{\s*setOrder\(draftRef\.current\);/);
+ assert.match(src, /if \(draftRef\.current\) \{\s*setOrder\(withFixed\(draftRef\.current\)\);/);
// layoutScroll on the settings pane would double-count its scroll against the constraints.
assert.ok(!readSrc("features/settings/settings-dialog.tsx").includes("layoutScroll"));
});
+
+test("a pinned Deep research sits right under Tools, not with the other pinned items", () => {
+ const src = readSrc("components/assistant-ui/thread.tsx");
+ const tools = src.indexOf(" Tools\n");
+ const research = src.indexOf("{deepResearchWithTools ? plusMenuNodes.deepResearch : null}");
+ const separator = src.indexOf("<DropdownMenuSeparator />", tools);
+ assert.ok(tools > 0 && research > tools && research < separator, "Deep research is not between Tools and the separator");
+ assert.match(src, /pinnedPlusItems\s*\.filter\(\(id\) => id !== "deepResearch"\)/);
+});
+
+test("Settings shows Deep research under Tools with a switch and no drag handle", () => {
+ const src = readSrc("features/settings/components/chat-menu-order-list.tsx");
+ const tools = src.indexOf('label={t("settings.chat.menu.tools")}');
+ const row = src.indexOf("<ToggleRow id={FIXED_TOGGLE}");
+ assert.ok(tools > 0 && row > tools && row < src.indexOf("border-t", row), "Deep research is not under Tools");
+ const toggle = src.slice(src.indexOf("function ToggleRow"), src.indexOf("function MovableRow"));
+ assert.ok(toggle.includes("<Switch") && !toggle.includes("DragDropVerticalIcon"));
+ // It never joins the draggable list, and a drop or arrow key keeps it in the saved order.
+ assert.match(src, /\.filter\(\(id\) => id !== FIXED_TOGGLE\)/);
+ assert.match(src, /setOrder\(withFixed\(next\)\)/);
+});
+
+test("moving another row keeps Deep research where it was in More, not at the top", () => {
+ const saved = ["chatWithFiles", "browserUse", "deepResearch", "mcp", "skills"] as const;
+ // Skills dragged to the top; the list it comes from never shows Deep research.
+ const moved = keepSavedSlot(["skills", "chatWithFiles", "browserUse", "mcp"], [...saved], "deepResearch");
+ assert.deepEqual(moved, ["skills", "chatWithFiles", "deepResearch", "browserUse", "mcp"]);
+ // A saved slot past the end of the list lands at its end; an order without it puts it first.
+ assert.deepEqual(keepSavedSlot(["mcp"], ["mcp", "skills", "deepResearch"], "deepResearch"), ["mcp", "deepResearch"]);
+ assert.deepEqual(keepSavedSlot(["mcp"], ["mcp"], "deepResearch"), ["deepResearch", "mcp"]);
+});