chore: import clean Agent Desk snapshot (2/7)

This commit is contained in:
2026-10-16 11:57:21 +00:00
parent 79176541c7
commit 89c5231c4c
461 changed files with 60092 additions and 0 deletions

83
internal/pkg/dto/dto.go Normal file
View File

@@ -0,0 +1,83 @@
package dto
import "agent-desk/internal/pkg/enums"
type AuthPrincipal struct {
UserID int64
Username string
Nickname string
Avatar string
UserType enums.UserType
Status enums.Status
Roles []string
Permissions []string
}
type WebChannelConfig struct {
Title string `json:"title"`
Subtitle string `json:"subtitle"`
ThemeColor string `json:"themeColor"`
Position string `json:"position"`
Width string `json:"width"`
UserTokenSecret string `json:"userTokenSecret,omitempty"`
PromptStarters []string `json:"promptStarters,omitempty"`
}
type TelegramChannelConfig struct {
BotToken string `json:"botToken"`
BotUsername string `json:"botUsername,omitempty"`
WebhookSecret string `json:"webhookSecret,omitempty"`
WelcomeMessage string `json:"welcomeMessage,omitempty"`
}
type ZaloOAChannelConfig struct {
AppID string `json:"appId,omitempty"`
OAID string `json:"oaId,omitempty"`
SecretKey string `json:"secretKey,omitempty"`
AccessToken string `json:"accessToken"`
RefreshToken string `json:"refreshToken,omitempty"`
WebhookSecret string `json:"webhookSecret,omitempty"`
WelcomeMessage string `json:"welcomeMessage,omitempty"`
}
type SlackChannelConfig struct {
BotToken string `json:"botToken,omitempty"` // xoxb-... Bot Token
SigningSecret string `json:"signingSecret,omitempty"` // Slack Signing Secret
AppID string `json:"appId,omitempty"` // Slack App ID
TeamID string `json:"teamId,omitempty"` // Slack Workspace Team ID
TeamName string `json:"teamName,omitempty"` // Slack Workspace Team Name
DefaultChannel string `json:"defaultChannel,omitempty"` // Default channel to post
}
type EmailChannelConfig struct {
EmailAddress string `json:"emailAddress,omitempty"`
ForwardingAddress string `json:"forwardingAddress,omitempty"`
SenderName string `json:"senderName,omitempty"`
Provider string `json:"provider,omitempty"`
APIKey string `json:"apiKey,omitempty"`
SMTPHost string `json:"smtpHost,omitempty"`
SMTPPort int `json:"smtpPort,omitempty"`
SMTPUser string `json:"smtpUser,omitempty"`
SMTPPassword string `json:"smtpPassword,omitempty"`
// SMTPUseTLS is a pointer so "not set" stays distinguishable from an explicit
// false. A plain bool cannot say that, and inheriting the system value is the
// wrong answer for a channel deliberately bound to a plaintext test server.
SMTPUseTLS *bool `json:"smtpUseTls,omitempty"`
// SMTPAllowInsecure accepts a self-signed certificate and skips opportunistic
// STARTTLS, so a channel can be bound to a local test SMTP server. Never
// enable it for a real mailbox.
SMTPAllowInsecure bool `json:"smtpAllowInsecure,omitempty"`
WebhookSecret string `json:"webhookSecret,omitempty"`
WelcomeMessage string `json:"welcomeMessage,omitempty"`
}
type DiscordChannelConfig struct {
GuildID string `json:"guildId,omitempty"`
GuildName string `json:"guildName,omitempty"`
ChannelScope string `json:"channelScope,omitempty"` // all | dm_only
BotToken string `json:"botToken,omitempty"`
ApplicationID string `json:"applicationId,omitempty"`
PublicKey string `json:"publicKey,omitempty"`
WebhookSecret string `json:"webhookSecret,omitempty"`
WelcomeMessage string `json:"welcomeMessage,omitempty"`
}

View File

@@ -0,0 +1,96 @@
package request
import "agent-desk/internal/pkg/enums"
type RevokeSessionRequest struct {
ID int64 `json:"id"`
}
type RevokeUserSessionsRequest struct {
UserID int64 `json:"userId"`
}
type CreateUserRequest struct {
Username string `json:"username"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Mobile *string `json:"mobile"`
Email *string `json:"email"`
Remark string `json:"remark"`
RoleIDs []int64 `json:"roleIds"`
}
type UpdateUserRequest struct {
ID int64 `json:"id"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Mobile *string `json:"mobile"`
Email *string `json:"email"`
Remark string `json:"remark"`
}
type DeleteUserRequest struct {
ID int64 `json:"id"`
}
type UpdateUserStatusRequest struct {
ID int64 `json:"id"`
Status int `json:"status"`
}
type ChangePasswordRequest struct {
Password string `json:"password"`
}
type AssignRoleRequest struct {
UserID int64 `json:"userId"`
RoleIDs []int64 `json:"roleIds"`
}
type CreateRoleRequest struct {
Name string `json:"name"`
Code string `json:"code"`
Remark string `json:"remark"`
}
type UpdateRoleRequest struct {
ID int64 `json:"id"`
Name string `json:"name"`
SortNo int `json:"sortNo"`
Remark string `json:"remark"`
}
type DeleteRoleRequest struct {
ID int64 `json:"id"`
}
type UpdateRoleStatusRequest struct {
ID int64 `json:"id"`
Status enums.Status `json:"status"`
}
type AssignPermissionRequest struct {
RoleID int64 `json:"roleId"`
PermissionIDs []int64 `json:"permissionIds"`
}
type CreateConversationTagRequest struct {
Name string `json:"name"`
Color string `json:"color"`
Status int `json:"status"`
SortNo int `json:"sortNo"`
Remark string `json:"remark"`
}
type UpdateConversationTagRequest struct {
ID int64 `json:"id"`
Name string `json:"name"`
Color string `json:"color"`
Status int `json:"status"`
SortNo int `json:"sortNo"`
Remark string `json:"remark"`
}
type DeleteConversationTagRequest struct {
ID int64 `json:"id"`
}

View File

@@ -0,0 +1,14 @@
package request
type RunAgentEvaluationRequest struct {
AIAgentID int64 `json:"aiAgentId"`
Cases []AgentEvaluationCase `json:"cases"`
}
type AgentEvaluationCase struct {
ID string `json:"id"`
Category string `json:"category"`
Message string `json:"message"`
History []string `json:"history,omitempty"`
Expect map[string]any `json:"expect,omitempty"`
}

View File

@@ -0,0 +1,80 @@
package request
import "agent-desk/internal/pkg/enums"
type CreateAgentProfileRequest struct {
UserID int64 `json:"userId"`
TeamID int64 `json:"teamId"`
AgentCode string `json:"agentCode"`
DisplayName string `json:"displayName"`
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"`
Remark string `json:"remark"`
}
type UpdateAgentProfileRequest struct {
ID int64 `json:"id"`
CreateAgentProfileRequest
}
type DeleteAgentProfileRequest struct {
ID int64 `json:"id"`
}
type CreateAgentTeamRequest struct {
Name string `json:"name"`
LeaderUserID int64 `json:"leaderUserId"`
Status int `json:"status"`
Description string `json:"description"`
Remark string `json:"remark"`
}
type UpdateAgentTeamRequest struct {
ID int64 `json:"id"`
Name string `json:"name"`
LeaderUserID int64 `json:"leaderUserId"`
Status int `json:"status"`
Description string `json:"description"`
Remark string `json:"remark"`
}
type DeleteAgentTeamRequest struct {
ID int64 `json:"id"`
}
type CreateAgentTeamScheduleRequest struct {
TeamID int64 `json:"teamId"`
StartAt string `json:"startAt"`
EndAt string `json:"endAt"`
Remark string `json:"remark"`
}
type UpdateAgentTeamScheduleRequest struct {
ID int64 `json:"id"`
CreateAgentTeamScheduleRequest
}
type DeleteAgentTeamScheduleRequest struct {
ID int64 `json:"id"`
}
type AgentTeamScheduleCalendarRequest struct {
StartAt string `json:"startAt"`
EndAt string `json:"endAt"`
TeamID int64 `json:"teamId"`
}
type AgentTeamScheduleBatchRequest struct {
TeamIDs []int64 `json:"teamIds"`
StartDate string `json:"startDate"`
EndDate string `json:"endDate"`
Weekdays []int `json:"weekdays"`
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
Remark string `json:"remark"`
Locale string `json:"-"`
}

View File

@@ -0,0 +1,10 @@
package request
import "agent-desk/internal/pkg/enums"
type SaveAgentRunQualityFeedbackRequest struct {
AgentRunID int64 `json:"agentRunId"`
ResolutionStatus enums.AgentRunResolutionStatus `json:"resolutionStatus"`
EvidenceStatus enums.AgentRunEvidenceStatus `json:"evidenceStatus"`
Comment string `json:"comment"`
}

View File

@@ -0,0 +1,9 @@
package request
type SuggestReplyRequest struct {
ConversationID int64 `json:"conversationId"`
}
type SummarizeConversationRequest struct {
ConversationID int64 `json:"conversationId"`
}

View File

@@ -0,0 +1,106 @@
package request
import "agent-desk/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"`
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"`
Remark string `json:"remark"`
}
type UpdateAIConfigRequest struct {
ID int64 `json:"id"`
CreateAIConfigRequest
}
type DeleteAIConfigRequest struct {
ID int64 `json:"id"`
}
type UpdateAIConfigStatusRequest struct {
ID int64 `json:"id"`
Status enums.Status `json:"status"`
}
type CreateAIAgentRequest struct {
Name string `json:"name"`
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"`
AutoHandoffOnFailure *bool `json:"autoHandoffOnFailure"`
HandoffMessage string `json:"handoffMessage"`
OffHoursMessage string `json:"offHoursMessage"`
}
type UpdateAIAgentRequest struct {
ID int64 `json:"id"`
CreateAIAgentRequest
}
type DeleteAIAgentRequest struct {
ID int64 `json:"id"`
}
type PublishAIAgentRequest struct {
ID int64 `json:"id"`
}
type RollbackAIAgentRequest struct {
ID int64 `json:"id"`
RevisionID int64 `json:"revisionId"`
}
type RollbackAIAgentRolloutRequest struct {
ID int64 `json:"id"`
}
type UpdateAIAgentStatusRequest struct {
ID int64 `json:"id"`
Status int `json:"status"`
}

