Skip to content

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

Bot settings: say where a new bot's model comes from (#4217)

Aditya Umalec184f5ec9083
diff --git a/src/components/bot-settings/ModelSection.test.ts b/src/components/bot-settings/ModelSection.test.ts
index 8ad1e7fef9..c60f8b18f2 100644
--- a/src/components/bot-settings/ModelSection.test.ts
+++ b/src/components/bot-settings/ModelSection.test.ts
@@ -11,7 +11,13 @@ vi.mock("@/state/store", async (importOriginal) => {
return { ...original, useStore: () => ({ state: { ...original.initialState, instances, config: { automaticRecovery: recovery } }, dispatch: vi.fn() }) };
});
-const { FallbackChain } = await import("./ModelSection");
+vi.mock("../ModelPicker", () => ({
+ ModelPicker: ({ label }: { label: ReactNode }) => label,
+ EffortRow: () => null,
+}));
+
+const { FallbackChain, ModelSection } = await import("./ModelSection");
+const { BotEditorContext } = await import("./BotEditorContext");
const engine = (instanceId: string, displayName: string, options: string[], authenticated = true) => ({
instanceId, displayName, driverKind: "openai-compat", enabled: true,
@@ -62,3 +68,17 @@ describe("a bot's backup models", () => {
expect(markup).toMatch(/aria-label="Model for Codex"[^>]*>.*<option value="gpt-old" selected="">gpt-old<\/option>/);
});
});
+
+describe("the bot's model in Bot settings", () => {
+ const hint = "A new bot starts on this installation&#x27;s default model unless you pick another here. To switch automatically when this model is at its usage limit, add backup models below.";
+ const render = (draft: boolean) => renderToStaticMarkup(createElement(BotEditorContext.Provider, { value: { request: vi.fn() as never, draft } },
+ createElement(ModelSection, { bot: bot(undefined) })));
+
+ it("says where a new bot's model comes from and points to backup models", () => {
+ expect(render(false)).toContain(hint);
+ });
+
+ it("leaves the hint out while a bot is still being made", () => {
+ expect(render(true)).not.toContain(hint);
+ });
+});
diff --git a/src/components/bot-settings/ModelSection.tsx b/src/components/bot-settings/ModelSection.tsx
index 1f2a59fd63..58735220d6 100644
--- a/src/components/bot-settings/ModelSection.tsx
+++ b/src/components/bot-settings/ModelSection.tsx
@@ -29,6 +29,7 @@ export function ModelSection({ bot }: { bot: Bot }) {
}
/>
{!draft && <ThreadModelsLine bot={bot} className="mt-3" />}
+ {!draft && <div className="mt-3 text-[13px] text-ink-secondary">{t("model.section.installationDefault")}</div>}
</div>
<EffortRow
diff --git a/src/locales/en.json b/src/locales/en.json
index e5d86d57a0..92a866a517 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -2995,6 +2995,7 @@
"model.section.default": "Default model",
"model.section.starting": "Starting model for the new bot and its threads.",
"model.section.threads": "For groups and every thread that uses the bot's model. A thread keeps its own model only when you pick one in it.",
+ "model.section.installationDefault": "A new bot starts on this installation's default model unless you pick another here. To switch automatically when this model is at its usage limit, add backup models below.",
"model.section.effort": "Effort",
"model.section.startingReasoning": "Starting reasoning variant for the new bot.",
"model.section.effortHelp": "How hard this bot thinks in groups and every thread that uses its model.",