2026-04-09 10:01:23 +08:00
|
|
|
package response
|
|
|
|
|
|
|
|
|
|
import (
|
2026-08-21 00:41:07 +08:00
|
|
|
"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"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-25 12:04:06 +08:00
|
|
|
type AgentRevisionResponse struct {
|
2026-07-27 23:29:02 +08:00
|
|
|
ID int64 `json:"id"`
|
2026-08-28 22:23:13 +08:00
|
|
|
AgentID int64 `json:"agent_id"`
|
2026-07-27 23:29:02 +08:00
|
|
|
Revision int `json:"revision"`
|
|
|
|
|
Status enums.Status `json:"status"`
|
2026-08-28 22:23:13 +08:00
|
|
|
DefinitionHash string `json:"definition_hash"`
|
|
|
|
|
PublishedAt string `json:"published_at"`
|
|
|
|
|
PublishedByID int64 `json:"published_by_id"`
|
|
|
|
|
PublishedByName string `json:"published_by_name"`
|
2026-07-25 12:04:06 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
type AIConfigResponse struct {
|
|
|
|
|
ID int64 `json:"id"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Provider enums.AIProvider `json:"provider"`
|
2026-08-28 22:23:13 +08:00
|
|
|
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"`
|
2026-08-28 22:23:13 +08:00
|
|
|
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"`
|
2026-08-28 22:23:13 +08:00
|
|
|
SortNo int `json:"sort_no"`
|
2026-04-09 10:01:23 +08:00
|
|
|
Remark string `json:"remark"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-28 22:23:13 +08:00
|
|
|
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,
|
2026-05-30 22:41:21 +08:00
|
|
|
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 {
|
2026-08-28 22:23:13 +08:00
|
|
|
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
|
|
|
}
|