initial 2
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-06-26 09:26:50 +01:00
parent 194330fb47
commit 3b37368e7d
213 changed files with 14688 additions and 1 deletions

View File

@@ -0,0 +1,38 @@
import type { AIProvider, AIProviderType } from "./types";
import { createOllamaProvider } from "./providers/ollama";
import {
createOpenAICompatibleProvider,
createLlamaCppProvider,
} from "./providers/openai-compatible";
const providers: Record<AIProviderType, () => AIProvider> = {
ollama: createOllamaProvider,
openai_compatible: () => createOpenAICompatibleProvider("openai_compatible"),
llamacpp: createLlamaCppProvider,
};
export function getProvider(type: AIProviderType): AIProvider {
const factory = providers[type];
if (!factory) throw new Error(`Unknown provider: ${type}`);
return factory();
}
export function listProviderTypes(): {
type: AIProviderType;
name: string;
envVars: string[];
}[] {
return [
{ type: "ollama", name: "Ollama", envVars: [] },
{
type: "openai_compatible",
name: "OpenAI Compatible",
envVars: ["OPENAI_API_KEY"],
},
{
type: "llamacpp",
name: "llama.cpp Server",
envVars: ["LLAMACPP_API_KEY"],
},
];
}