Skip to content

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

Merge #5112: Let a person turn an Ollama model's thinking off, or pick its level

milind-soni92aa4c19afbd
diff --cc server/drivers/openai-chat.ts
index 4f3a2b174a,b26493700a..0e729e1e88
--- a/server/drivers/openai-chat.ts
+++ b/server/drivers/openai-chat.ts
@@@ -93,10 -93,8 +93,10 @@@ interface RuntimeOptions<Config>
apiKey: string;
apiUrl: string;
models: () => ModelCatalog;
- requestBody(model: string, messages: OpenAIChatMessage[], stream: boolean): Record<string, unknown>;
+ requestBody(model: string, messages: OpenAIChatMessage[], stream: boolean, variant?: string): Record<string, unknown>;
httpErrorLabel: string;
+ /** A refusal this provider words itself: the sentence the person sees instead of the HTTP line, or undefined. */
+ plainRefusal?: (status: number, body: string) => string | undefined;
missingKeyError: string;
unavailableReason: string;
timeoutMs: number;
diff --cc server/drivers/openai-compat.ts
index b38565ecd8,e8e5168f76..8315d803fe
--- a/server/drivers/openai-compat.ts
+++ b/server/drivers/openai-compat.ts
@@@ -1,11 -1,10 +1,11 @@@
// Transcript-replay driver for OpenRouter, Groq, Together, llama.cpp, and
// other endpoints that speak the OpenAI chat-completions contract.
- import type { ModelCatalog, ProviderDriver } from "../contracts.ts";
+ import { titleCaseModelId, type ModelCatalog, type ProviderDriver } from "../contracts.ts";
+import { operatorEnvKey } from "../credential-env.ts";
import { isLoopback } from "../provider-key-check.ts";
import { lmStudioV1Catalog } from "./local-inject.ts";
- import { isContextName, isOllama, serveWithWindow } from "./ollama-context.ts";
- import { isOllamaServer, OLLAMA_PLACEHOLDER_KEY, ollamaOrigin, ollamaUnavailable, onOllamaPort, probeOllama, type OllamaModel, type OllamaStatus } from "./ollama.ts";
+ import { isContextName, isOllama, pickedName, serveWithWindow } from "./ollama-context.ts";
+ import { isOllamaServer, OLLAMA_PLACEHOLDER_KEY, ollamaOrigin, ollamaUnavailable, onOllamaPort, probeOllama, thinkingEffort, type OllamaModel, type OllamaStatus } from "./ollama.ts";
import { createOpenAIChatRuntime } from "./openai-chat.ts";
import {
freeDefault, freeFallbackCatalog, freeLabel, freeToolModels, freeToolsFirst, isOpenRouterOrigin, openRouterFreeTier,