Skip to content

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

Merge pull request #6074 from AdityaUmale/fix2/6064-always-allow-save

milind-soni286f853e4ebd
diff --cc server/routes/bot-patch.test.ts
index 0a9b7e02a0,57efcee1a4..1410e78001
--- a/server/routes/bot-patch.test.ts
+++ b/server/routes/bot-patch.test.ts
@@@ -263,29 -263,19 +263,42 @@@ describe("PATCH /api/bots/:id toolsOff"
});
});
+describe("PATCH /api/bots/:id liveVoice", () => {
+ it("gives one bot its own Live call voice, leaves the others on the app's, clears it, and refuses a voice that is not a Live one", async () => {
+ const { store, bot, patch } = fixture();
+ const other = store.createBot({ name: "Echo" });
+ expect((await patch(bot.id, { liveVoice: "cedar" })).status).toBe(200);
+ expect(store.bot(bot.id)?.liveVoice).toBe("cedar");
+ expect(store.bot(other.id)?.liveVoice).toBeUndefined();
+ expect((await patch(bot.id, { liveVoice: "Kore" })).status).toBe(200);
+ expect(store.bot(bot.id)?.liveVoice).toBe("Kore");
+ for (const liveVoice of ["robot", "kore", 7, "cedar ".repeat(3)]) {
+ const refused = await patch(bot.id, { liveVoice });
+ expect(refused.status, String(liveVoice)).toBe(400);
+ expect(refused.body.error).toBe("liveVoice must be a GPT-Live or Gemini Live voice, or empty");
+ }
+ expect(store.bot(bot.id)?.liveVoice).toBe("Kore");
+ expect((await patch(bot.id, { liveVoice: "" })).status).toBe(200);
+ expect(store.bot(bot.id)?.liveVoice).toBeUndefined();
+ await patch(bot.id, { liveVoice: "ash" });
+ expect((await patch(bot.id, { liveVoice: null })).status).toBe(200);
+ expect(store.bot(bot.id)?.liveVoice).toBeUndefined();
+ });
+});
+
+ describe("PATCH /api/bots/:id alwaysAllow", () => {
+ it("stores the list once each, and refuses a list over the limit instead of cutting it", async () => {
+ const { store, bot, patch } = fixture();
+ const keys = Array.from({ length: 200 }, (_, i) => `tool_${i}`);
+ expect((await patch(bot.id, { alwaysAllow: [...keys, keys[0]] })).status).toBe(200);
+ expect(store.bot(bot.id)?.alwaysAllow).toEqual(keys);
+ const refused = await patch(bot.id, { alwaysAllow: [...keys, "tool_200"] });
+ expect(refused.status).toBe(400);
+ expect(refused.body.errorKey).toBe("serverError.bot.alwaysAllowFull");
+ expect(store.bot(bot.id)?.alwaysAllow).toEqual(keys);
+ });
+ });
+
describe("PATCH /api/bots/:id phoneApps", () => {
it("stores phoneApps and clears it with null", async () => {
const { store, bot, patch } = fixture();
diff --cc src/locales/source-hashes.json
index aadc40d0e5,486aec9568..212af601eb
--- a/src/locales/source-hashes.json
+++ b/src/locales/source-hashes.json
@@@ -36982,8 -36969,7 +36982,9 @@@
"devices.computers.pairButton": "60f8288e33f9f57d2b51409fdb540b47a89c25447061bd354122442818a36ee0",
"devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8",
"devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174",
+ "engineSetup.cloudPasteSummary": "99bef9b03db7662e2944939a6bf8e904d5c674c3577540ef994a9f5c4862ed5f",
+ "engineSetup.cloudPasteHint": "e6e7b723c8ec76caec36a54986610db04f079430fd3a7a1986c627e18480a7ea",
+ "serverError.bot.alwaysAllowFull": "1caf76fd33c01df36490a0cc1aeff51c85c3b6b5f3d35c5df748db434fdf15c3",
"routines.noStartStreak": "fb107024c4705682465cf381239f9ecfc60e2e5dca2776c8082236b44ef38a9d",
"routines.unreadable": "389a5c2a0eaa1366fc44c538daef1c28f2271aba90e806be13da78c14c1d3ced",
"routines.server.busyTooLong": "4127f973deb204a8156c2c823319287c125b4e457d6ffe467c3597846b656d3b",