mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-13 07:57:29 +08:00
expose gateway autonomy in CLI help and add autonomy action ratios
This commit is contained in:
@@ -108,6 +108,7 @@ func printHelp() {
|
||||
fmt.Println(" clawgo gateway # register service")
|
||||
fmt.Println(" clawgo gateway start|stop|restart|status")
|
||||
fmt.Println(" clawgo gateway run # run foreground")
|
||||
fmt.Println(" clawgo gateway autonomy on|off|status")
|
||||
fmt.Println()
|
||||
fmt.Println("Uninstall:")
|
||||
fmt.Println(" clawgo uninstall # remove gateway service")
|
||||
|
||||
@@ -177,12 +177,20 @@ func summarizeAutonomyActions(statsJSON []byte) string {
|
||||
return ""
|
||||
}
|
||||
keys := []string{"autonomy:dispatch", "autonomy:waiting", "autonomy:resume", "autonomy:blocked", "autonomy:complete"}
|
||||
parts := make([]string, 0, len(keys))
|
||||
parts := make([]string, 0, len(keys)+1)
|
||||
total := 0
|
||||
for _, k := range keys {
|
||||
if v, ok := payload.Counts[k]; ok {
|
||||
parts = append(parts, fmt.Sprintf("%s=%d", strings.TrimPrefix(k, "autonomy:"), v))
|
||||
total += v
|
||||
}
|
||||
}
|
||||
if total > 0 {
|
||||
d := payload.Counts["autonomy:dispatch"]
|
||||
w := payload.Counts["autonomy:waiting"]
|
||||
b := payload.Counts["autonomy:blocked"]
|
||||
parts = append(parts, fmt.Sprintf("ratios(dispatch/waiting/blocked)=%.2f/%.2f/%.2f", float64(d)/float64(total), float64(w)/float64(total), float64(b)/float64(total)))
|
||||
}
|
||||
return strings.Join(parts, " ")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user