Refactored orchestrator for staged file handling, added structured prompt support, adjusted Feishu file handling

This commit is contained in:
whlaoding
2026-03-08 22:38:29 +08:00
parent e2f806edb3
commit 52b8dbb835
30 changed files with 9325 additions and 34 deletions

View File

@@ -0,0 +1,31 @@
package agent
import (
"encoding/json"
"fmt"
"strings"
)
type capabilityRouteDecision struct {
NeedSkills bool `json:"need_skills"`
SelectedTools []string `json:"selected_tools"`
SelectedSkills []string `json:"selected_skills"`
Reason string `json:"reason"`
}
func parseCapabilityRoute(raw string) (capabilityRouteDecision, error) {
raw = normalizeJSON(raw)
start := strings.Index(raw, "{")
end := strings.LastIndex(raw, "}")
if start < 0 || end < start {
return capabilityRouteDecision{}, fmt.Errorf("no json object found")
}
raw = raw[start : end+1]
var out capabilityRouteDecision
if err := json.Unmarshal([]byte(raw), &out); err != nil {
return capabilityRouteDecision{}, err
}
out.Reason = strings.TrimSpace(out.Reason)
return out, nil
}