Start Study Desk V2: remove V1 sources, add backend foundation
V1 remains intact on main and in history. This branch replaces it with a new application: node:sqlite storage with migrations, scrypt auth and sessions, content/SRS/attempt/stats services, document extraction and chunking, a provider-neutral AI layer (OpenAI, Anthropic, Gemini, OpenAI-compatible, Ollama), the generation pipeline and the tool-using assistant. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
7bd0a9aad4
commit
3e74ecd843
268 changed files with 17740 additions and 55423 deletions
26
server/ai/providers/index.ts
Normal file
26
server/ai/providers/index.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { AIError, type ProviderAdapter, type ProviderKind } from '../types.ts';
|
||||
import { anthropicAdapter } from './anthropic.ts';
|
||||
import { geminiAdapter } from './gemini.ts';
|
||||
import { ollamaAdapter } from './ollama.ts';
|
||||
import { openaiAdapter } from './openai.ts';
|
||||
import { openaiCompatibleAdapter } from './openaiCompatible.ts';
|
||||
|
||||
const ADAPTERS: Record<ProviderKind, ProviderAdapter> = {
|
||||
openai: openaiAdapter,
|
||||
anthropic: anthropicAdapter,
|
||||
gemini: geminiAdapter,
|
||||
openai_compatible: openaiCompatibleAdapter,
|
||||
ollama: ollamaAdapter,
|
||||
};
|
||||
|
||||
export function getAdapter(kind: ProviderKind): ProviderAdapter {
|
||||
const adapter = ADAPTERS[kind];
|
||||
if (!adapter) throw new AIError('unsupported', `Unknown provider type "${kind}".`);
|
||||
return adapter;
|
||||
}
|
||||
|
||||
export function listAdapterMeta(): Array<{ kind: ProviderKind } & ProviderAdapter['meta']> {
|
||||
return (Object.keys(ADAPTERS) as ProviderKind[]).map((kind) => ({ kind, ...ADAPTERS[kind].meta }));
|
||||
}
|
||||
|
||||
export { CATALOG_UPDATED, lookupModelDefaults } from './catalog.ts';
|
||||
Loading…
Add table
Add a link
Reference in a new issue