feat(ai): add AI trace tracking and admin panel
Test Suite / backend-pr-quick (push) Has been skipped
Test Suite / quick-import-pr-quick (push) Has been skipped
Test Suite / backend-full (push) Successful in 12m45s
Test Suite / flutter-quality (push) Failing after 7m24s

- 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:
Nils-Johan Gynther
2026-05-21 17:33:21 +02:00
parent c3520b5ad4
commit 67a7590525
21 changed files with 2477 additions and 509 deletions
+23
View File
@@ -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])
}