Skip to content

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

Merge branch 'main' into fix/issue-5712-gemini-key

Krishna Dobhal9f41b58f1c12
diff --cc server/decider/index.ts
index 7c6a783fb5,e8b2229a31..71bd4c99e7
--- a/server/decider/index.ts
+++ b/server/decider/index.ts
@@@ -4,10 -4,9 +4,10 @@@ import { userError, type UserError } fr
import type { AppConfig } from "../config.ts";
import { deciderCredential } from "../included-services.ts";
import {
- customAccount, helpersOn, includedAccount, jevAccount, openrouterAccount, sharedOpenRouterKey, workersAiAccount, type HelperAccount,
+ customAccount, geminiAccount, helpersOn, includedAccount, jevAccount, openrouterAccount, sharedOpenRouterKey, workersAiAccount, type HelperAccount,
} from "./accounts.ts";
- import { CUSTOM_DEFAULT_API, customBackend, customEndpoint } from "./custom.ts";
+import { geminiBackend } from "./gemini.ts";
+ import { CUSTOM_DEFAULT_API, customApiOf, customBackend, customEndpoint } from "./custom.ts";
import { jevBackend } from "./jev.ts";
import { appendDeciderLog, stateHash } from "./log.ts";
import { OPENROUTER_DEFAULT_API, OPENROUTER_DEFAULT_MODEL, openrouterBackend } from "./openrouter.ts";
@@@ -88,14 -87,10 +88,15 @@@ export function deciderSharedKeyUsable(
return Boolean(sharedOpenRouterKey(cfg));
}
+/** A key from elsewhere in Settings the decision model falls back on: OpenRouter's, or a Gemini one. */
+export function deciderBorrowedKey(cfg: AppConfig): boolean {
+ return deciderSharedKeyUsable(cfg) || Boolean(geminiAccount(cfg));
+}
+
/** Never a key, nor an operator base URL with no UI; a custom gateway's `baseUrl` is the person's own setting. `provider` is the one in use, else the one chosen
- * (so Settings shows its key field); `keySource` and `sharedKey` are OpenRouter's, while it is in use. Which own
- * keys are on file is `describeHelpers`'s. */
+ * (so Settings shows its key field); `keySource` and `sharedKey` are OpenRouter's, while it is in use. `chosen` is Jev
+ * when the person picked it but only the shared OpenRouter key stands in, so Settings keeps Jev and its key field.
+ * Which own keys are on file is `describeHelpers`'s. */
export function describeDecider(cfg: AppConfig) {
const account = deciderAccount(cfg);
const provider = account?.provider ?? draftProvider(cfg);
diff --cc src/components/DecisionModelSettings.tsx
index 191dd16731,1cfd4cc285..75b2ba865a
--- a/src/components/DecisionModelSettings.tsx
+++ b/src/components/DecisionModelSettings.tsx
@@@ -156,10 -158,11 +159,12 @@@ export function DecisionModelSettings(
const custom = provider === "custom";
const configured = decider?.configured ?? false;
const included = configured && decider?.included === true;
- const usingShared = openrouter && configured && decider?.keySource === "shared";
+ // The shared OpenRouter key decides, whether OpenRouter is chosen or it stands in for a chosen Jev with no key yet.
+ const usingShared = configured && decider?.keySource === "shared";
+ const sharedOpenRouter = openrouter && usingShared;
const sharedKey = openrouter && decider?.sharedKey === true;
- const ownKey = configured && !included && !usingShared;
+ const borrowedGemini = configured && decider?.provider === "gemini";
+ const ownKey = configured && !included && !usingShared && !borrowedGemini;
const enabled = decider?.enabled ?? false;
const roomRouting = decider?.jobs.roomRouting ?? true;
const [value, setValue] = useState("");
diff --cc src/state/config-status.ts
index aeb60e70aa,9be7322e8a..845505a658
--- a/src/state/config-status.ts
+++ b/src/state/config-status.ts
@@@ -101,7 -110,9 +110,9 @@@ export interface ConfigStatus
* saved. OpenRouter only: `keySource` says which key is in use (its own, or
* the one under Settings → API keys); `sharedKey`: that one is on file. */
decider?: {
- provider: "jev" | "workersai" | "openrouter" | "custom";
+ provider: "jev" | "workersai" | "openrouter" | "custom" | "gemini";
+ /** Jev, when the person picked it but the shared OpenRouter key decides until a Jev key is saved. */
+ chosen?: "jev";
/** The OpenRouter or custom model in use; present only while that is the provider. */
model?: string;
/** The custom endpoint's protocol, or the OpenRouter API. */