Files
ai-agent/internal/pkg/dto/response/ai_response.go
T

109 lines
5.0 KiB
Go
Raw Normal View History

2026-04-09 10:01:23 +08:00
package response
import (
"code.tczkiot.com/wlw/ai-agent/internal/models"
"code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
2026-04-09 10:01:23 +08:00
)
type AIAgentTeamResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
type AgentRevisionResponse struct {
ID int64 `json:"id"`
AgentID int64 `json:"agent_id"`
Revision int `json:"revision"`
Status enums.Status `json:"status"`
DefinitionHash string `json:"definition_hash"`
PublishedAt string `json:"published_at"`
PublishedByID int64 `json:"published_by_id"`
PublishedByName string `json:"published_by_name"`
}
2026-04-09 10:01:23 +08:00
type AIConfigResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Provider enums.AIProvider `json:"provider"`
BaseURL string `json:"base_url"`
APIKey string `json:"api_key,omitempty"`
HasAPIKey bool `json:"has_api_key"`
ModelType enums.AIModelType `json:"model_type"`
ModelName string `json:"model_name"`
2026-04-09 10:01:23 +08:00
Dimension int `json:"dimension"`
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"`
2026-04-09 10:01:23 +08:00
Status enums.Status `json:"status"`
SortNo int `json:"sort_no"`
2026-04-09 10:01:23 +08:00
Remark string `json:"remark"`
}
func BuildAIConfigDetailResponse(item *models.AIConfig) AIConfigResponse {
result := BuildAIConfigResponse(item)
if item != nil {
result.APIKey = item.APIKey
}
return result
}
2026-04-09 10:01:23 +08:00
func BuildAIConfigResponse(item *models.AIConfig) AIConfigResponse {
return AIConfigResponse{
ID: item.ID,
Name: item.Name,
Provider: item.Provider,
BaseURL: item.BaseURL,
HasAPIKey: item.APIKey != "",
2026-04-09 10:01:23 +08:00
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"`
Avatar string `json:"avatar"`
Description string `json:"description"`
Status enums.Status `json:"status"`
StatusName string `json:"status_name"`
AIConfigID int64 `json:"ai_config_id"`
AIConfigName string `json:"ai_config_name"`
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"`
ServiceModeName string `json:"service_mode_name"`
SystemPrompt string `json:"system_prompt"`
WelcomeMessage string `json:"welcome_message"`
ReplyTimeoutSeconds int `json:"reply_timeout_seconds"`
RolloutPercent int `json:"rollout_percent"`
PreviousRolloutPercent int `json:"previous_rollout_percent"`
Teams []AIAgentTeamResponse `json:"teams"`
HandoffMode enums.AIAgentHandoffMode `json:"handoff_mode"`
HandoffModeName string `json:"handoff_mode_name"`
FallbackMode enums.AIAgentFallbackMode `json:"fallback_mode"`
FallbackModeName string `json:"fallback_mode_name"`
FallbackMessage string `json:"fallback_message"`
KnowledgeBaseIDs []int64 `json:"knowledge_base_ids"`
PublishedRevisionID int64 `json:"published_revision_id"`
SortNo int `json:"sort_no"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
CreateUserName string `json:"create_user_name"`
UpdateUserName string `json:"update_user_name"`
2026-04-09 10:01:23 +08:00
}