feat(ai): add AI trace tracking and admin panel
- Add AiTrace model to Prisma schema with relations to User - Implement AiTraceService with CRUD operations for AI traces - Add new admin panel for AI traces with filtering and detail views - Integrate trace persistence in receipt import flow - Add API endpoints for listing and retrieving AI traces - Update Flutter admin UI with new AI tab and navigation - Add new domain models for AI traces and details - Add migration for AiTrace table creation BREAKING CHANGE: None
This commit is contained in:
@@ -33,6 +33,7 @@ model User {
|
||||
flyerSessions FlyerSession[]
|
||||
flyerSelections FlyerSelection[]
|
||||
shoppingListItems ShoppingListItem[]
|
||||
aiTraces AiTrace[]
|
||||
}
|
||||
|
||||
model Product {
|
||||
@@ -388,3 +389,25 @@ model ShoppingListItem {
|
||||
@@index([productId, unit, status])
|
||||
@@index([categoryId])
|
||||
}
|
||||
|
||||
model AiTrace {
|
||||
id Int @id @default(autoincrement())
|
||||
source String
|
||||
userId Int?
|
||||
sessionId Int?
|
||||
model String?
|
||||
prompt String? @db.LongText
|
||||
rawOutput String? @db.LongText
|
||||
normalizedOutput Json?
|
||||
status String
|
||||
error String? @db.Text
|
||||
durationMs Int?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([source, createdAt])
|
||||
@@index([userId, createdAt])
|
||||
@@index([status, createdAt])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user