Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

refactor: consolidated model registery

Gabriel Stein485410848c2b
diff --git a/CLAUDE.md b/CLAUDE.md
index 8a166d57f..612faabc9 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -151,7 +151,7 @@ Settings stored in localStorage with these keys:
- `geminiApiKey`: Encrypted API key
- `language`: Selected language code
- `agentName`: User's custom agent name
-- `reasoningModel`: Selected AI model for processing (defaults to gpt-4o-mini)
+- `reasoningModel`: Selected AI model for processing
- `reasoningProvider`: AI provider (openai/anthropic/gemini/local)
- `hotkey`: Custom hotkey configuration
- `hasCompletedOnboarding`: Onboarding completion flag
@@ -169,26 +169,47 @@ Settings stored in localStorage with these keys:
- Name stored in localStorage and database
- ReasoningService detects "Hey [AgentName]" patterns
- AI processes command and removes agent reference from output
-- Supports multiple AI providers:
- - **OpenAI** (Now using Responses API as of September 2025):
- - GPT-5 Series (Nano/Mini/Full) - Latest models with fastest performance
- - GPT-4.1 Series (Nano/Mini/Full) with 1M context window
- - o-series reasoning models (o3/o3-pro/o4-mini) for deep reasoning tasks
- - GPT-4o multimodal series (4o/4o-mini) - default model
- - Legacy support for GPT-4 Turbo, GPT-4 classic, GPT-3.5 Turbo
- - **Anthropic** (Via IPC bridge to avoid CORS):
- - Claude Opus 4.1 (claude-opus-4-1-20250805) - Frontier intelligence
- - Claude Sonnet 4 (claude-sonnet-4-20250514) - Latest balanced model
- - Claude 3.5 Sonnet (claude-3-5-sonnet-20241022) - Balanced performance
- - Claude 3.5 Haiku (claude-3-5-haiku-20241022) - Fast and efficient
+- Supports multiple AI providers (all models defined in `src/models/modelRegistryData.json`):
+ - **OpenAI** (Responses API):
+ - GPT-5.2 (`gpt-5.2`) - Latest flagship reasoning model
+ - GPT-5 Mini (`gpt-5-mini`) - Fast and cost-efficient
+ - GPT-5 Nano (`gpt-5-nano`) - Ultra-fast, low latency
+ - GPT-4.1 Series (`gpt-4.1`, `gpt-4.1-mini`, `gpt-4.1-nano`) - Strong baseline with 1M context
+ - **Anthropic** (Via IPC bridge to avoid CORS):
+ - Claude Sonnet 4.5 (`claude-sonnet-4-5`) - Balanced performance
+ - Claude Haiku 4.5 (`claude-haiku-4-5`) - Fast with near-frontier intelligence
+ - Claude Opus 4.5 (`claude-opus-4-5`) - Most capable Claude model
- **Google Gemini** (Direct API integration):
- - Gemini 2.5 Pro (gemini-2.5-pro) - Most intelligent with thinking capability
- - Gemini 2.5 Flash (gemini-2.5-flash) - High-performance with thinking
- - Gemini 2.5 Flash Lite (gemini-2.5-flash-lite) - Fast and low-cost
- - Gemini 2.0 Flash (gemini-2.0-flash) - 1M token context
- - **Local**: Community models via LocalReasoningService (Qwen, LLaMA, Mistral)
+ - Gemini 2.5 Pro (`gemini-2.5-pro`) - Most capable Gemini model
+ - Gemini 2.5 Flash (`gemini-2.5-flash`) - High-performance with thinking
+ - Gemini 2.5 Flash Lite (`gemini-2.5-flash-lite`) - Lowest latency and cost
+ - Gemini 2.0 Flash (`gemini-2.0-flash`) - Fast, long-context option
+ - **Local**: GGUF models via llama.cpp (Qwen, Llama, Mistral, GPT-OSS)
-### 8. API Integrations and Updates
+### 8. Model Registry Architecture
+
+All AI model definitions are centralized in `src/models/modelRegistryData.json` as the single source of truth:
+
+```json
+{
+ "cloudProviders": [...], // OpenAI, Anthropic, Gemini API models
+ "localProviders": [...] // GGUF models with download URLs
+}
+```
+
+**Key files:**
+- `src/models/modelRegistryData.json` - Single source of truth for all models
+- `src/models/ModelRegistry.ts` - TypeScript wrapper with helper methods
+- `src/config/aiProvidersConfig.ts` - Derives AI_MODES from registry
+- `src/utils/languages.ts` - Derives REASONING_PROVIDERS from registry
+- `src/helpers/modelManagerBridge.js` - Handles local model downloads
+
+**Local model features:**
+- Each model has `hfRepo` for direct HuggingFace download URLs
+- `promptTemplate` defines the chat format (ChatML, Llama, Mistral)
+- Download URLs constructed as: `{baseUrl}/{hfRepo}/resolve/main/{fileName}`
+
+### 9. API Integrations and Updates
**OpenAI Responses API (September 2025)**:
- Migrated from Chat Completions to new Responses API
@@ -201,7 +222,7 @@ Settings stored in localStorage with these keys:
**Anthropic Integration**:
- Routes through IPC handler to avoid CORS issues in renderer process
- Uses main process for API calls with proper error handling
-- Model names use hyphens (e.g., `claude-3-5-sonnet` not `claude-3.5-sonnet`)
+- Model IDs use alias format (e.g., `claude-sonnet-4-5` not date-suffixed versions)
**Gemini Integration**:
- Direct API calls from renderer process
diff --git a/src/components/AIModelSelectorEnhanced.tsx b/src/components/AIModelSelectorEnhanced.tsx
index abe8ec185..1461094b7 100644
--- a/src/components/AIModelSelectorEnhanced.tsx
+++ b/src/components/AIModelSelectorEnhanced.tsx
@@ -5,7 +5,7 @@ import { Cloud, Lock, Brain, Zap, Globe, Cpu, Download, Check, Wrench } from 'lu
import ApiKeyInput from './ui/ApiKeyInput';
import { UnifiedModelPickerCompact } from './UnifiedModelPicker';
import { API_ENDPOINTS, buildApiUrl, normalizeBaseUrl } from '../config/constants';
-import { REASONING_PROVIDERS } from '../utils/languages';
+import { REASONING_PROVIDERS } from '../models/ModelRegistry';
import { modelRegistry } from '../models/ModelRegistry';
type CloudModelOption = {
@@ -281,10 +281,11 @@ export default function AIModelSelectorEnhanced({
if (isMountedRef.current && latestReasoningBaseRef.current === normalizedBase) {
setCustomModelOptions(mappedModels);
if (
+ reasoningModel &&
mappedModels.length > 0 &&
!mappedModels.some((model) => model.value === reasoningModel)
) {
- setReasoningModel(mappedModels[0].value);
+ setReasoningModel("");
}
setCustomModelsError(null);
lastLoadedBaseRef.current = normalizedBase;
diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsx
index 144cb2e83..5cb136b97 100644
--- a/src/components/OnboardingFlow.tsx
+++ b/src/components/OnboardingFlow.tsx
@@ -33,7 +33,8 @@ import { usePython } from "../hooks/usePython";
import { usePermissions } from "../hooks/usePermissions";
import { useClipboard } from "../hooks/useClipboard";
import { useSettings } from "../hooks/useSettings";
-import { getLanguageLabel, REASONING_PROVIDERS } from "../utils/languages";
+import { getLanguageLabel } from "../utils/languages";
+import { REASONING_PROVIDERS } from "../models/ModelRegistry";
import LanguageSelector from "./ui/LanguageSelector";
import { UnifiedModelPickerCompact } from "./UnifiedModelPicker";
const InteractiveKeyboard = React.lazy(() => import("./ui/Keyboard"));
@@ -250,8 +251,11 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
if (mappedModels.length === 0) {
setCustomModelsError("No models returned by this endpoint.");
- } else if (!mappedModels.some((model) => model.value === reasoningModelRef.current)) {
- updateReasoningSettings({ reasoningModel: mappedModels[0].value });
+ } else if (
+ reasoningModelRef.current &&
+ !mappedModels.some((model) => model.value === reasoningModelRef.current)
+ ) {
+ updateReasoningSettings({ reasoningModel: "" });
}
} catch (error) {
if (isCancelled) {
@@ -279,8 +283,8 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
useEffect(() => {
if (!usingCustomReasoningBase && defaultReasoningModels.length > 0) {
- if (!defaultReasoningModels.some((model) => model.value === reasoningModel)) {
- updateReasoningSettings({ reasoningModel: defaultReasoningModels[0].value });
+ if (reasoningModel && !defaultReasoningModels.some((model) => model.value === reasoningModel)) {
+ updateReasoningSettings({ reasoningModel: "" });
}
}
}, [usingCustomReasoningBase, defaultReasoningModels, reasoningModel, updateReasoningSettings]);
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index fae2e8a46..5a51c9828 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -12,7 +12,7 @@ import { useAgentName } from "../utils/agentName";
import { useWhisper } from "../hooks/useWhisper";
import { usePermissions } from "../hooks/usePermissions";
import { useClipboard } from "../hooks/useClipboard";
-import { REASONING_PROVIDERS } from "../utils/languages";
+import { REASONING_PROVIDERS } from "../models/ModelRegistry";
import { formatHotkeyLabel } from "../utils/hotkeys";
import LanguageSelector from "./ui/LanguageSelector";
import PromptStudio from "./ui/PromptStudio";
diff --git a/src/components/ui/PromptStudio.tsx b/src/components/ui/PromptStudio.tsx
index 442fb0601..18a0112f5 100644
--- a/src/components/ui/PromptStudio.tsx
+++ b/src/components/ui/PromptStudio.tsx
@@ -100,13 +100,18 @@ export default function PromptStudio({ className = "" }: PromptStudioProps) {
try {
// Check if reasoning model is enabled and if we have the necessary settings
const useReasoningModel = localStorage.getItem("useReasoningModel") === "true";
- const reasoningModel = localStorage.getItem("reasoningModel") || "gpt-4o-mini";
+ const reasoningModel = localStorage.getItem("reasoningModel") || "";
const reasoningProvider = localStorage.getItem("reasoningProvider") || "openai";
if (!useReasoningModel) {
setTestResult("⚠️ AI text enhancement is disabled. Enable it in AI Models settings to test prompts.");
return;
}
+
+ if (!reasoningModel) {
+ setTestResult("⚠️ No reasoning model selected. Choose one in AI Models settings.");
+ return;
+ }
const providerConfig = PROVIDER_CONFIG[reasoningProvider] || {
label: reasoningProvider.charAt(0).toUpperCase() + reasoningProvider.slice(1),
@@ -305,7 +310,7 @@ export default function PromptStudio({ className = "" }: PromptStudioProps) {
const renderTestPlayground = () => {
const useReasoningModel = localStorage.getItem("useReasoningModel") === "true";
- const reasoningModel = localStorage.getItem("reasoningModel") || "gpt-4o-mini";
+ const reasoningModel = localStorage.getItem("reasoningModel") || "";
const reasoningProvider = localStorage.getItem("reasoningProvider") || "openai";
const providerConfig = PROVIDER_CONFIG[reasoningProvider] || {
label: reasoningProvider.charAt(0).toUpperCase() + reasoningProvider.slice(1),
@@ -462,4 +467,4 @@ export default function PromptStudio({ className = "" }: PromptStudioProps) {
{activeTab === "test" && renderTestPlayground()}
</div>
);
-}
\ No newline at end of file
+}
diff --git a/src/config/aiProvidersConfig.ts b/src/config/aiProvidersConfig.ts
deleted file mode 100644
index b513723ea..000000000
--- a/src/config/aiProvidersConfig.ts
+++ /dev/null
@@ -1,178 +0,0 @@
-export interface AIModel {
- value: string;
- label: string;
- description: string;
- size?: string;
-}
-
-export interface AIProvider {
- id: string;
- name: string;
- models: AIModel[];
-}
-
-export interface AIMode {
- id: 'cloud' | 'local';
- name: string;
- providers: AIProvider[];
-}
-
-export const AI_MODES: AIMode[] = [
- {
- id: 'cloud',
- name: 'Cloud AI',
- providers: [
- {
- id: 'openai',
- name: 'OpenAI',
- models: [
- {
- value: 'gpt-3.5-turbo',
- label: 'GPT-3.5 Turbo',
- description: 'Fast and efficient for most tasks'
- },
- {
- value: 'gpt-4o-mini',
- label: 'GPT-4o Mini',
- description: 'Higher quality reasoning'
- },
- {
- value: 'gpt-4-turbo-preview',
- label: 'GPT-4 Turbo',
- description: 'Most capable model'
- }
- ]
- },
- {
- id: 'anthropic',
- name: 'Anthropic',
- models: [
- {
- value: 'claude-3-haiku-20240307',
- label: 'Claude 3 Haiku',
- description: 'Fast and affordable'
- },
- {
- value: 'claude-3-sonnet-20240229',
- label: 'Claude 3 Sonnet',
- description: 'Balanced performance'
- },
- {
- value: 'claude-3-opus-20240229',
- label: 'Claude 3 Opus',
- description: 'Most capable Claude model'
- }
- ]
- }
- ]
- },
- {
- id: 'local',
- name: 'Local AI',
- providers: [
- {
- id: 'qwen',
- name: 'Qwen',
- models: [
- {
- value: 'qwen2.5-0.5b-instruct-q5_k_m',
- label: 'Qwen 2.5 0.5B',
- description: 'Smallest, fast but limited',
- size: '0.4GB'
- },
- {
- value: 'qwen2.5-1.5b-instruct-q5_k_m',
- label: 'Qwen 2.5 1.5B',
- description: 'Small, good for basic tasks',
- size: '1.3GB'
- },
- {
- value: 'qwen2.5-3b-instruct-q5_k_m',
- label: 'Qwen 2.5 3B',
- description: 'Balanced for general use',
- size: '2.3GB'
- },
- {
- value: 'qwen2.5-7b-instruct-q4km',
- label: 'Qwen 2.5 7B (Q4_K_M)',
- description: 'Large, high quality',
- size: '4.7GB'
- },
- {
- value: 'qwen2.5-7b-instruct-q5_k_m',
- label: 'Qwen 2.5 7B (Q5_K_M)',
- description: 'Large, highest quality',
- size: '5.4GB'
- }
- ]
- },
- {
- id: 'mistral',
- name: 'Mistral',
- models: [
- {
- value: 'mistral-7b-instruct-v0.2-q4_k_m',
- label: 'Mistral 7B v0.2',
- description: 'Popular open model',
- size: '4.1GB'
- },
- {
- value: 'mixtral-8x7b-instruct-v0.1-q3_k_m',
- label: 'Mixtral 8x7B',
- description: 'MoE architecture, very capable',
- size: '26.4GB'
- }
- ]
- },
- {
- id: 'llama',
- name: 'Meta Llama',
- models: [
- {
- value: 'llama-3.2-1b-instruct-q5_k_m',
- label: 'Llama 3.2 1B',
- description: 'Small and efficient',
- size: '1.0GB'
- },
- {
- value: 'llama-3.2-3b-instruct-q4_k_m',
- label: 'Llama 3.2 3B',
- description: 'Good balance',
- size: '2.0GB'
- },
- {
- value: 'llama-3.1-8b-instruct-q4_k_m',
- label: 'Llama 3.1 8B',
- description: 'Large, high quality',
- size: '4.7GB'
- }
- ]
- }
- ]
- }
-];
-
-export function getAIMode(modeId: 'cloud' | 'local'): AIMode | undefined {
- return AI_MODES.find(mode => mode.id === modeId);
-}
-
-export function getAIProvider(modeId: 'cloud' | 'local', providerId: string): AIProvider | undefined {
- const mode = getAIMode(modeId);
- return mode?.providers.find(provider => provider.id === providerId);
-}
-
-export function getAIModel(modeId: 'cloud' | 'local', providerId: string, modelId: string): AIModel | undefined {
- const provider = getAIProvider(modeId, providerId);
- return provider?.models.find(model => model.value === modelId);
-}
-
-export function detectModeFromModel(modelId: string): { mode: 'cloud' | 'local', providerId: string } | undefined {
- for (const mode of AI_MODES) {
- for (const provider of mode.providers) {
- if (provider.models.some(model => model.value === modelId)) {
- return { mode: mode.id, providerId: provider.id };
- }
- }
- }
- return undefined;
-}
\ No newline at end of file
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.js
index 0278367ee..09f649046 100644
--- a/src/helpers/audioManager.js
+++ b/src/helpers/audioManager.js
@@ -402,14 +402,21 @@ class AudioManager {
});
const reasoningModel = (typeof window !== 'undefined' && window.localStorage)
- ? (localStorage.getItem("reasoningModel") || "gpt-4o-mini")
- : "gpt-4o-mini";
+ ? (localStorage.getItem("reasoningModel") || "")
+ : "";
const reasoningProvider = (typeof window !== 'undefined' && window.localStorage)
? (localStorage.getItem("reasoningProvider") || "auto")
: "auto";
const agentName = (typeof window !== 'undefined' && window.localStorage)
? (localStorage.getItem("agentName") || null)
: null;
+ if (!reasoningModel) {
+ logger.logReasoning("REASONING_SKIPPED", {
+ reason: "No reasoning model selected"
+ });
+ return normalizedText;
+ }
+
const useReasoning = await this.isReasoningAvailable();
logger.logReasoning("REASONING_CHECK", {
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index b84f5ed37..b4a59f702 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -444,8 +444,12 @@ class IPCHandlers {
? `You are ${agentName}, a helpful AI assistant. Clean up the following dictated text by fixing grammar, punctuation, and formatting. Remove any reference to your name. Output ONLY the cleaned text without explanations or options:\n\n${text}`
: `Clean up the following dictated text by fixing grammar, punctuation, and formatting. Output ONLY the cleaned text without any explanations, options, or commentary:\n\n${text}`;
+ if (!modelId) {
+ throw new Error("No model specified for Anthropic API call");
+ }
+
const requestBody = {
- model: modelId || "claude-3-5-sonnet-20241022",
+ model: modelId,
messages: [{ role: "user", content: userPrompt }],
system: systemPrompt,
max_tokens: config?.maxTokens || Math.max(100, Math.min(text.length * 2, 4096)),
diff --git a/src/helpers/modelManagerBridge.js b/src/helpers/modelManagerBridge.js
index b13a07e30..4f53e5181 100644
--- a/src/helpers/modelManagerBridge.js
+++ b/src/helpers/modelManagerBridge.js
@@ -6,75 +6,10 @@ const https = require("https");
const { app } = require("electron");
// Import the model registry data directly
-let modelRegistryData;
-try {
- modelRegistryData = require("../models/modelRegistryData.json");
- console.log('[ModelManager] Loaded registry data successfully');
-} catch (error) {
- console.error('[ModelManager] Failed to load registry data:', error);
- // Fallback to inline data
- modelRegistryData = {
- providers: [
- {
- id: "qwen",
- name: "Qwen",
- baseUrl: "https://huggingface.co",
- models: [
- {
- id: "qwen2.5-0.5b-instruct-q5_k_m",
- name: "Qwen2.5 0.5B",
- size: "0.4GB",
- sizeBytes: 429496729,
- description: "Smallest model, fast but limited capabilities",
- fileName: "qwen2.5-0.5b-instruct-q5_k_m.gguf",
- quantization: "q5_k_m",
- contextLength: 32768
- },
- {
- id: "qwen2.5-1.5b-instruct-q5_k_m",
- name: "Qwen2.5 1.5B",
- size: "1.3GB",
- sizeBytes: 1395864371,
- description: "Small model, good for basic tasks",
- fileName: "qwen2.5-1.5b-instruct-q5_k_m.gguf",
- quantization: "q5_k_m",
- contextLength: 32768
- },
- {
- id: "qwen2.5-3b-instruct-q5_k_m",
- name: "Qwen2.5 3B",
- size: "2.3GB",
- sizeBytes: 2469606195,
- description: "Balanced model for general use",
- fileName: "qwen2.5-3b-instruct-q5_k_m.gguf",
- quantization: "q5_k_m",
- contextLength: 32768
- },
- {
- id: "qwen2.5-7b-instruct-q4km",
- name: "Qwen2.5 7B",
- size: "4.7GB",
- sizeBytes: 5046586241,
- description: "Large model with high quality (Q4_K_M quantization)",
- fileName: "qwen2.5-7b-instruct-q4_k_m.gguf",
- quantization: "q4_k_m",
- contextLength: 128000,
- recommended: true
- },
- {
- id: "qwen2.5-7b-instruct-q5_k_m",
- name: "Qwen2.5 7B",
- size: "5.4GB",
- sizeBytes: 5798205849,
- description: "Large model, high quality reasoning (Q5_K_M quantization)",
- fileName: "qwen2.5-7b-instruct-q5_k_m.gguf",
- quantization: "q5_k_m",
- contextLength: 128000
- }
- ]
- }
- ]
- };
+const modelRegistryData = require("../models/modelRegistryData.json");
+
+function getLocalProviders() {
+ return modelRegistryData.localProviders || [];
}
class ModelError extends Error {
@@ -118,11 +53,8 @@ class ModelManager {
try {
const models = [];
- console.log('[ModelManager] Getting all models from registry');
- console.log('[ModelManager] Registry data:', modelRegistryData);
-
// Get all models from registry
- for (const provider of modelRegistryData.providers) {
+ for (const provider of getLocalProviders()) {
for (const model of provider.models) {
const modelPath = path.join(this.modelsDir, model.fileName);
const isDownloaded = await this.checkFileExists(modelPath);
@@ -137,7 +69,6 @@ class ModelManager {
}
}
- console.log('[ModelManager] Found models:', models.length);
return models;
} catch (error) {
console.error('[ModelManager] Error getting all models:', error);
@@ -167,7 +98,7 @@ class ModelManager {
}
findModelById(modelId) {
- for (const provider of modelRegistryData.providers) {
+ for (const provider of getLocalProviders()) {
const model = provider.models.find(m => m.id === modelId);
if (model) {
return { model, provider };
@@ -221,12 +152,8 @@ class ModelManager {
}
getDownloadUrl(provider, model) {
- // Based on the provider type, construct the download URL
- if (provider.id === 'qwen') {
- return `https://huggingface.co/Qwen/Qwen2.5-${model.name.split(' ')[1]}-Instruct-GGUF/resolve/main/${model.fileName}`;
- }
- // Add more providers as needed
- throw new ModelError(`Unknown provider: ${provider.id}`, "UNKNOWN_PROVIDER");
+ const baseUrl = provider.baseUrl || "https://huggingface.co";
+ return `${baseUrl}/${model.hfRepo}/resolve/main/${model.fileName}`;
}
async downloadFile(url, destPath, onProgress) {
@@ -423,10 +350,12 @@ class ModelManager {
}
formatPrompt(provider, text, systemPrompt) {
- if (provider.id === 'qwen') {
- return `<|im_start|>system\n${systemPrompt}<|im_end|>\n<|im_start|>user\n${text}<|im_end|>\n<|im_start|>assistant\n`;
+ if (provider.promptTemplate) {
+ return provider.promptTemplate
+ .replace('{system}', systemPrompt)
+ .replace('{user}', text);
}
- // Add more providers as needed
+ // Fallback for providers without template
return `${systemPrompt}\n\n${text}`;
}
}
diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts
index 374501f5c..f7261245d 100644
--- a/src/hooks/useSettings.ts
+++ b/src/hooks/useSettings.ts
@@ -1,6 +1,6 @@
import { useCallback } from "react";
import { useLocalStorage } from "./useLocalStorage";
-import { getModelProvider } from "../utils/languages";
+import { getModelProvider } from "../models/ModelRegistry";
import { API_ENDPOINTS } from "../config/constants";
export interface TranscriptionSettings {
@@ -115,7 +115,7 @@ export function useSettings() {
const [reasoningModel, setReasoningModel] = useLocalStorage(
"reasoningModel",
- "gpt-4o-mini",
+ "",
{
serialize: String,
deserialize: String,
@@ -235,20 +235,9 @@ export function useSettings() {
setUseReasoningModel,
setReasoningModel,
setReasoningProvider: (provider: string) => {
- if (provider === 'custom') {
- return;
+ if (provider !== 'custom') {
+ setReasoningModel("");
}
-
- const providerModels = {
- openai: "gpt-4o-mini", // Start with cost-efficient multimodal model
- anthropic: "claude-3.5-sonnet-20241022",
- gemini: "gemini-2.5-flash",
- local: "llama-3.2-3b",
- };
- setReasoningModel(
- providerModels[provider as keyof typeof providerModels] ||
- "gpt-4o-mini"
- );
},
setOpenaiApiKey,
setAnthropicApiKey,
diff --git a/src/models/ModelRegistry.ts b/src/models/ModelRegistry.ts
index 089211c22..c34a87760 100644
--- a/src/models/ModelRegistry.ts
+++ b/src/models/ModelRegistry.ts
@@ -1,3 +1,6 @@
+import modelData from './modelRegistryData.json';
+
+// Types for local models (downloadable GGUF files)
export interface ModelDefinition {
id: string;
name: string;
@@ -7,9 +10,18 @@ export interface ModelDefinition {
fileName: string;
quantization: string;
contextLength: number;
+ hfRepo: string;
recommended?: boolean;
}
+export interface LocalProviderData {
+ id: string;
+ name: string;
+ baseUrl: string;
+ promptTemplate: string;
+ models: ModelDefinition[];
+}
+
export interface ModelProvider {
id: string;
name: string;
@@ -19,15 +31,23 @@ export interface ModelProvider {
getDownloadUrl(model: ModelDefinition): string;
}
-export interface InferenceOptions {
- maxTokens?: number;
- temperature?: number;
- topK?: number;
- topP?: number;
- repeatPenalty?: number;
- contextSize?: number;
- threads?: number;
- stream?: boolean;
+// Types for cloud models (API-based)
+export interface CloudModelDefinition {
+ id: string;
+ name: string;
+ description: string;
+}
+
+export interface CloudProviderData {
+ id: string;
+ name: string;
+ models: CloudModelDefinition[];
+}
+
+function createPromptFormatter(template: string): (text: string, systemPrompt: string) => string {
+ return (text: string, systemPrompt: string) => {
+ return template.replace('{system}', systemPrompt).replace('{user}', text);
+ };
}
class ModelRegistry {
@@ -35,7 +55,7 @@ class ModelRegistry {
private providers = new Map<string, ModelProvider>();
private constructor() {
- this.registerDefaultProviders();
+ this.registerProvidersFromData();
}
static getInstance(): ModelRegistry {
@@ -69,216 +89,112 @@ class ModelRegistry {
getAllModels(): Array<ModelDefinition & { providerId: string }> {
const models: Array<ModelDefinition & { providerId: string }> = [];
-
for (const provider of this.providers.values()) {
for (const model of provider.models) {
- models.push({
- ...model,
- providerId: provider.id
- });
+ models.push({ ...model, providerId: provider.id });
}
}
-
return models;
}
- private registerDefaultProviders() {
- // Qwen Provider
- this.registerProvider({
- id: 'qwen',
- name: 'Qwen',
- baseUrl: 'https://huggingface.co',
- models: [
- {
- id: 'qwen2.5-0.5b-instruct-q5_k_m',
- name: 'Qwen2.5 0.5B',
- size: '0.4GB',
- sizeBytes: 429496729,
- description: 'Smallest model, fast but limited capabilities',
- fileName: 'qwen2.5-0.5b-instruct-q5_k_m.gguf',
- quantization: 'q5_k_m',
- contextLength: 32768,
- },
- {
- id: 'qwen2.5-1.5b-instruct-q5_k_m',
- name: 'Qwen2.5 1.5B',
- size: '1.3GB',
- sizeBytes: 1395864371,
- description: 'Small model, good for basic tasks',
- fileName: 'qwen2.5-1.5b-instruct-q5_k_m.gguf',
- quantization: 'q5_k_m',
- contextLength: 32768,
- },
- {
- id: 'qwen2.5-3b-instruct-q5_k_m',
- name: 'Qwen2.5 3B',
- size: '2.3GB',
- sizeBytes: 2469606195,
- description: 'Balanced model for general use',
- fileName: 'qwen2.5-3b-instruct-q5_k_m.gguf',
- quantization: 'q5_k_m',
- contextLength: 32768,
- },
- {
- id: 'qwen2.5-7b-instruct-q5_k_m',
- name: 'Qwen2.5 7B',
- size: '5.4GB',
- sizeBytes: 5798205849,
- description: 'Large model, high quality reasoning',
- fileName: 'qwen2.5-7b-instruct-q5_k_m.gguf',
- quantization: 'q5_k_m',
- contextLength: 128000,
- recommended: true,
- },
- ],
- formatPrompt(text: string, systemPrompt: string): string {
- return `<|im_start|>system
-${systemPrompt}<|im_end|>
-<|im_start|>user
-${text}<|im_end|>
-<|im_start|>assistant
-`;
- },
- getDownloadUrl(model: ModelDefinition): string {
- return `${this.baseUrl}/Qwen/Qwen2.5-${model.name.split(' ')[1]}-Instruct-GGUF/resolve/main/${model.fileName}`;
- }
- });
-
- this.registerProvider({
- id: 'mistral',
- name: 'Mistral AI',
- baseUrl: 'https://huggingface.co',
- models: [
- {
- id: 'mistral-7b-instruct-v0.3-q4_k_m',
- name: 'Mistral 7B Instruct v0.3',
- size: '4.4GB',
- sizeBytes: 4724956928,
- description: 'Fast and efficient instruction model',
- fileName: 'Mistral-7B-Instruct-v0.3-Q4_K_M.gguf',
- quantization: 'q4_k_m',
- contextLength: 32768,
- recommended: true,
- },
- {
- id: 'mistral-7b-instruct-v0.3-q5_k_m',
- name: 'Mistral 7B Instruct v0.3 (Q5)',
- size: '5.1GB',
- sizeBytes: 5477387264,
- description: 'Higher quality instruction model',
- fileName: 'Mistral-7B-Instruct-v0.3-Q5_K_M.gguf',
- quantization: 'q5_k_m',
- contextLength: 32768,
- },
- {
- id: 'mistral-7b-v0.1-q4_k_m',
- name: 'Mistral 7B v0.1',
- size: '4.4GB',
- sizeBytes: 4724956928,
- description: 'Base model for general text',
- fileName: 'mistral-7b-v0.1.Q4_K_M.gguf',
- quantization: 'q4_k_m',
- contextLength: 32768,
- },
- ],
- formatPrompt(text: string, systemPrompt: string): string {
- return `[INST] ${systemPrompt}\n\n${text} [/INST]`;
- },
- getDownloadUrl(model: ModelDefinition): string {
- if (model.id.includes('v0.3')) {
- return `${this.baseUrl}/bartowski/Mistral-7B-Instruct-v0.3-GGUF/resolve/main/${model.fileName}`;
- }
- return `${this.baseUrl}/TheBloke/Mistral-7B-v0.1-GGUF/resolve/main/${model.fileName}`;
- }
- });
-
- // Llama Provider
- this.registerProvider({
- id: 'llama',
- name: 'Meta Llama',
- baseUrl: 'https://huggingface.co',
- models: [
- {
- id: 'llama-3.2-1b-instruct-q4_k_m',
- name: 'Llama 3.2 1B',
- size: '0.9GB',
- sizeBytes: 966367642,
- description: 'Tiny model for edge devices',
- fileName: 'Llama-3.2-1B-Instruct-Q4_K_M.gguf',
- quantization: 'q4_k_m',
- contextLength: 131072,
- },
- {
- id: 'llama-3.2-3b-instruct-q4_k_m',
- name: 'Llama 3.2 3B',
- size: '2.0GB',
- sizeBytes: 2147483648,
- description: 'Small but capable multilingual model',
- fileName: 'Llama-3.2-3B-Instruct-Q4_K_M.gguf',
- quantization: 'q4_k_m',
- contextLength: 131072,
- recommended: true,
- },
- {
- id: 'llama-3.1-8b-instruct-q4_k_m',
- name: 'Llama 3.1 8B',
- size: '4.9GB',
- sizeBytes: 5260091802,
- description: 'Powerful model with great performance',
- fileName: 'Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf',
- quantization: 'q4_k_m',
- contextLength: 131072,
- },
- ],
- formatPrompt(text: string, systemPrompt: string): string {
- return `<|begin_of_text|><|start_header_id|>system<|end_header_id|>
-
-${systemPrompt}<|eot_id|><|start_header_id|>user<|end_header_id|>
-
-${text}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
-
-`;
- },
- getDownloadUrl(model: ModelDefinition): string {
- if (model.id.includes('3.2')) {
- return `${this.baseUrl}/bartowski/Llama-3.2-${model.name.split(' ')[2]}-Instruct-GGUF/resolve/main/${model.fileName}`;
+ getCloudProviders(): CloudProviderData[] {
+ return modelData.cloudProviders as CloudProviderData[];
+ }
+
+ private registerProvidersFromData() {
+ const localProviders = modelData.localProviders as LocalProviderData[];
+
+ for (const providerData of localProviders) {
+ const formatPrompt = createPromptFormatter(providerData.promptTemplate);
+
+ this.registerProvider({
+ id: providerData.id,
+ name: providerData.name,
+ baseUrl: providerData.baseUrl,
+ models: providerData.models,
+ formatPrompt,
+ getDownloadUrl(model: ModelDefinition): string {
+ return `${providerData.baseUrl}/${model.hfRepo}/resolve/main/${model.fileName}`;
}
- return `${this.baseUrl}/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF/resolve/main/${model.fileName}`;
- }
- });
-
- // OpenAI OSS Provider
- this.registerProvider({
- id: 'openai-oss',
- name: 'OpenAI OSS',
- baseUrl: 'https://huggingface.co',
- models: [
- {
- id: 'gpt-oss-20b-q4_k_m',
- name: 'GPT-OSS 20B',
- size: '12.1GB',
- sizeBytes: 12999763968,
- description: 'OpenAI\'s open-source model for consumer hardware',
- fileName: 'openai_gpt-oss-20b-Q4_K_M.gguf',
- quantization: 'q4_k_m',
- contextLength: 128000,
- recommended: true,
- },
- ],
- formatPrompt(text: string, systemPrompt: string): string {
- // GPT-OSS uses ChatML format
- return `<|im_start|>system
-${systemPrompt}<|im_end|>
-<|im_start|>user
-${text}<|im_end|>
-<|im_start|>assistant
-`;
- },
- getDownloadUrl(model: ModelDefinition): string {
- return `${this.baseUrl}/bartowski/openai_gpt-oss-20b-GGUF/resolve/main/${model.fileName}`;
- }
- });
+ });
+ }
}
}
-export const modelRegistry = ModelRegistry.getInstance();
\ No newline at end of file
+export const modelRegistry = ModelRegistry.getInstance();
+
+// Reasoning providers (flat structure for UI dropdowns)
+export interface ReasoningModel {
+ value: string;
+ label: string;
+ description: string;
+}
+
+export interface ReasoningProvider {
+ name: string;
+ models: ReasoningModel[];
+}
+
+export type ReasoningProviders = Record<string, ReasoningProvider>;
+
+function buildReasoningProviders(): ReasoningProviders {
+ const providers: ReasoningProviders = {};
+
+ for (const cloudProvider of modelRegistry.getCloudProviders()) {
+ providers[cloudProvider.id] = {
+ name: cloudProvider.name,
+ models: cloudProvider.models.map(m => ({
+ value: m.id,
+ label: m.name,
+ description: m.description,
+ })),
+ };
+ }
+
+ providers.local = {
+ name: "Local AI",
+ models: modelRegistry.getAllModels().map(model => ({
+ value: model.id,
+ label: model.name,
+ description: `${model.description} (${model.size})`,
+ })),
+ };
+
+ return providers;
+}
+
+export const REASONING_PROVIDERS = buildReasoningProviders();
+
+export interface ReasoningModelWithProvider extends ReasoningModel {
+ provider: string;
+ fullLabel: string;
+}
+
+export function getAllReasoningModels(): ReasoningModelWithProvider[] {
+ return Object.entries(REASONING_PROVIDERS).flatMap(([providerId, provider]) =>
+ provider.models.map((model) => ({
+ ...model,
+ provider: providerId,
+ fullLabel: `${provider.name} ${model.label}`,
+ }))
+ );
+}
+
+export function getReasoningModelLabel(modelId: string): string {
+ const model = getAllReasoningModels().find((m) => m.value === modelId);
+ return model?.fullLabel || modelId;
+}
+
+export function getModelProvider(modelId: string): string {
+ const model = getAllReasoningModels().find((m) => m.value === modelId);
+
+ if (!model) {
+ // Infer provider from model name pattern
+ if (modelId.includes("claude")) return "anthropic";
+ if (modelId.includes("gemini")) return "gemini";
+ if (modelId.includes("gpt-4") || modelId.includes("gpt-5")) return "openai";
+ if (modelId.includes("qwen") || modelId.includes("llama") || modelId.includes("mistral")) return "local";
+ }
+
+ return model?.provider || "openai";
+}
diff --git a/src/models/modelRegistryData.json b/src/models/modelRegistryData.json
index 544032de5..54e8a85c2 100644
--- a/src/models/modelRegistryData.json
+++ b/src/models/modelRegistryData.json
@@ -1,9 +1,95 @@
{
- "providers": [
+ "cloudProviders": [
+ {
+ "id": "openai",
+ "name": "OpenAI",
+ "models": [
+ {
+ "id": "gpt-5.2",
+ "name": "GPT-5.2",
+ "description": "Latest flagship reasoning model"
+ },
+ {
+ "id": "gpt-5-mini",
+ "name": "GPT-5 Mini",
+ "description": "Fast and cost-efficient"
+ },
+ {
+ "id": "gpt-5-nano",
+ "name": "GPT-5 Nano",
+ "description": "Ultra-fast, low latency"
+ },
+ {
+ "id": "gpt-4.1",
+ "name": "GPT-4.1",
+ "description": "Strong baseline, 1M context"
+ },
+ {
+ "id": "gpt-4.1-mini",
+ "name": "GPT-4.1 Mini",
+ "description": "Smaller GPT-4.1 model"
+ },
+ {
+ "id": "gpt-4.1-nano",
+ "name": "GPT-4.1 Nano",
+ "description": "Lowest latency GPT-4.1"
+ }
+ ]
+ },
+ {
+ "id": "anthropic",
+ "name": "Anthropic",
+ "models": [
+ {
+ "id": "claude-sonnet-4-5",
+ "name": "Claude Sonnet 4.5",
+ "description": "Balanced performance"
+ },
+ {
+ "id": "claude-haiku-4-5",
+ "name": "Claude Haiku 4.5",
+ "description": "Fast with near-frontier intelligence"
+ },
+ {
+ "id": "claude-opus-4-5",
+ "name": "Claude Opus 4.5",
+ "description": "Most capable Claude model"
+ }
+ ]
+ },
+ {
+ "id": "gemini",
+ "name": "Google Gemini",
+ "models": [
+ {
+ "id": "gemini-2.5-pro",
+ "name": "Gemini 2.5 Pro",
+ "description": "Most capable Gemini model"
+ },
+ {
+ "id": "gemini-2.5-flash",
+ "name": "Gemini 2.5 Flash",
+ "description": "High-performance with thinking"
+ },
+ {
+ "id": "gemini-2.5-flash-lite",
+ "name": "Gemini 2.5 Flash Lite",
+ "description": "Lowest latency and cost"
+ },
+ {
+ "id": "gemini-2.0-flash",
+ "name": "Gemini 2.0 Flash",
+ "description": "Fast, long-context option"
+ }
+ ]
+ }
+ ],
+ "localProviders": [
{
"id": "qwen",
"name": "Qwen",
"baseUrl": "https://huggingface.co",
+ "promptTemplate": "<|im_start|>system\n{system}<|im_end|>\n<|im_start|>user\n{user}<|im_end|>\n<|im_start|>assistant\n",
"models": [
{
"id": "qwen2.5-0.5b-instruct-q5_k_m",
@@ -13,7 +99,8 @@
"description": "Smallest model, fast but limited capabilities",
"fileName": "qwen2.5-0.5b-instruct-q5_k_m.gguf",
"quantization": "q5_k_m",
- "contextLength": 32768
+ "contextLength": 32768,
+ "hfRepo": "Qwen/Qwen2.5-0.5B-Instruct-GGUF"
},
{
"id": "qwen2.5-1.5b-instruct-q5_k_m",
@@ -23,7 +110,8 @@
"description": "Small model, good for basic tasks",
"fileName": "qwen2.5-1.5b-instruct-q5_k_m.gguf",
"quantization": "q5_k_m",
- "contextLength": 32768
+ "contextLength": 32768,
+ "hfRepo": "Qwen/Qwen2.5-1.5B-Instruct-GGUF"
},
{
"id": "qwen2.5-3b-instruct-q5_k_m",
@@ -33,30 +121,126 @@
"description": "Balanced model for general use",
"fileName": "qwen2.5-3b-instruct-q5_k_m.gguf",
"quantization": "q5_k_m",
- "contextLength": 32768
+ "contextLength": 32768,
+ "hfRepo": "Qwen/Qwen2.5-3B-Instruct-GGUF"
},
{
- "id": "qwen2.5-7b-instruct-q4km",
+ "id": "qwen2.5-7b-instruct-q4_k_m",
"name": "Qwen2.5 7B",
"size": "4.7GB",
"sizeBytes": 5046586241,
- "description": "Large model with high quality (Q4_K_M quantization)",
+ "description": "Large model with high quality (Q4_K_M)",
"fileName": "qwen2.5-7b-instruct-q4_k_m.gguf",
"quantization": "q4_k_m",
"contextLength": 128000,
+ "hfRepo": "Qwen/Qwen2.5-7B-Instruct-GGUF",
"recommended": true
},
{
"id": "qwen2.5-7b-instruct-q5_k_m",
- "name": "Qwen2.5 7B",
- "size": "5.4GB",
+ "name": "Qwen2.5 7B (Q5)",
+ "size": "5.4GB",
"sizeBytes": 5798205849,
- "description": "Large model, high quality reasoning (Q5_K_M quantization)",
+ "description": "Large model, high quality reasoning (Q5_K_M)",
"fileName": "qwen2.5-7b-instruct-q5_k_m.gguf",
"quantization": "q5_k_m",
- "contextLength": 128000
+ "contextLength": 128000,
+ "hfRepo": "Qwen/Qwen2.5-7B-Instruct-GGUF"
+ }
+ ]
+ },
+ {
+ "id": "mistral",
+ "name": "Mistral AI",
+ "baseUrl": "https://huggingface.co",
+ "promptTemplate": "[INST] {system}\n\n{user} [/INST]",
+ "models": [
+ {
+ "id": "mistral-7b-instruct-v0.3-q4_k_m",
+ "name": "Mistral 7B Instruct v0.3",
+ "size": "4.4GB",
+ "sizeBytes": 4724956928,
+ "description": "Fast and efficient instruction model",
+ "fileName": "Mistral-7B-Instruct-v0.3-Q4_K_M.gguf",
+ "quantization": "q4_k_m",
+ "contextLength": 32768,
+ "hfRepo": "bartowski/Mistral-7B-Instruct-v0.3-GGUF",
+ "recommended": true
+ },
+ {
+ "id": "mistral-7b-instruct-v0.3-q5_k_m",
+ "name": "Mistral 7B Instruct v0.3 (Q5)",
+ "size": "5.1GB",
+ "sizeBytes": 5477387264,
+ "description": "Higher quality instruction model",
+ "fileName": "Mistral-7B-Instruct-v0.3-Q5_K_M.gguf",
+ "quantization": "q5_k_m",
+ "contextLength": 32768,
+ "hfRepo": "bartowski/Mistral-7B-Instruct-v0.3-GGUF"
+ }
+ ]
+ },
+ {
+ "id": "llama",
+ "name": "Meta Llama",
+ "baseUrl": "https://huggingface.co",
+ "promptTemplate": "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\n{system}<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n{user}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",
+ "models": [
+ {
+ "id": "llama-3.2-1b-instruct-q4_k_m",
+ "name": "Llama 3.2 1B",
+ "size": "0.9GB",
+ "sizeBytes": 966367642,
+ "description": "Tiny model for edge devices",
+ "fileName": "Llama-3.2-1B-Instruct-Q4_K_M.gguf",
+ "quantization": "q4_k_m",
+ "contextLength": 131072,
+ "hfRepo": "bartowski/Llama-3.2-1B-Instruct-GGUF"
+ },
+ {
+ "id": "llama-3.2-3b-instruct-q4_k_m",
+ "name": "Llama 3.2 3B",
+ "size": "2.0GB",
+ "sizeBytes": 2147483648,
+ "description": "Small but capable multilingual model",
+ "fileName": "Llama-3.2-3B-Instruct-Q4_K_M.gguf",
+ "quantization": "q4_k_m",
+ "contextLength": 131072,
+ "hfRepo": "bartowski/Llama-3.2-3B-Instruct-GGUF",
+ "recommended": true
+ },
+ {
+ "id": "llama-3.1-8b-instruct-q4_k_m",
+ "name": "Llama 3.1 8B",
+ "size": "4.9GB",
+ "sizeBytes": 5260091802,
+ "description": "Powerful model with great performance",
+ "fileName": "Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf",
+ "quantization": "q4_k_m",
+ "contextLength": 131072,
+ "hfRepo": "bartowski/Meta-Llama-3.1-8B-Instruct-GGUF"
+ }
+ ]
+ },
+ {
+ "id": "openai-oss",
+ "name": "OpenAI OSS",
+ "baseUrl": "https://huggingface.co",
+ "promptTemplate": "<|im_start|>system\n{system}<|im_end|>\n<|im_start|>user\n{user}<|im_end|>\n<|im_start|>assistant\n",
+ "models": [
+ {
+ "id": "gpt-oss-20b-mxfp4",
+ "name": "GPT-OSS 20B",
+ "size": "12.1GB",
+ "sizeBytes": 12999763968,
+ "description": "OpenAI's open-weight model for consumer hardware",
+ "fileName": "gpt-oss-20b-mxfp4.gguf",
+ "quantization": "mxfp4",
+ "contextLength": 128000,
+ "hfRepo": "ggml-org/gpt-oss-20b-GGUF",
+ "recommended": true
}
]
}
]
-}
\ No newline at end of file
+}
diff --git a/src/services/ReasoningService.ts b/src/services/ReasoningService.ts
index a89c2ec66..eb742d7e4 100644
--- a/src/services/ReasoningService.ts
+++ b/src/services/ReasoningService.ts
@@ -1,4 +1,4 @@
-import { getModelProvider } from "../utils/languages";
+import { getModelProvider } from "../models/ModelRegistry";
import { BaseReasoningService, ReasoningConfig } from "./BaseReasoningService";
import { SecureCache } from "../utils/SecureCache";
import { withRetry, createApiRetryStrategy } from "../utils/retry";
@@ -178,14 +178,18 @@ class ReasoningService extends BaseReasoningService {
async processText(
text: string,
- model: string = "gpt-4o-mini",
+ model: string = "",
agentName: string | null = null,
config: ReasoningConfig = {}
): Promise<string> {
- const provider = getModelProvider(model);
+ const trimmedModel = model?.trim?.() || "";
+ if (!trimmedModel) {
+ throw new Error("No reasoning model selected");
+ }
+ const provider = getModelProvider(trimmedModel);
logger.logReasoning("PROVIDER_SELECTION", {
- model,
+ model: trimmedModel,
provider,
agentName,
hasConfig: Object.keys(config).length > 0,
@@ -204,16 +208,16 @@ class ReasoningService extends BaseReasoningService {
switch (provider) {
case "openai":
- result = await this.processWithOpenAI(text, model, agentName, config);
+ result = await this.processWithOpenAI(text, trimmedModel, agentName, config);
break;
case "anthropic":
- result = await this.processWithAnthropic(text, model, agentName, config);
+ result = await this.processWithAnthropic(text, trimmedModel, agentName, config);
break;
case "local":
- result = await this.processWithLocal(text, model, agentName, config);
+ result = await this.processWithLocal(text, trimmedModel, agentName, config);
break;
case "gemini":
- result = await this.processWithGemini(text, model, agentName, config);
+ result = await this.processWithGemini(text, trimmedModel, agentName, config);
break;
default:
throw new Error(`Unsupported reasoning provider: ${provider}`);
@@ -279,7 +283,7 @@ class ReasoningService extends BaseReasoningService {
// Build request body for Responses API
const requestBody: any = {
- model: model || "gpt-4o-mini",
+ model,
input,
messages: input, // include both for Responses and Chat Completions compatibility
store: false, // Don't store responses for privacy
diff --git a/src/utils/languages.ts b/src/utils/languages.ts
index 86ba72500..bbcf6b8de 100644
--- a/src/utils/languages.ts
+++ b/src/utils/languages.ts
@@ -1,5 +1,3 @@
-import { modelRegistry } from "../models/ModelRegistry";
-
export const LANGUAGE_OPTIONS = [
{ value: "auto", label: "Auto-detect" },
{ value: "af", label: "Afrikaans" },
@@ -65,164 +63,3 @@ export const getLanguageLabel = (code: string): string => {
const option = LANGUAGE_OPTIONS.find((lang) => lang.value === code);
return option?.label || code;
};
-
-// Reasoning model configuration with provider abstraction
-export const REASONING_PROVIDERS = {
- openai: {
- name: "OpenAI",
- models: [
- // GPT-5 Series (Latest)
- {
- value: "gpt-5-nano",
- label: "GPT-5 Nano",
- description: "Ultra-fast, low latency",
- },
- {
- value: "gpt-5-mini",
- label: "GPT-5 Mini",
- description: "Fast and cost-efficient (default)",
- },
- {
- value: "gpt-5",
- label: "GPT-5",
- description: "Deep reasoning, multi-step logic",
- },
- // GPT-4.1 Series
- {
- value: "gpt-4.1-nano",
- label: "GPT-4.1 Nano",
- description: "Fastest, cheapest for low latency",
- },
- {
- value: "gpt-4.1-mini",
- label: "GPT-4.1 Mini",
- description: "Improved coding, 1M context",
- },
- {
- value: "gpt-4.1",
- label: "GPT-4.1",
- description: "Best GPT-4, June 2024 knowledge",
- },
- // o-series Reasoning Models
- {
- value: "o4-mini",
- label: "o4 Mini",
- description: "Fast reasoning, math & coding",
- },
- {
- value: "o3",
- label: "o3",
- description: "Advanced reasoning, longer thinking",
- },
- {
- value: "o3-pro",
- label: "o3 Pro",
- description: "Most intelligent, deepest reasoning",
- },
- // GPT-4o Series
- {
- value: "gpt-4o-mini",
- label: "GPT-4o Mini",
- description: "Multimodal, balanced performance",
- },
- {
- value: "gpt-4o",
- label: "GPT-4o",
- description: "Multimodal with vision support",
- }
- ],
- },
- anthropic: {
- name: "Anthropic",
- models: [
- {
- value: "claude-3-5-haiku-20241022",
- label: "Claude 3.5 Haiku",
- description: "Fast and efficient",
- },
- {
- value: "claude-3-5-sonnet-20241022",
- label: "Claude 3.5 Sonnet",
- description: "Balanced performance",
- },
- {
- value: "claude-sonnet-4-20250514",
- label: "Claude Sonnet 4",
- description: "Latest balanced model",
- },
- {
- value: "claude-opus-4-1-20250805",
- label: "Claude Opus 4.1",
- description: "Frontier intelligence",
- },
- ],
- },
- gemini: {
- name: "Google Gemini",
- models: [
- {
- value: "gemini-2.5-flash-lite",
- label: "Gemini 2.5 Flash Lite",
- description: "Fast and low-cost",
- },
- {
- value: "gemini-2.5-flash",
- label: "Gemini 2.5 Flash",
- description: "High-performance with thinking",
- },
- {
- value: "gemini-2.5-pro",
- label: "Gemini 2.5 Pro",
- description: "Most intelligent with thinking",
- },
- {
- value: "gemini-2.0-flash",
- label: "Gemini 2.0 Flash",
- description: "1M token context",
- },
- ],
- },
- local: {
- name: "Local AI",
- models: [], // Will be populated dynamically
- },
-};
-
-// Dynamically populate local models from registry
-const localModels = modelRegistry.getAllModels();
-REASONING_PROVIDERS.local.models = localModels.map(model => ({
- value: model.id,
- label: model.name,
- description: `${model.description} (${model.size})`,
-}));
-
-export const getAllReasoningModels = () => {
- return Object.entries(REASONING_PROVIDERS).flatMap(([providerId, provider]) =>
- provider.models.map((model) => ({
- ...model,
- provider: providerId,
- fullLabel: `${provider.name} ${model.label}`,
- }))
- );
-};
-
-export const getReasoningModelLabel = (modelId: string): string => {
- const allModels = getAllReasoningModels();
- const model = allModels.find((m) => m.value === modelId);
- return model?.fullLabel || modelId;
-};
-
-export const getModelProvider = (modelId: string): string => {
- const allModels = getAllReasoningModels();
- const model = allModels.find((m) => m.value === modelId);
-
- // If model not found, try to infer from model name
- if (!model) {
- if (modelId.includes("claude")) return "anthropic";
- if (modelId.includes("gemini")) return "gemini";
- if (modelId.includes("gpt") || modelId.includes("o3") || modelId.includes("o4") || modelId.includes("o1")) return "openai";
- if (modelId.includes("qwen") || modelId.includes("llama") || modelId.includes("mistral")) return "local";
- }
-
- return model?.provider || "openai";
-};
\ No newline at end of file