f2d7037ca2
- Add success/error feedback messages near submit buttons in all admin forms - Display success prompt for 1s before redirect after save - Show API error details on save failure - Add isFeatured/featuredOrder fields to Agent model and admin UI - Add difyApiUrl/difyApiKey fields for per-agent Dify API configuration - Show featured badge column in agent admin list - Display featured agents on homepage sorted by order - Refactor chat page streaming with AbortController and stable userId - Improve Dify API proxy to use per-agent credentials
86 lines
2.5 KiB
Plaintext
86 lines
2.5 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
email String @unique
|
|
username String @unique
|
|
password String
|
|
name String?
|
|
role String @default("admin")
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
conversations Conversation[]
|
|
}
|
|
|
|
model Category {
|
|
id Int @id @default(autoincrement())
|
|
name String @unique
|
|
icon String?
|
|
description String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
agents Agent[]
|
|
}
|
|
|
|
model Agent {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
slug String @unique
|
|
description String
|
|
icon String?
|
|
categoryId Int?
|
|
features String @default("")
|
|
hotQuestions String @default("[]")
|
|
quickQuestions String @default("[]")
|
|
difyApiUrl String?
|
|
difyApiKey String?
|
|
usageCount Int @default(0)
|
|
status String @default("active")
|
|
isFeatured Boolean @default(false)
|
|
featuredOrder Int @default(0)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
category Category? @relation(fields: [categoryId], references: [id])
|
|
conversations Conversation[]
|
|
}
|
|
|
|
model News {
|
|
id Int @id @default(autoincrement())
|
|
title String
|
|
content String
|
|
type String @default("news")
|
|
published Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model Conversation {
|
|
id Int @id @default(autoincrement())
|
|
agentId Int
|
|
userId Int?
|
|
title String @default("新对话")
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
user User? @relation(fields: [userId], references: [id])
|
|
agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
|
|
messages Message[]
|
|
}
|
|
|
|
model Message {
|
|
id Int @id @default(autoincrement())
|
|
conversationId Int
|
|
role String
|
|
content String
|
|
timestamp DateTime @default(now())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
conversation Conversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
|
|
}
|