Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Explain in Generate with AI that subscriptions can't make pictures
AdityaUmalea1da4f24f9cc
diff --git a/src/components/AvatarImageGenerator.dom.test.ts b/src/components/AvatarImageGenerator.dom.test.tsnew file mode 100644index 0000000000..3d88cfd735--- /dev/null+++ b/src/components/AvatarImageGenerator.dom.test.ts@@ -0,0 +1,57 @@+// @vitest-environment happy-dom+import { act, createElement } from "react";+import { createRoot, type Root } from "react-dom/client";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { setLocale } from "@/lib/i18n";++const fixture = vi.hoisted(() => ({ config: {} as Record<string, unknown> }));+vi.mock("@/state/store-select", async (original) => ({+ ...await original<typeof import("@/state/store-select")>(),+ useStoreSelector: (selector: (state: unknown) => unknown) => selector({ config: fixture.config }),+ useStoreDispatch: () => () => {},+}));+import { AvatarImageGenerator } from "./AvatarImageGenerator";++const GEMINI_KEY_URL = "https://aistudio.google.com/apikey";+let container: HTMLDivElement, root: Root;+beforeEach(() => {+ vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);+ setLocale("en");+ container = document.createElement("div"); document.body.append(container); root = createRoot(container);+});+afterEach(async () => { await act(async () => root.unmount()); container.remove(); vi.unstubAllGlobals(); });++const render = async (imageGen: unknown) => {+ fixture.config = imageGen === undefined ? {} : { imageGen };+ await act(async () => {+ root.render(createElement(AvatarImageGenerator, { botLabel: "Researcher", disabled: false, generating: false, onGenerate: async () => {} }));+ });+};+const keyLink = () => [...container.querySelectorAll("a")].find((a) => a.getAttribute("href") === GEMINI_KEY_URL);++describe("Generate with AI: no image provider yet", () => {+ it("says a subscription can't make pictures and links to a Gemini API key", async () => {+ await render({ ready: false, primary: { provider: "gemini", configured: false } });+ expect(container.textContent).toContain("No image provider is set up yet.");+ expect(container.textContent).toContain("Pictures need an image API key. AI subscriptions such as Antigravity or Gemini can't make them here.");+ const link = keyLink();+ expect(link?.textContent).toBe("Get a Gemini API key");+ expect(link?.getAttribute("target")).toBe("_blank");+ expect(link?.getAttribute("rel")).toBe("noreferrer");+ expect(container.querySelector("textarea")?.disabled).toBe(true);+ });++ it("shows the same help before the image settings were ever loaded", async () => {+ await render(undefined);+ expect(container.textContent).toContain("can't make them here");+ expect(keyLink()).toBeTruthy();+ });++ it("shows only the provider in use once a key is set", async () => {+ await render({ ready: true, primary: { provider: "gemini", configured: true } });+ expect(container.textContent).toContain("Uses Gemini, as set in Image generation.");+ expect(container.textContent).not.toContain("can't make them here");+ expect(keyLink()).toBeUndefined();+ expect(container.querySelector("textarea")?.disabled).toBe(false);+ });+});diff --git a/src/components/AvatarImageGenerator.tsx b/src/components/AvatarImageGenerator.tsxindex 6ce3fe0af8..18f0766d31 100644--- a/src/components/AvatarImageGenerator.tsx+++ b/src/components/AvatarImageGenerator.tsx@@ -5,6 +5,7 @@ import { t } from "@/lib/i18n";import { sameFields, useStoreDispatch, useStoreSelector } from "@/state/store-select";const INPUT_CLASS = "w-full min-w-0 rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none disabled:opacity-50";+const GEMINI_KEY_URL = "https://aistudio.google.com/apikey";const PROVIDER_LABEL = { openai: "OpenAI", xai: "Grok (xAI)", gemini: "Gemini", openrouter: "OpenRouter", higgsfield: "Higgsfield", custom: "Custom" } as const;export function AvatarImageGenerator({@@ -25,6 +26,7 @@ export function AvatarImageGenerator({const ready = imageGen?.ready ?? imageGen?.configured === true;const primary = imageGen?.primary ?? (imageGen?.provider ? { provider: imageGen.provider, configured: imageGen.configured } : null);const inUse = primary?.configured ? primary.provider : imageGen?.fallback?.configured ? imageGen.fallback.provider : null;+ const usable = ready ? inUse : null;return (<div className="mt-5 border-t border-hairline/40 pt-4">@@ -32,7 +34,7 @@ export function AvatarImageGenerator({<Sparkles size={14} className="text-accent" /> {t("botIdentity.ai.generateWith")}</div><p className="mt-1.5 text-[11px] leading-relaxed text-ink-secondary">- {ready && inUse ? t("botIdentity.ai.usingProvider", { provider: PROVIDER_LABEL[inUse] }) : t("botIdentity.ai.noProvider")}{" "}+ {usable ? t("botIdentity.ai.usingProvider", { provider: PROVIDER_LABEL[usable] }) : t("botIdentity.ai.noProvider")}{" "}<buttontype="button"onClick={() => dispatch({ type: "toggleAppSettings", open: true, section: "imageGeneration" })}@@ -41,6 +43,14 @@ export function AvatarImageGenerator({{t("botIdentity.ai.openImageSettings")}</button></p>+ {!usable && (+ <p className="mt-1 text-[11px] leading-relaxed text-ink-secondary">+ {t("botIdentity.ai.keyNeeded")}{" "}+ <a href={GEMINI_KEY_URL} target="_blank" rel="noreferrer" className="text-accent-text hover:underline focus-visible:underline">+ {t("botIdentity.ai.getGeminiKey")}+ </a>+ </p>+ )}<textareavalue={direction}diff --git a/src/locales/de.json b/src/locales/de.jsonindex 8096d929eb..0f173545d2 100644--- a/src/locales/de.json+++ b/src/locales/de.json@@ -4567,5 +4567,7 @@"githubSignIn.tokenPlaceholder": "github_pat_…","approval.status.teammateSkills": "Team-Skills geändert","approval.applied.skill.teammates": "{name} hat Skills im Team geändert: {title}",- "skills.request.reviewTeammates": "Prüfe jede Änderung, bevor du sie anwendest"+ "skills.request.reviewTeammates": "Prüfe jede Änderung, bevor du sie anwendest",+ "botIdentity.ai.keyNeeded": "Bilder brauchen einen Bild-API-Schlüssel. KI-Abos wie Antigravity oder Gemini können hier keine Bilder erstellen.",+ "botIdentity.ai.getGeminiKey": "Gemini-API-Schlüssel holen"}diff --git a/src/locales/en.json b/src/locales/en.jsonindex 0eceb2f2dc..cdfa35a68a 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -10910,6 +10910,8 @@"botIdentity.ai.usingProvider": "Uses {provider}, as set in Image generation.","botIdentity.ai.noProvider": "No image provider is set up yet.","botIdentity.ai.openImageSettings": "Open image settings",+ "botIdentity.ai.keyNeeded": "Pictures need an image API key. AI subscriptions such as Antigravity or Gemini can't make them here.",+ "botIdentity.ai.getGeminiKey": "Get a Gemini API key","imageGen.key.xai": "Grok (xAI) API key","imageGen.key.openrouter": "OpenRouter API key","server.voice.noNoteNoVoice": "No voice note with this reply: this bot has no voice set up yet.",diff --git a/src/locales/es.json b/src/locales/es.jsonindex 9a7287ba41..cc66d310bb 100644--- a/src/locales/es.json+++ b/src/locales/es.json@@ -6756,5 +6756,7 @@"server.github.card.description": "Conecta GitHub para que {bot} pueda subir su trabajo a tus repositorios.","server.github.card.connectInApps": "Conecta GitHub desde esta tarjeta en la app de tu ordenador o en Apps.","githubSignIn.title": "Inicio de sesión en GitHub",- "githubSignIn.tokenPlaceholder": "github_pat_…"+ "githubSignIn.tokenPlaceholder": "github_pat_…",+ "botIdentity.ai.keyNeeded": "Las imágenes necesitan una clave de API de imágenes. Las suscripciones de IA como Antigravity o Gemini no pueden crearlas aquí.",+ "botIdentity.ai.getGeminiKey": "Obtener una clave de API de Gemini"}diff --git a/src/locales/fr.json b/src/locales/fr.jsonindex 5d468a7fca..a2ba625b3f 100644--- a/src/locales/fr.json+++ b/src/locales/fr.json@@ -4167,5 +4167,7 @@"server.github.card.description": "Connectez GitHub pour que {bot} puisse pousser son travail vers vos dépôts.","server.github.card.connectInApps": "Connectez GitHub depuis cette carte dans l'app de votre ordinateur, ou dans Apps.","githubSignIn.title": "Connexion à GitHub",- "githubSignIn.tokenPlaceholder": "github_pat_…"+ "githubSignIn.tokenPlaceholder": "github_pat_…",+ "botIdentity.ai.keyNeeded": "Les images demandent une clé API d'images. Les abonnements IA comme Antigravity ou Gemini ne peuvent pas en créer ici.",+ "botIdentity.ai.getGeminiKey": "Obtenir une clé API Gemini"}diff --git a/src/locales/hi.json b/src/locales/hi.jsonindex ea15287a86..7f031e9591 100644--- a/src/locales/hi.json+++ b/src/locales/hi.json@@ -4019,5 +4019,7 @@"server.github.card.description": "GitHub कनेक्ट करें ताकि {bot} अपना काम आपकी रिपॉज़िटरी में पुश कर सके।","server.github.card.connectInApps": "अपने कंप्यूटर के ऐप में इस कार्ड से, या Apps में, GitHub कनेक्ट करें।","githubSignIn.title": "GitHub साइन-इन",- "githubSignIn.tokenPlaceholder": "github_pat_…"+ "githubSignIn.tokenPlaceholder": "github_pat_…",+ "botIdentity.ai.keyNeeded": "तस्वीरें बनाने के लिए इमेज API कुंजी चाहिए। Antigravity या Gemini जैसी AI सदस्यताएँ यहाँ तस्वीरें नहीं बना सकतीं।",+ "botIdentity.ai.getGeminiKey": "Gemini API कुंजी पाएँ"}diff --git a/src/locales/it.json b/src/locales/it.jsonindex 0d290b0ae9..6b5420d5ab 100644--- a/src/locales/it.json+++ b/src/locales/it.json@@ -10880,6 +10880,8 @@"botIdentity.ai.usingProvider": "Usi {provider}, come impostato nella generazione di immagini.","botIdentity.ai.noProvider": "Nessun fornitore di immagini è ancora impostato.","botIdentity.ai.openImageSettings": "Impostazioni delle immagini aperte",+ "botIdentity.ai.keyNeeded": "Le immagini richiedono una chiave API per immagini. Gli abbonamenti IA come Antigravity o Gemini non possono crearle qui.",+ "botIdentity.ai.getGeminiKey": "Ottieni una chiave API Gemini","imageGen.key.xai": "Chiave API Grok (xAI)","imageGen.key.openrouter": "Chiave API OpenRouter","server.voice.noNoteNoVoice": "Nessuna nota vocale con questa risposta: questo bot non ha ancora una voce impostata.",diff --git a/src/locales/ja.json b/src/locales/ja.jsonindex dd20356aa0..bfe9bb0965 100644--- a/src/locales/ja.json+++ b/src/locales/ja.json@@ -8291,5 +8291,7 @@"server.github.card.description": "GitHub に接続すると、{bot} が作業をあなたのリポジトリにプッシュできます。","server.github.card.connectInApps": "コンピューターのアプリのこのカード、またはアプリ画面から GitHub に接続してください。","githubSignIn.title": "GitHub サインイン",- "githubSignIn.tokenPlaceholder": "github_pat_…"+ "githubSignIn.tokenPlaceholder": "github_pat_…",+ "botIdentity.ai.keyNeeded": "画像の作成には画像用の API キーが必要です。Antigravity や Gemini などの AI サブスクリプションでは、ここで画像を作成できません。",+ "botIdentity.ai.getGeminiKey": "Gemini の API キーを取得"}diff --git a/src/locales/ko.json b/src/locales/ko.jsonindex c644de388e..55b3e453cb 100644--- a/src/locales/ko.json+++ b/src/locales/ko.json@@ -7983,5 +7983,7 @@"server.github.card.description": "GitHub를 연결하면 {bot}이(가) 작업을 내 저장소로 푸시할 수 있습니다.","server.github.card.connectInApps": "컴퓨터의 앱에서 이 카드로, 또는 앱 화면에서 GitHub를 연결하세요.","githubSignIn.title": "GitHub 로그인",- "githubSignIn.tokenPlaceholder": "github_pat_…"+ "githubSignIn.tokenPlaceholder": "github_pat_…",+ "botIdentity.ai.keyNeeded": "그림을 만들려면 이미지 API 키가 필요합니다. Antigravity나 Gemini 같은 AI 구독으로는 여기서 그림을 만들 수 없습니다.",+ "botIdentity.ai.getGeminiKey": "Gemini API 키 받기"}diff --git a/src/locales/pl.json b/src/locales/pl.jsonindex ab87218523..5c892f992b 100644--- a/src/locales/pl.json+++ b/src/locales/pl.json@@ -7452,5 +7452,7 @@"server.github.card.description": "Połącz z GitHubem, aby {bot} mógł wysyłać swoją pracę do Twoich repozytoriów.","server.github.card.connectInApps": "Połącz z GitHubem przez tę kartę w aplikacji na komputerze albo w Aplikacjach.","githubSignIn.title": "Logowanie do GitHuba",- "githubSignIn.tokenPlaceholder": "github_pat_…"+ "githubSignIn.tokenPlaceholder": "github_pat_…",+ "botIdentity.ai.keyNeeded": "Do tworzenia obrazów potrzebny jest klucz API do obrazów. Subskrypcje AI, takie jak Antigravity czy Gemini, nie mogą ich tu tworzyć.",+ "botIdentity.ai.getGeminiKey": "Uzyskaj klucz API Gemini"}diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex ccc22fb8ca..91676d9ce9 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -10811,6 +10811,8 @@"botIdentity.ai.usingProvider": "Usa {provider}, conforme definido em Geração de imagens.","botIdentity.ai.noProvider": "Nenhum provedor de imagens configurado ainda.","botIdentity.ai.openImageSettings": "Abrir as configurações de imagem",+ "botIdentity.ai.keyNeeded": "Imagens precisam de uma chave de API de imagens. Assinaturas de IA como Antigravity ou Gemini não conseguem criá-las aqui.",+ "botIdentity.ai.getGeminiKey": "Obter uma chave de API do Gemini","imageGen.key.xai": "Chave de API do Grok (xAI)","imageGen.key.openrouter": "Chave de API do OpenRouter","connectedWorkspaces.localTitle": "Ambientes neste computador",diff --git a/src/locales/ru.json b/src/locales/ru.jsonindex 9fecfafd7e..49d1f40ad9 100644--- a/src/locales/ru.json+++ b/src/locales/ru.json@@ -7506,5 +7506,7 @@"server.github.card.description": "Подключите GitHub, чтобы {bot} мог отправлять работу в ваши репозитории.","server.github.card.connectInApps": "Подключите GitHub через эту карточку в приложении на компьютере или в разделе «Приложения».","githubSignIn.title": "Вход в GitHub",- "githubSignIn.tokenPlaceholder": "github_pat_…"+ "githubSignIn.tokenPlaceholder": "github_pat_…",+ "botIdentity.ai.keyNeeded": "Для картинок нужен API-ключ для изображений. Подписки на ИИ, например Antigravity или Gemini, здесь их не создают.",+ "botIdentity.ai.getGeminiKey": "Получить API-ключ Gemini"}diff --git a/src/locales/tr.json b/src/locales/tr.jsonindex 4f42fdbbab..9cc6d7e714 100644--- a/src/locales/tr.json+++ b/src/locales/tr.json@@ -6251,5 +6251,7 @@"server.github.card.description": "{bot} işini depolarınıza gönderebilsin diye GitHub'ı bağlayın.","server.github.card.connectInApps": "GitHub'ı bilgisayarınızdaki uygulamada bu karttan ya da Uygulamalar'dan bağlayın.","githubSignIn.title": "GitHub oturumu",- "githubSignIn.tokenPlaceholder": "github_pat_…"+ "githubSignIn.tokenPlaceholder": "github_pat_…",+ "botIdentity.ai.keyNeeded": "Görsel oluşturmak için bir görsel API anahtarı gerekir. Antigravity veya Gemini gibi yapay zekâ abonelikleri burada görsel oluşturamaz.",+ "botIdentity.ai.getGeminiKey": "Gemini API anahtarı al"}diff --git a/src/locales/uk.json b/src/locales/uk.jsonindex caa7b7ed7d..9b6b17ae4e 100644--- a/src/locales/uk.json+++ b/src/locales/uk.json@@ -4436,5 +4436,7 @@"server.github.card.description": "Підключіть GitHub, щоб {bot} міг надсилати роботу у ваші репозиторії.","server.github.card.connectInApps": "Підключіть GitHub через цю картку в застосунку на комп'ютері або в розділі «Застосунки».","githubSignIn.title": "Вхід у GitHub",- "githubSignIn.tokenPlaceholder": "github_pat_…"+ "githubSignIn.tokenPlaceholder": "github_pat_…",+ "botIdentity.ai.keyNeeded": "Для зображень потрібен API-ключ для зображень. Підписки на ШІ, як-от Antigravity чи Gemini, тут їх не створюють.",+ "botIdentity.ai.getGeminiKey": "Отримати API-ключ Gemini"}diff --git a/src/locales/vi.json b/src/locales/vi.jsonindex 0835b40bca..34f63521de 100644--- a/src/locales/vi.json+++ b/src/locales/vi.json@@ -6432,5 +6432,7 @@"server.github.card.connectInApps": "Kết nối GitHub từ thẻ này trong ứng dụng trên máy tính, hoặc trong Ứng dụng.","githubSignIn.title": "Đăng nhập GitHub","githubSignIn.tokenPlaceholder": "github_pat_…",- "shortcuts.start-fresh": "Bắt đầu lại cuộc trò chuyện này (giữ nguyên tin nhắn)"+ "shortcuts.start-fresh": "Bắt đầu lại cuộc trò chuyện này (giữ nguyên tin nhắn)",+ "botIdentity.ai.keyNeeded": "Cần khóa API hình ảnh để tạo ảnh. Các gói đăng ký AI như Antigravity hoặc Gemini không tạo được ảnh ở đây.",+ "botIdentity.ai.getGeminiKey": "Lấy khóa API Gemini"}diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.jsonindex 5dfa1e0448..1ef941c3f9 100644--- a/src/locales/zh-tw.json+++ b/src/locales/zh-tw.json@@ -9579,6 +9579,8 @@"botIdentity.ai.usingProvider": "使用 {provider},依「圖片生成」中的設定。","botIdentity.ai.noProvider": "尚未設定圖片供應商。","botIdentity.ai.openImageSettings": "開啟圖片設定",+ "botIdentity.ai.keyNeeded": "產生圖片需要圖片 API 金鑰。Antigravity 或 Gemini 等 AI 訂閱無法在這裡產生圖片。",+ "botIdentity.ai.getGeminiKey": "取得 Gemini API 金鑰","imageGen.key.xai": "Grok(xAI)API 金鑰","imageGen.key.openrouter": "OpenRouter API 金鑰","server.voice.noNoteNoVoice": "這則回覆沒有語音留言:這個機器人還沒有設定聲音。",diff --git a/src/locales/zh.json b/src/locales/zh.jsonindex d7f8f2e1bc..d63decdba2 100644--- a/src/locales/zh.json+++ b/src/locales/zh.json@@ -10802,6 +10802,8 @@"botIdentity.ai.usingProvider": "使用 {provider},与“图片生成”中的设置一致。","botIdentity.ai.noProvider": "还没有设置图片提供方。","botIdentity.ai.openImageSettings": "打开图片设置",+ "botIdentity.ai.keyNeeded": "生成图片需要图片 API 密钥。Antigravity 或 Gemini 等 AI 订阅无法在这里生成图片。",+ "botIdentity.ai.getGeminiKey": "获取 Gemini API 密钥","imageGen.key.xai": "Grok(xAI)API 密钥","imageGen.key.openrouter": "OpenRouter API 密钥","server.voice.noNoteNoVoice": "这条回复没有语音留言:这个机器人还没有设置声音。",