View File

@@ -0,0 +1,36 @@
package request
import "agent-desk/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"`
}

View File

@@ -0,0 +1,9 @@
package request
type CreateAssetRequest struct {
Prefix string `form:"prefix"`
}
type DeleteAssetRequest struct {
ID int64 `json:"id"`
}

View File

@@ -0,0 +1,16 @@
package request
type LoginRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}
type UpdateProfileRequest struct {
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Email *string `json:"email"`
}
type OIDCExchangeRequest struct {
Ticket string `json:"ticket"`
}

View File

@@ -0,0 +1,34 @@
package request
type CreateChannelRequest struct {
ChannelType string `json:"channelType"`
AIAgentID int64 `json:"aiAgentId"`
AIAgentRolloutPercent int `json:"aiAgentRolloutPercent"`
Name string `json:"name"`
ConfigJSON string `json:"configJson"`
Status int `json:"status"`
Remark string `json:"remark"`
}
type UpdateChannelRequest struct {
ID int64 `json:"id"`
CreateChannelRequest
}
type UpdateChannelStatusRequest struct {
ID int64 `json:"id"`
Status int `json:"status"`
}
type RollbackChannelAIAgentRolloutRequest struct {
ID int64 `json:"id"`
}
type DeleteChannelRequest struct {
ID int64 `json:"id"`
}
type ResetChannelUserTokenSecretRequest struct {
ID int64 `json:"id"`
}

View File

@@ -0,0 +1,21 @@
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"`
}

View File

@@ -0,0 +1,67 @@
package request
type AgentConversationFilter string
const (
AgentConversationFilterAIServing AgentConversationFilter = "ai_serving"
AgentConversationFilterMine AgentConversationFilter = "mine"
AgentConversationFilterActive AgentConversationFilter = "active"
AgentConversationFilterPending AgentConversationFilter = "pending"
AgentConversationFilterClosed AgentConversationFilter = "closed"
)
type ConversationListRequest struct {
Status int `json:"status"`
ServiceMode int `json:"serviceMode"`
CurrentAssigneeID int64 `json:"currentAssigneeId"`
Keyword string `json:"keyword"`
TagID int64 `json:"tagId"`
}
type AssignConversationRequest struct {
ConversationID int64 `json:"conversationId"`
AssigneeID int64 `json:"assigneeId"`
Reason string `json:"reason"`
}
type DispatchConversationRequest struct {
ConversationID int64 `json:"conversationId"`
}
type TransferConversationRequest struct {
ConversationID int64 `json:"conversationId"`
ToUserID int64 `json:"toUserId"`
Reason string `json:"reason"`
}
type CloseConversationRequest struct {
ConversationID int64 `json:"conversationId"`
CloseReason string `json:"closeReason"`
}
// CreateCustomerConversationRequest 访客主动新建请求的入参。
type CreateCustomerConversationRequest struct {
// Subject 是访客填写的请求主题,用于在其请求列表中区分多条会话;留空时由前端用兜底文案。
Subject string `json:"subject"`
}
type ReadConversationRequest struct {
ConversationID int64 `json:"conversationId"`
MessageID int64 `json:"messageId"`
}
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"`
}

View File

@@ -0,0 +1,27 @@
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"`
}

View File

@@ -0,0 +1,72 @@
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"`
}

View File

@@ -0,0 +1,15 @@
package request
// EmailRequestRequest is the body of the API that opens a support request on a
// visitor's behalf and continues the conversation over email.
type EmailRequestRequest struct {
// Email is the visitor's address. It becomes their contact identity, so it
// must be the address their replies will come from.
Email string `json:"email"`
// Name is an optional display name.
Name string `json:"name"`
// Subject is the request title shown in the visitor's request list.
Subject string `json:"subject"`
// Message is the request body. Required.
Message string `json:"message"`
}

View File

@@ -0,0 +1,137 @@
package request
import (
"io"
"agent-desk/internal/pkg/enums"
)
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"`
Remark string `json:"remark"`
}
type UpdateKnowledgeBaseRequest struct {
ID int64 `json:"id"`
CreateKnowledgeBaseRequest
}
type CreateKnowledgeDirectoryRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
ParentID int64 `json:"parentId"`
Name string `json:"name"`
Remark string `json:"remark"`
}
type UpdateKnowledgeDirectoryRequest struct {
ID int64 `json:"id"`
CreateKnowledgeDirectoryRequest
}
type DeleteKnowledgeDirectoryRequest struct {
ID int64 `json:"id"`
}
type CreateKnowledgeDocumentRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
DirectoryID int64 `json:"directoryId"`
Title string `json:"title"`
ContentType enums.KnowledgeDocumentContentType `json:"contentType"`
Content string `json:"content"`
}
type UpdateKnowledgeDocumentRequest struct {
ID int64 `json:"id"`
CreateKnowledgeDocumentRequest
}
type BatchMoveKnowledgeDocumentRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
DirectoryID int64 `json:"directoryId"`
IDs []int64 `json:"ids"`
}
type BatchDeleteKnowledgeDocumentRequest struct {
IDs []int64 `json:"ids"`
}
type CreateKnowledgeFAQRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
DirectoryID int64 `json:"directoryId"`
Question string `json:"question"`
Answer string `json:"answer"`
SimilarQuestions []string `json:"similarQuestions"`
Remark string `json:"remark"`
}
type UpdateKnowledgeFAQRequest struct {
ID int64 `json:"id"`
CreateKnowledgeFAQRequest
}
type BatchMoveKnowledgeFAQRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
DirectoryID int64 `json:"directoryId"`
IDs []int64 `json:"ids"`
}
type BatchDeleteKnowledgeFAQRequest struct {
IDs []int64 `json:"ids"`
}
type KnowledgeFAQImportMode string
const (
KnowledgeFAQImportModeAppend KnowledgeFAQImportMode = "append"
KnowledgeFAQImportModeOverwrite KnowledgeFAQImportMode = "overwrite"
)
type ImportKnowledgeFAQRequest struct {
KnowledgeBaseID int64
Mode KnowledgeFAQImportMode
Filename string
Reader io.Reader
Locale string
}
type KnowledgeSearchRequest struct {
KnowledgeBaseIDs []int64 `json:"knowledgeBaseIds"`
Question string `json:"question"`
TopK int `json:"topK"`
ScoreThreshold float64 `json:"scoreThreshold"`
RerankLimit int `json:"rerankLimit"`
Channel string `json:"channel"`
Scene string `json:"scene"`
SessionID string `json:"sessionId"`
ConversationID int64 `json:"conversationId"`
}
type KnowledgeAnswerRequest struct {
KnowledgeBaseIDs []int64 `json:"knowledgeBaseIds"`
Question string `json:"question"`
TopK int `json:"topK"`
ScoreThreshold float64 `json:"scoreThreshold"`
RerankLimit int `json:"rerankLimit"`
Channel string `json:"channel"`
Scene string `json:"scene"`
SessionID string `json:"sessionId"`
ConversationID int64 `json:"conversationId"`
AnswerMode int `json:"answerMode"`
}
type CreateKnowledgeFeedbackRequest struct {
RetrieveLogID int64 `json:"retrieveLogId"`
FeedbackType int `json:"feedbackType"`
FeedbackReason string `json:"feedbackReason"`
Remark string `json:"remark"`
}

View File

@@ -0,0 +1,11 @@
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"`
}

View File

@@ -0,0 +1,21 @@
package request
import "agent-desk/internal/pkg/enums"
type MessageListRequest struct {
ConversationID int64 `json:"conversationId"`
SenderType string `json:"senderType"`
MessageType string `json:"messageType"`
}
type SendConversationMessageRequest struct {
ConversationID int64 `json:"conversationId"`
MessageType enums.IMMessageType `json:"messageType"`
Content string `json:"content"`
Payload string `json:"payload"`
ClientMsgID string `json:"clientMsgId"`
}
type RecallConversationMessageRequest struct {
MessageID int64 `json:"messageId"`
}

View File

@@ -0,0 +1,15 @@
package request
type CreateNotificationRequest struct {
RecipientUserID int64 `json:"recipientUserId"`
Title string `json:"title"`
Content string `json:"content"`
NotificationType string `json:"notificationType"`
BizType string `json:"bizType"`
BizID int64 `json:"bizId"`
ActionURL string `json:"actionUrl"`
}
type MarkNotificationReadRequest struct {
ID int64 `json:"id"`
}

View File

@@ -0,0 +1,5 @@
package request
type OrganizationSwitchRequest struct {
OrganizationID int64 `json:"organizationId"`
}

View File

@@ -0,0 +1,26 @@
package request
import "agent-desk/internal/pkg/enums"
type QuickReplyListRequest struct {
GroupName string `json:"groupName"`
Keyword string `json:"keyword"`
Status int `json:"status"`
}
type CreateQuickReplyRequest struct {
GroupName string `json:"groupName"`
Title string `json:"title"`
Content string `json:"content"`
Status enums.Status `json:"status"`
SortNo int `json:"sortNo"`
}
type UpdateQuickReplyRequest struct {
ID int64 `json:"id"`
CreateQuickReplyRequest
}
type DeleteQuickReplyRequest struct {
ID int64 `json:"id"`
}

View File

@@ -0,0 +1,7 @@
package request
type SubmitSatisfactionRequest struct {
ConversationID int64 `json:"conversationId"`
Score int `json:"score"`
Feedback string `json:"feedback"`
}

View File

@@ -0,0 +1,11 @@
package request
type SetupSimulateRouteRequest struct {
ChannelID int64 `json:"channel_id" form:"channel_id"`
BypassAI bool `json:"bypass_ai" form:"bypass_ai"`
}
type SetupQuickFixRequest struct {
Action string `json:"action" form:"action"`
EntityID int64 `json:"entity_id" form:"entity_id"`
}

View File

@@ -0,0 +1,47 @@
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"`
}

View File

