refactor: 将客服后端重构为宿主可嵌入模块

- 注入数据库、运行时配置、统一响应、文件存储和平台 AI 能力,补充业务读写工具与客户快捷操作契约。

- 移除模块内重复的组织、客户、工单、标签、技能、旧工作流、MCP 和迁移实现,将身份权限与业务主体交由宿主管理。

- 使用 libSQL 重构向量存储,并完善图片消息、访客身份、排队调度、企业微信和支持聊天页面。

- 统一 HTTP、DTO 与 WebSocket 的 snake_case 协议,补齐模块初始化、业务动作和公共载荷等回归测试。
This commit is contained in:
t
2026-08-28 22:23:13 +08:00
parent 6845c728f8
commit 18c9354095
377 changed files with 13199 additions and 22881 deletions
@@ -1,7 +1,7 @@
package request
type RunAgentEvaluationRequest struct {
AIAgentID int64 `json:"aiAgentId"`
AIAgentID int64 `json:"ai_agent_id"`
Cases []AgentEvaluationCase `json:"cases"`
}
+22 -22
View File
@@ -3,16 +3,16 @@ package request
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type CreateAgentProfileRequest struct {
UserID int64 `json:"userId"`
TeamID int64 `json:"teamId"`
AgentCode string `json:"agentCode"`
DisplayName string `json:"displayName"`
UserID int64 `json:"user_id"`
TeamID int64 `json:"team_id"`
AgentCode string `json:"agent_code"`
DisplayName string `json:"display_name"`
Avatar string `json:"avatar"`
ServiceStatus enums.ServiceStatus `json:"serviceStatus"`
MaxConcurrentCount int `json:"maxConcurrentCount"`
PriorityLevel int `json:"priorityLevel"`
AutoAssignEnabled bool `json:"autoAssignEnabled"`
ReceiveOfflineMessage bool `json:"receiveOfflineMessage"`
ServiceStatus enums.ServiceStatus `json:"service_status"`
MaxConcurrentCount int `json:"max_concurrent_count"`
PriorityLevel int `json:"priority_level"`
AutoAssignEnabled bool `json:"auto_assign_enabled"`
ReceiveOfflineMessage bool `json:"receive_offline_message"`
Remark string `json:"remark"`
}
@@ -27,7 +27,7 @@ type DeleteAgentProfileRequest struct {
type CreateAgentTeamRequest struct {
Name string `json:"name"`
LeaderUserID int64 `json:"leaderUserId"`
LeaderUserID int64 `json:"leader_user_id"`
Status int `json:"status"`
Description string `json:"description"`
Remark string `json:"remark"`
@@ -36,7 +36,7 @@ type CreateAgentTeamRequest struct {
type UpdateAgentTeamRequest struct {
ID int64 `json:"id"`
Name string `json:"name"`
LeaderUserID int64 `json:"leaderUserId"`
LeaderUserID int64 `json:"leader_user_id"`
Status int `json:"status"`
Description string `json:"description"`
Remark string `json:"remark"`
@@ -47,9 +47,9 @@ type DeleteAgentTeamRequest struct {
}
type CreateAgentTeamScheduleRequest struct {
TeamID int64 `json:"teamId"`
StartAt string `json:"startAt"`
EndAt string `json:"endAt"`
TeamID int64 `json:"team_id"`
StartAt string `json:"start_at"`
EndAt string `json:"end_at"`
Remark string `json:"remark"`
}
@@ -63,18 +63,18 @@ type DeleteAgentTeamScheduleRequest struct {
}
type AgentTeamScheduleCalendarRequest struct {
StartAt string `json:"startAt"`
EndAt string `json:"endAt"`
TeamID int64 `json:"teamId"`
StartAt string `json:"start_at"`
EndAt string `json:"end_at"`
TeamID int64 `json:"team_id"`
}
type AgentTeamScheduleBatchRequest struct {
TeamIDs []int64 `json:"teamIds"`
StartDate string `json:"startDate"`
EndDate string `json:"endDate"`
TeamIDs []int64 `json:"team_ids"`
StartDate string `json:"start_date"`
EndDate string `json:"end_date"`
Weekdays []int `json:"weekdays"`
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
Remark string `json:"remark"`
Locale string `json:"-"`
}
@@ -3,8 +3,8 @@ package request
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type SaveAgentRunQualityFeedbackRequest struct {
AgentRunID int64 `json:"agentRunId"`
ResolutionStatus enums.AgentRunResolutionStatus `json:"resolutionStatus"`
EvidenceStatus enums.AgentRunEvidenceStatus `json:"evidenceStatus"`
AgentRunID int64 `json:"agent_run_id"`
ResolutionStatus enums.AgentRunResolutionStatus `json:"resolution_status"`
EvidenceStatus enums.AgentRunEvidenceStatus `json:"evidence_status"`
Comment string `json:"comment"`
}
+27 -48
View File
@@ -2,39 +2,20 @@ package request
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type AIAgentMCPToolRequest struct {
ToolCode string `json:"toolCode"`
ServerCode string `json:"serverCode"`
ToolName string `json:"toolName"`
Title string `json:"title"`
Description string `json:"description"`
RiskLevel string `json:"riskLevel"`
RequireConfirmation bool `json:"requireConfirmation"`
Arguments map[string]string `json:"arguments"`
}
type AIAgentWorkflowBindingRequest struct {
WorkflowVersionID int64 `json:"workflowVersionId"`
ToolName string `json:"toolName"`
TriggerInstruction string `json:"triggerInstruction"`
Priority int `json:"priority"`
Enabled bool `json:"enabled"`
}
type CreateAIConfigRequest struct {
Name string `json:"name"`
Provider enums.AIProvider `json:"provider"`
BaseURL string `json:"baseUrl"`
APIKey string `json:"apiKey"`
ModelType enums.AIModelType `json:"modelType"`
ModelName string `json:"modelName"`
BaseURL string `json:"base_url"`
APIKey string `json:"api_key"`
ModelType enums.AIModelType `json:"model_type"`
ModelName string `json:"model_name"`
Dimension int `json:"dimension"`
MaxContextTokens int `json:"maxContextTokens"`
MaxOutputTokens int `json:"maxOutputTokens"`
TimeoutMS int `json:"timeoutMs"`
MaxRetryCount int `json:"maxRetryCount"`
RPMLimit int `json:"rpmLimit"`
TPMLimit int `json:"tpmLimit"`
MaxContextTokens int `json:"max_context_tokens"`
MaxOutputTokens int `json:"max_output_tokens"`
TimeoutMS int `json:"timeout_ms"`
MaxRetryCount int `json:"max_retry_count"`
RPMLimit int `json:"rpm_limit"`
TPMLimit int `json:"tpm_limit"`
Remark string `json:"remark"`
}
@@ -54,25 +35,23 @@ type UpdateAIConfigStatusRequest struct {
type CreateAIAgentRequest struct {
Name string `json:"name"`
Avatar string `json:"avatar"`
Description string `json:"description"`
AIConfigID int64 `json:"aiConfigId"`
MaxSteps int `json:"maxSteps"`
ContextWindow int `json:"contextWindow"`
ToolPolicy string `json:"toolPolicy"`
KnowledgePolicy string `json:"knowledgePolicy"`
ServiceMode enums.IMConversationServiceMode `json:"serviceMode"`
SystemPrompt string `json:"systemPrompt"`
WelcomeMessage string `json:"welcomeMessage"`
ReplyTimeoutSeconds int `json:"replyTimeoutSeconds"`
RolloutPercent int `json:"rolloutPercent"`
TeamIDs []int64 `json:"teamIds"`
HandoffMode enums.AIAgentHandoffMode `json:"handoffMode"`
FallbackMode enums.AIAgentFallbackMode `json:"fallbackMode"`
FallbackMessage string `json:"fallbackMessage"`
KnowledgeBaseIDs []int64 `json:"knowledgeBaseIds"`
SkillIDs []int64 `json:"skillIds"`
MCPTools []AIAgentMCPToolRequest `json:"mcpTools"`
WorkflowBindings []AIAgentWorkflowBindingRequest `json:"workflowBindings"`
AIConfigID int64 `json:"ai_config_id"`
MaxSteps int `json:"max_steps"`
ContextWindow int `json:"context_window"`
ToolPolicy string `json:"tool_policy"`
KnowledgePolicy string `json:"knowledge_policy"`
ServiceMode enums.IMConversationServiceMode `json:"service_mode"`
SystemPrompt string `json:"system_prompt"`
WelcomeMessage string `json:"welcome_message"`
ReplyTimeoutSeconds int `json:"reply_timeout_seconds"`
RolloutPercent int `json:"rollout_percent"`
TeamIDs []int64 `json:"team_ids"`
HandoffMode enums.AIAgentHandoffMode `json:"handoff_mode"`
FallbackMode enums.AIAgentFallbackMode `json:"fallback_mode"`
FallbackMessage string `json:"fallback_message"`
KnowledgeBaseIDs []int64 `json:"knowledge_base_ids"`
}
type UpdateAIAgentRequest struct {
@@ -90,7 +69,7 @@ type PublishAIAgentRequest struct {
type RollbackAIAgentRequest struct {
ID int64 `json:"id"`
RevisionID int64 `json:"revisionId"`
RevisionID int64 `json:"revision_id"`
}
type RollbackAIAgentRolloutRequest struct {
@@ -1,36 +0,0 @@
package request
import "code.tczkiot.com/wlw/ai-agent/internal/ai/workflow/dsl"
type CreateAIWorkflowRequest struct {
Name string `json:"name"`
Description string `json:"description"`
Definition dsl.Definition `json:"definition"`
}
type UpdateAIWorkflowRequest struct {
ID int64 `json:"id"`
CreateAIWorkflowRequest
}
type DeleteAIWorkflowRequest struct {
ID int64 `json:"id"`
}
type ValidateAIWorkflowRequest struct {
Definition dsl.Definition `json:"definition"`
}
type PublishAIWorkflowRequest struct {
WorkflowID int64 `json:"workflowId"`
Definition dsl.Definition `json:"definition"`
}
type AIWorkflowVersionListRequest struct {
WorkflowID int64 `json:"workflowId"`
}
type RestoreAIWorkflowVersionRequest struct {
WorkflowID int64 `json:"workflowId"`
WorkflowVersionID int64 `json:"workflowVersionId"`
}
+4 -4
View File
@@ -1,11 +1,11 @@
package request
type CreateChannelRequest struct {
ChannelType string `json:"channelType"`
AIAgentID int64 `json:"aiAgentId"`
AIAgentRolloutPercent int `json:"aiAgentRolloutPercent"`
ChannelType string `json:"channel_type"`
AIAgentID int64 `json:"ai_agent_id"`
AIAgentRolloutPercent int `json:"ai_agent_rollout_percent"`
Name string `json:"name"`
ConfigJSON string `json:"configJson"`
ConfigJSON string `json:"config_json"`
Status int `json:"status"`
Remark string `json:"remark"`
}
@@ -1,21 +0,0 @@
package request
type CreateCompanyRequest struct {
Name string `json:"name"`
Code string `json:"code"`
Remark string `json:"remark"`
}
type UpdateCompanyRequest struct {
ID int64 `json:"id"`
CreateCompanyRequest
}
type DeleteCompanyRequest struct {
ID int64 `json:"id"`
}
type UpdateCompanyStatusRequest struct {
ID int64 `json:"id"`
Status int `json:"status"`
}
@@ -12,50 +12,39 @@ const (
type ConversationListRequest struct {
Status int `json:"status"`
ServiceMode int `json:"serviceMode"`
CurrentAssigneeID int64 `json:"currentAssigneeId"`
ServiceMode int `json:"service_mode"`
CurrentAssigneeID int64 `json:"current_assignee_id"`
Keyword string `json:"keyword"`
TagID int64 `json:"tagId"`
}
type AssignConversationRequest struct {
ConversationID int64 `json:"conversationId"`
AssigneeID int64 `json:"assigneeId"`
ConversationID int64 `json:"conversation_id"`
AssigneeID int64 `json:"assignee_id"`
Reason string `json:"reason"`
}
type DispatchConversationRequest struct {
ConversationID int64 `json:"conversationId"`
ConversationID int64 `json:"conversation_id"`
}
type TransferConversationRequest struct {
ConversationID int64 `json:"conversationId"`
ToUserID int64 `json:"toUserId"`
ConversationID int64 `json:"conversation_id"`
ToUserID int64 `json:"to_user_id"`
Reason string `json:"reason"`
}
type CloseConversationRequest struct {
ConversationID int64 `json:"conversationId"`
CloseReason string `json:"closeReason"`
ConversationID int64 `json:"conversation_id"`
CloseReason string `json:"close_reason"`
}
type ReadConversationRequest struct {
ConversationID int64 `json:"conversationId"`
MessageID int64 `json:"messageId"`
ConversationID int64 `json:"conversation_id"`
MessageID int64 `json:"message_id"`
}
type AddConversationTagRequest struct {
ConversationID int64 `json:"conversationId"`
TagID int64 `json:"tagId"`
}
type RemoveConversationTagRequest struct {
ConversationID int64 `json:"conversationId"`
TagID int64 `json:"tagId"`
}
// LinkConversationCustomerRequest 将客服会话关联到 CRM 客户(并同步访客身份映射)。
type LinkConversationCustomerRequest struct {
ConversationID int64 `json:"conversationId"`
CustomerID int64 `json:"customerId"`
type ExecuteCustomerQuickActionRequest struct {
ConversationID int64 `json:"conversation_id"`
Code string `json:"code"`
ClientMsgID string `json:"client_msg_id"`
}
@@ -1,27 +0,0 @@
package request
type CreateCustomerContactRequest struct {
CustomerID int64 `json:"customerId"`
ContactType string `json:"contactType"`
ContactValue string `json:"contactValue"`
IsPrimary bool `json:"isPrimary"`
IsVerified bool `json:"isVerified"`
Source string `json:"source"`
Status int `json:"status"`
Remark string `json:"remark"`
}
type UpdateCustomerContactRequest struct {
ID int64 `json:"id"`
ContactType string `json:"contactType"`
ContactValue string `json:"contactValue"`
IsPrimary bool `json:"isPrimary"`
IsVerified bool `json:"isVerified"`
Source string `json:"source"`
Status int `json:"status"`
Remark string `json:"remark"`
}
type DeleteCustomerContactRequest struct {
ID int64 `json:"id"`
}
@@ -1,72 +0,0 @@
package request
// CustomerListRequest 客户分页列表查询(POST /customer/list JSON Body)。
type CustomerListRequest struct {
Page int `json:"page"`
Limit int `json:"limit"`
Status *int `json:"status,omitempty"`
Gender *int `json:"gender,omitempty"`
CompanyID *int64 `json:"companyId,omitempty"`
// Keyword 模糊匹配:客户姓名、主手机号、主邮箱、任意联系方式(t_customer_contact)、公司名称(t_company)。
Keyword string `json:"keyword"`
}
func (r CustomerListRequest) GetPage() int {
if r.Page <= 0 {
return 1
}
return r.Page
}
func (r CustomerListRequest) GetLimit() int {
if r.Limit <= 0 {
return 20
}
return r.Limit
}
func (r CustomerListRequest) Offset() int {
return (r.GetPage() - 1) * r.GetLimit()
}
type CreateCustomerRequest struct {
Name string `json:"name"`
Gender int `json:"gender"`
CompanyID int64 `json:"companyId"`
PrimaryMobile string `json:"primaryMobile"`
PrimaryEmail string `json:"primaryEmail"`
Remark string `json:"remark"`
}
type UpdateCustomerRequest struct {
ID int64 `json:"id"`
CreateCustomerRequest
}
type DeleteCustomerRequest struct {
ID int64 `json:"id"`
}
type UpdateCustomerStatusRequest struct {
ID int64 `json:"id"`
Status int `json:"status"`
}
// CustomerProfileContactItem 保存客户档案时的联系方式行(无 id 表示新建)。
type CustomerProfileContactItem struct {
ID *int64 `json:"id,omitempty"`
ContactType string `json:"contactType"`
ContactValue string `json:"contactValue"`
IsPrimary bool `json:"isPrimary"`
Remark string `json:"remark"`
}
// SaveCustomerProfileRequest 客户主信息与联系方式一并保存(单事务);id 为空或 0 表示新建客户。
type SaveCustomerProfileRequest struct {
ID *int64 `json:"id,omitempty"`
Name string `json:"name"`
Gender int `json:"gender"`
CompanyID int64 `json:"companyId"`
Remark string `json:"remark"`
Contacts []CustomerProfileContactItem `json:"contacts"`
}
+37 -37
View File
@@ -9,15 +9,15 @@ import (
type CreateKnowledgeBaseRequest struct {
Name string `json:"name"`
Description string `json:"description"`
KnowledgeType string `json:"knowledgeType"`
DefaultTopK int `json:"defaultTopK"`
DefaultScoreThreshold float64 `json:"defaultScoreThreshold"`
DefaultRerankLimit int `json:"defaultRerankLimit"`
ChunkProvider string `json:"chunkProvider"`
ChunkTargetTokens int `json:"chunkTargetTokens"`
ChunkMaxTokens int `json:"chunkMaxTokens"`
ChunkOverlapTokens int `json:"chunkOverlapTokens"`
AnswerMode int `json:"answerMode"`
KnowledgeType string `json:"knowledge_type"`
DefaultTopK int `json:"default_top_k"`
DefaultScoreThreshold float64 `json:"default_score_threshold"`
DefaultRerankLimit int `json:"default_rerank_limit"`
ChunkProvider string `json:"chunk_provider"`
ChunkTargetTokens int `json:"chunk_target_tokens"`
ChunkMaxTokens int `json:"chunk_max_tokens"`
ChunkOverlapTokens int `json:"chunk_overlap_tokens"`
AnswerMode int `json:"answer_mode"`
Remark string `json:"remark"`
}
@@ -27,8 +27,8 @@ type UpdateKnowledgeBaseRequest struct {
}
type CreateKnowledgeDirectoryRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
ParentID int64 `json:"parentId"`
KnowledgeBaseID int64 `json:"knowledge_base_id"`
ParentID int64 `json:"parent_id"`
Name string `json:"name"`
Remark string `json:"remark"`
}
@@ -43,10 +43,10 @@ type DeleteKnowledgeDirectoryRequest struct {
}
type CreateKnowledgeDocumentRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
DirectoryID int64 `json:"directoryId"`
KnowledgeBaseID int64 `json:"knowledge_base_id"`
DirectoryID int64 `json:"directory_id"`
Title string `json:"title"`
ContentType enums.KnowledgeDocumentContentType `json:"contentType"`
ContentType enums.KnowledgeDocumentContentType `json:"content_type"`
Content string `json:"content"`
}
@@ -56,8 +56,8 @@ type UpdateKnowledgeDocumentRequest struct {
}
type BatchMoveKnowledgeDocumentRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
DirectoryID int64 `json:"directoryId"`
KnowledgeBaseID int64 `json:"knowledge_base_id"`
DirectoryID int64 `json:"directory_id"`
IDs []int64 `json:"ids"`
}
@@ -66,11 +66,11 @@ type BatchDeleteKnowledgeDocumentRequest struct {
}
type CreateKnowledgeFAQRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
DirectoryID int64 `json:"directoryId"`
KnowledgeBaseID int64 `json:"knowledge_base_id"`
DirectoryID int64 `json:"directory_id"`
Question string `json:"question"`
Answer string `json:"answer"`
SimilarQuestions []string `json:"similarQuestions"`
SimilarQuestions []string `json:"similar_questions"`
Remark string `json:"remark"`
}
@@ -80,8 +80,8 @@ type UpdateKnowledgeFAQRequest struct {
}
type BatchMoveKnowledgeFAQRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
DirectoryID int64 `json:"directoryId"`
KnowledgeBaseID int64 `json:"knowledge_base_id"`
DirectoryID int64 `json:"directory_id"`
IDs []int64 `json:"ids"`
}
@@ -105,33 +105,33 @@ type ImportKnowledgeFAQRequest struct {
}
type KnowledgeSearchRequest struct {
KnowledgeBaseIDs []int64 `json:"knowledgeBaseIds"`
KnowledgeBaseIDs []int64 `json:"knowledge_base_ids"`
Question string `json:"question"`
TopK int `json:"topK"`
ScoreThreshold float64 `json:"scoreThreshold"`
RerankLimit int `json:"rerankLimit"`
TopK int `json:"top_k"`
ScoreThreshold float64 `json:"score_threshold"`
RerankLimit int `json:"rerank_limit"`
Channel string `json:"channel"`
Scene string `json:"scene"`
SessionID string `json:"sessionId"`
ConversationID int64 `json:"conversationId"`
SessionID string `json:"session_id"`
ConversationID int64 `json:"conversation_id"`
}
type KnowledgeAnswerRequest struct {
KnowledgeBaseIDs []int64 `json:"knowledgeBaseIds"`
KnowledgeBaseIDs []int64 `json:"knowledge_base_ids"`
Question string `json:"question"`
TopK int `json:"topK"`
ScoreThreshold float64 `json:"scoreThreshold"`
RerankLimit int `json:"rerankLimit"`
TopK int `json:"top_k"`
ScoreThreshold float64 `json:"score_threshold"`
RerankLimit int `json:"rerank_limit"`
Channel string `json:"channel"`
Scene string `json:"scene"`
SessionID string `json:"sessionId"`
ConversationID int64 `json:"conversationId"`
AnswerMode int `json:"answerMode"`
SessionID string `json:"session_id"`
ConversationID int64 `json:"conversation_id"`
AnswerMode int `json:"answer_mode"`
}
type CreateKnowledgeFeedbackRequest struct {
RetrieveLogID int64 `json:"retrieveLogId"`
FeedbackType int `json:"feedbackType"`
FeedbackReason string `json:"feedbackReason"`
RetrieveLogID int64 `json:"retrieve_log_id"`
FeedbackType int `json:"feedback_type"`
FeedbackReason string `json:"feedback_reason"`
Remark string `json:"remark"`
}
-11
View File
@@ -1,11 +0,0 @@
package request
type MCPServerDebugRequest struct {
ServerCode string `json:"serverCode"`
}
type MCPCallToolRequest struct {
ServerCode string `json:"serverCode"`
ToolName string `json:"toolName"`
Arguments map[string]any `json:"arguments"`
}
+7 -7
View File
@@ -3,19 +3,19 @@ package request
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type MessageListRequest struct {
ConversationID int64 `json:"conversationId"`
SenderType string `json:"senderType"`
MessageType string `json:"messageType"`
ConversationID int64 `json:"conversation_id"`
SenderType string `json:"sender_type"`
MessageType string `json:"message_type"`
}
type SendConversationMessageRequest struct {
ConversationID int64 `json:"conversationId"`
MessageType enums.IMMessageType `json:"messageType"`
ConversationID int64 `json:"conversation_id"`
MessageType enums.IMMessageType `json:"message_type"`
Content string `json:"content"`
Payload string `json:"payload"`
ClientMsgID string `json:"clientMsgId"`
ClientMsgID string `json:"client_msg_id"`
}
type RecallConversationMessageRequest struct {
MessageID int64 `json:"messageId"`
MessageID int64 `json:"message_id"`
}
@@ -1,13 +1,13 @@
package request
type CreateNotificationRequest struct {
RecipientUserID int64 `json:"recipientUserId"`
RecipientUserID int64 `json:"recipient_user_id"`
Title string `json:"title"`
Content string `json:"content"`
NotificationType string `json:"notificationType"`
BizType string `json:"bizType"`
BizID int64 `json:"bizId"`
ActionURL string `json:"actionUrl"`
NotificationType string `json:"notification_type"`
BizType string `json:"biz_type"`
BizID int64 `json:"biz_id"`
ActionURL string `json:"action_url"`
}
type MarkNotificationReadRequest struct {
@@ -3,17 +3,17 @@ package request
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type QuickReplyListRequest struct {
GroupName string `json:"groupName"`
GroupName string `json:"group_name"`
Keyword string `json:"keyword"`
Status int `json:"status"`
}
type CreateQuickReplyRequest struct {
GroupName string `json:"groupName"`
GroupName string `json:"group_name"`
Title string `json:"title"`
Content string `json:"content"`
Status enums.Status `json:"status"`
SortNo int `json:"sortNo"`
SortNo int `json:"sort_no"`
}
type UpdateQuickReplyRequest struct {
-47
View File
@@ -1,47 +0,0 @@
package request
type SkillDefinitionListRequest struct {
Name string `json:"name"`
Status int `json:"status"`
}
type CreateSkillDefinitionRequest struct {
Name string `json:"name"`
Description string `json:"description"`
Instruction string `json:"instruction"`
Examples []string `json:"examples"`
ToolWhitelist []string `json:"toolWhitelist"`
Remark string `json:"remark"`
}
type UpdateSkillDefinitionRequest struct {
ID int64 `json:"id"`
CreateSkillDefinitionRequest
}
type DeleteSkillDefinitionRequest struct {
ID int64 `json:"id"`
}
type RestoreSkillDefinitionRequest struct {
ID int64 `json:"id"`
}
type UpdateSkillDefinitionStatusRequest struct {
ID int64 `json:"id"`
Status int `json:"status"`
}
type SkillDebugRunRequest struct {
AIAgentID int64 `json:"aiAgentId"`
ConversationID int64 `json:"conversationId"`
SkillDefinitionID int64 `json:"skillDefinitionId"`
UserMessage string `json:"userMessage"`
}
type SkillDebugResumeRequest struct {
AIAgentID int64 `json:"aiAgentId"`
ConversationID int64 `json:"conversationId"`
CheckPointID string `json:"checkPointId"`
UserMessage string `json:"userMessage"`
}
@@ -0,0 +1,56 @@
package request
import (
"go/ast"
"go/parser"
"go/token"
"reflect"
"strconv"
"strings"
"testing"
"unicode"
)
func TestRequestStructTagsUseSnakeCase(t *testing.T) {
fset := token.NewFileSet()
packages, err := parser.ParseDir(fset, ".", nil, 0)
if err != nil {
t.Fatalf("parse request package: %v", err)
}
for _, pkg := range packages {
for filename, file := range pkg.Files {
ast.Inspect(file, func(node ast.Node) bool {
field, ok := node.(*ast.Field)
if !ok || field.Tag == nil {
return true
}
rawTag, err := strconv.Unquote(field.Tag.Value)
if err != nil {
t.Errorf("%s: invalid struct tag %s: %v", filename, field.Tag.Value, err)
return true
}
for _, key := range []string{"json", "form", "query", "uri"} {
name := strings.Split(reflect.StructTag(rawTag).Get(key), ",")[0]
if name == "" || name == "-" {
continue
}
if !isSnakeCaseRequestName(name) {
t.Errorf("%s: %s tag %q must use snake_case", filename, key, name)
}
}
return true
})
}
}
}
func isSnakeCaseRequestName(name string) bool {
for _, r := range name {
if unicode.IsLower(r) || unicode.IsDigit(r) || r == '_' {
continue
}
return false
}
return true
}
-27
View File
@@ -1,27 +0,0 @@
package request
type TagListRequest struct {
ParentID int64 `json:"parentId"`
Name string `json:"name"`
Status int `json:"status"`
}
type CreateTagRequest struct {
ParentID int64 `json:"parentId"`
Name string `json:"name"`
Remark string `json:"remark"`
}
type UpdateTagRequest struct {
ID int64 `json:"id"`
CreateTagRequest
}
type DeleteTagRequest struct {
ID int64 `json:"id"`
}
type UpdateTagStatusRequest struct {
ID int64 `json:"id"`
Status int `json:"status"`
}
@@ -1,59 +0,0 @@
package request
type CreateTicketRequest struct {
Title string `json:"title"`
Description string `json:"description"`
Source string `json:"source"`
Channel string `json:"channel"`
CustomerID int64 `json:"customerId"`
ConversationID int64 `json:"conversationId"`
TagIDs []int64 `json:"tagIds"`
CurrentAssigneeID int64 `json:"currentAssigneeId"`
}
type CreateTicketFromConversationRequest struct {
ConversationID int64 `json:"conversationId"`
Title string `json:"title"`
Description string `json:"description"`
TagIDs []int64 `json:"tagIds"`
CurrentAssigneeID int64 `json:"currentAssigneeId"`
}
type UpdateTicketRequest struct {
TicketID int64 `json:"ticketId"`
Title string `json:"title"`
Description string `json:"description"`
TagIDs []int64 `json:"tagIds"`
CurrentAssigneeID int64 `json:"currentAssigneeId"`
}
type LinkTicketCustomerRequest struct {
TicketID int64 `json:"ticketId"`
CustomerID int64 `json:"customerId"`
}
type AssignTicketRequest struct {
TicketID int64 `json:"ticketId"`
ToUserID int64 `json:"toUserId"`
Reason string `json:"reason"`
}
type ChangeTicketStatusRequest struct {
TicketID int64 `json:"ticketId"`
Status string `json:"status"`
}
type CreateTicketProgressRequest struct {
TicketID int64 `json:"ticketId"`
Content string `json:"content"`
}
type SaveTicketViewRequest struct {
ID int64 `json:"id"`
Name string `json:"name"`
Filters map[string]any `json:"filters"`
}
type DeleteTicketViewRequest struct {
ID int64 `json:"id"`
}