2026-06-09 23:53:08 +08:00
|
|
|
package model
|
2026-06-10 12:49:29 +08:00
|
|
|
|
|
|
|
|
// WorkflowType 工作流类型
|
|
|
|
|
type WorkflowType string
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
WorkflowTypeLoop WorkflowType = "loop"
|
|
|
|
|
WorkflowTypeParallel WorkflowType = "parallel"
|
|
|
|
|
WorkflowTypeSequential WorkflowType = "sequential"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// AiAgentConfigTable 一个 Agent 配置表的顶层结构,对应 YAML 中 tables 下的每一项
|
|
|
|
|
type AiAgentConfigTable struct {
|
|
|
|
|
AppName string `yaml:"app-name" json:"appName"`
|
|
|
|
|
Agent AgentSummary `yaml:"agent" json:"agent"`
|
|
|
|
|
Module AgentModule `yaml:"module" json:"module"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AgentSummary Agent 摘要信息
|
|
|
|
|
type AgentSummary struct {
|
|
|
|
|
AgentID string `yaml:"agent-id" json:"agentId"`
|
|
|
|
|
AgentName string `yaml:"agent-name" json:"agentName"`
|
|
|
|
|
AgentDesc string `yaml:"agent-desc" json:"agentDesc"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AgentModule Agent 模块配置,包含 API、模型、Agent 定义、工作流和 Runner
|
|
|
|
|
type AgentModule struct {
|
|
|
|
|
AiAPI AiAPIConfig `yaml:"ai-api" json:"aiApi"`
|
|
|
|
|
ChatModel ChatModelConfig `yaml:"chat-model" json:"chatModel"`
|
|
|
|
|
Agents []AgentConfig `yaml:"agents" json:"agents"`
|
|
|
|
|
AgentWorkflows []AgentWorkflowConfig `yaml:"agent-workflows" json:"agentWorkflows"`
|
|
|
|
|
Runner RunnerConfig `yaml:"runner" json:"runner"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AiAPIConfig LLM API 连接配置
|
|
|
|
|
type AiAPIConfig struct {
|
|
|
|
|
BaseURL string `yaml:"base-url" json:"baseUrl"`
|
|
|
|
|
APIKey string `yaml:"api-key" json:"apiKey"`
|
|
|
|
|
CompletionsPath string `yaml:"completions-path" json:"completionsPath"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ChatModelConfig 聊天模型配置
|
|
|
|
|
type ChatModelConfig struct {
|
|
|
|
|
Model string `yaml:"model" json:"model"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AgentConfig 单个 Agent 的定义
|
|
|
|
|
type AgentConfig struct {
|
|
|
|
|
Name string `yaml:"name" json:"name"`
|
|
|
|
|
Instruction string `yaml:"instruction" json:"instruction"`
|
|
|
|
|
Description string `yaml:"description" json:"description"`
|
|
|
|
|
OutputKey string `yaml:"output-key" json:"outputKey"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AgentWorkflowConfig 工作流配置,支持 loop/parallel/sequential 三种类型
|
|
|
|
|
type AgentWorkflowConfig struct {
|
|
|
|
|
Type WorkflowType `yaml:"type" json:"type"`
|
|
|
|
|
Name string `yaml:"name" json:"name"`
|
|
|
|
|
SubAgents []string `yaml:"sub-agents" json:"subAgents"`
|
|
|
|
|
Description string `yaml:"description" json:"description"`
|
|
|
|
|
MaxIterations int `yaml:"max-iterations" json:"maxIterations"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RunnerConfig Runner 配置,指定入口 Agent 名称
|
|
|
|
|
type RunnerConfig struct {
|
|
|
|
|
AgentName string `yaml:"agent-name" json:"agentName"`
|
|
|
|
|
}
|