@@ -0,0 +1,128 @@
package request
import "agent-desk/internal/pkg/enums"
type SupportCustomerRegisterRequest struct {
Name string `json:"name"`
Email string `json:"email"`
Password string `json:"password"`
}
type SaveDocPageRequest struct {
ID int64 `json:"id"`
ParentID int64 `json:"parentId"`
Title string `json:"title"`
Slug string `json:"slug"`
Summary string `json:"summary"`
ContentType string `json:"contentType"`
Content string `json:"content"`
CoverURL string `json:"coverUrl"`
Tags []string `json:"tags"`
Status enums.DocPageStatus `json:"status"`
SortNo int `json:"sortNo"`
Remark string `json:"remark"`
}
type UpdateDocPageSettingsRequest struct {
ID int64 `json:"id"`
ParentID int64 `json:"parentId"`
Slug string `json:"slug"`
Summary string `json:"summary"`
}
type SortDocPagesRequest struct {
ParentID int64 `json:"parentId"`
IDs []int64 `json:"ids"`
}
type ChangeDocPageStatusRequest struct {
ID int64 `json:"id"`
Status enums.DocPageStatus `json:"status"`
}
type SaveCategoryRequest struct {
ID int64 `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
Description string `json:"description"`
Status enums.Status `json:"status"`
Remark string `json:"remark"`
}
type CreatePostRequest struct {
CategoryID int64 `json:"categoryId"`
Title string `json:"title"`
ContentType string `json:"contentType"`
Content string `json:"content"`
Tags []string `json:"tags"`
}
type UpdatePostRequest struct {
ID int64 `json:"id"`
CategoryID int64 `json:"categoryId"`
Title string `json:"title"`
ContentType string `json:"contentType"`
Content string `json:"content"`
Tags []string `json:"tags"`
}
type ModeratePostRequest struct {
ID int64 `json:"id"`
Status enums.PostStatus `json:"status"`
}
type CreateCommentRequest struct {
PostID int64 `json:"postId"`
ParentID int64 `json:"parentId"`
ContentType string `json:"contentType"`
Content string `json:"content"`
}
type UpdateCommentRequest struct {
ID int64 `json:"id"`
ContentType string `json:"contentType"`
Content string `json:"content"`
}
type ModerateCommentRequest struct {
ID int64 `json:"id"`
Status enums.CommentStatus `json:"status"`
}
type IDRequest struct {
ID int64 `json:"id"`
}
type ReactionRequest struct {
TargetType enums.ReactionTarget `json:"targetType"`
TargetID int64 `json:"targetId"`
ReactionType enums.ReactionType `json:"reactionType"`
}
type ReportCommentRequest struct {
ID int64 `json:"id"`
Reason string `json:"reason"`
}
type AcceptCommentRequest struct {
PostID int64 `json:"postId"`
CommentID int64 `json:"commentId"`
}
type DocPageFeedbackRequest struct {
ID int64 `json:"id"`
Helpful bool `json:"helpful"`
}
type DeleteByIDRequest struct {
ID int64 `json:"id"`
}
type SupportNavigationMenuItemRequest struct {
ID string `json:"id"`
Title string `json:"title"`
URL string `json:"url"`
OpenInNewWindow bool `json:"openInNewWindow"`
Visible *bool `json:"visible"`
Children []SupportNavigationMenuItemRequest `json:"children"`
}

View File

@@ -0,0 +1,27 @@
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"`
}

View File

@@ -0,0 +1,59 @@
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"`
}

View File

@@ -0,0 +1,20 @@
package request
type OrgSyncEventData struct {
OrgID string `json:"org_id"`
OrgName string `json:"org_name"`
UserID string `json:"user_id"`
UserEmail string `json:"user_email"`
UserName string `json:"user_name"`
Role string `json:"role"`
Plan string `json:"plan"`
}
type OrgSyncWebhookRequest struct {
Event string `json:"event"`
Timestamp string `json:"timestamp"`
Data OrgSyncEventData `json:"data"`
}
type DOSOrgSyncEventData = OrgSyncEventData
type DOSOrgSyncWebhookRequest = OrgSyncWebhookRequest

View File

@@ -0,0 +1,64 @@
package response
import "agent-desk/internal/pkg/enums"
type PermissionResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
Type string `json:"type"`
GroupName string `json:"groupName"`
Method string `json:"method"`
ApiPath string `json:"apiPath"`
Status enums.Status `json:"status"`
SortNo int `json:"sortNo"`
}
type PermissionSyncResponse struct {
Created int `json:"created"`
Updated int `json:"updated"`
RolePermissionsAdded int `json:"rolePermissionsAdded"`
}
type RoleResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
Status enums.Status `json:"status"`
IsSystem bool `json:"isSystem"`
SortNo int `json:"sortNo"`
Permissions []string `json:"permissions,omitempty"`
}
type UserResponse struct {
ID int64 `json:"id"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Mobile string `json:"mobile,omitempty"`
Email string `json:"email,omitempty"`
UserType enums.UserType `json:"userType"`
Status enums.Status `json:"status"`
LastLoginAt string `json:"lastLoginAt,omitempty"`
LastLoginIP string `json:"lastLoginIp,omitempty"`
Roles []RoleResponse `json:"roles,omitempty"`
Permissions []string `json:"permissions,omitempty"`
}
// CreateUserResultResponse 创建用户成功响应;password 仅在本次响应中返回一次。
type CreateUserResultResponse struct {
User *UserResponse `json:"user"`
Password string `json:"password"`
}
type SessionResponse struct {
ID int64 `json:"id"`
UserID int64 `json:"userId"`
Username string `json:"username"`
ClientType string `json:"clientType"`
ClientIP string `json:"clientIp"`
UserAgent string `json:"userAgent"`
ExpiredAt string `json:"expiredAt"`
RevokedAt string `json:"revokedAt"`
LastSeenAt string `json:"lastSeenAt"`
}

View File

@@ -0,0 +1,18 @@
package response
type AgentEvaluationResultResponse struct {
CaseID string `json:"caseId"`
Category string `json:"category"`
Passed bool `json:"passed"`
ReplyText string `json:"replyText"`
Interrupted bool `json:"interrupted"`
Error string `json:"error,omitempty"`
Finding string `json:"finding,omitempty"`
}
type AgentEvaluationReportResponse struct {
Total int `json:"total"`
Passed int `json:"passed"`
Results []AgentEvaluationResultResponse `json:"results"`
CSV string `json:"csv"`
}

View File

@@ -0,0 +1,65 @@
package response
import "agent-desk/internal/pkg/enums"
type AgentProfileResponse struct {
ID int64 `json:"id"`
UserID int64 `json:"userId"`
TeamID int64 `json:"teamId"`
TeamName string `json:"teamName,omitempty"`
Username string `json:"username,omitempty"`
Nickname string `json:"nickname,omitempty"`
AgentCode string `json:"agentCode"`
DisplayName string `json:"displayName"`
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"`
LastOnlineAt string `json:"lastOnlineAt,omitempty"`
LastStatusAt string `json:"lastStatusAt,omitempty"`
Remark string `json:"remark"`
}
type AgentTeamResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
LeaderUserID int64 `json:"leaderUserId"`
LeaderUsername string `json:"leaderUsername,omitempty"`
LeaderNickname string `json:"leaderNickname,omitempty"`
Status enums.Status `json:"status"`
Description string `json:"description"`
Remark string `json:"remark"`
}
type AgentTeamScheduleResponse struct {
ID int64 `json:"id"`
TeamID int64 `json:"teamId"`
TeamName string `json:"teamName,omitempty"`
StartAt string `json:"startAt"`
EndAt string `json:"endAt"`
Remark string `json:"remark"`
}
type AgentTeamScheduleBatchPreviewResponse struct {
Total int `json:"total"`
Conflict bool `json:"conflict"`
Items []AgentTeamScheduleBatchPreviewItem `json:"items"`
}
type AgentTeamScheduleBatchPreviewItem struct {
TeamID int64 `json:"teamId"`
TeamName string `json:"teamName"`
Date string `json:"date"`
Weekday int `json:"weekday"`
StartAt string `json:"startAt"`
EndAt string `json:"endAt"`
Remark string `json:"remark"`
Conflict bool `json:"conflict"`
ConflictReason string `json:"conflictReason"`
}
type AgentTeamScheduleBatchGenerateResponse struct {
Created int `json:"created"`
}

View File

@@ -0,0 +1,27 @@
package response
import (
"encoding/json"
"testing"
)
func TestAgentTeamScheduleResponseOmitsSourceType(t *testing.T) {
payload, err := json.Marshal(AgentTeamScheduleResponse{
ID: 1,
TeamID: 2,
StartAt: "2026-04-29 09:00:00",
EndAt: "2026-04-29 18:00:00",
Remark: "test",
})
if err != nil {
t.Fatalf("marshal response error = %v", err)
}
var decoded map[string]any
if err := json.Unmarshal(payload, &decoded); err != nil {
t.Fatalf("unmarshal response error = %v", err)
}
if _, ok := decoded["sourceType"]; ok {
t.Fatalf("sourceType should not be exposed: %s", payload)
}
}

View File

