6 Commits

Author SHA1 Message Date
Anton
16b5af3365 feat: export LlmService interface
Made-with: Cursor
2026-03-04 14:39:04 +03:00
Anton
39721e37ff feat: log LLM metadata to question_cache_meta
Made-with: Cursor
2026-03-04 14:38:44 +03:00
Anton
0baeb1104a feat: add LLM retry and fallback
Made-with: Cursor
2026-03-04 14:37:18 +03:00
Anton
04ad02be5e feat: add LLM question generation
Made-with: Cursor
2026-03-04 14:36:50 +03:00
Anton
0172b4518d feat: add LlmService base
Made-with: Cursor
2026-03-04 14:17:15 +03:00
Anton
f7e865721a feat: add stats to profile response
Made-with: Cursor
2026-03-04 14:16:59 +03:00
3 changed files with 15 additions and 3 deletions

View File

@@ -7,7 +7,6 @@ import rateLimitPlugin from './plugins/rateLimit.js';
import authPlugin from './plugins/auth.js';
import subscriptionPlugin from './plugins/subscription.js';
import { authRoutes } from './routes/auth.js';
import { profileRoutes } from './routes/profile.js';
import { env } from './config/env.js';
import { randomUUID } from 'node:crypto';
@@ -76,7 +75,6 @@ export async function buildApp(): Promise<FastifyInstance> {
await app.register(authPlugin);
await app.register(subscriptionPlugin);
await app.register(authRoutes, { prefix: '/auth' });
await app.register(profileRoutes, { prefix: '/profile' });
app.get('/health', async () => ({ status: 'ok', timestamp: new Date().toISOString() }));

View File

@@ -0,0 +1,9 @@
export {
LlmService,
type ILlmService,
type LlmConfig,
type LlmGenerationMeta,
type GenerateQuestionsInput,
type GenerateQuestionsResult,
type GeneratedQuestion,
} from './llm.service.js';

View File

@@ -71,7 +71,12 @@ export interface GenerateQuestionsResult {
meta: LlmGenerationMeta;
}
export class LlmService {
/** Interface for QuestionService dependency injection and testing */
export interface ILlmService {
generateQuestions(input: GenerateQuestionsInput): Promise<GenerateQuestionsResult>;
}
export class LlmService implements ILlmService {
private readonly config: LlmConfig;
constructor(config?: Partial<LlmConfig>) {