feat: 添加客服账号管理及WebSocket功能

This commit is contained in:
2026-04-03 17:52:09 +08:00
parent b7cce0befa
commit 7416bf8d96
20 changed files with 1065 additions and 74 deletions

View File

@@ -6,19 +6,65 @@ import (
"gitea.com/red-future/common/beans"
)
type accountCol struct {
beans.SQLBaseCol
DatasetIds string
DocumentIds string
SpeechcraftIds string
AccountName string
Status string
Greeting string
Prompt string
SelfIdentity string
Platform string
AccessToken string
AppId string
SecretKey string
XhsUserId string
ContactCardMessage string
NameCardMessage string
CardTriggerCount string
}
var AccountCol = accountCol{
SQLBaseCol: beans.DefSQLBaseCol,
DatasetIds: "dataset_ids",
DocumentIds: "document_ids",
SpeechcraftIds: "speechcraft_ids",
AccountName: "account_name",
Status: "status",
Greeting: "greeting",
Prompt: "prompt",
SelfIdentity: "self_identity",
Platform: "platform",
AccessToken: "access_token",
AppId: "app_id",
SecretKey: "secret_key",
XhsUserId: "xhs_user_id",
ContactCardMessage: "contact_card_message",
NameCardMessage: "name_card_message",
CardTriggerCount: "card_trigger_count",
}
type Account struct {
beans.SQLBaseDO `orm:",inline"`
DatasetIds []string `orm:"dataset_ids" json:"datasetIds" dc:"绑定的数据集ID列表"`
DocumentIds []string `orm:"document_ids" json:"documentIds" dc:"绑定的文档ID列表"`
SpeechcraftIds []string `orm:"speechcraftIds" json:"speechcraftIds" dc:"绑定的话术ID列表"`
AccountName string `orm:"account_name" json:"accountName" dc:"客服账号名称"`
Status account.Status `orm:"status" json:"status" dc:"客服账号状态"`
Greeting string `orm:"greeting" json:"greeting" dc:"开场白"`
Prompt []string `orm:"prompt" json:"prompt" dc:"提示词"`
SelfIdentity string `orm:"self_identity" json:"selfIdentity" dc:"AI身份描述"`
Platform string `orm:"platform" json:"platform" dc:"客服平台"`
DatasetIds []int64 `orm:"dataset_ids" json:"datasetIds" dc:"绑定的数据集ID列表"`
DocumentIds []int64 `orm:"document_ids" json:"documentIds" dc:"绑定的文档ID列表"`
AccountName string `orm:"account_name" json:"accountName" dc:"客服账号名称"`
Status account.Status `orm:"status" json:"status" dc:"客服账号状态"`
Platform account.Platform `orm:"platform" json:"platform" dc:"客服平台"`
Greeting string `orm:"greeting" json:"greeting" dc:"开场白"`
Prompt []string `orm:"prompt" json:"prompt" dc:"提示词"`
SelfIdentity string `orm:"self_identity" json:"selfIdentity" dc:"AI身份描述"`
ExpandData *AccountExpandData `orm:"expand_data" json:"expandData" description:"扩展数据(JSONB)"`
}
type AccountExpandData struct {
Xhs XhsExpandData `orm:",inline" json:"xhs"`
}
type XhsExpandData struct {
// 小红书平台专属字段仅platform=xiaohongshu时有效
AccessToken string `orm:"access_token" json:"accessToken" dc:"小红书AccessToken14天有效期"`
AppId int64 `orm:"app_id" json:"appId" dc:"小红书应用ID"`

View File

@@ -4,6 +4,22 @@ import (
"gitea.com/red-future/common/beans"
)
type scriptedSpeechCol struct {
beans.SQLBaseCol
AccountId string
DatasetId string
QuestionContent string
AnswerContent string
}
var ScriptedSpeechCol = scriptedSpeechCol{
SQLBaseCol: beans.DefSQLBaseCol,
AccountId: "account_id",
DatasetId: "dataset_id",
QuestionContent: "question_content",
AnswerContent: "answer_content",
}
type ScriptedSpeech struct {
beans.SQLBaseDO `orm:",inline"`