import type { AiProvider } from './provider.interface';
import { AnthropicProvider } from './anthropic.provider';
import { OpenAIProvider } from './openai.provider';
import type { AiProviderConfig } from '@ftb/shared';

export function createProvider(config: AiProviderConfig): AiProvider {
  if (config.format === 'anthropic') {
    return new AnthropicProvider(config.apiKey, config.baseURL);
  }
  if (config.format === 'openai') {
    return new OpenAIProvider(config.apiKey, config.baseURL);
  }
  throw new Error(`未支持的 provider format: ${(config as any).format}`);
}