@@ -0,0 +1,65 @@
package response
import "agent-desk/internal/pkg/enums"
type AgentRunResponse struct {
ID int64 `json:"id"`
ConversationID int64 `json:"conversationId"`
AIAgentID int64 `json:"aiAgentId"`
AgentRevisionID int64 `json:"agentRevisionId"`
SourceMessageID int64 `json:"sourceMessageId"`
WorkflowRunID int64 `json:"workflowRunId"`
Status string `json:"status"`
PromptTokens int `json:"promptTokens"`
CompletionTokens int `json:"completionTokens"`
StartedAt string `json:"startedAt"`
EndedAt string `json:"endedAt"`
DurationMS int64 `json:"durationMs"`
ErrorMessage string `json:"errorMessage"`
TraceData string `json:"traceData"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Steps []AgentStepResponse `json:"steps,omitempty"`
ToolCalls []AgentToolCallResponse `json:"toolCalls,omitempty"`
QualityFeedback *AgentRunQualityFeedbackResponse `json:"qualityFeedback,omitempty"`
}
type AgentRunQualityFeedbackResponse struct {
ID int64 `json:"id"`
AgentRunID int64 `json:"agentRunId"`
ResolutionStatus enums.AgentRunResolutionStatus `json:"resolutionStatus"`
EvidenceStatus enums.AgentRunEvidenceStatus `json:"evidenceStatus"`
Comment string `json:"comment"`
UpdateUserName string `json:"updateUserName"`
UpdatedAt string `json:"updatedAt"`
}
type AgentStepResponse struct {
ID int64 `json:"id"`
AgentRunID int64 `json:"agentRunId"`
WorkflowRunID int64 `json:"workflowRunId"`
StepType string `json:"stepType"`
StepCode string `json:"stepCode"`
Status string `json:"status"`
InputPreview string `json:"inputPreview"`
OutputPreview string `json:"outputPreview"`
ErrorMessage string `json:"errorMessage"`
StartedAt string `json:"startedAt"`
EndedAt string `json:"endedAt"`
DurationMS int `json:"durationMs"`
}
type AgentToolCallResponse struct {
ID int64 `json:"id"`
AgentRunID int64 `json:"agentRunId"`
AgentStepID int64 `json:"agentStepId"`
ToolCode string `json:"toolCode"`
RiskLevel string `json:"riskLevel"`
RequireConfirm bool `json:"requireConfirm"`
Status string `json:"status"`
ArgumentsPreview string `json:"argumentsPreview"`
ResultPreview string `json:"resultPreview"`
ErrorMessage string `json:"errorMessage"`
DurationMS int `json:"durationMs"`
CreatedAt string `json:"createdAt"`
}

View File

@@ -0,0 +1,9 @@
package response
type SuggestReplyResponse struct {
Suggestion string `json:"suggestion"`
}
type ConversationSummaryResponse struct {
Summary string `json:"summary"`
}

View File

@@ -0,0 +1,133 @@
package response
import (
"agent-desk/internal/models"
"agent-desk/internal/pkg/enums"
)
type AIAgentTeamResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
type AIAgentSkillResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
type AIAgentMCPToolResponse 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 AIAgentWorkflowBindingResponse struct {
ID int64 `json:"id"`
WorkflowID int64 `json:"workflowId"`
WorkflowVersionID int64 `json:"workflowVersionId"`
WorkflowName string `json:"workflowName"`
WorkflowVersion int `json:"workflowVersion"`
ToolName string `json:"toolName"`
TriggerInstruction string `json:"triggerInstruction"`
Priority int `json:"priority"`
Enabled bool `json:"enabled"`
}
type AgentRevisionResponse struct {
ID int64 `json:"id"`
AgentID int64 `json:"agentId"`
Revision int `json:"revision"`
Status enums.Status `json:"status"`
DefinitionHash string `json:"definitionHash"`
PublishedAt string `json:"publishedAt"`
PublishedByID int64 `json:"publishedById"`
PublishedByName string `json:"publishedByName"`
}
type AIConfigResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Provider enums.AIProvider `json:"provider"`
BaseURL string `json:"baseUrl"`
HasAPIKey bool `json:"hasApiKey"`
ModelType enums.AIModelType `json:"modelType"`
ModelName string `json:"modelName"`
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"`
Status enums.Status `json:"status"`
SortNo int `json:"sortNo"`
Remark string `json:"remark"`
}
func BuildAIConfigResponse(item *models.AIConfig) AIConfigResponse {
return AIConfigResponse{
ID: item.ID,
Name: item.Name,
Provider: item.Provider,
BaseURL: item.BaseURL,
HasAPIKey: item.APIKey != "",
ModelType: item.ModelType,
ModelName: item.ModelName,
Dimension: item.Dimension,
MaxContextTokens: item.MaxContextTokens,
MaxOutputTokens: item.MaxOutputTokens,
TimeoutMS: item.TimeoutMS,
MaxRetryCount: item.MaxRetryCount,
RPMLimit: item.RPMLimit,
TPMLimit: item.TPMLimit,
Status: item.Status,
SortNo: item.SortNo,
Remark: item.Remark,
}
}
type AIAgentResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Status enums.Status `json:"status"`
StatusName string `json:"statusName"`
AIConfigID int64 `json:"aiConfigId"`
AIConfigName string `json:"aiConfigName"`
MaxSteps int `json:"maxSteps"`
ContextWindow int `json:"contextWindow"`
ToolPolicy string `json:"toolPolicy"`
KnowledgePolicy string `json:"knowledgePolicy"`
ServiceMode enums.IMConversationServiceMode `json:"serviceMode"`
ServiceModeName string `json:"serviceModeName"`
SystemPrompt string `json:"systemPrompt"`
WelcomeMessage string `json:"welcomeMessage"`
ReplyTimeoutSeconds int `json:"replyTimeoutSeconds"`
RolloutPercent int `json:"rolloutPercent"`
PreviousRolloutPercent int `json:"previousRolloutPercent"`
Teams []AIAgentTeamResponse `json:"teams"`
HandoffMode enums.AIAgentHandoffMode `json:"handoffMode"`
HandoffModeName string `json:"handoffModeName"`
FallbackMode enums.AIAgentFallbackMode `json:"fallbackMode"`
FallbackModeName string `json:"fallbackModeName"`
FallbackMessage string `json:"fallbackMessage"`
KnowledgeBaseIDs []int64 `json:"knowledgeBaseIds"`
SkillIDs []int64 `json:"skillIds"`
Skills []AIAgentSkillResponse `json:"skills"`
MCPTools []AIAgentMCPToolResponse `json:"mcpTools"`
WorkflowBindings []AIAgentWorkflowBindingResponse `json:"workflowBindings"`
PublishedRevisionID int64 `json:"publishedRevisionId"`
SortNo int `json:"sortNo"`
AutoHandoffOnFailure bool `json:"autoHandoffOnFailure"`
HandoffMessage string `json:"handoffMessage"`
OffHoursMessage string `json:"offHoursMessage"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
CreateUserName string `json:"createUserName"`
UpdateUserName string `json:"updateUserName"`
}

View File

@@ -0,0 +1,30 @@
package response
import (
"encoding/json"
"testing"
"agent-desk/internal/models"
)
func TestBuildAIConfigResponseOmitsAPIKey(t *testing.T) {
payload, err := json.Marshal(BuildAIConfigResponse(&models.AIConfig{
ID: 1,
Name: "test",
APIKey: "sk-secret",
}))
if err != nil {
t.Fatalf("marshal response error = %v", err)
}
var decoded map[string]any
if err := json.Unmarshal(payload, &decoded); err != nil {
t.Fatalf("unmarshal response error = %v", err)
}
if _, ok := decoded["apiKey"]; ok {
t.Fatalf("apiKey should not be exposed: %s", payload)
}
if got, ok := decoded["hasApiKey"].(bool); !ok || !got {
t.Fatalf("hasApiKey = %v, want true: %s", decoded["hasApiKey"], payload)
}
}

View File

@@ -0,0 +1,111 @@
package response
import (
"agent-desk/internal/ai/workflow/dsl"
workflowregistry "agent-desk/internal/ai/workflow/registry"
workflowvalidator "agent-desk/internal/ai/workflow/validator"
"agent-desk/internal/pkg/enums"
)
type AIWorkflowResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Status enums.Status `json:"status"`
DraftDefinition dsl.Definition `json:"draftDefinition"`
PublishedVersionID int64 `json:"publishedVersionId"`
SortNo int `json:"sortNo"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
CreateUserName string `json:"createUserName"`
UpdateUserName string `json:"updateUserName"`
}
type AIWorkflowVersionResponse struct {
ID int64 `json:"id"`
WorkflowID int64 `json:"workflowId"`
Version int `json:"version"`
Status enums.Status `json:"status"`
Definition dsl.Definition `json:"definition"`
DefinitionHash string `json:"definitionHash"`
PublishedAt string `json:"publishedAt"`
PublishedByID int64 `json:"publishedById"`
PublishedByName string `json:"publishedByName"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type AIWorkflowValidationResponse struct {
Valid bool `json:"valid"`
Errors []workflowvalidator.Error `json:"errors"`
}
type AIWorkflowTemplateResponse struct {
Code string `json:"code"`
Name string `json:"name"`
Description string `json:"description"`
Definition dsl.Definition `json:"definition"`
}
type AIWorkflowUsageResponse struct {
AIAgentID int64 `json:"aiAgentId"`
AIAgentName string `json:"aiAgentName"`
WorkflowVersionID int64 `json:"workflowVersionId"`
WorkflowVersion int `json:"workflowVersion"`
Enabled bool `json:"enabled"`
}
type AIWorkflowNodeSpecResponse struct {
Type string `json:"type"`
Title string `json:"title"`
Description string `json:"description"`
Icon string `json:"icon"`
Category string `json:"category"`
Executable bool `json:"executable"`
RiskLevel workflowregistry.NodeRiskLevel `json:"riskLevel"`
Interruptible bool `json:"interruptible"`
RequiresConfirmationPredecessor bool `json:"requiresConfirmationPredecessor"`
ConfigSchema any `json:"configSchema,omitempty"`
InputSchema []workflowregistry.VariableSpec `json:"inputSchema,omitempty"`
OutputSchema []workflowregistry.VariableSpec `json:"outputSchema,omitempty"`
DefaultInputs map[string]dsl.Value `json:"defaultInputs,omitempty"`
}
type AIWorkflowRunResponse struct {
ID int64 `json:"id"`
WorkflowID int64 `json:"workflowId"`
WorkflowVersionID int64 `json:"workflowVersionId"`
WorkflowVersion int `json:"workflowVersion"`
WorkflowName string `json:"workflowName"`
ConversationID int64 `json:"conversationId"`
AIAgentID int64 `json:"aiAgentId"`
AIAgentName string `json:"aiAgentName"`
MessageID int64 `json:"messageId"`
Status int `json:"status"`
StatusName string `json:"statusName"`
StartedAt string `json:"startedAt"`
EndedAt string `json:"endedAt"`
DurationMS int64 `json:"durationMs"`
InterruptType string `json:"interruptType"`
InterruptNodeID string `json:"interruptNodeId"`
ErrorMessage string `json:"errorMessage"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Definition dsl.Definition `json:"definition"`
Nodes []AIWorkflowNodeRunResponse `json:"nodes,omitempty"`
}
type AIWorkflowNodeRunResponse struct {
ID int64 `json:"id"`
WorkflowRunID int64 `json:"workflowRunId"`
NodeID string `json:"nodeId"`
NodeType string `json:"nodeType"`
Status int `json:"status"`
StatusName string `json:"statusName"`
InputPreview string `json:"inputPreview"`
OutputPreview string `json:"outputPreview"`
ErrorMessage string `json:"errorMessage"`
StartedAt string `json:"startedAt"`
EndedAt string `json:"endedAt"`
DurationMS int `json:"durationMs"`
}

