WIP - ai process builder codex attempt
This commit is contained in:
@@ -181,6 +181,101 @@ model ContactDetail {
|
||||
@@map("contact_details")
|
||||
}
|
||||
|
||||
// AI Process Builder + Chat Orchestrator
|
||||
model AiProcess {
|
||||
id String @id @default(uuid())
|
||||
tenantId String @map("tenant_id")
|
||||
name String
|
||||
description String? @db.Text
|
||||
latestVersion Int @default(1) @map("latest_version")
|
||||
createdBy String @map("created_by")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
versions AiProcessVersion[]
|
||||
runs AiProcessRun[]
|
||||
|
||||
@@index([tenantId])
|
||||
@@map("ai_processes")
|
||||
}
|
||||
|
||||
model AiProcessVersion {
|
||||
id String @id @default(uuid())
|
||||
tenantId String @map("tenant_id")
|
||||
processId String @map("process_id")
|
||||
version Int
|
||||
graphJson Json @map("graph_json")
|
||||
compiledJson Json @map("compiled_json")
|
||||
createdBy String @map("created_by")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
process AiProcess @relation(fields: [processId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([processId, version])
|
||||
@@index([tenantId])
|
||||
@@map("ai_process_versions")
|
||||
}
|
||||
|
||||
model AiProcessRun {
|
||||
id String @id @default(uuid())
|
||||
tenantId String @map("tenant_id")
|
||||
processId String @map("process_id")
|
||||
version Int
|
||||
status String
|
||||
inputJson Json @map("input_json")
|
||||
outputJson Json? @map("output_json")
|
||||
errorJson Json? @map("error_json")
|
||||
stateJson Json? @map("state_json")
|
||||
currentNodeId String? @map("current_node_id")
|
||||
startedAt DateTime @default(now()) @map("started_at")
|
||||
endedAt DateTime? @map("ended_at")
|
||||
|
||||
process AiProcess @relation(fields: [processId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([tenantId])
|
||||
@@index([processId])
|
||||
@@map("ai_process_runs")
|
||||
}
|
||||
|
||||
model AiChatSession {
|
||||
id String @id @default(uuid())
|
||||
tenantId String @map("tenant_id")
|
||||
userId String @map("user_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
messages AiChatMessage[]
|
||||
|
||||
@@index([tenantId])
|
||||
@@index([userId])
|
||||
@@map("ai_chat_sessions")
|
||||
}
|
||||
|
||||
model AiChatMessage {
|
||||
id String @id @default(uuid())
|
||||
sessionId String @map("session_id")
|
||||
role String
|
||||
content String @db.Text
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
session AiChatSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([sessionId])
|
||||
@@map("ai_chat_messages")
|
||||
}
|
||||
|
||||
model AiAuditEvent {
|
||||
id String @id @default(uuid())
|
||||
tenantId String @map("tenant_id")
|
||||
runId String @map("run_id")
|
||||
eventType String @map("event_type")
|
||||
payloadJson Json @map("payload_json")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@index([tenantId])
|
||||
@@index([runId])
|
||||
@@map("ai_audit_events")
|
||||
}
|
||||
|
||||
// Application Builder
|
||||
model App {
|
||||
id String @id @default(uuid())
|
||||
|
||||
Reference in New Issue
Block a user