Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Find Ollama by itself and add it in one click
milind-soniec3061ce25f9
diff --git a/apps/docs/content/docs/providers/model-providers.mdx b/apps/docs/content/docs/providers/model-providers.mdxindex ed78a790ff..c1b0cd60d2 100644--- a/apps/docs/content/docs/providers/model-providers.mdx+++ b/apps/docs/content/docs/providers/model-providers.mdx@@ -241,6 +241,11 @@ list only over HTTPS or to this computer. Check that:## Ollama+To add Ollama, open **Settings → AI → API keys → Your own model servers** and find the+**Ollama** row. MausBot looks for Ollama on this computer by itself. Press+**Add Ollama** to use what it found, or enter another computer's address and+press **Check again**.+A chat engine whose address is Ollama shows up as **Ollama**, with Ollama'smark, in Settings and the model picker. MausBot treats an address as Ollamawhen it uses Ollama's port (11434), or when an address on this computer or yourdiff --git a/server/contracts.ts b/server/contracts.tsindex e2c1c0dcca..b68be05300 100644--- a/server/contracts.ts+++ b/server/contracts.ts@@ -6,7 +6,7 @@ import type { EffortLevel } from "../shared/wire.ts";import type {DriverKind, InstanceId, ModelVariantOption, RuntimeEventListener, ThreadId, TurnId,} from "../shared/runtime-events.ts";-import type { LocalModelFacts } from "../shared/local-model.ts";+import type { LocalModelFacts, OllamaProblem } from "../shared/local-model.ts";import type { ProviderIcon } from "../shared/provider-icon.ts";export type { CloudBackend, EffortLevel, ModelSelection } from "../shared/wire.ts";@@ -372,6 +372,8 @@ export interface ProviderSnapshot {title: string;message: string;};+ /** Set with `unavailable` on a server recognised as Ollama: what stops it, for the app to say in its own words. */+ ollama?: OllamaProblem;}// How a user installs this engine; onboarding, the picker and settings render from it.diff --git a/server/drivers/ollama.test.ts b/server/drivers/ollama.test.tsindex 82a9709f28..36b3659640 100644--- a/server/drivers/ollama.test.ts+++ b/server/drivers/ollama.test.ts@@ -238,7 +238,6 @@ describe("the chat engine on Ollama", () => {const { url } = await fakeOllama({ models: [LLAMA, GEMMA] });const instance = await create({ url: `${url}/v1`, catalog: "ollama" });try {- await instance.refreshModels?.();expect(instance.models).toEqual({default: "llama3.2:latest",options: [@@ -253,14 +252,14 @@ describe("the chat engine on Ollama", () => {it("is unavailable, saying why, while Ollama is not running or has nothing to run", async () => {const closed = await create({ url: `${await closedPort()}/v1`, catalog: "ollama" });try {- expect(await closed.snapshot()).toMatchObject({ state: "unavailable", reason: expect.stringMatching(/^Ollama isn't running at /) });+ expect(await closed.snapshot()).toMatchObject({ state: "unavailable", reason: expect.stringMatching(/^Ollama isn't running at /), ollama: { state: "not-running" } });expect(closed.models).toEqual({ default: "", options: [] });} finally { await closed.dispose(); }const { url } = await fakeOllama({ models: [] });const empty = await create({ url: `${url}/v1`, catalog: "ollama" });try {await empty.refreshModels?.();- expect(await empty.snapshot()).toMatchObject({ state: "unavailable", reason: expect.stringContaining("ollama pull llama3.2") });+ expect(await empty.snapshot()).toMatchObject({ state: "unavailable", reason: expect.stringContaining("ollama pull llama3.2"), ollama: { state: "no-models", url } });} finally { await empty.dispose(); }});diff --git a/server/drivers/ollama.ts b/server/drivers/ollama.tsindex 090bb0bf11..32785d9ddf 100644--- a/server/drivers/ollama.ts+++ b/server/drivers/ollama.ts@@ -1,6 +1,7 @@// Ollama's own API (docs/api.md in github.com/ollama/ollama): /api/tags lists the pulled models with their size and// details, /api/version answers with a version, and /api/show names a model's capabilities ("tools", "vision") from// v0.6.4. A default install takes no key on these routes or on the OpenAI-compatible ones under /v1.+import type { LocalModel, OllamaState, OllamaStatus } from "../../shared/local-model.ts";import { isContextName } from "./ollama-context.ts";export const OLLAMA_PORT = "11434";@@ -11,31 +12,8 @@ export const OLLAMA_PLACEHOLDER_KEY = "ollama";export const OLLAMA_PULL_COMMAND = "ollama pull llama3.2";/** A pulled model, as /api/tags and /api/show describe it. */-export interface OllamaModel {- name: string;- /** Bytes on disk. */- bytes?: number;- /** As Ollama writes it, such as "3.2B". */- parameters?: string;- /** As Ollama writes it, such as "Q4_K_M". */- quantization?: string;- /** Absent when the server does not say (before v0.6.4). */- tools?: boolean;- vision?: boolean;-}--/** `ready`: running with models. `no-models`: running, nothing pulled. `not-running`: nothing listens there.- * `unreachable`: no answer in time, the host or network is unknown, or something else answers there. */-export type OllamaState = "ready" | "no-models" | "not-running" | "unreachable";--export interface OllamaStatus {- state: OllamaState;- url: string;- version?: string;- models: OllamaModel[];- /** Why an `unreachable` server could not be used. */- problem?: "timeout" | "network" | "not-ollama";-}+export type OllamaModel = LocalModel;+export type { OllamaState, OllamaStatus };/** The server's own address: the base URL without the /v1 the OpenAI-compatible routes sit under. */export function ollamaOrigin(baseUrl: string): string {diff --git a/server/drivers/openai-chat.ts b/server/drivers/openai-chat.tsindex 7f831c4889..03e7fd8bd8 100644--- a/server/drivers/openai-chat.ts+++ b/server/drivers/openai-chat.ts@@ -4,6 +4,7 @@ import type {DriverCreateInput,ModelCatalog,ProviderInstance,+ ProviderSnapshot,RuntimeEvent,RuntimeEventListener,SendTurnInput,@@ -118,7 +119,7 @@ interface RuntimeOptions<Config> {/** False for a model its server says cannot call tools: its turns go without them instead of being refused. */toolUse?: (model: string) => boolean;/** Why the server cannot answer now (not running, nothing to run), asked before the key is. */- serverUnavailable?: () => Promise<string | null>;+ serverUnavailable?: () => Promise<Pick<ProviderSnapshot, "reason" | "ollama"> | null>;/** The name to send for a model, when its server knows it by another. */servedModel?: (model: string) => Promise<string>;/** Smaller models announce a step and end the turn without calling a tool; such a reply gets a nudge, at most three@@ -938,7 +939,7 @@ export function createOpenAIChatRuntime<Config>(options: RuntimeOptions<Config>)...(options.refreshModels ? { refreshModels: options.refreshModels } : {}),snapshot: async () => {const down = await options.serverUnavailable?.();- if (down) return { state: "unavailable", reason: down };+ if (down) return { state: "unavailable", ...down };if (!options.apiKey) return { state: "unavailable", reason: options.unavailableReason };if (keyRejected(options.apiUrl, options.apiKey)) return { state: "available", authenticated: false, reason: KEY_REJECTED_REASON, version: null };return { state: "available", authenticated: true, version: null, ...(options.billing ? { billing: options.billing } : {}) };diff --git a/server/drivers/openai-compat.ts b/server/drivers/openai-compat.tsindex 606e3b5bd9..f47d1debf2 100644--- a/server/drivers/openai-compat.ts+++ b/server/drivers/openai-compat.ts@@ -40,6 +40,7 @@ const DEFAULT_MODELS: ModelCatalog = {const NO_MODELS: ModelCatalog = { default: "", options: [] };const OLLAMA_STATUS_MS = 5_000;+const OLLAMA_FIRST_LIST_MS = 2_000;const localFacts = ({ bytes, parameters, quantization, tools, vision }: OllamaModel) => ({...(bytes ? { bytes } : {}), ...(parameters ? { parameters } : {}), ...(quantization ? { quantization } : {}),@@ -341,6 +342,9 @@ export const OpenAICompatDriver: ProviderDriver<OpenAICompatConfig> = {return served.model;} : undefined;+ // The first list says which models can call tools, and is what the engine list shows right after adding Ollama.+ if (loading && isOllamaServer(config)) await Promise.race([loading, new Promise((done) => { setTimeout(done, OLLAMA_FIRST_LIST_MS).unref(); })]);+const runtime = createOpenAIChatRuntime({input,driverKind: DRIVER_KIND,@@ -356,7 +360,10 @@ export const OpenAICompatDriver: ProviderDriver<OpenAICompatConfig> = {toolUse: (model) => fact(model)?.tools ?? true,...(ollamaCandidate ? {serverUnavailable: async () => {- return isOllamaServer(config) ? ollamaUnavailable(await checkOllama()) : null;+ if (!isOllamaServer(config)) return null;+ const status = await checkOllama();+ const reason = ollamaUnavailable(status);+ return reason ? { reason, ollama: { state: status.state, url: status.url, ...(status.problem ? { problem: status.problem } : {}) } } : null;},} : {}),requestBody: (model, messages, stream) => ({diff --git a/server/routes/instances.test.ts b/server/routes/instances.test.tsindex 1b97ce1a5b..a2f6c37d37 100644--- a/server/routes/instances.test.ts+++ b/server/routes/instances.test.ts@@ -8,6 +8,7 @@ import type { ProviderAuthenticationStart, ProviderAuthenticationStatus } from "import { ENGINE_LIST_REUSE_MS, ProviderRegistry } from "../harness/registry.ts";import { json, readBody } from "../harness/http.ts";import { ProviderAuthSessions } from "../provider-auth-sessions.ts";+import type { RequestAuth } from "../request-auth.ts";import { makeFakeDriver } from "../testing/fake-driver.ts";import { createInstanceRoutes, type InstanceRouteDeps } from "./instances.ts";import { dispatchRoutes } from "./table.ts";@@ -17,7 +18,7 @@ afterEach(async () => {await Promise.all(servers.splice(0).map((server) => new Promise((done) => server.close(done))));});-async function serve(extra: Partial<InstanceRouteDeps> = {}) {+async function serve(extra: Partial<InstanceRouteDeps> = {}, auth: RequestAuth = { kind: "loopback", scopes: ["admin"] }) {const fake = makeFakeDriver();const registry = new ProviderRegistry([fake.driver]);await registry.load({ a: { driver: "fake" } });@@ -52,7 +53,7 @@ async function serve(extra: Partial<InstanceRouteDeps> = {}) {const url = new URL(req.url ?? "/", "http://localhost");const handled = await dispatchRoutes(routes, {req, res, url, path: url.pathname, method: req.method ?? "GET",- auth: { kind: "loopback", scopes: ["admin"] }, json, readBody,+ auth, json, readBody,});if (!handled) json(res, 404, { from: "inline routes" });});@@ -312,3 +313,32 @@ describe("hiding a provider", () => {});});++describe("looking for Ollama", () => {+ it("answers what one address said, and refuses an address that is not one", async () => {+ const ollama = createServer((request, response) => {+ response.setHeader("content-type", "application/json");+ if (request.url === "/api/tags") return response.end(JSON.stringify({ models: [{ name: "qwen3:4b", size: 2_500_000_000, details: { parameter_size: "4.0B" } }] }));+ if (request.url === "/api/version") return response.end(JSON.stringify({ version: "0.12.6" }));+ response.statusCode = 404;+ response.end("{}");+ });+ servers.push(ollama);+ await new Promise<void>((ready) => ollama.listen(0, "127.0.0.1", ready));+ const address = `http://127.0.0.1:${(ollama.address() as AddressInfo).port}`;+ const { call, base } = await serve();+ expect(await call("GET", `/api/instances/ollama?url=${encodeURIComponent(`${address}/v1`)}`)).toEqual({+ status: { state: "ready", url: address, version: "0.12.6", models: [{ name: "qwen3:4b", bytes: 2_500_000_000, parameters: "4.0B" }] },+ });+ const refused = await fetch(`${base}/api/instances/ollama?url=${encodeURIComponent("ftp://127.0.0.1:11434")}`);+ expect(refused.status).toBe(400);+ expect(await refused.json()).toEqual({ error: "Enter an http or https address, such as http://127.0.0.1:11434." });+ });++ it("is only for the owner: a shared server's bot shell or a hosted workspace can't make this server ask an address", async () => {+ const shell = await serve({}, { kind: "loopback", scopes: ["admin"], trust: "service" });+ expect((await fetch(`${shell.base}/api/instances/ollama?url=${encodeURIComponent("http://127.0.0.1:9")}`)).status).toBe(403);+ const hosted = await serve({ hostedModels: true });+ expect((await fetch(`${hosted.base}/api/instances/ollama`)).status).toBe(403);+ });+});diff --git a/server/routes/instances.ts b/server/routes/instances.tsindex f9fca7514e..6586ac9b16 100644--- a/server/routes/instances.ts+++ b/server/routes/instances.ts@@ -20,7 +20,8 @@ import {} from "../claude-endpoints.ts";import { updateClaudeCli } from "../claude-update.ts";import { persistableInstanceConfigs, saveConfig, withInstanceCli, type AppConfig } from "../config.ts";-import { addEndpoint, addEndpointSchema, isAddedEndpoint, withEndpointUrls } from "../openai-compat-endpoints.ts";+import { addEndpoint, addEndpointSchema, endpointBaseUrl, isAddedEndpoint, withEndpointUrls } from "../openai-compat-endpoints.ts";+import { findOllama, probeOllama } from "../drivers/ollama.ts";import type { InstanceConfigMap, ModelSelection, ProviderInstance } from "../contracts.ts";import { removeAntigravityProfile } from "../drivers/antigravity-acp.ts";import { BUILT_IN_DRIVERS } from "../drivers/builtIn.ts";@@ -30,7 +31,7 @@ import { checkEngine, type EngineCheck } from "../engine-check.ts";import { HOSTED_PROVIDER_SETTINGS_ERROR } from "../hosted-models.ts";import type { ProviderAuthSessions } from "../provider-auth-sessions.ts";import { providerIconPatchSchema, withInstanceIcon } from "../provider-icon.ts";-import { isLoopbackHost, isProxied } from "../request-auth.ts";+import { isLoopbackHost, isProxied, ownerOrAdmin } from "../request-auth.ts";import type { SessionRegistry } from "../sessions.ts";import type { Store } from "../store.ts";import type { BusyFlag, ConfigStatus } from "./config.ts";@@ -109,6 +110,13 @@ export function createInstanceRoutes(deps: InstanceRouteDeps): RouteHandler {if (url.searchParams.get("fresh") === "1") registry.forgetSnapshots();return json(res, 200, { instances: await describeInstances() });}+ if (method === "GET" && path === "/api/instances/ollama") {+ if (hostedModels || !ownerOrAdmin(auth)) return json(res, 403, { error: "Only the owner of this server can look for Ollama." });+ const asked = url.searchParams.get("url")?.trim();+ const address = asked ? endpointBaseUrl(asked) : null;+ if (asked && !address) return json(res, 400, { error: "Enter an http or https address, such as http://127.0.0.1:11434." });+ return json(res, 200, { status: address ? await probeOllama(address) : await findOllama() });+ }const companyMutation = /^\/api\/instances\/(company\.[\w.-]+)(?:\/|$)/.exec(path);if (hostedModels && path.startsWith("/api/instances/") && method !== "GET") return json(res, 403, { error: HOSTED_PROVIDER_SETTINGS_ERROR });if (companyMutation && method !== "GET") return json(res, 403, { error: "Company accounts are read-only here. Manage this connection in desktop Settings." });diff --git a/shared/local-model.ts b/shared/local-model.tsindex 66fd80975d..94cae23c28 100644--- a/shared/local-model.ts+++ b/shared/local-model.ts@@ -7,3 +7,25 @@ export interface LocalModelFacts {tools?: boolean;vision?: boolean;}++export interface LocalModel extends LocalModelFacts {+ name: string;+}++/** `ready`: running with models. `no-models`: running, nothing pulled. `not-running`: nothing listens there.+ * `unreachable`: no answer in time, the host or network is unknown, or something else answers there. */+export type OllamaState = "ready" | "no-models" | "not-running" | "unreachable";++/** What looking for Ollama at one address found (GET /api/instances/ollama). */+export interface OllamaStatus {+ state: OllamaState;+ /** The server's own address, without /v1. */+ url: string;+ version?: string;+ models: LocalModel[];+ /** Why an `unreachable` server could not be used. */+ problem?: "timeout" | "network" | "not-ollama";+}++/** Why an Ollama cannot answer now, for the engine list to say in the reader's language. */+export type OllamaProblem = Pick<OllamaStatus, "state" | "url" | "problem">;diff --git a/src/components/EngineSetup.test.ts b/src/components/EngineSetup.test.tsindex 6beacddfca..fb7ddbdd91 100644--- a/src/components/EngineSetup.test.ts+++ b/src/components/EngineSetup.test.ts@@ -364,4 +364,17 @@ describe("Ollama setup", () => {expect(markup).toContain("Ollama isn't running at http://127.0.0.1:11434");expect(markup).not.toContain("API key");});++ it("says it in the app's own words when the engine names the problem, with the command to run", () => {+ vi.stubGlobal("window", { ogb: { platform: "darwin" } });+ const ollama: InstanceInfo = {+ instanceId: "openaiCompat", driverKind: "openai-compat", displayName: "Ollama", access: "api", serverKind: "ollama",+ models: { default: "", options: [] },+ snapshot: { state: "unavailable", reason: "Ollama has no models yet.", ollama: { state: "no-models", url: "http://127.0.0.1:11434" } },+ };+ const markup = renderToStaticMarkup(createElement(StoreProvider, null, createElement(EngineSetup, { instance: ollama })));+ expect(markup).toContain('data-ollama-state="no-models"');+ expect(markup).toContain("ollama pull llama3.2");+ expect(markup).not.toContain("Ollama has no models yet.");+ });});diff --git a/src/components/EngineSetup.tsx b/src/components/EngineSetup.tsxindex 82a1ace6e6..2d01e11c39 100644--- a/src/components/EngineSetup.tsx+++ b/src/components/EngineSetup.tsx@@ -15,6 +15,7 @@ export { installCommandFor };import { keyEntry, keyForInstance, type KeyId } from "./keys/key-catalog";import { openKeySettings } from "./keys/key-focus";import { KeyRow, SavedKeyLine } from "./keys/KeyRow";+import { OllamaStatusLine } from "./OllamaStatusLine";export function needsSignIn(instance: InstanceInfo | undefined): boolean {return instance?.snapshot.state === "available" && instance.snapshot.authenticated === false;@@ -401,7 +402,7 @@ export function isApiKeyEngine(instance: InstanceInfo | undefined): boolean {}export function hasSavedApiKey(instance: InstanceInfo): boolean {- return isApiKeyEngine(instance) && instance.snapshot.authenticated === true;+ return isApiKeyEngine(instance) && instance.serverKind !== "ollama" && instance.snapshot.authenticated === true;}function apiKeySetup(instance: InstanceInfo): boolean {@@ -580,9 +581,11 @@ export function EngineSetup({return (<div className={cn(!unframed && "rounded-xl border border-hairline/40 bg-control/30 p-3", className)}><div className="text-[13px] font-semibold text-ink">{t("engineSetup.notReady", { name: engineDisplayName(instance) })}</div>- <p className="mt-1 text-[12px] leading-relaxed text-ink-secondary">- {instance.snapshot.authenticationUnavailableReason ?? instance.snapshot.reason ?? t("engineSetup.noReason")}- </p>+ {instance.snapshot.ollama+ ? <div className="mt-1"><OllamaStatusLine status={instance.snapshot.ollama} /></div>+ : <p className="mt-1 text-[12px] leading-relaxed text-ink-secondary">+ {instance.snapshot.authenticationUnavailableReason ?? instance.snapshot.reason ?? t("engineSetup.noReason")}+ </p>}</div>);}diff --git a/src/components/EnginesSettings.tsx b/src/components/EnginesSettings.tsxindex 5508d0a41d..509b32c36d 100644--- a/src/components/EnginesSettings.tsx+++ b/src/components/EnginesSettings.tsx@@ -17,6 +17,7 @@ import { CacheKeepWarmSettings } from "./CacheKeepWarmSettings";import { ConfirmDialog } from "./ConfirmDialog";import { Select } from "./Select";import { SettingsDisclosureRow, SettingsGroup, SettingsRows } from "./SettingsPrimitives";+import { OllamaModels, ollamaShortStatus } from "./OllamaStatusLine";import { InstanceProviderMark } from "./ProviderIcons";interface ProbeResult {@@ -389,6 +390,7 @@ function EngineRow({ instance, bare = false }: { instance: InstanceInfo; bare?:{policyNote}{!engineReady(instance) && <EngineSetup instance={instance} intent={instance.access === "custom" ? "inject" : "cloud"} description={instance.codexEndpoint ? t("agentEndpoints.codexHint") : undefined} unframed />}{engineReady(instance) && <ApiKeyEngineManage instance={instance} className="mt-3" />}+ {engineReady(instance) && instance.serverKind === "ollama" && <OllamaModels instance={instance} className="mt-3" />}{/* The setup panel that first said so is gone once the engine is Ready. */}{engineReady(instance) && <AppCopyNotice instance={instance} className="mt-3" />}{instance.snapshot.update && <EngineUpdateNotice update={instance.snapshot.update} instance={instance} className="mt-3" quiet />}@@ -416,6 +418,7 @@ function EngineRow({ instance, bare = false }: { instance: InstanceInfo; bare?:function simpleStatus(instance: InstanceInfo, ready: boolean): string {if (ready) return instance.snapshot.authenticated === true && instance.snapshot.account?.email ? instance.snapshot.account.email : t("onboarding.engines.ready");+ if (instance.snapshot.ollama) return ollamaShortStatus(instance.snapshot.ollama);return instance.snapshot.state === "available" && instance.snapshot.authenticated === false ? t("model.signInRequired") : t("onboarding.engines.needsSetup");}diff --git a/src/components/OllamaServer.test.ts b/src/components/OllamaServer.test.tsnew file mode 100644index 0000000000..5513ca8557--- /dev/null+++ b/src/components/OllamaServer.test.ts@@ -0,0 +1,60 @@+import { createElement } from "react";+import { renderToStaticMarkup } from "react-dom/server";+import { describe, expect, it } from "vitest";++import type { OllamaStatus } from "../../shared/local-model";+import { KEY_CATALOG, keyMatches } from "./keys/key-catalog";+import { ollamaBaseUrl } from "./OllamaServer";+import { OllamaModels, ollamaShortStatus, ollamaStatusText, OllamaStatusLine, OLLAMA_PULL } from "./OllamaStatusLine";++const URL = "http://127.0.0.1:11434";+const status = (state: OllamaStatus["state"], extra: Partial<OllamaStatus> = {}): OllamaStatus => ({ state, url: URL, models: [], ...extra });++describe("the Ollama card's states", () => {+ it("says it runs, with how many models it has", () => {+ expect(ollamaStatusText(status("ready", { models: [{ name: "llama3.2:latest" }, { name: "qwen3:4b" }] }))).toEqual({+ ok: true, text: `Ollama is running at ${URL}. Pulled models: 2.`,+ });+ });++ it("gives the command that pulls a first model, or starts Ollama", () => {+ expect(ollamaStatusText(status("no-models"))).toEqual({ ok: false, text: expect.stringContaining("has no models yet"), command: OLLAMA_PULL });+ expect(ollamaStatusText(status("not-running"))).toEqual({ ok: false, text: expect.stringContaining("isn’t running"), command: "ollama serve" });+ });++ it("tells a timeout, an unknown host and another server apart", () => {+ expect(ollamaStatusText(status("unreachable", { problem: "timeout" })).text).toContain("didn’t answer in time");+ expect(ollamaStatusText(status("unreachable", { problem: "network" })).text).toContain("Can’t reach Ollama");+ expect(ollamaStatusText(status("unreachable", { problem: "not-ollama" })).text).toContain("it isn’t Ollama");+ });++ it("shows the command as one line to copy", () => {+ const markup = renderToStaticMarkup(createElement(OllamaStatusLine, { status: status("no-models") }));+ expect(markup).toContain('data-ollama-state="no-models"');+ expect(markup).toContain(`<code class="self-start rounded-md bg-inset px-2 py-1 font-mono text-[12px] leading-4 text-ink select-all">${OLLAMA_PULL}</code>`);+ });++ it("has a few words for the engine list", () => {+ expect(ollamaShortStatus(status("not-running"))).toBe("Not running");+ expect(ollamaShortStatus(status("no-models"))).toBe("No models yet");+ expect(ollamaShortStatus(status("unreachable", { problem: "timeout" }))).toBe("Can’t be reached");+ });++ it("lists the pulled models with their facts, for the engine's row", () => {+ const markup = renderToStaticMarkup(createElement(OllamaModels, { instance: { models: { default: "a", options: [+ { id: "a", label: "llama3.2:latest", custom: true, local: { bytes: 2_019_393_189, parameters: "3.2B", quantization: "Q4_K_M", tools: true } },+ { id: "b", label: "typed-by-hand", custom: true },+ ] } } }));+ expect(markup).toContain("llama3.2:latest");+ expect(markup).toContain("3.2B · Q4_K_M · 2 GB");+ expect(markup).not.toContain("typed-by-hand");+ });++ it("adds the OpenAI-compatible routes under /v1", () => {+ expect(ollamaBaseUrl(`${URL}/`)).toBe(`${URL}/v1`);+ });++ it("is what a search for Ollama finds in Connections", () => {+ expect(KEY_CATALOG.filter((entry) => keyMatches(entry, "ollama")).map((entry) => entry.id)[0]).toBe("ollama");+ });+});diff --git a/src/components/OllamaServer.tsx b/src/components/OllamaServer.tsxnew file mode 100644index 0000000000..efc8da858c--- /dev/null+++ b/src/components/OllamaServer.tsx@@ -0,0 +1,110 @@+import { useCallback, useEffect, useRef, useState } from "react";+import { Loader2, Plus, RotateCw } from "lucide-react";+import { api, useStore, type InstanceInfo } from "@/state/store";+import { t } from "@/lib/i18n";+import { keySaved } from "@/lib/product-events";+import { addedServers } from "@/lib/openai-compat-endpoints";+import { cn } from "@/lib/cn";+import type { OllamaStatus } from "../../shared/local-model";+import { KEY_FIELD } from "./keys/KeyRow";+import { OllamaStatusLine } from "./OllamaStatusLine";++/** Ollama ignores the key; the server's add-server route still asks for one. */+const PLACEHOLDER_KEY = "ollama";+const DOWNLOAD_URL = "https://ollama.com/download";++export const ollamaBaseUrl = (origin: string) => `${origin.replace(/\/+$/, "")}/v1`;+const sameBase = (a: string | undefined, b: string) => a?.trim().replace(/\/+$/, "") === b;++/** Finds Ollama on this computer, or at an address someone enters, and adds it in one click: no key, no URL to type. */+export function OllamaServer({ visible }: { visible: boolean }) {+ const { state, dispatch, refreshInstances } = useStore();+ const [address, setAddress] = useState("");+ const [status, setStatus] = useState<OllamaStatus | null>(null);+ const [checking, setChecking] = useState(false);+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState<string | null>(null);++ const latest = useRef(0);+ const looked = useRef(false);++ const check = useCallback((url: string) => {+ const request = ++latest.current;+ setChecking(true);+ setError(null);+ void api<{ status: OllamaStatus }>(`/api/instances/ollama${url ? `?url=${encodeURIComponent(url)}` : ""}`)+ .then((result) => { if (request === latest.current) setStatus(result.status); })+ .catch((cause: Error) => { if (request === latest.current) { setStatus(null); setError(cause.message || t("apiInstances.failed")); } })+ .finally(() => { if (request === latest.current) setChecking(false); });+ }, []);+ // Connections mounts every row, folded or not; a folded section has nothing to show yet.+ useEffect(() => {+ if (!visible || looked.current) return;+ looked.current = true;+ check("");+ }, [visible, check]);++ const target = status ? ollamaBaseUrl(status.url) : null;+ const present = Boolean(target && (addedServers(state.instances).some((server) => server.url === target) || sameBase(state.config?.openaiCompat?.url, target)));+ const canAdd = Boolean(target && !present && !busy && !checking && (status?.state === "ready" || status?.state === "no-models"));++ const add = () => {+ if (!canAdd || !target) return;+ setBusy(true);+ setError(null);+ void api<{ instances?: unknown }>("/api/instances/openai-compat", {+ method: "POST",+ body: JSON.stringify({ displayName: "Ollama", url: target, key: PLACEHOLDER_KEY, catalog: "ollama" }),+ }).then(+ async (created) => {+ keySaved("custom_endpoint", "settings", "unverified");+ if (Array.isArray(created.instances)) dispatch({ type: "instances", instances: created.instances as InstanceInfo[] });+ else await refreshInstances({ reportErrors: true });+ },+ (cause: unknown) => {+ keySaved("custom_endpoint", "settings", "error");+ setError(cause instanceof Error && cause.message ? cause.message : t("apiInstances.failed"));+ },+ ).finally(() => setBusy(false));+ };++ return (+ <div data-ollama-server>+ <p className="text-[12px] leading-4 text-ink-secondary">{t("ollama.desc")}</p>+ <div role="status" aria-live="polite" className="mt-2">+ {checking+ ? <p className="flex items-center gap-1.5 text-[12px] leading-4 text-ink-secondary"><Loader2 size={12} className="animate-spin" aria-hidden="true" />{t("ollama.checking")}</p>+ : status && <OllamaStatusLine status={status} />}+ </div>+ {!checking && status?.state === "not-running" && (+ <a href={DOWNLOAD_URL} target="_blank" rel="noopener noreferrer" className="mt-1 inline-block text-[12px] font-medium text-accent-text hover:underline">{t("ollama.download")}</a>+ )}+ <div className="mt-2 flex flex-col gap-1.5">+ <input+ type="url"+ value={address}+ onChange={(event) => setAddress(event.target.value)}+ onKeyDown={(event) => { if (event.key === "Enter") check(address.trim()); }}+ placeholder="http://127.0.0.1:11434"+ aria-label={t("ollama.address")}+ spellCheck={false}+ disabled={busy}+ className={cn(KEY_FIELD, "font-mono")}+ />+ <p className="text-[12px] leading-4 text-ink-secondary">{t("ollama.addressHint")}</p>+ <div className="flex flex-wrap gap-1.5">+ <button type="button" onClick={add} disabled={!canAdd} className="ui-button">+ {busy ? <Loader2 size={12} aria-hidden="true" className="animate-spin" /> : <Plus size={12} aria-hidden="true" />}+ {busy ? t("ollama.adding") : t("ollama.add")}+ </button>+ <button type="button" onClick={() => check(address.trim())} disabled={checking || busy} className="ui-button">+ <RotateCw size={12} aria-hidden="true" />+ {t("common.checkAgain")}+ </button>+ </div>+ {present && <p className="text-[12px] text-ink-secondary">{t("ollama.added")}</p>}+ </div>+ {error && <div role="alert" className="mt-1 text-[12px] text-danger">{error}</div>}+ </div>+ );+}diff --git a/src/components/OllamaStatusLine.tsx b/src/components/OllamaStatusLine.tsxnew file mode 100644index 0000000000..e5eeb4d0dc--- /dev/null+++ b/src/components/OllamaStatusLine.tsx@@ -0,0 +1,58 @@+import { Check } from "lucide-react";+import { t } from "@/lib/i18n";+import { cn } from "@/lib/cn";+import { localModelDetail } from "@/lib/local-model";+import type { InstanceInfo } from "@/state/store";+import type { OllamaProblem, OllamaStatus } from "../../shared/local-model";++export const OLLAMA_PULL = "ollama pull llama3.2";+const OLLAMA_SERVE = "ollama serve";++type Found = OllamaProblem & { models?: OllamaStatus["models"] };++/** What one look found, in a line, and the command that fixes it. */+export function ollamaStatusText(status: Found): { text: string; command?: string; ok: boolean } {+ switch (status.state) {+ case "ready": return { ok: true, text: t("ollama.ready", { url: status.url, count: status.models?.length ?? 0 }) };+ case "no-models": return { ok: false, text: t("ollama.noModels", { url: status.url }), command: OLLAMA_PULL };+ case "not-running": return { ok: false, text: t("ollama.notRunning", { url: status.url }), command: OLLAMA_SERVE };+ case "unreachable": return {+ ok: false,+ text: t(status.problem === "not-ollama" ? "ollama.notOllama" : status.problem === "timeout" ? "ollama.timeout" : "ollama.unreachable", { url: status.url }),+ };+ }+}++/** The engine list's few words for what stops an Ollama. */+export function ollamaShortStatus(problem: OllamaProblem): string {+ return t(problem.state === "not-running" ? "ollama.short.notRunning" : problem.state === "no-models" ? "ollama.short.noModels" : "ollama.short.unreachable");+}++/** The pulled models of a recognised Ollama, for its row in the engine list. */+export function OllamaModels({ instance, className }: { instance: Pick<InstanceInfo, "models">; className?: string }) {+ const models = instance.models.options.filter((option) => option.local);+ if (models.length === 0) return null;+ return (+ <ul data-ollama-models className={cn("flex flex-col gap-0.5", className)}>+ {models.map((model) => (+ <li key={model.id} className="flex items-baseline justify-between gap-3 text-[12px] leading-4">+ <span className="min-w-0 truncate font-mono text-ink">{model.label}</span>+ <span className="shrink-0 text-ink-secondary">{localModelDetail(model.local)}</span>+ </li>+ ))}+ </ul>+ );+}++export function OllamaStatusLine({ status }: { status: Found }) {+ const { text, command, ok } = ollamaStatusText(status);+ return (+ <div data-ollama-state={status.state} className="flex flex-col gap-1">+ <p className={cn("flex items-start gap-1.5 text-[12px] leading-4", ok ? "text-success" : "text-ink-secondary")}>+ {ok && <Check size={13} className="mt-px shrink-0" aria-hidden="true" />}+ <span>{text}</span>+ </p>+ {command && <code className="self-start rounded-md bg-inset px-2 py-1 font-mono text-[12px] leading-4 text-ink select-all">{command}</code>}+ </div>+ );+}diff --git a/src/components/SettingsModal.tsx b/src/components/SettingsModal.tsxindex eb16c07ec3..b934c03544 100644--- a/src/components/SettingsModal.tsx+++ b/src/components/SettingsModal.tsx@@ -93,7 +93,7 @@ export const SECTIONS: Array<{{ id: "appearance", group: "you", labelKey: "settings.section.appearance", icon: Palette, keywords: ["skin", "theme", "appearance", "chat width", "width", "wide", "full width", "bubble", "bubbles", "tools", "tool calls", "threads", "show threads", "hide threads", "sidebar", "display", "run", "this run", "run card", "commands", "notifications", "sound", "sounds", "mute", "silent", "chime", "pinned", "circles", "universal", "groups", "top", "send", "enter", "return", "shift+enter", "ctrl+enter", "cmd+enter", "⌘+enter", "new line", "keyboard", "ime", "japanese", "message color", "my messages", "toolbar", "tools layout", "footer", "routines", "triggers", "team map", "color", "colour", "cloud color", "server color", "tint", "sidebar color", "sidebar picture", "picture", "image", "banner", "background", "computers", "your computers", "rail", "strip", "frame", "window frame", "title bar"] },{ id: "companion", group: "you", labelKey: "settings.section.companion", icon: TabletSmartphone, keywords: ["companion", "device", "phone", "desktop", "client", "host", "pair", "pairing", "mobile", "https", "secure", "tailscale", "wifi", "remote", "advanced", "domain", "dns", "self-hosted", "server", "caddy"] },{ id: "engines", group: "ai", labelKey: "settings.section.engines", icon: Terminal, keywords: ["models", "model providers", "engines", "claude", "codex", "grok", "providers", "cli", "sign in", "subscription"] },- { id: "connections", group: "ai", labelKey: "settings.section.connections", icon: KeyRound, keywords: ["keys", "api", "api key", "api keys", "connections", "composio", "box", "xai", "mistral", "cerebras", "meta", "muse", "vps", "router", "openrouter", "base url", "openai", "anthropic", "groq", "greenference", "opencode", "deepseek", "provider", "lm studio", "lmstudio", "llm studio", "llmstudio", "bionic"] },+ { id: "connections", group: "ai", labelKey: "settings.section.connections", icon: KeyRound, keywords: ["keys", "api", "api key", "api keys", "connections", "composio", "box", "xai", "mistral", "cerebras", "meta", "muse", "vps", "router", "openrouter", "base url", "openai", "anthropic", "groq", "greenference", "opencode", "deepseek", "provider", "ollama", "lm studio", "lmstudio", "llm studio", "llmstudio", "bionic"] },{ id: "decisionModel", group: "ai", labelKey: "settings.section.decisionModel", icon: Zap, keywords: ["decision", "extraction", "jev", "typesafe", "cloudflare", "workers ai", "clef", "clairic", "email", "routing", "auto", "rooms", "who answers"] },{ id: "imageGeneration", group: "ai", labelKey: "settings.section.imageGeneration", icon: ImagePlus, keywords: ["image", "images", "picture", "generate", "avatar", "gpt image", "grok imagine", "gemini", "nano banana", "openrouter", "flux", "backup"] },{ id: "skills", group: "ai", labelKey: "settings.section.skills", icon: BookOpen, keywords: ["skills", "library", "assign", "agent skills", "skill md"] },diff --git a/src/components/keys/KeysPage.dom.test.ts b/src/components/keys/KeysPage.dom.test.tsindex 968f3e463f..2dbba215cd 100644--- a/src/components/keys/KeysPage.dom.test.ts+++ b/src/components/keys/KeysPage.dom.test.ts@@ -221,6 +221,62 @@ describe("the OpenAI-compatible server row", () => {});});+describe("the Ollama row", () => {+ const openServers = () => flushSync(() => section("servers").querySelector<HTMLButtonElement>("button[aria-expanded]")!.click());+ const button = (text: string) => [...row("ollama")!.querySelectorAll("button")].find((candidate) => candidate.textContent === text)!;+ const found = (state: string) => vi.waitFor(() => expect(row("ollama")!.querySelector(`[data-ollama-state="${state}"]`)).not.toBeNull());+ const answer = (state: string, url = "http://127.0.0.1:11434", models: unknown[] = []) => {+ fx.api.mockImplementation(async (path: string) => path.startsWith("/api/instances/ollama") ? { status: { state, url, models } } : { instances: [] });+ };++ it("looks only once its section is open, and adds what it found with no key or address to type", async () => {+ answer("ready", undefined, [{ name: "llama3.2:latest" }]);+ page();+ expect(fx.api).not.toHaveBeenCalled();+ openServers();+ await found("ready");+ expect(row("ollama")!.textContent).toContain("Pulled models: 1.");+ expect(fx.api.mock.calls.map(([path]) => path)).toEqual(["/api/instances/ollama"]);+ flushSync(() => button("Add Ollama").click());+ await vi.waitFor(() => expect(fx.api).toHaveBeenCalledTimes(2));+ expect(fx.api.mock.calls[1]![0]).toBe("/api/instances/openai-compat");+ expect(JSON.parse(fx.api.mock.calls[1]![1].body)).toEqual({ displayName: "Ollama", url: "http://127.0.0.1:11434/v1", key: "ollama", catalog: "ollama" });+ });++ it("asks at the address someone enters", async () => {+ answer("no-models");+ page();+ openServers();+ await found("no-models");+ expect(row("ollama")!.textContent).toContain("ollama pull llama3.2");+ answer("ready", "http://gpu-box.local:11434", [{ name: "qwen3:4b" }]);+ type(row("ollama")!.querySelector<HTMLInputElement>("input")!, "http://gpu-box.local:11434");+ flushSync(() => button("Check again").click());+ await found("ready");+ expect(fx.api.mock.calls.at(-1)![0]).toBe(`/api/instances/ollama?url=${encodeURIComponent("http://gpu-box.local:11434")}`);+ });++ it("offers nothing to add while Ollama isn't running, only how to start or get it", async () => {+ answer("not-running");+ page();+ openServers();+ await found("not-running");+ expect(button("Add Ollama").disabled).toBe(true);+ expect(row("ollama")!.querySelector<HTMLAnchorElement>('a[href="https://ollama.com/download"]')).not.toBeNull();+ expect(row("ollama")!.textContent).toContain("ollama serve");+ });++ it("says when this Ollama is already added, through the built-in server or an added one", async () => {+ answer("ready", undefined, [{ name: "llama3.2:latest" }]);+ fx.config = { ...fx.config, openaiCompat: { url: "http://127.0.0.1:11434/v1/" } };+ page();+ openServers();+ await found("ready");+ expect(row("ollama")!.textContent).toContain("already added");+ expect(button("Add Ollama").disabled).toBe(true);+ });+});+describe("Boat's credit offer on the Boat card", () => {const offer = () => row("box")!.querySelector<HTMLElement>("[data-boat-offer]");const buttons = () => [...offer()!.querySelectorAll<HTMLButtonElement>("button")];diff --git a/src/components/keys/KeysPage.tsx b/src/components/keys/KeysPage.tsxindex 0848d94dfb..debd2e30f5 100644--- a/src/components/keys/KeysPage.tsx+++ b/src/components/keys/KeysPage.tsx@@ -8,6 +8,7 @@ import { BoatOfferPanel } from "../BoatOffer";import { LiveProviderSettings } from "../LiveProviderSettings";import { VoiceEveryReplySetting } from "../VoiceEveryReplySetting";import { BuiltInReplyWait, LmStudioServer, OtherOpenAiCompatServers } from "../OpenAiCompatServers";+import { OllamaServer } from "../OllamaServer";import { KEY_CATALOG, KEY_SECTIONS, keyMatches, savedState, type KeyEntry, type KeyId, type KeySectionId } from "./key-catalog";import { finishKeyFocus, useKeyFocus, type KeyFocusRequest } from "./key-focus";import { AnthropicEveryClaudeBot, OpenAiCompatUrl, OpenCodeProviderKeys, VpsConnection } from "./KeyPanels";@@ -16,8 +17,9 @@ import { KEY_ROW, KeyRow, MaskedKey, RowHeading, type KeyStatus } from "./KeyRowconst CARD = "rounded-xl bg-card in-data-[settings-look=simple]:rounded-[12px] in-data-[settings-look=simple]:border-[0.5px] in-data-[settings-look=simple]:border-(--settings-edge) in-data-[settings-look=simple]:bg-menu";const HIGHLIGHT_MS = 1600;-const PANELS: Partial<Record<KeyId, () => ReactNode>> = {+const PANELS: Partial<Record<KeyId, (visible: boolean) => ReactNode>> = {opencodeProviders: () => <OpenCodeProviderKeys />,+ ollama: (visible) => <OllamaServer visible={visible} />,lmStudio: () => <LmStudioServer heading={false} />,vps: () => <VpsConnection />,};@@ -35,7 +37,7 @@ function connected(entry: KeyEntry, config: ConfigStatus | null | undefined): boreturn saved.configured || saved.included === true;}-function PanelRow({ entry }: { entry: KeyEntry }) {+function PanelRow({ entry, visible }: { entry: KeyEntry; visible: boolean }) {const { state } = useStore();const titleId = useId();const saved = savedState(entry, state.config);@@ -43,7 +45,7 @@ function PanelRow({ entry }: { entry: KeyEntry }) {return (<div data-key-row={entry.id} role="group" aria-labelledby={titleId} className={KEY_ROW}><RowHeading entry={entry} status={status} titleId={titleId} />- <div className="flex flex-col gap-2 pl-8">{PANELS[entry.id]?.()}</div>+ <div className="flex flex-col gap-2 pl-8">{PANELS[entry.id]?.(visible)}</div></div>);}@@ -72,9 +74,9 @@ function ElsewhereRow({ entry }: { entry: KeyEntry }) {);}-export function KeyCatalogRow({ entry }: { entry: KeyEntry }) {+export function KeyCatalogRow({ entry, visible }: { entry: KeyEntry; visible: boolean }) {if (entry.kind === "uses" && entry.uses) return <KeyRow id={entry.uses} row={entry.id} />;- if (entry.kind === "panel") return <PanelRow entry={entry} />;+ if (entry.kind === "panel") return <PanelRow entry={entry} visible={visible} />;if (entry.kind === "elsewhere") return <ElsewhereRow entry={entry} />;return <KeyRow id={entry.id}>{EXTRAS[entry.id]?.()}</KeyRow>;}@@ -102,7 +104,7 @@ function KeySection({ id, rows, open, onToggle }: { id: KeySectionId; rows: KeyE<ChevronRight size={14} aria-hidden="true" className={cn("shrink-0 text-ink-secondary transition-transform motion-reduce:transition-none", open && "rotate-90")} /></button><div id={bodyId} hidden={!open} className="flex flex-col gap-0.5 border-t border-hairline/40 px-1 py-1.5 in-data-[settings-look=simple]:border-t-[0.5px] in-data-[settings-look=simple]:border-(--settings-edge)">- {rows.map((entry) => <KeyCatalogRow key={entry.id} entry={entry} />)}+ {rows.map((entry) => <KeyCatalogRow key={entry.id} entry={entry} visible={open} />)}{id === "voice" && <VoiceEveryReplySetting />}</div></section>diff --git a/src/components/keys/key-catalog.ts b/src/components/keys/key-catalog.tsindex a8d61b78ba..a672553590 100644--- a/src/components/keys/key-catalog.ts+++ b/src/components/keys/key-catalog.ts@@ -40,7 +40,7 @@ export interface KeyTarget {export type KeyId =| "openai" | "anthropic" | "xai" | "openrouter" | "mistral" | "cerebras" | "groq" | "greenference" | "meta" | "deepseek" | "opencodeGo" | "opencodeProviders"- | "lmStudio" | "openaiCompat" | "liveCalls" | "liveKey" | "elevenlabs" | "fishAudio" | "geminiTts" | "box" | "vps" | "onePassword" | "composio" | "treg" | "postiz"+ | "ollama" | "lmStudio" | "openaiCompat" | "liveCalls" | "liveKey" | "elevenlabs" | "fishAudio" | "geminiTts" | "box" | "vps" | "onePassword" | "composio" | "treg" | "postiz"| "jev" | "openrouterHelper" | "workersAi" | "imageOpenai" | "imageGemini" | "imageCustom";export type KeyMark = { driverKind: string; preset?: ProviderIconPreset } | { icon: LucideIcon };@@ -114,10 +114,12 @@ export const KEY_CATALOG: readonly KeyEntry[] = [{ id: "opencodeProviders", section: "ai", labelKey: "keys.opencode.otherProviders.title", purposeKey: "keys.purpose.opencodeProviders", name: "OpenCode", env: [],words: ["opencode", "venice", "providers", "provider keys"], mark: provider("opencodeGo"), kind: "panel",status: (config) => ({ configured: (config.opencodeGo?.providerKeys?.length ?? 0) > 0 }) },+ { id: "ollama", section: "servers", labelKey: "ollama.title", purposeKey: "keys.purpose.ollama", name: "Ollama", env: [],+ words: ["ollama", "local", "llama", "ollama pull"], mark: provider("openai-compat", "ollama"), kind: "panel" },{ id: "lmStudio", section: "servers", labelKey: "lmStudio.title", purposeKey: "keys.purpose.lmStudio", name: "LM Studio", env: [],words: ["lm studio", "lmstudio", "llm studio", "local", "bionic"], mark: { icon: Server }, kind: "panel" },{ id: "openaiCompat", section: "servers", labelKey: "keys.openaiCompat.label", purposeKey: "keys.purpose.openaiCompat", name: "OpenAI-compatible", env: ["OPENAI_COMPAT_API_KEY", "OPENAI_COMPAT_URL"],- words: ["openai-compatible", "openai compatible", "ollama", "together", "gemini", "google ai studio", "base url", "server", "endpoint"], mark: { icon: Server }, kind: "key",+ words: ["openai-compatible", "openai compatible", "together", "gemini", "google ai studio", "base url", "server", "endpoint"], mark: { icon: Server }, kind: "key",target: { patch: (value) => ({ openaiCompat: { key: value } }), saved: (config) => flag(config.openaiCompat), placeholder: "…", placeholderKey: "keys.openaiCompat.placeholder",href: "https://platform.openai.com/docs/api-reference", test: "openaiCompat", analytics: "openai_compat" } },{ id: "liveCalls", section: "voice", labelKey: "call.live.key", purposeKey: "keys.purpose.liveCalls", name: "OpenAI", env: [],diff --git a/src/locales/en.json b/src/locales/en.jsonindex 6818aee2dc..ebb55fc2a1 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -3817,6 +3817,24 @@"lmStudio.add": "Add LM Studio","lmStudio.adding": "Adding…","lmStudio.added": "This server is already added.",+ "ollama.title": "Ollama",+ "ollama.desc": "Run models on this computer, or another one on your network, with Ollama. No key needed.",+ "ollama.checking": "Looking for Ollama…",+ "ollama.ready": "Ollama is running at {url}. Pulled models: {count}.",+ "ollama.noModels": "Ollama is running at {url} but has no models yet. Pull one, then check again:",+ "ollama.notRunning": "Ollama isn’t running at {url}. Open the Ollama app, or start it with:",+ "ollama.unreachable": "Can’t reach Ollama at {url}. Check the address and that this computer can reach it.",+ "ollama.timeout": "Ollama at {url} didn’t answer in time. Check that it’s running and reachable, then check again.",+ "ollama.notOllama": "Something answers at {url}, but it isn’t Ollama. Check the address.",+ "ollama.address": "Ollama address",+ "ollama.addressHint": "Leave this empty to use Ollama on this computer, or enter another computer’s address, such as http://192.168.1.20:11434, and check again.",+ "ollama.add": "Add Ollama",+ "ollama.adding": "Adding…",+ "ollama.added": "Ollama at this address is already added.",+ "ollama.download": "Download Ollama",+ "ollama.short.notRunning": "Not running",+ "ollama.short.noModels": "No models yet",+ "ollama.short.unreachable": "Can’t be reached","keys.integrations.title": "Integrations","keys.anthropic.label": "Anthropic API key","keys.anthropic.desc": "Adds “Claude (API key)” to the model picker, billed per token to your Anthropic console. Signed-in Claude bots keep their plan.",@@ -7619,6 +7637,7 @@"keys.purpose.opencodeGo": "OpenCode Zen and Go","keys.purpose.opencodeProviders": "Any other provider OpenCode supports","keys.purpose.lmStudio": "Models from the LM Studio app",+ "keys.purpose.ollama": "Models you run with Ollama, on this computer or your network","keys.purpose.openaiCompat": "Ollama, Together or any server that speaks the OpenAI API","keys.purpose.liveCalls": "Live calls use the same key as OpenAI's models","keys.purpose.liveKey": "Optional. Live calls use it instead of your OpenAI key",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex e8d5871ffc..13b5ce3c06 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -3683,6 +3683,24 @@"lmStudio.add": "Adicionar LM Studio","lmStudio.adding": "Adicionando…","lmStudio.added": "Este servidor já foi adicionado.",+ "ollama.title": "Ollama",+ "ollama.desc": "Rode modelos neste computador, ou em outro da sua rede, com o Ollama. Não precisa de chave.",+ "ollama.checking": "Procurando o Ollama…",+ "ollama.ready": "O Ollama está rodando em {url}. Modelos baixados: {count}.",+ "ollama.noModels": "O Ollama está rodando em {url}, mas ainda não tem modelos. Baixe um e verifique de novo:",+ "ollama.notRunning": "O Ollama não está rodando em {url}. Abra o app do Ollama ou inicie-o com:",+ "ollama.unreachable": "Não foi possível acessar o Ollama em {url}. Confira o endereço e se este computador consegue alcançá-lo.",+ "ollama.timeout": "O Ollama em {url} não respondeu a tempo. Confira se ele está rodando e acessível, depois verifique de novo.",+ "ollama.notOllama": "Algo responde em {url}, mas não é o Ollama. Confira o endereço.",+ "ollama.address": "Endereço do Ollama",+ "ollama.addressHint": "Deixe vazio para usar o Ollama deste computador ou informe o endereço de outro computador, como http://192.168.1.20:11434, e verifique de novo.",+ "ollama.add": "Adicionar Ollama",+ "ollama.adding": "Adicionando…",+ "ollama.added": "O Ollama neste endereço já foi adicionado.",+ "ollama.download": "Baixar o Ollama",+ "ollama.short.notRunning": "Não está rodando",+ "ollama.short.noModels": "Ainda sem modelos",+ "ollama.short.unreachable": "Fora de alcance","keys.integrations.title": "Integrações","keys.anthropic.label": "Chave de API da Anthropic","keys.anthropic.desc": "Adiciona “Claude (chave de API)” ao seletor de modelos, com cobrança por token no seu console da Anthropic. Bots do Claude com login mantêm o plano deles.",@@ -7544,6 +7562,7 @@"keys.purpose.opencodeGo": "OpenCode Zen e Go","keys.purpose.opencodeProviders": "Qualquer outro provedor aceito pelo OpenCode","keys.purpose.lmStudio": "Modelos do app LM Studio",+ "keys.purpose.ollama": "Modelos que você roda com o Ollama, neste computador ou na sua rede","keys.purpose.openaiCompat": "Ollama, Together ou qualquer servidor compatível com a API da OpenAI","keys.purpose.liveCalls": "Chamadas ao vivo usam a mesma chave dos modelos da OpenAI","keys.purpose.liveKey": "Opcional. As chamadas ao vivo usam esta chave em vez da chave da OpenAI",diff --git a/src/state/store.tsx b/src/state/store.tsxindex f87d109c74..76de658762 100644--- a/src/state/store.tsx+++ b/src/state/store.tsx@@ -475,7 +475,7 @@ export interface InstanceInfo extends InstanceEndpointInfo {version?: string | null;update?: { title: string; message: string; command: string };billing?: "metered" | "subscription";- warning?: { title: string; message: string };+ warning?: { title: string; message: string }; ollama?: import("../../shared/local-model").OllamaProblem;};/** What one tiny test message through this AI showed, for its current sign-in; absent until one is sent. */aiTest?: import("../../shared/ai-ranking").AiTestState;