feat: 添加客服账号管理及WebSocket功能
This commit is contained in:
90
model/dto/account_dto.go
Normal file
90
model/dto/account_dto.go
Normal file
@@ -0,0 +1,90 @@
|
||||
// Package dto - 客服账号DTO
|
||||
// 功能:客服账号的增删改查请求响应结构体
|
||||
package dto
|
||||
|
||||
import (
|
||||
"customer-server/consts/account"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// AddAccountReq 添加客服账号
|
||||
type AddAccountReq struct {
|
||||
g.Meta `path:"/add" method:"post" tags:"客服账号管理" summary:"添加客服账号" dc:"创建新的客服账号"`
|
||||
|
||||
DatasetIds []int64 `json:"datasetIds" v:"required#数据集ID不能为空" dc:"数据集ID列表"`
|
||||
DocumentIds []int64 `json:"documentIds" v:"required#文档ID不能为空" dc:"文档ID列表"`
|
||||
AccountName string `json:"accountName" v:"required#客服账号名称不能为空"`
|
||||
Status account.Status `json:"status" dc:"客服账号状态"`
|
||||
Greeting string `json:"greeting" dc:"开场白"`
|
||||
Prompt []string `json:"prompt" dc:"提示词"`
|
||||
SelfIdentity string `json:"selfIdentity" dc:"AI身份描述"`
|
||||
Platform account.Platform `json:"platform" v:"required#客服平台不能为空" dc:"客服平台"`
|
||||
}
|
||||
|
||||
type AddAccountRes struct {
|
||||
Id int64 `json:"id"`
|
||||
}
|
||||
|
||||
// UpdateAccountReq 更新客服账号
|
||||
type UpdateAccountReq struct {
|
||||
g.Meta `path:"/update" method:"post" tags:"客服账号管理" summary:"更新客服账号" dc:"更新客服账号信息"`
|
||||
|
||||
Id int64 `json:"id" v:"required#客服账号ID不能为空" dc:"客服账号ID"`
|
||||
DatasetIds []int64 `json:"datasetIds" dc:"数据集ID列表"`
|
||||
DocumentIds []int64 `json:"documentIds" dc:"文档ID列表"`
|
||||
AccountName string `json:"accountName" dc:"客服账号名称"`
|
||||
Status account.Status `json:"status" dc:"客服账号状态"`
|
||||
Greeting string `json:"greeting" dc:"开场白"`
|
||||
Prompt []string `json:"prompt" dc:"提示词"`
|
||||
SelfIdentity string `json:"selfIdentity" dc:"AI身份描述"`
|
||||
Platform account.Platform `json:"platform" dc:"客服平台"`
|
||||
}
|
||||
|
||||
// DeleteAccountReq 删除客服账号
|
||||
type DeleteAccountReq struct {
|
||||
g.Meta `path:"/delete" method:"post" tags:"客服账号管理" summary:"删除客服账号" dc:"删除指定客服账号"`
|
||||
Id int64 `json:"id" v:"required#客服账号ID不能为空" dc:"客服账号ID"`
|
||||
}
|
||||
|
||||
// GetAccountReq 获取单个客服账号
|
||||
type GetAccountReq struct {
|
||||
g.Meta `path:"/getOne" method:"get" tags:"客服账号管理" summary:"获取客服账号详情" dc:"根据ID获取单个客服账号信息"`
|
||||
Id int64 `json:"id" v:"required#客服账号ID不能为空" dc:"客服账号ID"`
|
||||
}
|
||||
|
||||
// ListAccountReq 获取客服账号列表
|
||||
type ListAccountReq struct {
|
||||
g.Meta `path:"/list" method:"get" tags:"客服账号管理" summary:"获取客服账号列表" dc:"分页查询客服账号,支持按账号名称、状态、平台筛选"`
|
||||
Page *beans.Page `json:"page"`
|
||||
Keyword string `json:"keyword" dc:"关键字"`
|
||||
AccountName string `json:"accountName" dc:"客服账号名称"`
|
||||
Status account.Status `json:"status" dc:"客服账号状态"`
|
||||
Platform account.Platform `json:"platform" dc:"客服平台"`
|
||||
}
|
||||
|
||||
type ListAccountRes struct {
|
||||
List []*AccountVO `json:"list"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
// AccountVO 客服账号视图对象
|
||||
type AccountVO struct {
|
||||
Id int64 `json:"id,string"`
|
||||
DatasetIds []int64 `json:"datasetIds,string"`
|
||||
DocumentIds []int64 `json:"documentIds,string"`
|
||||
AccountName string `json:"accountName"`
|
||||
Status account.Status `json:"status"`
|
||||
Greeting string `json:"greeting"`
|
||||
Prompt []string `json:"prompt"`
|
||||
SelfIdentity string `json:"selfIdentity"`
|
||||
Platform account.Platform `json:"platform"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// GetByAccountNameReq 根据账号名称获取客服账号
|
||||
type GetByAccountNameReq struct {
|
||||
AccountName string `json:"accountName" dc:"客服账号名称"`
|
||||
}
|
||||
14
model/dto/account_websocket_dto.go
Normal file
14
model/dto/account_websocket_dto.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"customer-server/consts/account"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// AccountWebSocketConnectReq WebSocket 连接请求
|
||||
type AccountWebSocketConnectReq struct {
|
||||
g.Meta `path:"/accountConnect" method:"get" tags:"AccountWebSocket" summary:"WebSocket连接" dc:"建立WebSocket连接,用于实时消息推送"`
|
||||
AccountName string `json:"accountName" v:"required#客服账号不能为空" dc:"客服账号"`
|
||||
Platform account.Platform `json:"platform" v:"required#平台不能为空" dc:"平台"`
|
||||
}
|
||||
73
model/dto/scripted_speech_dto.go
Normal file
73
model/dto/scripted_speech_dto.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// Package dto - 预制话术DTO
|
||||
// 功能:预制话术的增删改查请求响应结构体
|
||||
package dto
|
||||
|
||||
import (
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// AddScriptedSpeechReq 添加预制话术
|
||||
type AddScriptedSpeechReq struct {
|
||||
g.Meta `path:"/add" method:"post" tags:"预制话术管理" summary:"添加预制话术" dc:"创建新的预制话术"`
|
||||
|
||||
AccountId int64 `json:"accountId" v:"required#账号ID不能为空" dc:"账号ID"`
|
||||
DatasetId int64 `json:"datasetId" v:"required#数据集ID不能为空" dc:"数据集ID"`
|
||||
QuestionContent string `json:"questionContent" v:"required#问题内容不能为空" dc:"问题内容"`
|
||||
AnswerContent string `json:"answerContent" v:"required#回答内容不能为空" dc:"回答内容"`
|
||||
}
|
||||
|
||||
type AddScriptedSpeechRes struct {
|
||||
Id int64 `json:"id"`
|
||||
}
|
||||
|
||||
// UpdateScriptedSpeechReq 更新预制话术
|
||||
type UpdateScriptedSpeechReq struct {
|
||||
g.Meta `path:"/update" method:"post" tags:"预制话术管理" summary:"更新预制话术" dc:"更新预制话术内容"`
|
||||
|
||||
Id int64 `json:"id" v:"required#预制话术ID不能为空" dc:"预制话术ID"`
|
||||
AccountId *int64 `json:"accountId" dc:"账号ID"`
|
||||
DatasetId *int64 `json:"datasetId" dc:"数据集ID"`
|
||||
QuestionContent string `json:"questionContent" dc:"问题内容"`
|
||||
AnswerContent string `json:"answerContent" dc:"回答内容"`
|
||||
}
|
||||
|
||||
// DeleteScriptedSpeechReq 删除预制话术
|
||||
type DeleteScriptedSpeechReq struct {
|
||||
g.Meta `path:"/delete" method:"post" tags:"预制话术管理" summary:"删除预制话术" dc:"删除指定预制话术"`
|
||||
|
||||
Id int64 `json:"id" v:"required#预制话术ID不能为空" dc:"预制话术ID"`
|
||||
}
|
||||
|
||||
// GetScriptedSpeechReq 获取单个预制话术
|
||||
type GetScriptedSpeechReq struct {
|
||||
g.Meta `path:"/getOne" method:"get" tags:"预制话术管理" summary:"获取预制话术详情" dc:"根据ID获取单个预制话术"`
|
||||
|
||||
Id int64 `json:"id" v:"required#预制话术ID不能为空" dc:"预制话术ID"`
|
||||
}
|
||||
|
||||
// ListScriptedSpeechReq 获取预制话术列表
|
||||
type ListScriptedSpeechReq struct {
|
||||
g.Meta `path:"/list" method:"get" tags:"预制话术管理" summary:"获取预制话术列表" dc:"分页查询预制话术,支持按账号ID、数据集ID筛选"`
|
||||
|
||||
Page *beans.Page `json:"page"`
|
||||
AccountId int64 `json:"accountId" dc:"账号ID"`
|
||||
DatasetId int64 `json:"datasetId" dc:"数据集ID"`
|
||||
}
|
||||
|
||||
type ListScriptedSpeechRes struct {
|
||||
List []*ScriptedSpeechVO `json:"list"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
// ScriptedSpeechVO 预制话术视图对象
|
||||
type ScriptedSpeechVO struct {
|
||||
Id int64 `json:"id,string"`
|
||||
TenantId uint64 `json:"tenantId,string"`
|
||||
AccountId int64 `json:"accountId,string"`
|
||||
DatasetId int64 `json:"datasetId,string"`
|
||||
QuestionContent string `json:"questionContent"`
|
||||
AnswerContent string `json:"answerContent"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
@@ -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:"小红书AccessToken(14天有效期)"`
|
||||
AppId int64 `orm:"app_id" json:"appId" dc:"小红书应用ID"`
|
||||
|
||||
@@ -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"`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user