feat: add general chat feature (without project/agent concept)

This commit is contained in:
AI Clinical Dev Team
2025-10-12 09:48:49 +08:00
parent 07704817ba
commit 348af7fee9
9 changed files with 688 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ model User {
knowledgeBases KnowledgeBase[]
documents Document[]
adminLogs AdminLog[]
generalConversations GeneralConversation[]
@@index([email])
@@index([status])
@@ -187,3 +188,42 @@ model AdminLog {
@@index([action])
@@map("admin_logs")
}
// ==================== 通用对话模块 ====================
model GeneralConversation {
id String @id @default(uuid())
userId String @map("user_id")
title String
modelName String? @map("model_name")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
messages GeneralMessage[]
@@index([userId])
@@index([createdAt])
@@index([updatedAt])
@@map("general_conversations")
}
model GeneralMessage {
id String @id @default(uuid())
conversationId String @map("conversation_id")
role String
content String @db.Text
model String?
metadata Json?
tokens Int?
createdAt DateTime @default(now()) @map("created_at")
conversation GeneralConversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
@@index([conversationId])
@@index([createdAt])
@@map("general_messages")
}