Files
ai-agent/internal/pkg/dto/response/ai_response.go
T
2026-06-22 00:14:36 +08:00

103 lines
4.6 KiB
Go

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"`
Arguments map[string]string `json:"arguments"`
}
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"`
ServiceMode enums.IMConversationServiceMode `json:"serviceMode"`
ServiceModeName string `json:"serviceModeName"`
SystemPrompt string `json:"systemPrompt"`
WelcomeMessage string `json:"welcomeMessage"`
ReplyTimeoutSeconds int `json:"replyTimeoutSeconds"`
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"`
KnowledgeIDs []int64 `json:"knowledgeIds"`
KnowledgeBaseNames []string `json:"knowledgeBaseNames"`
SkillIDs []int64 `json:"skillIds"`
Skills []AIAgentSkillResponse `json:"skills"`
DirectTools []AIAgentMCPToolResponse `json:"directTools"`
GraphTools []string `json:"graphTools"`
RuntimeMode enums.AIAgentRuntimeMode `json:"runtimeMode"`
RuntimeModeName string `json:"runtimeModeName"`
WorkflowVersionID int64 `json:"workflowVersionId"`
SortNo int `json:"sortNo"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
CreateUserName string `json:"createUserName"`
UpdateUserName string `json:"updateUserName"`
}