From 5888a3eb0fd2cb0e6a2bdcf2942f3ae5f6346d4f Mon Sep 17 00:00:00 2001 From: Mr-Macharia Date: Fri, 11 Sep 2026 16:58:11 +0300 Subject: [PATCH] refactor(ai): import AIProvider instead of redeclaring it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `AIProvider` was declared twice: the canonical union in `src/store/types.ts` and an independent copy in `aiService.ts`. Neither imported the other, so adding a provider to one and not the other compiled cleanly and failed at runtime instead — `getEnvApiKey` would return undefined, or `resolveOpenAICompatibleBaseUrl` would throw `Unknown provider`. Import the canonical type and re-export it to keep the module surface unchanged. Verified by temporarily adding a fake provider to the union: tsc now reports errors across aiProviders.ts, aiSettings.ts and aiSettingsSchemas.ts, where previously aiService.ts stayed silent. --- src/services/aiService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/aiService.ts b/src/services/aiService.ts index 8ac11fa5..13b07fa2 100644 --- a/src/services/aiService.ts +++ b/src/services/aiService.ts @@ -13,8 +13,9 @@ import { parseClaudeStreamDelta, parseOpenAIStreamDelta, } from './aiServiceSchemas'; +import type { AIProvider } from '@/store/types'; -export type AIProvider = 'gemini' | 'openai' | 'claude' | 'groq' | 'nvidia' | 'cerebras' | 'mistral' | 'openrouter' | 'ollama' | 'custom'; +export type { AIProvider }; interface AiServiceError { code: