Files
livedash-node/prisma/schema.prisma
Max Kowalski a9e4145001 feat: Implement structured message parsing and display in MessageViewer component
- Added MessageViewer component to display parsed messages in a chat-like format.
- Introduced new Message table in the database to store individual messages with timestamps, roles, and content.
- Updated Session model to include a relation to parsed messages.
- Created transcript parsing logic to convert raw transcripts into structured messages.
- Enhanced processing scheduler to handle sessions with parsed messages.
- Updated API endpoints to return parsed messages alongside session details.
- Added manual trigger commands for session refresh, transcript parsing, and processing.
- Improved user experience with color-coded message roles and timestamps in the UI.
- Documented the new scheduler workflow and transcript parsing implementation.
2025-06-25 17:45:08 +02:00

75 lines
2.5 KiB
Plaintext

// Database schema, one company = one org, linked to users and CSV config
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}
model Company {
id String @id @default(uuid())
name String
csvUrl String // where to fetch CSV
csvUsername String? // for basic auth
csvPassword String?
sentimentAlert Float? // e.g. alert threshold for negative chats
dashboardOpts String? // JSON blob for per-company dashboard preferences
users User[]
sessions Session[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model User {
id String @id @default(uuid())
email String @unique
password String // hashed, use bcrypt
company Company @relation(fields: [companyId], references: [id])
companyId String
role String // 'admin' | 'user' | 'auditor'
resetToken String?
resetTokenExpiry DateTime?
}
model Session {
id String @id
company Company @relation(fields: [companyId], references: [id])
companyId String
startTime DateTime
endTime DateTime
ipAddress String?
country String?
language String?
messagesSent Int?
sentiment Float? // Original sentiment score (float)
sentimentCategory String? // "positive", "neutral", "negative" from OpenAPI
escalated Boolean?
forwardedHr Boolean?
fullTranscriptUrl String?
avgResponseTime Float?
tokens Int?
tokensEur Float?
category String?
initialMsg String?
processed Boolean? // Flag for post-processing status
questions String? // JSON array of questions asked by user
summary String? // Brief summary of the conversation
messages Message[] // Relation to parsed messages
createdAt DateTime @default(now())
}
model Message {
id String @id @default(uuid())
session Session @relation(fields: [sessionId], references: [id], onDelete: Cascade)
sessionId String
timestamp DateTime // When the message was sent
role String // "User", "Assistant", "System", etc.
content String // The message content
order Int // Order within the conversation (0, 1, 2, ...)
createdAt DateTime @default(now())
@@index([sessionId, order]) // Index for efficient ordering queries
}