mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-06 10:17:29 +08:00
Fix config reload and subagent config feedback
This commit is contained in:
@@ -88,15 +88,49 @@ func extractSubagentDescription(content string) string {
|
||||
}
|
||||
|
||||
func formatCreatedSubagentForUser(result map[string]interface{}, configPath string) string {
|
||||
subagent, _ := result["subagent"].(map[string]interface{})
|
||||
role := ""
|
||||
displayName := ""
|
||||
toolAllowlist := interface{}(nil)
|
||||
systemPromptFile := ""
|
||||
if subagent != nil {
|
||||
if v, _ := subagent["role"].(string); v != "" {
|
||||
role = v
|
||||
}
|
||||
if v, _ := subagent["display_name"].(string); v != "" {
|
||||
displayName = v
|
||||
}
|
||||
if tools, ok := subagent["tools"].(map[string]interface{}); ok {
|
||||
toolAllowlist = tools["allowlist"]
|
||||
}
|
||||
if v, _ := subagent["system_prompt_file"].(string); v != "" {
|
||||
systemPromptFile = v
|
||||
}
|
||||
}
|
||||
routingKeywords := interface{}(nil)
|
||||
if rules, ok := result["rules"].([]interface{}); ok {
|
||||
agentID, _ := result["agent_id"].(string)
|
||||
for _, raw := range rules {
|
||||
rule, ok := raw.(map[string]interface{})
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if strings.TrimSpace(fmt.Sprint(rule["agent_id"])) != agentID {
|
||||
continue
|
||||
}
|
||||
routingKeywords = rule["keywords"]
|
||||
break
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf(
|
||||
"subagent 已写入 config.json。\npath: %s\nagent_id: %v\nrole: %v\ndisplay_name: %v\ntool_allowlist: %v\nrouting_keywords: %v\nsystem_prompt_file: %v",
|
||||
configPath,
|
||||
result["agent_id"],
|
||||
result["role"],
|
||||
result["display_name"],
|
||||
result["tool_allowlist"],
|
||||
result["routing_keywords"],
|
||||
result["system_prompt_file"],
|
||||
role,
|
||||
displayName,
|
||||
toolAllowlist,
|
||||
routingKeywords,
|
||||
systemPromptFile,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user