feat(chat): add AgentSessionType enum and filter chatbot history sessions

This commit is contained in:
yiling
2026-07-11 20:14:40 +08:00
parent 94a3ec0b9b
commit b5d52a4e56
10 changed files with 151 additions and 6 deletions
@@ -0,0 +1,8 @@
-- CreateEnum
CREATE TYPE "AgentSessionType" AS ENUM ('comment', 'chat');
-- AlterTable
ALTER TABLE "agent_sessions" ADD COLUMN "type" "AgentSessionType" NOT NULL DEFAULT 'comment';
-- CreateIndex
CREATE INDEX "agent_sessions_type_idx" ON "agent_sessions"("type");
+7
View File
@@ -645,6 +645,11 @@ enum AgentType {
embedding
}
enum AgentSessionType {
comment
chat
}
model Agent {
id String @id
user User @relation(fields: [id], references: [id], onDelete: Cascade)
@@ -693,11 +698,13 @@ model AgentSession {
assetId String? @map("asset_id")
asset Asset? @relation("AssetToAgentSession", fields: [assetId], references: [id], onDelete: Cascade)
userCommentId String? @map("user_comment_id")
type AgentSessionType @default(comment)
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
entries AgentSessionEntry[]
comments AssetComment[]
@@index([type])
@@map("agent_sessions")
}