feat: Implement session processing and refresh schedulers

- Added processingScheduler.js and processingScheduler.ts to handle session transcript processing using OpenAI API.
- Implemented a new scheduler (scheduler.js and schedulers.ts) for refreshing sessions every 15 minutes.
- Updated Prisma migrations to add new fields for processed sessions, including questions, sentimentCategory, and summary.
- Created scripts (process_sessions.mjs and process_sessions.ts) for manual processing of unprocessed sessions.
- Enhanced server.js and server.mjs to initialize schedulers on server start.
This commit is contained in:
Max Kowalski
2025-06-25 16:14:01 +02:00
parent c9e24298cd
commit 3196dabdf2
23 changed files with 2267 additions and 49 deletions

View File

@ -45,6 +45,7 @@ export interface ChatSession {
country?: string | null;
ipAddress?: string | null;
sentiment?: number | null;
sentimentCategory?: string | null; // "positive", "neutral", "negative" from OpenAPI
messagesSent?: number;
startTime: Date;
endTime?: Date | null;
@ -60,6 +61,9 @@ export interface ChatSession {
initialMsg?: string;
fullTranscriptUrl?: string | null;
transcriptContent?: string | null;
processed?: boolean | null; // Flag for post-processing status
questions?: string | null; // JSON array of questions asked by user
summary?: string | null; // Brief summary of the conversation
}
export interface SessionQuery {