Skip to content

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

Bot panel: Model and Reasoning rows set the blank chat's choices (#6806)

Milind Soniafbff51b7c9f
diff --git a/src/components/BotSettingsDialog.simple.test.ts b/src/components/BotSettingsDialog.simple.test.ts
index f78823b004..95fd4b0f03 100644
--- a/src/components/BotSettingsDialog.simple.test.ts
+++ b/src/components/BotSettingsDialog.simple.test.ts
@@ -667,6 +667,46 @@ describe("the Details tab", () => {
type: "setModel", botId: "scout", threadId: "thread-scout", selection: { ...haiku, effort: "high" },
});
});
+
+ describe("while a blank chat is open", () => {
+ const blank = (held: unknown[] = []) => {
+ fixture.storeState = { ...fixture.storeState, newChat: { session: 1, botId: "scout", held } };
+ };
+
+ it.each([true, false, null] as const)("sets the reasoning level on the blank chat, not the conversation it covers (owner: %s)", (ownerOrAdmin) => {
+ fixture.ownerOrAdmin = ownerOrAdmin;
+ blank();
+ const haiku = { instanceId: "claude", model: "claude-haiku-4-5", effort: "max" as const };
+ expect(pickHigh(thread(haiku))).toEqual({ type: "setModel", botId: "scout", threadId: "new-chat-scout", selection: { ...opus, effort: "high" } });
+ });
+
+ it("shows the blank chat's choices in both rows, and a held level as picked", () => {
+ blank([{ type: "setModel", botId: "scout", threadId: "new-chat-scout", selection: { ...opus, effort: "high" } }]);
+ const rendered = botTab(thread({ instanceId: "claude", model: "claude-haiku-4-5", effort: "max" }));
+ const picker = ofType(rendered, ModelPicker)!;
+ expect(picker.props.threadId).toBe("new-chat-scout");
+ expect(picker.key).toMatch(/new-chat-scout$/);
+ expect((picker.props.bot as Bot).modelSelection).toEqual({ ...opus, effort: "high" });
+ const row = ofType(rendered, EffortRow)!;
+ expect(row.props.threadId).toBe("new-chat-scout");
+ expect(capture(() => EffortRow(row.props as Parameters<typeof EffortRow>[0])).html).toMatch(/<option value="high" selected="">/);
+ });
+
+ it("hands a model-variant engine's row the blank chat too", () => {
+ fixture.storeState = { ...fixture.storeState, instances: [engine({ capabilities: { modelVariants: true },
+ models: { default: opus.model, options: [{ id: opus.model, label: "Opus", variants: [{ id: "deep", label: "Deep" }] }] } } as Partial<InstanceInfo>)] };
+ blank();
+ const row = ofType(botTab(thread({ ...opus, variant: "deep" })), EffortRow)!;
+ const variants = capture(() => EffortRow(row.props as Parameters<typeof EffortRow>[0])).nodes[0]!;
+ expect(variants.props.threadId).toBe("new-chat-scout");
+ expect((variants.props.bot as Bot).modelSelection).toEqual({ ...opus, effort: "low" });
+ });
+
+ it("leaves another bot's blank chat alone", () => {
+ fixture.storeState = { ...fixture.storeState, newChat: { session: 1, botId: "pepper", held: [] } };
+ expect(pickHigh(thread())).toEqual({ type: "setModel", botId: "scout", threadId: "thread-scout", selection: { ...opus, 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", () => {
diff --git a/src/components/bot-panel/DetailsTab.tsx b/src/components/bot-panel/DetailsTab.tsx
index 73b86fe465..08a1d7e262 100644
--- a/src/components/bot-panel/DetailsTab.tsx
+++ b/src/components/bot-panel/DetailsTab.tsx
@@ -11,7 +11,8 @@ import { BotConversations } from "./Conversations";
import type { SimplePageId } from "./page-registry";
import { TryAsking } from "./TryAsking";
import { Card, CardLabel, LabelAction, panelActionCls, NavRow, RowIcon, rowCls, RowText } from "./rows";
-import { useStoreDispatch } from "@/state/store-select";
+import { useStoreDispatch, useStoreSelector } from "@/state/store-select";
+import { newChatBot } from "@/state/new-chat";
type Derived = ReturnType<typeof useBotSettingsDerived>;
@@ -48,7 +49,10 @@ export function DetailsTab({ bot, derived, onOpen }: {
}) {
const { items } = useChatMoreItems(bot);
const dispatch = useStoreDispatch();
- const thread = currentTaskBot(bot);
+ // While a blank chat is open the chat shows it, not the conversation it covers: the Model and Reasoning rows show and
+ // set the blank chat's choices, which the first send applies to the conversation it makes.
+ const newChat = useStoreSelector((state) => state.newChat);
+ const thread = currentTaskBot(newChatBot(bot, newChat));
const routinesOn = derived.botRoutines.filter((routine) => routine.enabled).length;
const conversationItems = CONVERSATION_ITEMS.flatMap((key) => items.filter((item) => item.key === key));
@@ -58,17 +62,17 @@ 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
- key={bot.threadId}
+ key={thread.threadId}
bot={thread}
contained
- threadId={bot.threadId}
+ threadId={thread.threadId}
label={<span className="flex shrink-0 items-center gap-2.5"><RowIcon icon={Sparkles} /><RowText title={t("model.simple.model")} /></span>}
/>
</div>
{/* The picker hides its own reasoning row when contained, so this tab draws it as its own row. */}
<EffortRow
bot={thread}
- threadId={bot.threadId}
+ threadId={thread.threadId}
compact
className={cn(rowCls, "min-w-0 flex-1 rounded-[8px]")}
label={<span className="flex shrink-0 items-center gap-2.5"><RowIcon icon={Sparkles} /><RowText title={t("model.simple.reasoning")} /></span>}