feat: add general chat feature (without project/agent concept)
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user