Initial commit: deardiary project setup

This commit is contained in:
lotherk
2026-03-26 19:57:20 +00:00
commit 3f9bc1f484
73 changed files with 8627 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
export interface AIProvider {
provider: 'openai' | 'anthropic' | 'ollama' | 'lmstudio';
generate(prompt: string, systemPrompt?: string): Promise<string>;
validate?(): Promise<boolean>;
}
export interface AIProviderConfig {
provider: 'openai' | 'anthropic' | 'ollama' | 'lmstudio';
apiKey: string;
model?: string;
baseUrl?: string;
}
import { OpenAIProvider } from './openai';
import { AnthropicProvider } from './anthropic';
import { OllamaProvider } from './ollama';
import { LMStudioProvider } from './lmstudio';
export function createAIProvider(config: AIProviderConfig): AIProvider {
switch (config.provider) {
case 'openai':
return new OpenAIProvider(config);
case 'anthropic':
return new AnthropicProvider(config);
case 'ollama':
return new OllamaProvider(config);
case 'lmstudio':
return new LMStudioProvider(config);
default:
throw new Error(`Unknown AI provider: ${config.provider}`);
}
}