edtech / apps /api /src /services /ai /index.ts
CognxSafeTrack
Claude Sonnet 4.6
refactor(debt): resolve all 10 technical debt items from audit
a966957
Raw History Blame Contribute Delete
798 Bytes
import { AIService as BaseAIService } from '@repo/ai-sdk';
import { prisma } from '../prisma';
import { redis } from '../../lib/redis';
import { getTenantSecrets } from '../organization';
import { getOrganizationId } from '@repo/database';
/**
* API-specific instantiation of the AI Service.
* Binds the core AI logic to the API's database, cache, and organization context.
*/
export const aiService = new BaseAIService({
prisma,
redis: {
get: (key: string) => redis.get(key),
set: (key: string, value: string, _mode?: string, duration?: number) =>
duration ? redis.set(key, value, 'EX', duration) : redis.set(key, value)
},
getTenantSecrets,
getOrganizationId
});
// Re-export types and other components if needed
export * from '@repo/ai-sdk';