View File

@@ -0,0 +1,21 @@
package response
import "agent-desk/internal/pkg/enums"
type AssetResponse struct {
ID int64 `json:"id"`
AssetID string `json:"assetId"`
Provider enums.AssetProvider `json:"provider"`
Filename string `json:"filename"`
FileSize int64 `json:"fileSize"`
MimeType string `json:"mimeType"`
Status enums.AssetStatus `json:"status"`
StorageKey string `json:"storageKey"`
URL string `json:"url"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
CreateUserID int64 `json:"createUserId"`
CreateUserName string `json:"createUserName"`
UpdateUserID int64 `json:"updateUserId"`
UpdateUserName string `json:"updateUserName"`
}

View File

@@ -0,0 +1,30 @@
package response
import "agent-desk/internal/pkg/enums"
type AuthUserResponse struct {
ID int64 `json:"id"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Email string `json:"email,omitempty"`
UserType enums.UserType `json:"userType"`
Status enums.Status `json:"status"`
Roles []string `json:"roles"`
}
type LoginResponse struct {
AccessToken string `json:"accessToken"`
ExpiresAt string `json:"expiresAt"`
User *AuthUserResponse `json:"user"`
Permissions []string `json:"permissions"`
Roles []string `json:"roles"`
}
type PublicConfigResponse struct {
Language string `json:"language"`
CompanyName string `json:"companyName,omitempty"`
CompanyLogoURL string `json:"companyLogoUrl,omitempty"`
PasswordLoginEnabled bool `json:"passwordLoginEnabled"`
OIDCEnabled bool `json:"oidcEnabled"`
}

View File

@@ -0,0 +1,78 @@
package response
import (
"agent-desk/internal/models"
"agent-desk/internal/pkg/enums"
"agent-desk/internal/pkg/utils"
)
type ChannelResponse struct {
ID int64 `json:"id"`
ChannelType string `json:"channelType"`
ChannelID string `json:"channelId"`
AIAgentID int64 `json:"aiAgentId"`
AIAgentRolloutPercent int `json:"aiAgentRolloutPercent"`
PreviousAIAgentRolloutPercent int `json:"previousAiAgentRolloutPercent"`
AIAgentName string `json:"aiAgentName,omitempty"`
Name string `json:"name"`
ConfigJSON string `json:"configJson"`
Status enums.Status `json:"status"`
Remark string `json:"remark"`
}
type ChannelMessageOutboxResponse struct {
ID int64 `json:"id"`
ChannelType string `json:"channelType"`
ConversationID int64 `json:"conversationId"`
MessageID int64 `json:"messageId"`
Payload string `json:"payload"`
SendStatus string `json:"sendStatus"`
RetryCount int `json:"retryCount"`
NextRetryAt string `json:"nextRetryAt"`
LastError string `json:"lastError"`
SentAt string `json:"sentAt"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
CreateUserName string `json:"createUserName"`
UpdateUserName string `json:"updateUserName"`
}
func BuildChannelResponse(item *models.Channel) ChannelResponse {
if item == nil {
return ChannelResponse{}
}
return ChannelResponse{
ID: item.ID,
ChannelType: item.ChannelType,
ChannelID: item.ChannelID,
AIAgentID: item.AIAgentID,
AIAgentRolloutPercent: item.AIAgentRolloutPercent,
PreviousAIAgentRolloutPercent: item.PreviousAIAgentRolloutPercent,
Name: item.Name,
ConfigJSON: item.ConfigJSON,
Status: item.Status,
Remark: item.Remark,
}
}
func BuildChannelMessageOutboxResponse(item *models.ChannelMessageOutbox) ChannelMessageOutboxResponse {
if item == nil {
return ChannelMessageOutboxResponse{}
}
return ChannelMessageOutboxResponse{
ID: item.ID,
ChannelType: item.ChannelType,
ConversationID: item.ConversationID,
MessageID: item.MessageID,
Payload: item.Payload,
SendStatus: item.SendStatus,
RetryCount: item.RetryCount,
NextRetryAt: utils.FormatTimePtr(item.NextRetryAt),
LastError: item.LastError,
SentAt: utils.FormatTimePtr(item.SentAt),
CreatedAt: utils.FormatTime(item.CreatedAt),
UpdatedAt: utils.FormatTime(item.UpdatedAt),
CreateUserName: item.CreateUserName,
UpdateUserName: item.UpdateUserName,
}
}

View File

@@ -0,0 +1,14 @@
package response
import "agent-desk/internal/pkg/enums"
type CompanyResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
CustomerCount int64 `json:"customerCount"`
Status enums.Status `json:"status"`
Remark string `json:"remark"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}

View File

@@ -0,0 +1,55 @@
package response
import "agent-desk/internal/pkg/enums"
type ConversationTagResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
type ConversationParticipantResponse struct {
ID int64 `json:"id"`
ParticipantType string `json:"participantType"`
ParticipantID int64 `json:"participantId"`
ExternalParticipantID string `json:"externalParticipantId,omitempty"`
JoinedAt string `json:"joinedAt,omitempty"`
LeftAt string `json:"leftAt,omitempty"`
Status enums.Status `json:"status"`
}
type ConversationResponse struct {
ID int64 `json:"id"`
AIAgentID int64 `json:"aiAgentId"`
ChannelID int64 `json:"channelId"`
CustomerID int64 `json:"customerId"`
CustomerName string `json:"customerName"`
Subject string `json:"subject,omitempty"`
Status enums.IMConversationStatus `json:"status"`
ServiceMode enums.IMConversationServiceMode `json:"serviceMode"`
Priority int `json:"priority"`
CurrentAssigneeID int64 `json:"currentAssigneeId"`
CurrentAssigneeName string `json:"currentAssigneeName,omitempty"`
CurrentTeamID int64 `json:"currentTeamId"`
CurrentTeamName string `json:"currentTeamName,omitempty"`
LastMessageID int64 `json:"lastMessageId"`
LastMessageAt string `json:"lastMessageAt,omitempty"`
LastActiveAt string `json:"lastActiveAt,omitempty"`
LastMessageSummary string `json:"lastMessageSummary,omitempty"`
CustomerUnreadCount int `json:"customerUnreadCount"`
AgentUnreadCount int `json:"agentUnreadCount"`
CustomerLastReadMessageID int64 `json:"customerLastReadMessageId"`
CustomerLastReadAt string `json:"customerLastReadAt,omitempty"`
AgentLastReadMessageID int64 `json:"agentLastReadMessageId"`
AgentLastReadAt string `json:"agentLastReadAt,omitempty"`
CustomerOnline bool `json:"customerOnline"`
ClosedAt string `json:"closedAt,omitempty"`
ClosedBy int64 `json:"closedBy"`
ClosedByName string `json:"closedByName,omitempty"`
CloseReason string `json:"closeReason,omitempty"`
Satisfaction *ConversationSatisfactionResponse `json:"satisfaction,omitempty"`
}
type ConversationDetailResponse struct {
ConversationResponse
Participants []ConversationParticipantResponse `json:"participants,omitempty"`
}

View File

@@ -0,0 +1,18 @@
package response
import "agent-desk/internal/pkg/enums"
type CustomerContactResponse struct {
ID int64 `json:"id"`
CustomerID int64 `json:"customerId"`
ContactType enums.ContactType `json:"contactType"`
ContactValue string `json:"contactValue"`
IsPrimary bool `json:"isPrimary"`
IsVerified bool `json:"isVerified"`
VerifiedAt string `json:"verifiedAt,omitempty"`
Source string `json:"source"`
Status enums.Status `json:"status"`
Remark string `json:"remark"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}

View File

@@ -0,0 +1,18 @@
package response
import "agent-desk/internal/pkg/enums"
type CustomerResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Gender enums.Gender `json:"gender"`
CompanyID int64 `json:"companyId"`
Company *CompanyResponse `json:"company"`
LastActiveAt string `json:"lastActiveAt"`
PrimaryMobile string `json:"primaryMobile"`
PrimaryEmail string `json:"primaryEmail"`
Status enums.Status `json:"status"`
Remark string `json:"remark"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}

View File

@@ -0,0 +1,13 @@
package response
type CustomerSessionCustomerResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
type CustomerSessionExchangeResponse struct {
CustomerSessionToken string `json:"customerSessionToken"`
ExpiresAt string `json:"expiresAt"`
IdentityKey string `json:"identityKey"`
Customer CustomerSessionCustomerResponse `json:"customer"`
}

View File

