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

90
model/dto/account_dto.go Normal file
View 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:"客服账号名称"`
}

View 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:"平台"`
}

View 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"`
}