18c9354095
- 注入数据库、运行时配置、统一响应、文件存储和平台 AI 能力,补充业务读写工具与客户快捷操作契约。 - 移除模块内重复的组织、客户、工单、标签、技能、旧工作流、MCP 和迁移实现,将身份权限与业务主体交由宿主管理。 - 使用 libSQL 重构向量存储,并完善图片消息、访客身份、排队调度、企业微信和支持聊天页面。 - 统一 HTTP、DTO 与 WebSocket 的 snake_case 协议,补齐模块初始化、业务动作和公共载荷等回归测试。
109 lines
5.0 KiB
Go
109 lines
5.0 KiB
Go
package response
|
|
|
|
import (
|
|
"code.tczkiot.com/wlw/ai-agent/internal/models"
|
|
"code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
|
|
)
|
|
|
|
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"`
|
|
}
|
|
|
|
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"`
|
|
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"`
|
|
Status enums.Status `json:"status"`
|
|
SortNo int `json:"sort_no"`
|
|
Remark string `json:"remark"`
|
|
}
|
|
|
|
func BuildAIConfigDetailResponse(item *models.AIConfig) AIConfigResponse {
|
|
result := BuildAIConfigResponse(item)
|
|
if item != nil {
|
|
result.APIKey = item.APIKey
|
|
}
|
|
return result
|
|
}
|
|
|
|
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"`
|
|
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"`
|
|
}
|