Skip to content

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

Bot panel: Model and Reasoning rows show the open conversation's model

laijsg117720726c60a
diff --git a/src/components/BotSettingsDialog.simple.test.ts b/src/components/BotSettingsDialog.simple.test.ts
index 289e979726..bc9c37fca6 100644
--- a/src/components/BotSettingsDialog.simple.test.ts
+++ b/src/components/BotSettingsDialog.simple.test.ts
@@ -138,7 +138,7 @@ const { PageHeader } = await import("./bot-panel/rows");
const { ChatShareMenu } = await import("./ChatMoreMenu");
const { SoulField } = await import("./SoulField");
const { LocalComputerAutoWarning } = await import("./LocalComputerAutoWarning");
-const { ModelPicker } = await import("./ModelPicker");
+const { EffortRow, ModelPicker } = await import("./ModelPicker");
const { ThreadModelsLine } = await import("./ThreadModelsLine");
const { ModelSection } = await import("./bot-settings/ModelSection");
const { RoutineList } = await import("./routines/RoutineList");
@@ -630,6 +630,43 @@ describe("the Details tab", () => {
expect(switches(rendered.html)).toBe(0);
});
+ describe("the Model and Reasoning rows", () => {
+ const opus = { instanceId: "claude", model: "claude-opus-5-5" };
+ const thread = (modelSelection?: Bot["modelSelection"]) => makeBot({
+ modelSelection: { ...opus, effort: "low" },
+ tasks: [{ threadId: "thread-scout", title: "Main", createdAt: 1, ...(modelSelection ? { modelSelection, followsBotModel: false } : {}) }],
+ });
+ const pickHigh = (bot: Bot) => {
+ const row = ofType(botTab(bot), EffortRow)!;
+ const select = capture(() => EffortRow(row.props as Parameters<typeof EffortRow>[0])).nodes
+ .find((node) => node.props["aria-label"] === "Reasoning effort")!;
+ change(select, "high");
+ return (fixture.dispatch as ReturnType<typeof vi.fn>).mock.lastCall![0] as Record<string, unknown>;
+ };
+ beforeEach(() => {
+ fixture.storeState = { ...fixture.storeState, instances: [engine()] };
+ });
+
+ it("shows the open conversation's model, not the bot's default", () => {
+ const own = { instanceId: "claude", model: "claude-haiku-4-5", effort: "max" as const };
+ const rendered = botTab(thread(own));
+ const picker = ofType(rendered, ModelPicker)!;
+ expect((picker.props.bot as Bot).modelSelection).toEqual(own);
+ expect(picker.key).toMatch(/thread-scout$/);
+ const row = ofType(rendered, EffortRow)!;
+ expect(capture(() => EffortRow(row.props as Parameters<typeof EffortRow>[0])).html).toMatch(/<option value="max" selected="">/);
+ });
+
+ it.each([true, false, null] as const)("sets a reasoning level on the open conversation only, whatever its model (owner: %s)", (ownerOrAdmin) => {
+ fixture.ownerOrAdmin = ownerOrAdmin;
+ expect(pickHigh(thread())).toEqual({ type: "setModel", botId: "scout", threadId: "thread-scout", selection: { ...opus, effort: "high" } });
+ const haiku = { instanceId: "claude", model: "claude-haiku-4-5" };
+ expect(pickHigh(thread({ ...haiku, effort: "low" }))).toEqual({
+ type: "setModel", botId: "scout", threadId: "thread-scout", selection: { ...haiku, effort: "high" },
+ });
+ });
+ });
+
it("offers Add a routine, which says what routines are, and Automations while the bot has none, and lists them once it has some", () => {
const empty = botTab(makeBot());
expect(empty.html).toContain('data-panel-empty="routines"');
diff --git a/src/components/ModelPicker.simple.test.ts b/src/components/ModelPicker.simple.test.ts
index 6eaed50a78..1e539bf56e 100644
--- a/src/components/ModelPicker.simple.test.ts
+++ b/src/components/ModelPicker.simple.test.ts
@@ -547,6 +547,20 @@ describe("the model picker in Simple mode", () => {
}));
});
+ it.each([true, false] as const)("lets the bot panel's picker return its conversation's variant to the session setting, in that conversation only (owner: %s)", (ownerOrAdmin) => {
+ fixture.ownerOrAdmin = ownerOrAdmin;
+ const variants = [{ id: "low", label: "Low" }, { id: "high", label: "High" }];
+ fixture.instances = [{ ...engine("antigravity", "antigravityAgent", "Google Gemini", "subscription", [
+ { id: "gemini-4-neon", label: "Gemini 4 Neon", variants },
+ ]), capabilities: { modelVariants: true } }];
+ const neon = { instanceId: "antigravity", model: "gemini-4-neon" };
+ const simple = pane(open({ ...bot(), modelSelection: { ...neon, variant: "low" } }, { contained: true, thread: true }))!;
+ (simple.props as { onResetVariant: () => void }).onResetVariant();
+ expect(fixture.dispatch).toHaveBeenLastCalledWith({
+ type: "setModel", botId: "scout", threadId: "thread-scout", updateBotDefault: false, selection: neon,
+ });
+ });
+
it("shows the picked Antigravity thinking level on the closed picker, so the pick visibly lands (#4160)", () => {
const variants = [{ id: "low", label: "Low" }, { id: "medium", label: "Medium" }];
fixture.instances = [{ ...engine("antigravity", "antigravityAgent", "Google Gemini", "subscription", [
diff --git a/src/components/ModelPicker.tsx b/src/components/ModelPicker.tsx
index adf00468c1..89c8d9669c 100644
--- a/src/components/ModelPicker.tsx
+++ b/src/components/ModelPicker.tsx
@@ -492,7 +492,7 @@ export function ModelPicker({
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, selection: nextSelection });
close(true);
} : undefined;
diff --git a/src/components/bot-panel/DetailsTab.tsx b/src/components/bot-panel/DetailsTab.tsx
index 4a1be368e2..8977d5d509 100644
--- a/src/components/bot-panel/DetailsTab.tsx
+++ b/src/components/bot-panel/DetailsTab.tsx
@@ -2,7 +2,7 @@ import { Calendar, CalendarPlus, ChevronRight, Sparkles } from "lucide-react";
import { cn } from "@/lib/cn";
import { t } from "@/lib/i18n";
-import { useStore, type Bot } from "@/state/store";
+import { currentTaskBot, useStore, type Bot } from "@/state/store";
import { useChatMoreItems } from "../ChatMoreMenu";
import { EffortRow, ModelPicker } from "../ModelPicker";
import type { SidebarMenuItem } from "../SidebarPopoverMenu";
@@ -47,6 +47,7 @@ export function DetailsTab({ bot, derived, onOpen }: {
}) {
const { items } = useChatMoreItems(bot);
const { dispatch } = useStore();
+ const thread = currentTaskBot(bot);
const routinesOn = derived.botRoutines.filter((routine) => routine.enabled).length;
const conversationItems = CONVERSATION_ITEMS.flatMap((key) => items.filter((item) => item.key === key));
@@ -56,7 +57,8 @@ export function DetailsTab({ bot, derived, onOpen }: {
<section data-panel-card="model" className="pt-2">
<div data-panel-row="model" className={cn(rowCls, "rounded-[8px]")}>
<ModelPicker
- bot={bot}
+ key={bot.threadId}
+ bot={thread}
contained
threadId={bot.threadId}
label={<span className="flex shrink-0 items-center gap-2.5"><RowIcon icon={Sparkles} /><RowText title={t("model.simple.model")} /></span>}
@@ -64,7 +66,7 @@ export function DetailsTab({ bot, derived, onOpen }: {
</div>
{/* The picker hides its own reasoning row when contained, so this tab draws it as its own row. */}
<EffortRow
- bot={bot}
+ bot={thread}
threadId={bot.threadId}
compact
className={cn(rowCls, "min-w-0 flex-1 rounded-[8px]")}