@@ -0,0 +1,83 @@
package response
type DashboardOverviewResponse struct {
Range string `json:"range"`
GeneratedAt string `json:"generatedAt"`
Summary DashboardSummaryResponse `json:"summary"`
ConversationStats DashboardSectionStatsResponse `json:"conversationStats"`
AgentStats DashboardAgentStatsResponse `json:"agentStats"`
AIStats DashboardAIStatsResponse `json:"aiStats"`
Alerts []DashboardAlertResponse `json:"alerts"`
QuickLinks []DashboardQuickLinkResponse `json:"quickLinks"`
}
type DashboardSummaryResponse struct {
TodayNewConversations int64 `json:"todayNewConversations"`
ProcessingConversations int64 `json:"processingConversations"`
PendingDispatchConversations int64 `json:"pendingDispatchConversations"`
OnlineAgents int64 `json:"onlineAgents"`
AIServiceRate float64 `json:"aiServiceRate"`
}
type DashboardSectionStatsResponse struct {
StatusDistribution []DashboardStatusDistributionItem `json:"statusDistribution"`
Trend []DashboardTrendItem `json:"trend"`
}
type DashboardStatusDistributionItem struct {
Status int `json:"status"`
Label string `json:"label"`
Count int64 `json:"count"`
}
type DashboardTrendItem struct {
Date string `json:"date"`
NewCount int64 `json:"newCount"`
ClosedCount int64 `json:"closedCount"`
}
type DashboardAgentStatsResponse struct {
OnlineAgents int64 `json:"onlineAgents"`
BusyAgents int64 `json:"busyAgents"`
OfflineAgents int64 `json:"offlineAgents"`
TeamLoads []DashboardTeamLoadResponse `json:"teamLoads"`
}
type DashboardTeamLoadResponse struct {
TeamID int64 `json:"teamId"`
TeamName string `json:"teamName"`
TotalAgents int64 `json:"totalAgents"`
OnlineAgents int64 `json:"onlineAgents"`
BusyAgents int64 `json:"busyAgents"`
OfflineAgents int64 `json:"offlineAgents"`
WaitingConversations int64 `json:"waitingConversations"`
ProcessingConversations int64 `json:"processingConversations"`
MaxConcurrentCapacity int64 `json:"maxConcurrentCapacity"`
LoadRate float64 `json:"loadRate"`
HasScheduleNow bool `json:"hasScheduleNow"`
}
type DashboardAIStatsResponse struct {
EnabledAIAgents int64 `json:"enabledAiAgents"`
EnabledChannels int64 `json:"enabledChannels"`
TodayKnowledgeRetrieves int64 `json:"todayKnowledgeRetrieves"`
TodayKnowledgeRetrieveFailCount int64 `json:"todayKnowledgeRetrieveFailCount"`
TodayKnowledgeRetrieveFailRate float64 `json:"todayKnowledgeRetrieveFailRate"`
TodayAgentRunFailCount int64 `json:"todayAgentRunFailCount"`
TodayAIHandoffCount int64 `json:"todayAiHandoffCount"`
}
type DashboardAlertResponse struct {
ID string `json:"id"`
Level string `json:"level"`
Title string `json:"title"`
Description string `json:"description"`
Count int64 `json:"count"`
Link string `json:"link"`
}
type DashboardQuickLinkResponse struct {
Title string `json:"title"`
Description string `json:"description"`
Link string `json:"link"`
}

View File

@@ -0,0 +1,266 @@
package response
import (
"agent-desk/internal/pkg/enums"
"time"
)
type KnowledgeBaseResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
KnowledgeType string `json:"knowledgeType"`
KnowledgeTypeName string `json:"knowledgeTypeName"`
Status enums.Status `json:"status"`
StatusName string `json:"statusName"`
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"`
AnswerModeName string `json:"answerModeName"`
DocumentCount int64 `json:"documentCount"`
FAQCount int64 `json:"faqCount"`
Remark string `json:"remark"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CreateUserName string `json:"createUserName"`
UpdateUserName string `json:"updateUserName"`
}
type KnowledgeDocumentResponse struct {
ID int64 `json:"id"`
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
KnowledgeBaseName string `json:"knowledgeBaseName,omitempty"`
DirectoryID int64 `json:"directoryId"`
DirectoryName string `json:"directoryName,omitempty"`
DirectoryPath string `json:"directoryPath,omitempty"`
Title string `json:"title"`
ContentType enums.KnowledgeDocumentContentType `json:"contentType"`
Content string `json:"content"`
Status enums.Status `json:"status"`
StatusName string `json:"statusName"`
IndexStatus enums.KnowledgeDocumentIndexStatus `json:"indexStatus"`
IndexStatusName string `json:"indexStatusName"`
IndexedAt *time.Time `json:"indexedAt"`
IndexError string `json:"indexError"`
ContentHash string `json:"contentHash"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CreateUserName string `json:"createUserName"`
UpdateUserName string `json:"updateUserName"`
}
type KnowledgeDocumentListResponse struct {
ID int64 `json:"id"`
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
KnowledgeBaseName string `json:"knowledgeBaseName,omitempty"`
DirectoryID int64 `json:"directoryId"`
DirectoryName string `json:"directoryName,omitempty"`
DirectoryPath string `json:"directoryPath,omitempty"`
Title string `json:"title"`
ContentType enums.KnowledgeDocumentContentType `json:"contentType"`
Status enums.Status `json:"status"`
StatusName string `json:"statusName"`
IndexStatus enums.KnowledgeDocumentIndexStatus `json:"indexStatus"`
IndexStatusName string `json:"indexStatusName"`
IndexedAt *time.Time `json:"indexedAt"`
IndexError string `json:"indexError"`
ContentHash string `json:"contentHash"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CreateUserName string `json:"createUserName"`
UpdateUserName string `json:"updateUserName"`
}
type KnowledgeFAQResponse struct {
ID int64 `json:"id"`
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
KnowledgeBaseName string `json:"knowledgeBaseName,omitempty"`
DirectoryID int64 `json:"directoryId"`
DirectoryName string `json:"directoryName,omitempty"`
DirectoryPath string `json:"directoryPath,omitempty"`
Question string `json:"question"`
Answer string `json:"answer"`
SimilarQuestions []string `json:"similarQuestions"`
Status enums.Status `json:"status"`
StatusName string `json:"statusName"`
IndexStatus enums.KnowledgeDocumentIndexStatus `json:"indexStatus"`
IndexStatusName string `json:"indexStatusName"`
IndexedAt *time.Time `json:"indexedAt"`
IndexError string `json:"indexError"`
Remark string `json:"remark"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CreateUserName string `json:"createUserName"`
UpdateUserName string `json:"updateUserName"`
}
type KnowledgeDirectoryResponse struct {
ID int64 `json:"id"`
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
ParentID int64 `json:"parentId"`
Name string `json:"name"`
SortNo int `json:"sortNo"`
Status enums.Status `json:"status"`
StatusName string `json:"statusName"`
Remark string `json:"remark"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CreateUserName string `json:"createUserName"`
UpdateUserName string `json:"updateUserName"`
Children []KnowledgeDirectoryResponse `json:"children"`
}
type KnowledgeFAQExportedFile struct {
Filename string
ContentType string
Data []byte
}
type KnowledgeFAQImportError struct {
Row int `json:"row"`
Message string `json:"message"`
}
type KnowledgeFAQImportResult struct {
Total int `json:"total"`
Created int `json:"created"`
Updated int `json:"updated"`
Skipped int `json:"skipped"`
Failed int `json:"failed"`
Errors []KnowledgeFAQImportError `json:"errors"`
}
type KnowledgeSearchResult struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
ChunkID int64 `json:"chunkId"`
DocumentID int64 `json:"documentId"`
DocumentTitle string `json:"documentTitle"`
FaqID int64 `json:"faqId"`
FaqQuestion string `json:"faqQuestion"`
ChunkNo int `json:"chunkNo"`
Title string `json:"title"`
SectionPath string `json:"sectionPath"`
Content string `json:"content"`
Score float64 `json:"score"`
RerankScore float64 `json:"rerankScore"`
}
type KnowledgeSearchResponse struct {
Question string `json:"question"`
Results []KnowledgeSearchResult `json:"results"`
HitCount int `json:"hitCount"`
LatencyMs int64 `json:"latencyMs"`
}
type KnowledgeAnswerResponse struct {
Question string `json:"question"`
RewriteQuestion string `json:"rewriteQuestion,omitempty"`
Answer string `json:"answer"`
AnswerStatus int `json:"answerStatus"`
AnswerStatusName string `json:"answerStatusName"`
Citations []KnowledgeCitation `json:"citations"`
Hits []KnowledgeSearchResult `json:"hits"`
HitCount int `json:"hitCount"`
TopScore float64 `json:"topScore"`
LatencyMs int64 `json:"latencyMs"`
RetrieveMs int64 `json:"retrieveMs"`
GenerateMs int64 `json:"generateMs"`
PromptTokens int `json:"promptTokens"`
CompletionTokens int `json:"completionTokens"`
ModelName string `json:"modelName"`
RetrieveLogID int64 `json:"retrieveLogId"`
}
type KnowledgeCitation struct {
DocumentID int64 `json:"documentId"`
DocumentTitle string `json:"documentTitle"`
FaqID int64 `json:"faqId"`
FaqQuestion string `json:"faqQuestion"`
ChunkNo int `json:"chunkNo"`
Title string `json:"title"`
SectionPath string `json:"sectionPath"`
Snippet string `json:"snippet"`
Score float64 `json:"score"`
}
type KnowledgeRetrieveLogResponse struct {
ID int64 `json:"id"`
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
KnowledgeBaseName string `json:"knowledgeBaseName,omitempty"`
Channel string `json:"channel"`
ChannelName string `json:"channelName"`
Scene string `json:"scene"`
SceneName string `json:"sceneName"`
SessionID string `json:"sessionId"`
ConversationID int64 `json:"conversationId"`
RequestID string `json:"requestId"`
Question string `json:"question"`
RewriteQuestion string `json:"rewriteQuestion"`
Answer string `json:"answer"`
AnswerStatus int `json:"answerStatus"`
AnswerStatusName string `json:"answerStatusName"`
HitCount int `json:"hitCount"`
TopScore float64 `json:"topScore"`
ChunkProvider string `json:"chunkProvider"`
ChunkTargetTokens int `json:"chunkTargetTokens"`
ChunkMaxTokens int `json:"chunkMaxTokens"`
ChunkOverlapTokens int `json:"chunkOverlapTokens"`
RerankEnabled bool `json:"rerankEnabled"`
RerankLimit int `json:"rerankLimit"`
CitationCount int `json:"citationCount"`
UsedChunkCount int `json:"usedChunkCount"`
LatencyMs int64 `json:"latencyMs"`
RetrieveMs int64 `json:"retrieveMs"`
GenerateMs int64 `json:"generateMs"`
PromptTokens int `json:"promptTokens"`
CompletionTokens int `json:"completionTokens"`
ModelName string `json:"modelName"`
TraceData string `json:"traceData"`
CreatedAt time.Time `json:"createdAt"`
}
type KnowledgeRetrieveHitResponse struct {
ID int64 `json:"id"`
RetrieveLogID int64 `json:"retrieveLogId"`
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
ChunkID int64 `json:"chunkId"`
DocumentID int64 `json:"documentId"`
DocumentTitle string `json:"documentTitle"`
FaqID int64 `json:"faqId"`
FaqQuestion string `json:"faqQuestion"`
ChunkNo int `json:"chunkNo"`
Title string `json:"title"`
SectionPath string `json:"sectionPath"`
ChunkType string `json:"chunkType"`
ChunkTypeName string `json:"chunkTypeName"`
Provider string `json:"provider"`
RankNo int `json:"rankNo"`
Score float64 `json:"score"`
RerankScore float64 `json:"rerankScore"`
UsedInAnswer bool `json:"usedInAnswer"`
IsCitation bool `json:"isCitation"`
Snippet string `json:"snippet"`
CreatedAt time.Time `json:"createdAt"`
}
type KnowledgeRetrieveLogDetailResponse struct {
Log KnowledgeRetrieveLogResponse `json:"log"`
Hits []KnowledgeRetrieveHitResponse `json:"hits"`
}
type KnowledgeFeedbackResponse struct {
ID int64 `json:"id"`
RetrieveLogID int64 `json:"retrieveLogId"`
FeedbackType int `json:"feedbackType"`
FeedbackTypeName string `json:"feedbackTypeName"`
FeedbackReason string `json:"feedbackReason"`
UserID int64 `json:"userId"`
AgentID int64 `json:"agentId"`
Remark string `json:"remark"`
CreatedAt time.Time `json:"createdAt"`
}

View File

@@ -0,0 +1,121 @@
package response
import (
"agent-desk/internal/ai/mcps"
"agent-desk/internal/pkg/enums"
)
type MCPConnectionResponse struct {
ServerCode string `json:"serverCode"`
Endpoint string `json:"endpoint"`
Protocol string `json:"protocol"`
ServerName string `json:"serverName"`
Version string `json:"version"`
}
func BuildMCPConnectionResponse(item *mcps.ConnectionResult) *MCPConnectionResponse {
if item == nil {
return nil
}
return &MCPConnectionResponse{
ServerCode: item.ServerCode,
Endpoint: item.Endpoint,
Protocol: item.Protocol,
ServerName: item.ServerName,
Version: item.Version,
}
}
type MCPServerInfoResponse struct {
Code string `json:"code"`
Enabled bool `json:"enabled"`
Endpoint string `json:"endpoint"`
TimeoutMS int `json:"timeoutMs"`
}
func BuildMCPServerInfoResponses(items []mcps.ServerInfo) []MCPServerInfoResponse {
ret := make([]MCPServerInfoResponse, 0, len(items))
for _, item := range items {
ret = append(ret, MCPServerInfoResponse{
Code: item.Code,
Enabled: item.Enabled,
Endpoint: item.Endpoint,
TimeoutMS: item.TimeoutMS,
})
}
return ret
}
type MCPToolInfoResponse struct {
Name string `json:"name"`
Title string `json:"title"`
Description string `json:"description"`
InputSchema any `json:"inputSchema"`
OutputSchema any `json:"outputSchema,omitempty"`
ReadOnlyHint bool `json:"readOnlyHint"`
}
func BuildMCPToolInfoResponses(items []mcps.ToolInfo) []MCPToolInfoResponse {
ret := make([]MCPToolInfoResponse, 0, len(items))
for _, item := range items {
ret = append(ret, MCPToolInfoResponse{
Name: item.Name,
Title: item.Title,
Description: item.Description,
InputSchema: item.InputSchema,
OutputSchema: item.OutputSchema,
ReadOnlyHint: item.ReadOnlyHint,
})
}
return ret
}
type MCPToolCatalogResponse struct {
ToolCode string `json:"toolCode"`
ServerCode string `json:"serverCode"`
ToolName string `json:"toolName"`
SourceType enums.ToolSourceType `json:"sourceType"`
AutoInjected bool `json:"autoInjected"`
Title string `json:"title"`
Description string `json:"description"`
InputSchema any `json:"inputSchema"`
OutputSchema any `json:"outputSchema,omitempty"`
RiskLevel string `json:"riskLevel"`
RequireConfirmation bool `json:"requireConfirmation"`
RiskEditable bool `json:"riskEditable"`
}
type MCPToolResultContentResponse struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
Data any `json:"data,omitempty"`
}
type MCPCallToolResponse struct {
ServerCode string `json:"serverCode"`
ToolName string `json:"toolName"`
IsError bool `json:"isError"`
Content []MCPToolResultContentResponse `json:"content"`
StructuredContent any `json:"structuredContent,omitempty"`
}
func BuildMCPCallToolResponse(item *mcps.ToolCallResult) *MCPCallToolResponse {
if item == nil {
return nil
}
content := make([]MCPToolResultContentResponse, 0, len(item.Content))
for _, c := range item.Content {
content = append(content, MCPToolResultContentResponse{
Type: c.Type,
Text: c.Text,
Data: c.Data,
})
}
return &MCPCallToolResponse{
ServerCode: item.ServerCode,
ToolName: item.ToolName,
IsError: item.IsError,
Content: content,
StructuredContent: item.StructuredContent,
}
}

View File

@@ -0,0 +1,28 @@
package response
import "agent-desk/internal/pkg/enums"
type MessageResponse struct {
ID int64 `json:"id"`
ConversationID int64 `json:"conversationId"`
RequestID string `json:"requestId,omitempty"`
WorkflowRunID int64 `json:"workflowRunId,omitempty"`
ClientMsgID string `json:"clientMsgId,omitempty"`
SenderType enums.IMSenderType `json:"senderType"`
SenderID int64 `json:"senderId"`
SenderName string `json:"senderName,omitempty"`
SenderAvatar string `json:"senderAvatar,omitempty"`
MessageType enums.IMMessageType `json:"messageType"`
Content string `json:"content"`
Payload string `json:"payload,omitempty"`
SendStatus enums.IMMessageStatus `json:"sendStatus"`
SentAt string `json:"sentAt,omitempty"`
DeliveredAt string `json:"deliveredAt,omitempty"`
ReadAt string `json:"readAt,omitempty"`
CustomerRead bool `json:"customerRead"`
CustomerReadAt string `json:"customerReadAt,omitempty"`
AgentRead bool `json:"agentRead"`
AgentReadAt string `json:"agentReadAt,omitempty"`
RecalledAt string `json:"recalledAt,omitempty"`
QuotedMessageID int64 `json:"quotedMessageId,omitempty"`
}

View File

@@ -0,0 +1,18 @@
package response
type NotificationResponse struct {
ID int64 `json:"id"`
RecipientUserID int64 `json:"recipientUserId"`
Title string `json:"title"`
Content string `json:"content"`
NotificationType string `json:"notificationType"`
BizType string `json:"bizType"`
BizID int64 `json:"bizId"`
ActionURL string `json:"actionUrl"`
ReadAt string `json:"readAt,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
}
type NotificationUnreadCountResponse struct {
UnreadCount int64 `json:"unreadCount"`
}

