1
This commit is contained in:
71
model/entity/conversation_archive.go
Normal file
71
model/entity/conversation_archive.go
Normal file
@@ -0,0 +1,71 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
// ConversationArchiveTempCollection 归档临时表名
|
||||
const ConversationArchiveTempCollection = "conversation_archive_temp"
|
||||
|
||||
// ConversationArchiveTemp 归档临时表实体(与 Conversation 结构相同)
|
||||
type ConversationArchiveTemp struct {
|
||||
beans.MongoBaseDO `bson:",inline"`
|
||||
|
||||
UserId string `bson:"userId" json:"userId"`
|
||||
Platform string `bson:"platform" json:"platform"`
|
||||
SessionId string `bson:"sessionId" json:"sessionId"`
|
||||
Question string `bson:"question" json:"question"`
|
||||
Answer string `bson:"answer" json:"answer"`
|
||||
MessageId string `bson:"messageId" json:"messageId"`
|
||||
MsgTime *time.Time `bson:"msgTime" json:"msgTime"` // 指针类型,与MongoBaseDO一致
|
||||
|
||||
// 原始文档 ID,用于删除原表数据
|
||||
OriginalId string `bson:"originalId" json:"originalId"`
|
||||
}
|
||||
|
||||
// ConversationES ES 索引文档结构
|
||||
type ConversationES struct {
|
||||
Id string `json:"id"` // MongoDB 原始 ID
|
||||
UserId string `json:"userId"` // 用户ID
|
||||
Platform string `json:"platform"` // 平台
|
||||
SessionId string `json:"sessionId"` // Session ID
|
||||
Question string `json:"question"` // 问题
|
||||
Answer string `json:"answer"` // 回复
|
||||
MessageId string `json:"messageId"` // 消息ID
|
||||
MsgTime time.Time `json:"msgTime"` // 消息时间
|
||||
TenantId string `json:"tenantId"` // 租户ID
|
||||
CreatedAt time.Time `json:"createdAt"` // 创建时间
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
ArchivedAt time.Time `json:"archivedAt"` // 归档时间
|
||||
}
|
||||
|
||||
// ConversationESMapping ES 索引映射
|
||||
const ConversationESMapping = `
|
||||
{
|
||||
"settings": {
|
||||
"number_of_shards": 3,
|
||||
"number_of_replicas": 1
|
||||
},
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"id": { "type": "keyword" },
|
||||
"userId": { "type": "keyword" },
|
||||
"platform": { "type": "keyword" },
|
||||
"sessionId": { "type": "keyword" },
|
||||
"question": { "type": "text", "analyzer": "standard" },
|
||||
"answer": { "type": "text", "analyzer": "standard" },
|
||||
"messageId": { "type": "keyword" },
|
||||
"msgTime": { "type": "date" },
|
||||
"tenantId": { "type": "keyword" },
|
||||
"createdAt": { "type": "date" },
|
||||
"updatedAt": { "type": "date" },
|
||||
"archivedAt": { "type": "date" }
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
// ConversationESIndex ES 索引名
|
||||
const ConversationESIndex = "conversations"
|
||||
Reference in New Issue
Block a user