feat: enhance agent system with hot/quick questions, dynamic chat UI, and new enterprise agents

- Add hotQuestions and quickQuestions fields to agent model
- Update admin form with textarea inputs for hot/quick questions
- Make chat page display dynamic agent data (name, icon, questions)
- Widen center chat area to 60% for better readability
- Add enterprise service category and 3 new agents (jiaotou, promotion, group-policy)
- Update Prisma schema formatting and seed data
This commit is contained in:
root
2026-05-07 22:14:43 +08:00
parent 77ad8beb3d
commit 362c37fb42
9 changed files with 177 additions and 88 deletions
+41 -42
View File
@@ -1,6 +1,3 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
@@ -11,40 +8,42 @@ datasource db {
}
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
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?
id Int @id @default(autoincrement())
name String @unique
icon String?
description String?
agents Agent[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
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?
category Category? @relation(fields: [categoryId], references: [id])
features String @default("")
usageCount Int @default(0)
status String @default("active")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
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("[]")
usageCount Int @default(0)
status String @default("active")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
category Category? @relation(fields: [categoryId], references: [id])
conversations Conversation[]
}
@@ -53,30 +52,30 @@ model News {
title String
content String
type String @default("news")
published Boolean @default(false)
published Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Conversation {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
agentId Int
agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
userId Int?
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
title String @default("新对话")
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[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Message {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
conversationId Int
conversation Conversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
role String // 'user' 或 'assistant'
role String
content String
timestamp DateTime @default(now())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
timestamp DateTime @default(now())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
conversation Conversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
}