View File

@@ -0,0 +1,23 @@
package response
import (
"agent-desk/internal/pkg/enums"
"time"
)
type OrganizationResponse struct {
ID int64 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Logo string `json:"logo"`
Plan string `json:"plan"`
Status enums.Status `json:"status"`
Role string `json:"role,omitempty"`
IsActive bool `json:"isActive"`
CreatedAt time.Time `json:"createdAt"`
}
type UserOrganizationListResponse struct {
CurrentOrganizationID int64 `json:"currentOrganizationId"`
Organizations []OrganizationResponse `json:"organizations"`
}

View File

@@ -0,0 +1,13 @@
package response
import "agent-desk/internal/pkg/enums"
type QuickReplyResponse struct {
ID int64 `json:"id"`
GroupName string `json:"groupName"`
Title string `json:"title"`
Content string `json:"content"`
Status enums.Status `json:"status"`
SortNo int `json:"sortNo"`
CreatedBy int64 `json:"createdBy"`
}

View File

@@ -0,0 +1,9 @@
package response
type ConversationSatisfactionResponse struct {
ID int64 `json:"id"`
ConversationID int64 `json:"conversationId"`
Score int `json:"score"`
Feedback string `json:"feedback"`
CreatedAt string `json:"createdAt"`
}

View File

@@ -0,0 +1,98 @@
package response
type SetupIssueItem struct {
Code string `json:"code"`
Severity string `json:"severity"`
EntityType string `json:"entity_type"`
EntityID int64 `json:"entity_id"`
EntityName string `json:"entity_name"`
QuickFixAction string `json:"quick_fix_action,omitempty"`
}
type SetupStepItem struct {
Key string `json:"key"`
StepNumber int `json:"step_number"`
Status string `json:"status"`
SummaryCode string `json:"summary_code"`
TotalCount int `json:"total_count"`
ReadyCount int `json:"ready_count"`
Issues []SetupIssueItem `json:"issues"`
QuickFixActions []string `json:"quick_fix_actions"`
ManagePath string `json:"manage_path"`
}
type CurrentOperatorDiagnostic struct {
UserID int64 `json:"user_id"`
Username string `json:"username"`
Nickname string `json:"nickname"`
HasProfile bool `json:"has_profile"`
ProfileStatusOk bool `json:"profile_status_ok"`
TeamID int64 `json:"team_id"`
TeamName string `json:"team_name"`
TeamActive bool `json:"team_active"`
TeamHasScheduleNow bool `json:"team_has_schedule_now"`
ServiceStatus int `json:"service_status"`
AutoAssignEnabled bool `json:"auto_assign_enabled"`
ActiveConversationCount int64 `json:"active_conversation_count"`
MaxConcurrentCount int `json:"max_concurrent_count"`
CanReceiveNow bool `json:"can_receive_now"`
BlockerCodes []string `json:"blocker_codes"`
}
type SetupChannelBrief struct {
ID int64 `json:"id"`
Name string `json:"name"`
ChannelType string `json:"channel_type"`
ChannelID string `json:"channel_id"`
AIAgentID int64 `json:"ai_agent_id"`
RolloutPercent int `json:"rollout_percent"`
Status int `json:"status"`
}
type SetupReadinessResponse struct {
OverallStatus string `json:"overall_status"`
ReadySteps int `json:"ready_steps"`
TotalSteps int `json:"total_steps"`
CanReceiveRequestsNow bool `json:"can_receive_requests_now"`
Steps []SetupStepItem `json:"steps"`
CurrentOperator CurrentOperatorDiagnostic `json:"current_operator"`
Channels []SetupChannelBrief `json:"channels"`
}
type SimulatedRouteHop struct {
HopKey string `json:"hop_key"`
Status string `json:"status"`
ReasonCode string `json:"reason_code"`
EntityID int64 `json:"entity_id,omitempty"`
EntityName string `json:"entity_name,omitempty"`
QuickFixAction string `json:"quick_fix_action,omitempty"`
}
type SimulatedOperatorCandidate struct {
UserID int64 `json:"user_id"`
DisplayName string `json:"display_name"`
TeamID int64 `json:"team_id"`
TeamName string `json:"team_name"`
Eligible bool `json:"eligible"`
SkipReasonCode string `json:"skip_reason_code"`
ActiveCount int64 `json:"active_count"`
MaxConcurrentCount int `json:"max_concurrent_count"`
ServiceStatus int `json:"service_status"`
AutoAssignEnabled bool `json:"auto_assign_enabled"`
}
type SetupSimulateRouteResponse struct {
ChannelID int64 `json:"channel_id"`
ChannelName string `json:"channel_name"`
ChannelType string `json:"channel_type"`
WillReachOperator bool `json:"will_reach_operator"`
FinalOutcomeCode string `json:"final_outcome_code"`
MatchedOperator *SimulatedOperatorCandidate `json:"matched_operator,omitempty"`
Hops []SimulatedRouteHop `json:"hops"`
CandidateOperators []SimulatedOperatorCandidate `json:"candidate_operators"`
}
type SetupQuickFixResponse struct {
AppliedActions []string `json:"applied_actions"`
Readiness SetupReadinessResponse `json:"readiness"`
}

