feat: Introduce agent type presets for smart-reasoning mode

- Added a new configuration file `agent_type_presets.yaml` to define various agent type presets, including RAG Q&A, Wiki Q&A, Hybrid (Wiki + RAG), and Data Analysis.
- Updated the `builtin_agents.yaml` to associate built-in agents with the new agent type presets, enhancing their configuration options.
- Enhanced the agent system prompt templates to reflect the new agent types and their functionalities.
- Implemented API endpoints to retrieve agent type presets, allowing for dynamic loading in the frontend.
- Updated the frontend to support agent type selection in the agent editor modal, improving user experience by auto-filling relevant configurations based on selected presets.

These changes significantly enhance the flexibility and usability of the agent system, allowing users to easily configure agents based on predefined types.
This commit is contained in:
wizardchen
2026-04-21 17:12:41 +08:00
parent 0531700518
commit 4022f134bd
18 changed files with 1177 additions and 233 deletions
+12
View File
@@ -408,10 +408,22 @@ func LoadConfig() (*Config, error) {
fmt.Printf("Warning: failed to load builtin agents config: %v\n", err)
}
// Load smart-reasoning agent type presets (rag-qa / wiki-qa / hybrid / custom).
if err := types.LoadAgentTypePresetsConfig(configDir); err != nil {
fmt.Printf("Warning: failed to load agent type presets: %v\n", err)
}
// Resolve prompt template ID references in builtin agent configs
// (e.g. system_prompt_id -> actual content from agent_system_prompt.yaml)
if cfg.PromptTemplates != nil {
resolveBuiltinAgentPromptIDs(cfg.PromptTemplates)
// Validate that every preset references an existing prompt template.
types.ResolveAgentTypePresetPromptRefs(func(id string) string {
if t := FindTemplateByID(cfg.PromptTemplates, id); t != nil {
return t.Content
}
return ""
})
}
// Validate configuration values