Skip to content

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

#5150: pick a custom decision endpoint from chat

milind-soni446b45ab3440
diff --git a/server/app-settings/host.test.ts b/server/app-settings/host.test.ts
index f7b1fa8d22..587e1ec82c 100644
--- a/server/app-settings/host.test.ts
+++ b/server/app-settings/host.test.ts
@@ -379,6 +379,14 @@ describe("every other setting applies at once with Undo, Full access or not", ()
expect(JSON.stringify(fx.messages)).not.toContain(OPENAI_KEY);
});
+ it("picks a custom decision endpoint with Undo, but never sets its address", async () => {
+ const { set, saved } = fixture();
+ expect((await set("ai.routing", JSON.stringify({ provider: "custom", customModel: "m-1", customApi: "decisions" }))).status).toBe(200);
+ expect(saved).toEqual([{ decider: { provider: "custom", customModel: "m-1", customApi: "decisions" } }]);
+ expect((await set("ai.routing", JSON.stringify({ customBaseUrl: "https://elsewhere.example.com" }))).status).toBe(400);
+ expect(saved).toHaveLength(1);
+ });
+
it("a window preference is refused while no window is open, and nothing is posted", async () => {
const fx = fixture({ window: false });
expect((await fx.set("general.openAtLogin", true)).body.error).toContain("Open MausBot on this computer first");
diff --git a/server/app-settings/registry-config.ts b/server/app-settings/registry-config.ts
index 9bbad908e6..c63c6d8142 100644
--- a/server/app-settings/registry-config.ts
+++ b/server/app-settings/registry-config.ts
@@ -49,10 +49,11 @@ export function configEntries(deps: Pick<RegistryDeps, "cfg" | "saveConfig" | "b
says: ({ enabled, backup }) => (enabled && backup ? `Turn on automatic recovery: a bot whose engine fails before any work starts tries once more on ${backup.instanceId} / ${backup.model}` : "Turn off automatic recovery"),
}),
section({
- id: "ai.routing", label: "Decision and extraction", help: "The small model that decides who answers in rooms and sorts the inbox (Jev or OpenRouter). Its keys are set with keys.* or in Settings.", where: "Settings → AI",
- synonyms: ["decision", "extraction", "routing", "who answers", "jev", "openrouter", "workers ai", "cloudflare"],
- value: nonEmpty(withoutKeys(F.decider.unwrap().omit({ key: true, openrouterKey: true, workersAiToken: true }).strict())),
- allowed: '{"enabled"?,"provider"?:"jev"|"openrouter"|"off","openrouterModel"?,"openrouterApi"?:"chat"|"decisions","jobs"?:{"roomRouting"?,"inboxTriage"?},"workersAiAccountId"?, addresses?}',
+ id: "ai.routing", label: "Decision and extraction", help: "The small model that decides who answers in rooms and sorts the inbox (Jev, OpenRouter or the person's custom endpoint). Its keys, and a custom endpoint's address, are set only in Settings.", where: "Settings → AI",
+ synonyms: ["decision", "extraction", "routing", "who answers", "jev", "openrouter", "workers ai", "cloudflare", "custom endpoint", "system one"],
+ // Security: a custom endpoint's address is where its key goes, so only the person sets it.
+ value: nonEmpty(withoutKeys(F.decider.unwrap().omit({ key: true, openrouterKey: true, workersAiToken: true, customKey: true, customBaseUrl: true }).strict())),
+ allowed: '{"enabled"?,"provider"?:"jev"|"openrouter"|"custom"|"off","openrouterModel"?,"openrouterApi"?:"chat"|"decisions","customModel"?,"customApi"?:"systemone"|"decisions","jobs"?:{"roomRouting"?,"inboxTriage"?},"workersAiAccountId"?, addresses?}',
current: () => cfg().decider ?? {}, patch: (decider) => ({ decider }),
says: (decider) => `Decision and extraction: ${fields(decider)}. Decisions send conversation text to the chosen provider, off this computer`,
}),