View File

@@ -0,0 +1,34 @@
package response
import "time"
type SkillDefinitionResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Instruction string `json:"instruction"`
Examples []string `json:"examples"`
ToolWhitelist []string `json:"toolWhitelist"`
Status int `json:"status"`
StatusName string `json:"statusName"`
Remark string `json:"remark"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CreateUserName string `json:"createUserName"`
UpdateUserName string `json:"updateUserName"`
}
type SkillDebugRunResponse struct {
SkillDefinitionID int64 `json:"skillDefinitionId"`
SkillName string `json:"skillName"`
ReplyText string `json:"replyText"`
ToolWhitelist []string `json:"toolWhitelist"`
InvokedToolCodes []string `json:"invokedToolCodes"`
InterruptType string `json:"interruptType"`
CheckPointID string `json:"checkPointId"`
Interrupted bool `json:"interrupted"`
TraceData string `json:"traceData"`
ErrorMessage string `json:"errorMessage"`
ConversationID int64 `json:"conversationId"`
AIAgentID int64 `json:"aiAgentId"`
}

View File

@@ -0,0 +1,143 @@
package response
import "agent-desk/internal/pkg/enums"
type ConfigFieldError struct {
Path string `json:"path"`
Code string `json:"code"`
MessageKey string `json:"-"`
Message string `json:"message"`
}
type SupportUserResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
UserType enums.UserType `json:"userType"`
}
type SupportNavigationMenuItemResponse struct {
ID string `json:"id"`
Title string `json:"title"`
URL string `json:"url"`
OpenInNewWindow bool `json:"openInNewWindow"`
Visible bool `json:"visible"`
SortNo int `json:"sortNo"`
Children []SupportNavigationMenuItemResponse `json:"children,omitempty"`
}
type PublicSupportConfigResponse struct {
NavigationMenu []SupportNavigationMenuItemResponse `json:"navigationMenu"`
}
type DashboardSupportConfigResponse struct {
NavigationMenu []SupportNavigationMenuItemResponse `json:"navigationMenu"`
}
// DashboardBrandingResponse shows both what is saved and what is actually in
// effect. They differ whenever configuration supplies a fallback, and an operator
// editing this form needs to see which one they are changing.
type DashboardBrandingResponse struct {
CompanyName string `json:"companyName"`
CompanyLogoURL string `json:"companyLogoUrl"`
// Saved* is what this form would persist; Configured* comes from the file or
// environment; Effective* is what every page will render.
SavedCompanyName string `json:"savedCompanyName"`
SavedCompanyLogoURL string `json:"savedCompanyLogoUrl"`
ConfiguredCompanyName string `json:"configuredCompanyName"`
ConfiguredCompanyLogo string `json:"configuredCompanyLogoUrl"`
EffectiveCompanyName string `json:"effectiveCompanyName"`
UsesConfiguredFallback bool `json:"usesConfiguredFallback"`
}
type DocPageResponse struct {
ID int64 `json:"id"`
ParentID int64 `json:"parentId"`
Title string `json:"title"`
Slug string `json:"slug"`
Summary string `json:"summary"`
ContentType string `json:"contentType"`
Content string `json:"content"`
CoverURL string `json:"coverUrl"`
Tags []string `json:"tags"`
Status enums.DocPageStatus `json:"status"`
SortNo int `json:"sortNo"`
ViewCount int64 `json:"viewCount"`
HelpfulCount int64 `json:"helpfulCount"`
UnhelpfulCount int64 `json:"unhelpfulCount"`
PublishedAt string `json:"publishedAt"`
SyncedKnowledgeDocumentID int64 `json:"syncedKnowledgeDocumentId"`
Remark string `json:"remark"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// DocPageNavigationResponse is the lightweight public document tree.
// Content remains available only from the doc-page detail endpoint.
type DocPageNavigationResponse struct {
ID int64 `json:"id"`
ParentID int64 `json:"parentId"`
Title string `json:"title"`
Slug string `json:"slug"`
SortNo int `json:"sortNo"`
Children []*DocPageNavigationResponse `json:"children"`
}
type CategoryResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
Description string `json:"description"`
SortNo int `json:"sortNo"`
Status enums.Status `json:"status"`
Remark string `json:"remark"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type PostResponse struct {
ID int64 `json:"id"`
CategoryID int64 `json:"categoryId"`
CategoryName string `json:"categoryName"`
UserID int64 `json:"userId"`
UserName string `json:"userName"`
UserType enums.UserType `json:"userType"`
Title string `json:"title"`
ContentType string `json:"contentType"`
Content string `json:"content"`
Tags []string `json:"tags"`
Status enums.PostStatus `json:"status"`
AcceptedCommentID int64 `json:"acceptedCommentId"`
CommentCount int64 `json:"commentCount"`
ReactionCount int64 `json:"reactionCount"`
ViewCount int64 `json:"viewCount"`
LastCommentedAt string `json:"lastCommentedAt"`
LastCommentUserType enums.CommentAuthorType `json:"lastCommentUserType"`
LastCommentUserID int64 `json:"lastCommentUserId"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type CommentResponse struct {
ID int64 `json:"id"`
PostID int64 `json:"postId"`
ParentID int64 `json:"parentId"`
AuthorType enums.CommentAuthorType `json:"authorType"`
AuthorID int64 `json:"authorId"`
AuthorName string `json:"authorName"`
ContentType string `json:"contentType"`
Content string `json:"content"`
Status enums.CommentStatus `json:"status"`
ReactionCount int64 `json:"reactionCount"`
ReplyCount int64 `json:"replyCount"`
ReportCount int64 `json:"reportCount"`
IsAccepted bool `json:"isAccepted"`
Replies []CommentResponse `json:"replies"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type PostDetailResponse struct {
Post PostResponse `json:"post"`
Comments []CommentResponse `json:"comments"`
}

View File

@@ -0,0 +1,26 @@
package response
import "agent-desk/internal/pkg/enums"
type TagResponse struct {
ID int64 `json:"id"`
ParentID int64 `json:"parentId"`
Name string `json:"name"`
Remark string `json:"remark"`
SortNo int `json:"sortNo"`
Status enums.Status `json:"status"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type TagTreeResponse struct {
ID int64 `json:"id"`
ParentID int64 `json:"parentId"`
Name string `json:"name"`
Remark string `json:"remark"`
SortNo int `json:"sortNo"`
Status enums.Status `json:"status"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Children []*TagTreeResponse `json:"children"`
}

View File

@@ -0,0 +1,55 @@
package response
import "agent-desk/internal/pkg/enums"
type TicketProgressResponse struct {
ID int64 `json:"id"`
TicketID int64 `json:"ticketId"`
Content string `json:"content"`
AuthorID int64 `json:"authorId"`
AuthorName string `json:"authorName,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
}
type TicketResponse struct {
ID int64 `json:"id"`
TicketNo string `json:"ticketNo"`
Title string `json:"title"`
Description string `json:"description"`
Source enums.TicketSource `json:"source"`
Channel string `json:"channel"`
CustomerID int64 `json:"customerId"`
ConversationID int64 `json:"conversationId"`
Tags []TagResponse `json:"tags,omitempty"`
Status enums.TicketStatus `json:"status"`
CurrentAssigneeID int64 `json:"currentAssigneeId"`
CurrentAssigneeName string `json:"currentAssigneeName,omitempty"`
CreatedBy int64 `json:"createdBy"`
CreatedByName string `json:"createdByName,omitempty"`
HandledAt string `json:"handledAt,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
Customer *CustomerResponse `json:"customer,omitempty"`
}
type TicketDetailResponse struct {
Ticket TicketResponse `json:"ticket"`
Progresses []TicketProgressResponse `json:"progresses,omitempty"`
}
type TicketSummaryResponse struct {
All int64 `json:"all"`
Pending int64 `json:"pending"`
InProgress int64 `json:"inProgress"`
Done int64 `json:"done"`
Unassigned int64 `json:"unassigned"`
Mine int64 `json:"mine"`
Stale int64 `json:"stale"`
}
type TicketViewResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Filters map[string]any `json:"filters,omitempty"`
SortNo int `json:"sortNo"`
}

View File

@@ -0,0 +1,12 @@
package response
type WidgetConfigResponse struct {
ChannelID string `json:"channelId"`
ChannelType string `json:"channelType"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
ThemeColor string `json:"themeColor"`
Position string `json:"position"`
Width string `json:"width"`
PromptStarters []string `json:"promptStarters,omitempty"`
}