Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Merge remote-tracking branch 'upstream/main' into up/fix/model-picker-guest-scope

Sebastian B0aed238cd4b2
diff --cc src/components/ModelPicker.simple.test.ts
index 6095763744,574c9bd594..680aae85ca
--- a/src/components/ModelPicker.simple.test.ts
+++ b/src/components/ModelPicker.simple.test.ts
@@@ -49,10 -51,10 +51,10 @@@ vi.mock("@/state/store", async (importO
}),
}));
- const { ClaudeAccountSelect, EffortRow, FollowBotModelRow, ModelEngineRail, ModelPicker, ModelVariantRow, SIMPLE_POPOVER_WIDTH } = await import("./ModelPicker");
- const { SimpleModelPane } = await import("./SimpleModelPane");
-const { ModelPicker, ModelVariantRow, SIMPLE_POPOVER_WIDTH } = await import("./ModelPicker");
++const { EffortRow, ModelPicker, ModelVariantRow, SIMPLE_POPOVER_WIDTH } = await import("./ModelPicker");
+ const { FollowBotModelRow, ModelEngineRail, ModelRow } = await import("./ModelPickerFull");
+ const { SimpleModelMenu } = await import("./SimpleModelMenu");
const { EngineSetup } = await import("./EngineSetup");
- const { InstanceProviderMark } = await import("./ProviderIcons");
afterAll(() => vi.unstubAllGlobals());
@@@ -459,9 -445,8 +444,9 @@@ describe("the model picker in Simple mo
const forBot = bot();
const full = open(forBot);
click(full.nodes.find((node) => node.type === "button" && node.props.children === "Thread + bot default"));
+ fixture.ownerOrAdmin = false;
fixture.advanced = false;
- pane(render(forBot))!.props.onPick("claude-sonnet-5-5");
+ pane(render(forBot))!.props.onPick(instance("claude"), "claude-sonnet-5-5");
expect(fixture.dispatch).toHaveBeenLastCalledWith(expect.objectContaining({ updateBotDefault: false }));
});
@@@ -487,30 -472,16 +472,30 @@@
expect(opened.html).toContain("Only this thread");
});
+ it.each([false, null])("offers a guest no bot scope in the full picker and keeps its picks thread-only (owner status: %s)", (ownerOrAdmin) => {
+ fixture.advanced = true;
+ const forBot = bot();
+ const asOwner = open(forBot);
+ click(asOwner.nodes.find((node) => node.type === "button" && node.props.children === "Thread + bot default"));
+ fixture.ownerOrAdmin = ownerOrAdmin;
+ const asGuest = render(forBot);
+ expect(asGuest.html).not.toContain("Thread + bot default");
+ const effort = asGuest.nodes.find((node) => node.type === EffortRow)!;
+ expect(effort.props.updateBotDefault).toBe(false);
+ (asGuest.nodes.find((node) => (node.props.option as Option | undefined)?.id === "claude-sonnet-5-5")!.props.onPick as () => void)();
+ expect(fixture.dispatch).toHaveBeenLastCalledWith(expect.objectContaining({ type: "setModel", updateBotDefault: false }));
+ });
+
- it("shows the Simple pane inline for the bot panel's Default model and edits the bot's default", () => {
- const forBot = bot();
- const opened = open(forBot, { contained: true });
+ it("opens the same floating menu from bot settings' Default model, without a second Thinking control, and edits the bot's default", () => {
+ const opened = open(bot(), { contained: true });
const simple = pane(opened)!;
- expect(simple).toBeDefined();
expect(opened.html).toContain("Default model");
+ expect(simple.props.thinking).toBeNull();
+ expect(menu(opened.html)).not.toContain('data-simple-effort="true"');
const content = opened.nodes.find((node) => node.props["data-model-picker-content"] !== undefined)!;
- expect(String(content.props.className)).toContain("relative");
- expect(String(content.props.className)).not.toContain("absolute");
- simple.props.onPick("claude-haiku-4-5-20251001");
+ expect(String(content.props.className)).toContain("menu-surface");
+ expect(String(content.props.className)).not.toContain("relative");
+ simple.props.onPick(instance("claude"), "claude-haiku-4-5-20251001");
expect(fixture.dispatch).toHaveBeenLastCalledWith(expect.objectContaining({
type: "setModel", botId: "scout", threadId: "thread-scout", updateBotDefault: true,
selection: expect.objectContaining({ model: "claude-haiku-4-5-20251001" }),
@@@ -570,8 -543,63 +557,64 @@@
const full = render(forBot);
expect(pane(full)).toBeUndefined();
expect(full.nodes.some((node) => node.type === ModelEngineRail)).toBe(true);
+ const back = full.nodes.find((node) => node.props["data-model-back"] !== undefined)!;
+ expect(menu(full.html)).toContain(">Back</span>");
+ click(back);
+ expect(pane(render(forBot))).toBeDefined();
+ });
+
+ it("sets up a missing engine from its row", () => {
+ const missing: InstanceInfo = { ...cursor, snapshot: { state: "unavailable", reason: "`cursor-agent` isn't installed" } };
+ fixture.instances = [claude(), missing];
+ const forBot = bot(undefined, "cursor", "auto");
+ const opened = open(forBot);
+ expect(list(opened).current).toMatchObject({ meta: "Setup required", warning: true });
+ expect(list(opened).groups.map((entry) => [entry.label, entry.body.kind])).toEqual([["Cursor", "setUp"], ["Claude", "models"]]);
+ const html = region(menu(opened.html), 'data-simple-provider="cursor"', 'data-simple-provider="claude"');
+ expect(html).toContain(">Set up</span>");
+ expect(html).toContain("data-simple-set-up");
+ pane(opened)!.props.onSetUp(missing, false);
+ const full = render(forBot);
+ expect(full.nodes.find((node) => node.type === EngineSetup)?.props).toMatchObject({ instance: missing, quiet: true });
});
+ it("opens setup from the checked row when its engine cannot run, and closes from it otherwise, writing nothing", () => {
+ const missing: InstanceInfo = { ...cursor, snapshot: { state: "unavailable", reason: "`cursor-agent` isn't installed" } };
+ fixture.instances = [claude(), missing];
+ const forBot = bot(undefined, "cursor", "auto");
+ const currentRow = (rendered: Rendered) =>
+ nodes(SimpleModelMenu(pane(rendered)!.props)).find((node) => node.props["data-current-model"] !== undefined)!;
+ click(currentRow(open(forBot)));
+ const full = render(forBot);
+ expect(pane(full)).toBeUndefined();
+ expect(full.nodes.find((node) => node.type === EngineSetup)?.props).toMatchObject({ instance: missing });
+
+ fixture.values = [];
+ fixture.instances = [claude()];
+ click(currentRow(open(bot())));
+ expect(fixture.dispatch).not.toHaveBeenCalled();
+ expect(render(bot()).html).not.toContain("data-model-picker-content");
+ });
+
+ it.each([[true, true], [false, false], [null, false]] as const)(
+ "keeps the list's rule for a pick in the full picker behind Set up (owner: %s)", (ownerOrAdmin, updatesDefault) => {
+ fixture.ownerOrAdmin = ownerOrAdmin;
+ const missing: InstanceInfo = { ...cursor, snapshot: { state: "unavailable", reason: "`cursor-agent` isn't installed" } };
+ fixture.instances = [claude(), missing];
+ const forBot = bot();
+ pane(open(forBot))!.props.onSetUp(missing, false);
+ fixture.instances = [claude(), cursor];
+ const full = render(forBot);
- expect(menu(full.html)).toContain(updatesDefault ? "every thread that uses the bot&#x27;s model" : "This thread only.");
++ expect(menu(full.html).includes("every thread that uses the bot&#x27;s model")).toBe(updatesDefault);
++ expect(menu(full.html).includes("Thread + bot default")).toBe(updatesDefault);
+ (full.nodes.find((node) => node.type === ModelRow)!.props.onPick as () => void)();
+ expect(fixture.dispatch).toHaveBeenLastCalledWith(expect.objectContaining({
+ type: "setModel", threadId: "thread-scout", updateBotDefault: updatesDefault,
+ selection: expect.objectContaining({ instanceId: "cursor", model: "auto" }),
+ }));
+ },
+ );
+
it("starts over in the Simple view the next time it opens", () => {
fixture.instances = [claude(false)];
const forBot = bot();
diff --cc src/components/ModelPicker.tsx
index 9aacae2a11,5dc263c2c0..5e66bbb1ec
--- a/src/components/ModelPicker.tsx
+++ b/src/components/ModelPicker.tsx
@@@ -632,6 -448,33 +448,33 @@@ export function ModelPicker(
resetList();
};
+ const openMenu = () => {
+ if (bot.busy) return;
+ if (active && isClaudeAccount(active)) lastClaudeIdRef.current = active.instanceId;
+ if (active && signInFamily(active) === "openai") lastOpenaiIdRef.current = active.instanceId;
+ const initial = pickerInstances.find((instance) => instance.instanceId === selection.instanceId) ?? pickerInstances[0];
+ setRailId(initial?.instanceId ?? null);
+ setChangedBotModel(false);
+ setFullView(false);
+ setExpanded(new Set());
+ setPlacement(null);
+ openFor(initial);
+ focusOnPlace.current = "";
+ setOpen(true);
+ };
+
+ const openFull = (instance: InstanceInfo, keyboard: boolean) => {
+ selectRail(instance);
- setScope(simpleUpdatesBotDefault ? "bot" : "thread");
++ setScope(mayChangeBotDefault ? "bot" : "thread");
+ focusOnPlace.current = keyboard ? "[data-model-back]" : MENU_ITSELF;
+ setFullView(true);
+ };
+ const backToList = (keyboard: boolean) => {
+ focusOnPlace.current = keyboard && railInstance ? `[data-simple-provider="${railInstance.instanceId.replace(/["\\]/g, "\\$&")}"] [data-menu-row]` : MENU_ITSELF;
+ resetList();
+ setFullView(false);
+ };
+
const profile = state.bots.find((candidate) => candidate.id === bot.id) ?? bot;
const follows = threadId ? profile.tasks?.find((task) => task.threadId === threadId)?.followsBotModel : undefined;
const botModelInstance = state.instances.find((instance) => instance.instanceId === profile.modelSelection.instanceId);
@@@ -654,10 -501,11 +501,11 @@@
dispatch({ type: "setModel", botId: bot.id, threadId: threadId ?? bot.threadId, updateBotDefault: false, selection: profile.modelSelection });
};
- const pick = (instance: InstanceInfo, model: string) => {
+ const pick = (instance: InstanceInfo, model: string, variant?: string) => {
if (bot.busy || instance.policy) return;
const nextSelection = modelSelectionForPick(selection, instance, model);
+ if (variant !== undefined) nextSelection.variant = variant;
- const updateBotDefault = !threadId || (simpleView ? simpleUpdatesBotDefault : scope === "bot");
+ const updateBotDefault = !threadId || (mayChangeBotDefault && (simpleView || scope === "bot"));
const targets = updateBotDefault ? [currentTaskBot(profile, threadId ?? bot.threadId), profile] : [bot];
if (targets.some((target) => modelSwitchNeedsAsk(approvalModeFor(target),
state.instances.find((candidate) => candidate.instanceId === target.modelSelection.instanceId)?.driverKind,
@@@ -675,12 -523,19 +523,19 @@@
selection: nextSelection,
});
if (updateBotDefault && threadId) setChangedBotModel(true);
- setOpen(false);
+ close(true);
};
- const official = railInstance?.models.options.filter((option) => !option.custom) ?? [];
+ const resetVariant = contained && selection.variant !== undefined ? () => {
+ const { variant: _variant, ...nextSelection } = selection;
- dispatch({ type: "setModel", botId: bot.id, threadId: threadId ?? bot.threadId, updateBotDefault: !threadId || simpleUpdatesBotDefault, selection: nextSelection });
++ dispatch({ type: "setModel", botId: bot.id, threadId: threadId ?? bot.threadId, updateBotDefault: !threadId || mayChangeBotDefault, selection: nextSelection });
+ close(true);
+ } : undefined;
+
+ const official = railInstance ? modelChoices(railInstance, railInstance.models.options.filter((option) => !option.custom)) : [];
const custom = railInstance?.models.options.filter((option) => option.custom) ?? [];
- const currentModel = selection.instanceId === railInstance?.instanceId ? selection.model : undefined;
+ const currentModel = selection.instanceId === railInstance?.instanceId
+ ? official.find((option) => choiceIsSelected(option, selection))?.id : undefined;
const filteredOfficial = filterCustomModels(official, query);
const compactOfficial = railInstance
? suggestedModels(official, railInstance.models.default, currentModel, COMPACT_MODEL_COUNT)
@@@ -695,57 -550,34 +550,34 @@@
: false;
const canOpenCustom = Boolean(railInstance && !needsCli(railInstance));
const canReturnToOfficial = official.length > 0 && !isCustomOnly(railInstance);
- const lookingForLocal = Boolean(railInstance && probingLocal === railInstance.instanceId);
+ const lookingForLocal = Boolean(railInstance && probing.has(railInstance.instanceId));
const lookingForLocalStatus = (
- <span role="status" className="flex items-center justify-center gap-2">
- <Loader2 size={12} className="animate-spin" aria-hidden="true" />
+ <div role="status" className={cn(MENU_LINE, "justify-center text-ink-tertiary")}>
+ <Loader2 size={14} className="shrink-0 animate-spin" aria-hidden="true" />
{t("model.lookingLocal")}
- </span>
+ </div>
);
+ const remote = window.ogb?.remoteClient?.active === true;
- const simpleOpensOn = (accounts: InstanceInfo[], lastId: string | null) =>
- accounts.find((account) => account.instanceId === lastId)
- ?? accounts.find((account) => account.instanceId === selection.instanceId)
- ?? accounts.find((account) => !needsCli(account) && !needsSignIn(account))
- ?? accounts[0];
- const simpleProviders = (() => {
- const groups = railProviders(pickerInstances, railInstance,
- simpleOpensOn(claudeAccounts, lastClaudeIdRef.current), simpleOpensOn(openaiAccounts, lastOpenaiIdRef.current));
- return [...groups.subscription, ...groups.api, ...groups.custom];
- })();
- const simpleFamily = signInFamily(railInstance);
- const simpleAccounts = simpleFamily === "claude" ? claudeAccounts : simpleFamily === "openai" ? openaiAccounts : [];
- const simpleLabel = simpleProviders.find((provider) => provider.selected)?.label ?? railInstance?.displayName ?? "";
- const simpleSignIn = !customOnly && needsSignIn(railInstance);
- const simpleOfficial = customOnly || simpleSignIn ? [] : official;
- const simpleLocal = partitionCustomModels(custom);
- const simpleAll = [...simpleOfficial, ...simpleLocal.pinned, ...simpleLocal.rest];
- const simpleSetup = Boolean(railInstance && (railInstance.policy || needsCli(railInstance) || (simpleSignIn && simpleAll.length === 0)));
- const simpleSuggested = railInstance
- ? suggestedModels(simpleAll, railInstance.models.default, currentModel, COMPACT_MODEL_COUNT)
- : [];
- const simpleOpened = [...simpleSuggested, ...simpleAll.filter((option) => !simpleSuggested.includes(option))];
- const simpleSearch = showAll && simpleAll.length > SIMPLE_SEARCH_AFTER;
- const simpleQuery = simpleSearch ? query : "";
- const simpleModels = simpleQuery ? filterCustomModels(simpleOpened, simpleQuery) : showAll ? simpleOpened : simpleSuggested;
- const lookForLocalIn = (instance: InstanceInfo) => {
- if (offersLocalModels(instance, instance.models.options.filter((option) => option.custom).length)) lookForLocal(instance);
- };
- const browseSimple = (instance: InstanceInfo) => {
- selectRail(instance);
- lookForLocalIn(instance);
+ const levels = active?.capabilities?.effortLevels ?? [];
+ const writeEffort = (effort: EffortLevel | undefined) => {
+ const { effort: _effort, ...model } = selection;
- dispatch({ type: "setModel", botId: bot.id, threadId, ...(threadId && simpleUpdatesBotDefault ? { updateBotDefault: true } : {}),
++ dispatch({ type: "setModel", botId: bot.id, threadId, ...(threadId && mayChangeBotDefault ? { updateBotDefault: true } : {}),
+ selection: effort ? { ...model, effort } : model });
};
- const activeLevels = active?.capabilities?.effortLevels ?? [];
- const simpleEffort = activeLevels.length > 0 ? {
- levels: [...activeLevels],
- current: selection.effort,
- onPick: (level: EffortLevel) => dispatch({ type: "setModel", botId: bot.id, threadId,
- ...(threadId && mayChangeBotDefault ? { updateBotDefault: true } : {}), selection: { ...selection, effort: level } }),
- } : null;
+ const thinking: SimpleThinking | null = contained ? null
+ : variantChoices(state, selection, threadId ?? bot.threadId) ? {
+ variants: (
- <ModelVariantRow compact quiet bot={shown} threadId={threadId} updateBotDefault={Boolean(threadId) && simpleUpdatesBotDefault} className="px-2 py-1"
++ <ModelVariantRow compact quiet bot={shown} threadId={threadId} updateBotDefault={Boolean(threadId) && mayChangeBotDefault} className="px-2 py-1"
+ label={<span className="shrink-0 text-[12px] font-medium leading-4 text-ink-tertiary">{t("botSettings.simple.thinking")}</span>} />
+ ),
+ }
+ : levels.length > 0 && !shown.busy ? { levels, current: selection.effort, onPick: writeEffort, onReset: () => writeEffort(undefined) }
+ : null;
- const botModelId = follows !== undefined && profile.modelSelection.instanceId === railInstance?.instanceId
- ? profile.modelSelection.model : undefined;
- const renderRow = (option: ModelOption) => (
+ const botModelSelection = follows !== undefined && profile.modelSelection.instanceId === railInstance?.instanceId
+ ? profile.modelSelection : undefined;
+ const renderRow = (option: ModelChoice) => (
<ModelRow
key={option.id}
option={option}
@@@ -822,360 -756,368 +756,368 @@@
)}
/>
</button>
+ ) : (
+ <button
+ {...triggerProps}
+ className={cn(
+ "group flex shrink-0 items-center rounded-full text-[13px] leading-[18px] text-ink-secondary transition-colors duration-150 hover:bg-ink/[0.06] hover:text-ink aria-expanded:bg-ink/[0.08] aria-expanded:text-ink disabled:cursor-not-allowed disabled:text-ink-tertiary disabled:hover:bg-transparent",
+ size === "sm" ? "h-7 pl-2 pr-1.5" : "h-8 pl-2.5 pr-2",
+ )}
+ >
+ <span className="relative mr-1.5 flex shrink-0 group-disabled:opacity-50">
+ {active
+ ? <InstanceProviderMark instance={active} size={14} subtle />
+ : <span className="size-3.5 rounded-full bg-ink/[0.08]" aria-hidden="true" />}
+ {attention && <span data-model-attention className="absolute -bottom-0.5 -right-0.5 size-1.5 rounded-full bg-warning ring-[1.5px] ring-app" />}
+ </span>
+ <span className="max-w-[160px] truncate">{modelName(active, selection.model)}</span>
+ <ChevronDown size={12} strokeWidth={2} aria-hidden="true" className="ml-1 shrink-0 text-ink-tertiary group-hover:text-ink-secondary" />
+ </button>
);
- return (
- <div ref={rootRef} className={cn(contained ? "w-full" : "relative", className)}>
- {contained ? (
- <div className="flex items-center justify-between gap-4">
- {label}
- {trigger}
+ const simpleMenu = simpleView ? simpleModelMenu({
+ instances: state.instances,
+ listed: pickerInstances,
+ selection,
+ bot: { name: profile.name, selection: profile.modelSelection, follows },
+ query,
+ expanded,
+ probing,
+ loading: loadingInstances,
+ refreshing: refreshingId,
+ }) : null;
+
+ const fullPane = (
+ <>
+ {fullView && !advanced && (
+ <div className="shrink-0 border-b-[0.5px] border-ink/10 p-1.5">
+ <button type="button" data-menu-row data-model-back onClick={(event) => backToList(event.detail === 0)} className={cn(MENU_ROW, "text-ink-secondary hover:text-ink")}>
+ <ChevronLeft size={16} strokeWidth={MENU_STROKE} className="shrink-0 rtl:-scale-x-100" aria-hidden="true" />
+ <span className="min-w-0 flex-1 truncate">{t("model.simple.back")}</span>
+ </button>
</div>
- ) : (
- trigger
)}
+ {follows !== undefined && (
+ <FollowBotModelRow name={profile.name} model={botModelName} follows={follows} onPick={pickBotModel} />
+ )}
+ <div className="flex min-h-0 min-w-0 flex-1">
+ {pickerInstances.length > 0 && <ModelEngineRail instances={pickerInstances} selectedInstance={railInstance} claudeInstance={claudeRailInstance} openaiInstance={openaiRailInstance} onSelect={selectRail}
+ onAddApiKeys={remote ? undefined : openApiKeys} />}
- {motion.shown && (
- <div
- data-model-picker-content
- role="dialog"
- aria-label={t("model.choose")}
- {...motion.exitProps}
- style={contained ? undefined : { ...placement, width: popoverWidth }}
- className={cn(
- "flex flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-card",
- contained
- ? "relative mt-3 w-full max-h-[min(420px,50dvh)]"
- : "absolute right-0 top-full z-30 mt-2 max-w-[calc(100vw-2rem)] max-h-[min(600px,calc(100dvh-7rem))] shadow-2xl shadow-black/50",
- motion.className,
- )}
- >
- {follows !== undefined && (
- <FollowBotModelRow name={profile.name} model={botModelName} follows={follows} onPick={pickBotModel} />
+ <div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto">
- {threadId && (
++ {threadId && mayChangeBotDefault && (
+ <div className="shrink-0 border-b-[0.5px] border-ink/10 px-3.5 py-2">
+ <div role="group" aria-label={t("model.scope.label")} className="flex gap-1">
+ {(["thread", "bot"] as const).map((value) => (
+ <button key={value} type="button" aria-pressed={scope === value} onClick={() => setScope(value)}
+ className={cn("h-6 rounded-full px-2.5 text-[12px] leading-4",
+ scope === value ? "bg-ink/[0.08] font-medium text-ink" : "text-ink-secondary hover:bg-ink/[0.06] hover:text-ink")}>
+ {value === "bot" ? t("model.scope.bot") : t("model.scope.thread")}
+ </button>
+ ))}
+ </div>
+ <p className="mt-1.5 text-[12px] leading-4 text-ink-tertiary">
+ {scope === "bot" ? t("model.scope.botHelp") : t("model.scope.threadHelp")}
+ </p>
+ </div>
)}
- <div className="flex min-h-0 min-w-0 flex-1">
- {simpleView ? (
- <SimpleModelPane
- providers={simpleProviders}
- onProvider={browseSimple}
- account={railInstance && simpleAccounts.length > 1 ? (
- <ClaudeAccountSelect accounts={simpleAccounts} selectedId={railInstance.instanceId} onSelect={browseSimple} />
- ) : undefined}
- managedBy={railInstance?.policy?.organizationName ?? null}
- needsSetup={railInstance && simpleSetup ? { name: simpleAccounts.length > 1 ? railInstance.displayName : simpleLabel } : null}
- signIn={railInstance && simpleSignIn && !simpleSetup ? { name: simpleLabel } : null}
- onSetUp={() => {
- if (simpleSignIn && hasOfficialModels) setPane("main");
- setFullView(true);
- }}
- models={simpleModels}
- repeatedLabels={repeatedModelLabels(simpleAll)}
- query={simpleQuery}
- showAll={simpleAll.length > simpleSuggested.length && !simpleQuery ? {
- count: simpleAll.length,
- open: showAll,
- onToggle: () => {
- if (showAll) {
- resetList();
- return;
- }
- setShowAll(true);
- if (railInstance) lookForLocalIn(railInstance);
- },
- } : null}
- onRefresh={refreshModels}
- refreshing={refreshing}
- search={simpleSearch ? (
- <ModelSearch
- value={query}
- local={simpleOfficial.length === 0}
- onChange={setQuery}
- onEscape={() => (query ? setQuery("") : setOpen(false))}
- />
- ) : undefined}
- currentModelId={currentModel}
- botModelId={botModelId}
- onPick={(model) => railInstance && pick(railInstance, model)}
- variantsRow={active?.capabilities?.modelVariants ? (
- <ModelVariantRow compact wide bot={bot} threadId={threadId} updateBotDefault={Boolean(threadId) && mayChangeBotDefault}
- label={<span className="shrink-0 text-[12px] font-medium text-ink-secondary">{t("model.simple.reasoning")}</span>} />
- ) : undefined}
- effort={simpleEffort}
- onManage={() => {
- setOpen(false);
- dispatch({ type: "toggleAppSettings", open: true, section: "engines" });
- }}
- />
- ) : (
- <>
- {pickerInstances.length > 0 && <ModelEngineRail instances={pickerInstances} selectedInstance={railInstance} claudeInstance={claudeRailInstance} openaiInstance={openaiRailInstance} onSelect={selectRail}
- onAddApiKeys={window.ogb?.remoteClient?.active === true ? undefined : openApiKeys} />}
-
- <div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto">
- {threadId && mayChangeBotDefault && (
- <div className="shrink-0 border-b border-hairline/40 px-3 py-2">
- <div role="group" aria-label={t("model.scope.label")} className="flex gap-1">
- {(["thread", "bot"] as const).map((value) => (
- <button key={value} type="button" aria-pressed={scope === value} onClick={() => setScope(value)}
- className={cn("rounded-lg px-2 py-1 text-[12px]", scope === value ? "bg-control text-ink" : "text-ink-secondary hover:bg-control/60")}>
- {value === "bot" ? t("model.scope.bot") : t("model.scope.thread")}
+ {railInstance ? (
+ <>
+ <div className="shrink-0 px-3.5 pb-2 pt-3">
+ <div className="flex items-center justify-between gap-3">
+ <div className="truncate text-[14px] font-semibold leading-5 text-ink">{signInFamily(railInstance) ? SIGN_IN_FAMILY_LABEL[signInFamily(railInstance)!] : railInstance.displayName}</div>
+ <div className="flex shrink-0 items-center gap-1">
+ <button
+ type="button"
+ data-model-refresh
+ disabled={loadingInstances || refreshingId !== null}
+ onClick={() => refreshModels(railInstance.instanceId)}
+ aria-label={
+ loadingInstances || refreshingId !== null
+ ? t("model.refreshing", { name: railInstance.displayName })
+ : t("model.refresh", { name: railInstance.displayName })
+ }
+ title={t("model.refreshTitle")}
+ className="flex size-7 items-center justify-center rounded-full text-ink-tertiary hover:bg-ink/[0.06] hover:text-ink disabled:cursor-wait"
+ >
+ {loadingInstances || refreshingId !== null ? (
+ <Loader2 size={14} className="animate-spin" aria-hidden="true" />
+ ) : (
+ <RefreshCw size={14} strokeWidth={MENU_STROKE} aria-hidden="true" />
+ )}
</button>
- ))}
- </div>
- <p className="mt-1 text-[11px] text-ink-secondary">
- {scope === "bot" ? t("model.scope.botHelp") : t("model.scope.threadHelp")}
- </p>
- </div>
- )}
- {railInstance ? (
- <>
- <div className="shrink-0 px-4 pb-2 pt-3.5">
- <div className="flex items-center justify-between gap-3">
- <div className="truncate text-[14px] font-semibold text-ink">{signInFamily(railInstance) ? SIGN_IN_FAMILY_LABEL[signInFamily(railInstance)!] : railInstance.displayName}</div>
- <div className="flex shrink-0 items-center gap-1">
- <button
- type="button"
- data-model-refresh
- disabled={refreshing}
- onClick={refreshModels}
- aria-label={
- refreshing
- ? t("model.refreshing", { name: railInstance.displayName })
- : t("model.refresh", { name: railInstance.displayName })
- }
- title={t("model.refreshTitle")}
- className="flex size-6 items-center justify-center rounded-md text-ink-secondary hover:bg-control hover:text-ink disabled:cursor-wait disabled:opacity-70"
- >
- {refreshing ? (
- <Loader2 size={12} className="animate-spin" aria-hidden="true" />
- ) : (
- <RefreshCw size={12} aria-hidden="true" />
- )}
- </button>
- <span
- className={cn(
- "shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium",
- blocked ? "bg-warning/10 text-warning" : "bg-success/10 text-success",
- )}
- >
- {pane === "custom" && !blocked && railInstance.access !== "api" ? t("model.localModels") : engineStatus(railInstance)}
- </span>
- </div>
+ <span
+ className={cn(
+ "flex h-5 shrink-0 items-center rounded-full px-2 text-[11px] font-medium leading-4",
+ blocked ? "bg-warning/10 text-warning" : "bg-success/10 text-success",
+ )}
+ >
+ {pane === "custom" && !blocked && railInstance.access !== "api" ? t("model.localModels") : engineStatus(railInstance)}
+ </span>
</div>
- {isClaudeAccount(railInstance) && claudeAccounts.length > 1 && (
- <ClaudeAccountSelect accounts={claudeAccounts} selectedId={railInstance.instanceId} onSelect={selectRail} />
- )}
- {signInFamily(railInstance) === "openai" && openaiAccounts.length > 1 && (
- <ClaudeAccountSelect accounts={openaiAccounts} selectedId={railInstance.instanceId} onSelect={selectRail} />
- )}
- {railInstance.snapshot.authenticated && railInstance.snapshot.account && (
- <p className="mt-1 truncate text-[11px] text-ink-secondary" title={[railInstance.snapshot.account.email, railInstance.snapshot.account.organization].filter(Boolean).join(" · ")}>
- {[railInstance.snapshot.account.email, railInstance.snapshot.account.organization].filter(Boolean).join(" · ")}
- </p>
- )}
- {railInstance.snapshot.chatgptPlan && railInstance.snapshot.authenticated && (
- <ChatGptPlanStatus key={railInstance.instanceId} instanceId={railInstance.instanceId} />
- )}
- {railInstance.access === "api"
- ? <div className="mt-0.5 text-[12px] text-ink-secondary">{t("model.apiKeyHint")}</div>
- : pane === "custom" && <div className="mt-0.5 text-[12px] text-ink-secondary">{t("model.localHint")}</div>}
</div>
+ {isClaudeAccount(railInstance) && claudeAccounts.length > 1 && (
+ <ClaudeAccountSelect accounts={claudeAccounts} selectedId={railInstance.instanceId} onSelect={selectRail} />
+ )}
+ {signInFamily(railInstance) === "openai" && openaiAccounts.length > 1 && (
+ <ClaudeAccountSelect accounts={openaiAccounts} selectedId={railInstance.instanceId} onSelect={selectRail} />
+ )}
+ {railInstance.snapshot.authenticated && railInstance.snapshot.account && (
+ <p className="mt-1 truncate text-[12px] leading-4 text-ink-tertiary" title={[railInstance.snapshot.account.email, railInstance.snapshot.account.organization].filter(Boolean).join(" · ")}>
+ {[railInstance.snapshot.account.email, railInstance.snapshot.account.organization].filter(Boolean).join(" · ")}
+ </p>
+ )}
+ {railInstance.snapshot.chatgptPlan && railInstance.snapshot.authenticated && (
+ <ChatGptPlanStatus key={railInstance.instanceId} instanceId={railInstance.instanceId} />
+ )}
+ {railInstance.access === "api"
+ ? <ApiKeyHint instance={railInstance} />
+ : pane === "custom" && <div className="mt-0.5 text-[12px] leading-4 text-ink-tertiary">{t("model.localHint")}</div>}
+ </div>
- {pane === "custom" && canReturnToOfficial && (
+ {pane === "custom" && canReturnToOfficial && (
+ <div className="shrink-0 px-1.5 pb-1">
<button
type="button"
+ data-menu-row
onClick={() => {
setPane("main");
resetList();
}}
- className="mx-2 mb-1 flex shrink-0 items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-[12px] text-ink-secondary hover:bg-control/60"
+ className={cn(MENU_ROW, "text-ink-secondary hover:text-ink")}
>
- <ChevronLeft size={13} /> {t("model.backTo", { name: railInstance.displayName })}
+ <ChevronLeft size={16} strokeWidth={MENU_STROKE} className="shrink-0 rtl:-scale-x-100" aria-hidden="true" />
+ <span className="min-w-0 flex-1 truncate">{t("model.backTo", { name: railInstance.displayName })}</span>
</button>
- )}
+ </div>
+ )}
- {railInstance.policy ? (
- <div data-policy-blocked className="min-h-0 flex-1 overflow-y-auto px-3 pb-3 pt-1 text-[13px] leading-relaxed text-ink-secondary">
- <p className="font-medium text-ink">{t("policy.managedBy", { organization: railInstance.policy.organizationName })}</p>
- <p className="mt-1">{t("policy.modelBlocked", { organization: railInstance.policy.organizationName })}</p>
- </div>
- ) : blocked ? (
- <div className="min-h-0 flex-1 overflow-y-auto px-3 pb-3 pt-1">
- <EngineSetup instance={railInstance} intent={pane === "custom" ? "inject" : "cloud"} />
- {railInstance.claudeAccount && needsSignIn(railInstance) && pane !== "custom" && (
- <p className="mt-2 text-[12px] leading-relaxed text-ink-secondary">
- {railInstance.claudeAccount.signInShell === "powershell" && `${t("engines.account.powershell")} `}
- {t("engines.account.signInHint")}
- </p>
- )}
- <p className="mt-2 text-center text-[12px] text-ink-tertiary">
- {railInstance.snapshot.chatgptPlan ? t("engineSetup.chatgpt.modelsAfterSignIn") : pane === "main" && official.length > 0
- ? official.length === 1
- ? t("model.afterSetupOne")
- : t("model.afterSetupMany", { count: official.length })
- : t("model.localSoon")}
+ {railInstance.policy ? (
+ <div data-policy-blocked className="min-h-0 flex-1 overflow-y-auto px-3.5 pb-3 pt-1 text-[13px] leading-[18px] text-ink-secondary">
+ <p className="font-medium text-ink">{t("policy.managedBy", { organization: railInstance.policy.organizationName })}</p>
+ <p className="mt-1">{t("policy.modelBlocked", { organization: railInstance.policy.organizationName })}</p>
+ </div>
+ ) : blocked ? (
+ <div className="min-h-0 flex-1 overflow-y-auto px-2 pb-3 pt-1">
+ <EngineSetup instance={railInstance} intent={pane === "custom" ? "inject" : "cloud"} quiet={!advanced} />
+ {railInstance.claudeAccount && needsSignIn(railInstance) && pane !== "custom" && (
+ <p className="mt-2 px-1.5 text-[12px] leading-4 text-ink-tertiary">
+ {railInstance.claudeAccount.signInShell === "powershell" && `${t("engines.account.powershell")} `}
+ {t("engines.account.signInHint")}
</p>
- </div>
- ) : (
- <>
- {((pane === "main" && official.length > COMPACT_MODEL_COUNT) ||
- (pane === "custom" && custom.length > COMPACT_MODEL_COUNT)) && (
- <ModelSearch
- value={query}
- local={pane === "custom"}
- onChange={(value) => {
- setQuery(value);
- if (value) setShowAll(true);
- }}
- onEscape={() => {
- if (query) setQuery("");
- else if (pane === "custom" && canReturnToOfficial) setPane("main");
- }}
- />
- )}
+ )}
+ <p className="mt-2 text-center text-[12px] leading-4 text-ink-tertiary">
+ {railInstance.snapshot.chatgptPlan ? t("engineSetup.chatgpt.modelsAfterSignIn") : pane === "main" && official.length > 0
+ ? official.length === 1
+ ? t("model.afterSetupOne")
+ : t("model.afterSetupMany", { count: official.length })
+ : t("model.localSoon")}
+ </p>
+ </div>
+ ) : (
+ <>
+ {((pane === "main" && official.length > COMPACT_MODEL_COUNT) ||
+ (pane === "custom" && custom.length > COMPACT_MODEL_COUNT)) && (
+ <ModelSearch
+ value={query}
+ local={pane === "custom"}
+ onChange={(value) => {
+ setQuery(value);
+ if (value) setShowAll(true);
+ }}
+ />
+ )}
- <div data-model-list className="min-h-[min(180px,30dvh)] flex-1 overflow-y-auto px-2 pb-2">
- {pane === "main" ? (
- <>
- {railInstance.snapshot.update && (
- <EngineUpdateNotice update={railInstance.snapshot.update} instance={railInstance} className="mx-1 mb-2" />
- )}
- <EngineGroupLabel className="px-2 pb-1 pt-0.5">
- {query
- ? t("model.results", { count: filteredOfficial.length })
- : showAll
- ? t("model.allModels", { count: official.length })
- : t("model.suggested")}
- </EngineGroupLabel>
- {shownOfficial.map(renderRow)}
- {shownOfficial.length === 0 && (
- <div className="px-2 py-5 text-center text-[13px] text-ink-secondary">
- {t("model.noMatch", { query: query.trim() })}
- </div>
- )}
- {!query && !showAll && official.length > compactOfficial.length && (
- <button
- type="button"
- onClick={() => setShowAll(true)}
- className="mt-1 flex w-full items-center justify-between rounded-lg border-t border-hairline/40 px-2.5 py-2 text-[13px] font-medium text-ink-secondary hover:bg-control/60 hover:text-ink"
- >
- {t("model.showAll", { count: official.length })} <ChevronDown size={13} />
- </button>
- )}
- {!query && showAll && official.length > COMPACT_MODEL_COUNT && (
- <button
- type="button"
- onClick={() => setShowAll(false)}
- className="mt-1 w-full rounded-lg px-2.5 py-2 text-[12px] text-ink-secondary hover:bg-control/60 hover:text-ink"
- >
- {t("model.showSuggested")}
- </button>
- )}
- </>
- ) : (
- <>
- {lookingForLocal && custom.length > 0 && (
- <div className="flex px-2 pb-1.5 pt-0.5 text-[12px] text-ink-secondary">{lookingForLocalStatus}</div>
- )}
- {pinned.length > 0 && (
- <EngineGroupLabel className="px-2 pb-1 pt-0.5">{t("model.loadedNow")}</EngineGroupLabel>
- )}
- {pinned.map(renderRow)}
- {pinned.length > 0 && rest.length > 0 && (
- <div className="mx-2 my-2 border-t border-hairline/40" role="separator" />
- )}
- {rest.map(renderRow)}
- {custom.length === 0 && (
- <div className="mx-1 rounded-xl border border-dashed border-hairline/50 px-3 py-5 text-center">
- {lookingForLocal ? (
- <div className="text-[13px] text-ink-secondary">{lookingForLocalStatus}</div>
- ) : (
- <>
- <div className="text-[13px] font-medium text-ink">{t("model.noLocal")}</div>
- <div className="mt-1 text-[12px] leading-relaxed text-ink-secondary">
- {t("model.noLocalHint")}
- </div>
- </>
- )}
- </div>
- )}
- {custom.length > 0 && filteredCustom.length === 0 && (
- <div className="px-2 py-5 text-center text-[13px] text-ink-secondary">
- {t("model.noMatch", { query: query.trim() })}
- </div>
- )}
- </>
- )}
- </div>
- </>
- )}
+ <div data-model-list className="flex min-h-[min(180px,30dvh)] flex-1 flex-col gap-0.5 overflow-y-auto p-1.5">
+ {pane === "main" && loadingList ? (
+ <div role="status" className={cn(MENU_LINE, "justify-center text-ink-tertiary")}>
+ <Loader2 size={14} className="shrink-0 animate-spin" aria-hidden="true" />
+ {t("model.loadingModels", { name: railInstance.displayName })}
+ </div>
+ ) : pane === "main" ? (
+ <>
+ {railInstance.snapshot.update && (
+ <EngineUpdateNotice update={railInstance.snapshot.update} instance={railInstance} className="mx-0.5 mb-1.5" />
+ )}
+ <div className={MENU_LABEL}>
+ {query
+ ? t("model.results", { count: filteredOfficial.length })
+ : showAll
+ ? t("model.allModels", { count: official.length })
+ : t("model.suggested")}
+ </div>
+ {shownOfficial.map(renderRow)}
+ {shownOfficial.length === 0 && (
+ <div className="px-2 py-5 text-center text-[13px] leading-[18px] text-ink-secondary">
+ {t("model.noMatch", { query: query.trim() })}
+ </div>
+ )}
+ {!query && !showAll && official.length > compactOfficial.length && (
+ <button type="button" data-menu-row onClick={() => setShowAll(true)} className={cn(MENU_ROW, "text-ink-secondary hover:text-ink")}>
+ <span className="min-w-0 flex-1 truncate">{t("model.showAll", { count: official.length })}</span>
+ <ChevronDown size={16} strokeWidth={MENU_STROKE} className={MENU_TRAILING} aria-hidden="true" />
+ </button>
+ )}
+ {!query && showAll && official.length > COMPACT_MODEL_COUNT && (
+ <button type="button" data-menu-row onClick={() => setShowAll(false)} className={cn(MENU_ROW, "text-ink-secondary hover:text-ink")}>
+ <span className="min-w-0 flex-1 truncate">{t("model.showSuggested")}</span>
+ <ChevronUp size={16} strokeWidth={MENU_STROKE} className={MENU_TRAILING} aria-hidden="true" />
+ </button>
+ )}
+ </>
+ ) : (
+ <>
+ {lookingForLocal && custom.length > 0 && lookingForLocalStatus}
+ {pinned.length > 0 && <div className={MENU_LABEL}>{t("model.loadedNow")}</div>}
+ {pinned.map(renderRow)}
+ {pinned.length > 0 && rest.length > 0 && <div role="separator" className={MENU_SEPARATOR} />}
+ {rest.map(renderRow)}
+ {custom.length === 0 && (lookingForLocal ? lookingForLocalStatus : (
+ <div className="px-3 py-6 text-center">
+ <div className="text-[13px] leading-[18px] text-ink">{t("model.noLocal")}</div>
+ <div className="mt-1 text-[12px] leading-4 text-ink-tertiary">{t("model.noLocalHint")}</div>
+ </div>
+ ))}
+ {custom.length > 0 && filteredCustom.length === 0 && (
+ <div className="px-2 py-5 text-center text-[13px] leading-[18px] text-ink-secondary">
+ {t("model.noMatch", { query: query.trim() })}
+ </div>
+ )}
+ </>
+ )}
+ </div>
+ </>
+ )}
- {!contained && (
- <EffortRow
- compact
- bot={bot}
- threadId={threadId}
- updateBotDefault={Boolean(threadId && mayChangeBotDefault && scope === "bot")}
- className="shrink-0 border-t border-hairline/40 px-4 py-2"
- label={<span className="text-[13px] font-medium text-ink">{active?.capabilities?.modelVariants ? t("model.simple.reasoning") : t("model.section.effort")}</span>}
- />
- )}
+ {!contained && (
+ <EffortRow
+ compact
+ bot={shown}
+ threadId={threadId}
- updateBotDefault={Boolean(threadId && scope === "bot")}
++ updateBotDefault={Boolean(threadId && mayChangeBotDefault && scope === "bot")}
+ className="shrink-0 border-t-[0.5px] border-ink/10 px-3.5 py-[5px]"
+ label={<span className="text-[13px] leading-[18px] text-ink">{active?.capabilities?.modelVariants ? t("model.simple.reasoning") : t("model.section.effort")}</span>}
+ />
+ )}
- {pane === "main" && offersLocalModels(railInstance, custom.length) && (
- <button
- type="button"
- data-model-local-entry
- aria-label={
- custom.length > 0
- ? t("model.useLocalCount", { count: custom.length })
- : t("model.useLocal")
- }
- disabled={!canOpenCustom}
- onClick={() => openLocalModels(railInstance)}
- className="flex w-full shrink-0 items-center justify-between gap-2 border-t border-hairline/40 px-4 py-3 text-left text-[13px] font-medium text-ink hover:bg-control/60 disabled:cursor-not-allowed disabled:text-ink-secondary/40 disabled:hover:bg-transparent"
- >
- <span>{t("model.useLocal")}</span>
- <span className="flex items-center gap-2">
- {custom.length > 0 && (
- <span className="rounded-full bg-inset px-2 py-0.5 text-[11px] text-ink-secondary">
- {t("model.available", { count: custom.length })}
- </span>
- )}
- <ChevronRight size={14} className="text-ink-secondary" />
- </span>
- </button>
- )}
- </>
- ) : (
- <div className="px-4 py-5 text-[13px] text-ink-secondary">{t("model.noProviders")}</div>
- )}
- <div className="flex shrink-0 border-t border-hairline/40">
- <button type="button" onClick={() => {
- setOpen(false);
- dispatch({ type: "toggleAppSettings", open: true, section: "engines" });
- }} className="flex-1 px-4 py-2 text-left text-[12px] text-ink-secondary hover:bg-control/60 hover:text-ink">
- {t("settings.engines.title")}
- </button>
- {window.ogb?.remoteClient?.active !== true && (
- <button type="button" data-model-add-api-keys onClick={openApiKeys} className="flex shrink-0 items-center gap-1.5 px-4 py-2 text-[12px] text-ink-secondary hover:bg-control/60 hover:text-ink">
- <KeyRound size={12} aria-hidden="true" />
- {apiKeysLabel(pickerInstances)}
+ {pane === "main" && offersLocalModels(railInstance, custom.length) && (
+ <button
+ type="button"
+ data-model-local-entry
+ data-menu-row
+ aria-label={
+ custom.length > 0
+ ? t("model.useLocalCount", { count: custom.length })
+ : t("model.useLocal")
+ }
+ disabled={!canOpenCustom}
+ onClick={() => openLocalModels(railInstance)}
+ className="flex h-10 w-full shrink-0 items-center justify-between gap-2 border-t-[0.5px] border-ink/10 px-3.5 text-left text-[13px] leading-[18px] text-ink hover:bg-ink/[0.06] focus:bg-ink/[0.06] disabled:cursor-not-allowed disabled:text-ink-tertiary disabled:hover:bg-transparent"
+ >
+ <span>{t("model.useLocal")}</span>
+ <span className="flex items-center gap-2">
+ {custom.length > 0 && (
+ <span className="text-[12px] leading-4 text-ink-tertiary">{t("model.available", { count: custom.length })}</span>
+ )}
+ <ChevronRight size={16} strokeWidth={MENU_STROKE} className={MENU_TRAILING} aria-hidden="true" />
+ </span>
</button>
)}
- </div>
- </div>
- </>
+ </>
+ ) : (
+ <div className="px-3.5 py-5 text-[13px] leading-[18px] text-ink-secondary">{t("model.noProviders")}</div>
)}
+ <div className="flex h-9 shrink-0 items-center gap-1 border-t-[0.5px] border-ink/10 px-1.5">
+ <button type="button" onClick={openEngines}
+ className="h-7 min-w-0 flex-1 truncate rounded-md px-2 text-left text-[12px] leading-4 text-ink-secondary hover:bg-ink/[0.06] hover:text-ink">
+ {t("settings.engines.title")}
+ </button>
+ {!remote && (
+ <button type="button" data-model-add-api-keys onClick={openApiKeys}
+ className="flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-[12px] leading-4 text-ink-secondary hover:bg-ink/[0.06] hover:text-ink">
+ <KeyRound size={14} strokeWidth={MENU_STROKE} aria-hidden="true" />
+ {apiKeysLabel(pickerInstances)}
+ </button>
+ )}
</div>
</div>
+ </div>
+ </>
+ );
+
+ const menu = motion.shown && (
+ <div
+ ref={menuRef}
+ id={menuId}
+ data-model-picker-content
+ role="dialog"
+ aria-label={t("model.choose")}
+ aria-modal="false"
+ tabIndex={-1}
+ {...motion.exitProps}
+ onKeyDown={onMenuKey}
+ onPointerMove={onMenuPointerMove}
+ style={floating ? {
+ position: "fixed",
+ left: placement?.left ?? 0,
+ top: placement?.top,
+ bottom: placement?.bottom,
+ width: placement?.width ?? popoverWidth,
+ maxHeight: placement?.maxHeight,
+ transformOrigin: placement?.origin,
+ visibility: placement ? undefined : "hidden",
+ } : { width: popoverWidth }}
+ className={cn("menu-surface z-[80] flex flex-col overflow-hidden", motion.className)}
+ >
+ {simpleMenu ? (
+ <SimpleModelMenu
+ menu={simpleMenu}
+ query={query}
+ bot={profile}
+ botModel={{ label: modelName(botModelInstance, profile.modelSelection.model), title: botModelName }}
+ thinking={thinking}
+ idPrefix={menuId}
+ onQuery={setQuery}
+ onPick={pick}
+ onPickCurrent={() => close(true)}
+ onFollowBot={pickBotModel}
+ onToggle={(instance) => {
+ const opening = !expanded.has(instance.instanceId);
+ setExpanded((current) => {
+ const next = new Set(current);
+ if (opening) next.add(instance.instanceId);
+ else next.delete(instance.instanceId);
+ return next;
+ });
+ if (opening) lookForLocalIn(instance);
+ }}
+ onSetUp={openFull}
+ onCheckAgain={(instance) => refreshModels(instance.instanceId)}
+ onManage={openEngines}
+ onResetVariant={resetVariant}
+ />
+ ) : fullPane}
+ </div>
+ );
+
+ return (
+ <div ref={rootRef} className={cn(contained ? "w-full" : "relative", className)}>
+ {contained ? (
+ <div className="flex items-center justify-between gap-4">
+ {label}
+ {trigger}
+ </div>
+ ) : (
+ trigger
)}
+ {menu && floating ? createPortal(menu, document.body) : menu}
{!contained && changedBotModel && !open && ownModelThreads > 0 && (
<div data-thread-models-notice role="status"
- className="absolute right-0 top-full z-30 mt-2 flex max-w-[calc(100vw-2rem)] items-center gap-2 rounded-xl border border-hairline/50 bg-card py-2 pl-3 pr-2 shadow-xl shadow-black/30">
+ className="menu-surface absolute right-0 top-full z-30 mt-1 flex w-max max-w-[min(300px,calc(100vw-2rem))] items-center gap-2 py-1.5 pl-3 pr-1.5 text-[13px] leading-[18px]">
<ThreadModelsLine bot={profile} />
<button type="button" aria-label={t("common.close")} onClick={() => setChangedBotModel(false)}
- className="shrink-0 rounded-md p-1 text-ink-secondary hover:bg-control/60 hover:text-ink">
- <X size={13} aria-hidden="true" />
+ className="flex size-6 shrink-0 items-center justify-center rounded-full text-ink-tertiary hover:bg-ink/[0.06] hover:text-ink">
+ <X size={14} aria-hidden="true" />
</button>
</div>
)}