Skip to content

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

Settings → AI: show Google AI Studio in the main provider list

AdityaUmale7d5f717c8813
diff --git a/src/components/EnginesSettings.gemini.dom.test.ts b/src/components/EnginesSettings.gemini.dom.test.ts
index ab9b2284c7..5ab1ac1a3d 100644
--- a/src/components/EnginesSettings.gemini.dom.test.ts
+++ b/src/components/EnginesSettings.gemini.dom.test.ts
@@ -55,7 +55,7 @@ const type = async (input: HTMLInputElement, value: string) => {
};
describe("Settings → AI → Providers: Google AI Studio (#6352)", () => {
- it("offers Google AI Studio under More providers and adds its key as a Gemini server", async () => {
+ it("offers Google AI Studio and adds its key as a Gemini server", async () => {
await render();
expect(studio()?.textContent).toContain("Google AI Studio");
await click(studio()!.querySelector("button"));
@@ -72,6 +72,20 @@ describe("Settings → AI → Providers: Google AI Studio (#6352)", () => {
expect(container.querySelector("[data-simple-engine=\"openai-compat-gemini\"]")?.textContent).toContain("Google Gemini");
});
+ it("lists Google AI Studio in the main provider list, outside the closed More providers fold", async () => {
+ await act(async () => { root.render(createElement(EnginesSettings, { simple: true, more: { id: "more", open: false, onToggle: () => {} } })); });
+ expect(studio()?.textContent).toContain("Google AI Studio");
+ expect(studio()?.textContent).toContain("Not set up");
+ expect(container.textContent).not.toContain("More providers");
+ });
+
+ it("keeps an added Gemini server in the main list while its key is not working", async () => {
+ fixture.state = { ...fixture.state, instances: [{ ...gemini(GEMINI_URL), snapshot: { state: "available", authenticated: false } } as InstanceInfo] };
+ await act(async () => { root.render(createElement(EnginesSettings, { simple: true, more: { id: "more", open: false, onToggle: () => {} } })); });
+ expect(container.querySelector("[data-simple-engine=\"openai-compat-gemini\"]")?.textContent).toContain("Google Gemini");
+ expect(container.textContent).not.toContain("More providers");
+ });
+
it("is not offered once a Gemini server is added, nor on the chat's sign-in card", async () => {
fixture.state = { ...fixture.state, instances: [gemini(GEMINI_URL)] };
await render();
diff --git a/src/components/EnginesSettings.hidden-providers.dom.test.ts b/src/components/EnginesSettings.hidden-providers.dom.test.ts
index f90abb026f..d5e9678c42 100644
--- a/src/components/EnginesSettings.hidden-providers.dom.test.ts
+++ b/src/components/EnginesSettings.hidden-providers.dom.test.ts
@@ -103,8 +103,8 @@ describe("Settings → AI: a provider hidden from its own card", () => {
expect(hiddenRows()).toEqual(["kimi"]);
expect(server.refreshes).toBe(0);
expect(moreCount()).toContain("More providers");
- // Hidden Kimi and the Google AI Studio row.
- expect(moreCount()).toContain("2");
+ // Only hidden Kimi: the Google AI Studio row is in the main list.
+ expect(moreCount()).toMatch(/\D1$/);
const hiddenRow = container.querySelector('[data-hidden-engine="kimi"]')!;
expect(hiddenRow.textContent).toContain("Kimi");
expect(hiddenRow.textContent).toContain(t("settings.ai.hiddenStatus"));
@@ -122,7 +122,7 @@ describe("Settings → AI: a provider hidden from its own card", () => {
server.hidden.add("kimi");
fixture.state = { ...fixture.state, instances: [codex] };
await render(false);
- expect(moreCount()).toContain("2");
+ expect(moreCount()).toMatch(/\D1$/);
expect(hiddenRows()).toEqual([]);
await render(true);
expect(hiddenRows()).toEqual(["kimi"]);
diff --git a/src/components/EnginesSettings.test.ts b/src/components/EnginesSettings.test.ts
index 160b36e414..e01af9051d 100644
--- a/src/components/EnginesSettings.test.ts
+++ b/src/components/EnginesSettings.test.ts
@@ -453,7 +453,7 @@ describe("Settings → AI in Simple mode", () => {
];
const html = simple();
expect(html).toContain(">Providers</h3>");
- expect(rows(html)).toEqual(["claude", "codex"]);
+ expect(rows(html)).toEqual(["claude", "codex", "google-ai-studio"]);
expect(html).toMatch(/data-simple-engine="claude"[\s\S]*?>Manage<\/button>/);
expect(html).toMatch(/data-simple-engine="codex"[\s\S]*?>Set up<\/button>/);
expect(html).not.toContain("Model providers and accounts");
@@ -461,8 +461,8 @@ describe("Settings → AI in Simple mode", () => {
it("folds every other provider under More providers, in the same card, with the count", () => {
fixture.instances = [engine("claude", "claudeAgent", true), engine("kimi", "kimiAgent", false), engine("mistral", "mistral", false)];
- // Kimi, Mistral and the Google AI Studio row (a Gemini key).
- expect(simple()).toMatch(/aria-expanded="false"[^>]*>[\s\S]*?More providers[\s\S]*?>3</);
+ // Kimi and Mistral; the Google AI Studio row (a Gemini key) is in the main list.
+ expect(simple()).toMatch(/aria-expanded="false"[^>]*>[\s\S]*?More providers[\s\S]*?>2</);
expect(simple()).not.toContain('data-simple-engine="kimi"');
expect(simple(true)).toContain('data-simple-engine="kimi"');
});
diff --git a/src/components/EnginesSettings.tsx b/src/components/EnginesSettings.tsx
index b7d3697442..97a7c0ec06 100644
--- a/src/components/EnginesSettings.tsx
+++ b/src/components/EnginesSettings.tsx
@@ -474,9 +474,12 @@ const GOOGLE_MARK = { driverKind: "openai-compat", icon: { kind: "preset", prese
* whose own row takes this one's place once it is added. */
function GeminiProviderRow({ open, onToggle }: { open: boolean; onToggle: () => void }) {
return <>
- <div data-simple-engine="google-ai-studio" className="flex min-h-11 items-center gap-3 px-4 py-1.5">
+ <div data-simple-engine="google-ai-studio" className="flex min-h-16 items-center gap-3 px-4 py-3">
<SettingsMark><InstanceProviderMark instance={GOOGLE_MARK} size={18} subtle /></SettingsMark>
- <span className="min-w-0 flex-1 truncate text-[14px] leading-5 text-ink">{t("geminiServer.title")}</span>
+ <span className="flex min-w-0 flex-1 flex-col gap-0.5">
+ <span className="truncate text-[14px] leading-5 text-ink">{t("geminiServer.title")}</span>
+ <span className="truncate text-[13px] leading-[18px] text-ink-secondary"><StatusDot tone={null} />{`${t("settings.ai.notSetUp")} · ${t("settings.ai.needsKey")}`}</span>
+ </span>
<button type="button" aria-expanded={open} className="ui-button ml-3 shrink-0" onClick={onToggle}>
{t(open ? "common.close" : "settings.simple.ai.setUp")}
</button>
@@ -498,11 +501,11 @@ function SimpleEngines({ rows, isReady, renderEngine, more, accountsOnly = false
const [opened, setOpened] = useState<string | null>(null);
// A hidden provider is gone from the instance list, so without these rows nothing in Settings brings it back.
const allHidden = useHiddenProviders(), hidden = accountsOnly ? [] : allHidden;
- const featured = rows.filter((instance) => accountsOnly || isReady(instance) || instance.authentication !== undefined);
+ const featured = rows.filter((instance) => accountsOnly || isReady(instance) || instance.authentication !== undefined || hasGeminiServer([instance]));
const others = rows.filter((instance) => !featured.includes(instance));
// A hidden Gemini server comes back through its own hidden row; adding another would only make a second one.
const gemini = offerGemini && !hidden.some((provider) => provider.driverKind === "openai-compat" && provider.displayName === GEMINI_PRESET.name);
- const extra = hidden.length + (gemini ? 1 : 0);
+ const folded = others.length + hidden.length;
const row = (instance: InstanceInfo, compact: boolean) => {
const open = opened === instance.instanceId;
return <ProviderRow key={instance.instanceId} instance={instance} ready={isReady(instance)} open={open} compact={compact}
@@ -512,11 +515,11 @@ function SimpleEngines({ rows, isReady, renderEngine, more, accountsOnly = false
<SettingsGroup label={t("settings.ai.providers")} actions={<RefreshEngines />}>
<SettingsRows icons>
{featured.map((instance) => row(instance, false))}
- {others.length + extra > 0 && (
- <SettingsFoldRow id={more.id} title={t("settings.ai.moreProviders")} value={String(others.length + extra)} open={more.open} onToggle={more.onToggle}
+ {gemini && <GeminiProviderRow open={opened === "google-ai-studio"} onToggle={() => setOpened(opened === "google-ai-studio" ? null : "google-ai-studio")} />}
+ {folded > 0 && (
+ <SettingsFoldRow id={more.id} title={t("settings.ai.moreProviders")} value={String(folded)} open={more.open} onToggle={more.onToggle}
leading={<span aria-hidden="true" />}>
{others.map((instance) => row(instance, true))}
- {gemini && <GeminiProviderRow open={opened === "google-ai-studio"} onToggle={() => setOpened(opened === "google-ai-studio" ? null : "google-ai-studio")} />}
<HiddenProviderRows hidden={hidden} />
</SettingsFoldRow>
)}