mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-14 18:17:29 +08:00
fix
This commit is contained in:
@@ -573,32 +573,7 @@ func summarizeDialogTemplateChanges(oldCfg, newCfg *config.Config) []string {
|
||||
if oldCfg == nil || newCfg == nil {
|
||||
return nil
|
||||
}
|
||||
type pair struct {
|
||||
name string
|
||||
a string
|
||||
b string
|
||||
}
|
||||
oldT := oldCfg.Agents.Defaults.Texts
|
||||
newT := newCfg.Agents.Defaults.Texts
|
||||
checks := []pair{
|
||||
{name: "system_rewrite_template", a: oldT.SystemRewriteTemplate, b: newT.SystemRewriteTemplate},
|
||||
{name: "lang_usage", a: oldT.LangUsage, b: newT.LangUsage},
|
||||
{name: "lang_invalid", a: oldT.LangInvalid, b: newT.LangInvalid},
|
||||
{name: "lang_updated_template", a: oldT.LangUpdatedTemplate, b: newT.LangUpdatedTemplate},
|
||||
{name: "runtime_compaction_note", a: oldT.RuntimeCompactionNote, b: newT.RuntimeCompactionNote},
|
||||
{name: "startup_compaction_note", a: oldT.StartupCompactionNote, b: newT.StartupCompactionNote},
|
||||
{name: "autonomy_completion_template", a: oldT.AutonomyCompletionTemplate, b: newT.AutonomyCompletionTemplate},
|
||||
{name: "autonomy_blocked_template", a: oldT.AutonomyBlockedTemplate, b: newT.AutonomyBlockedTemplate},
|
||||
}
|
||||
out := make([]string, 0)
|
||||
for _, c := range checks {
|
||||
if strings.TrimSpace(c.a) != strings.TrimSpace(c.b) {
|
||||
out = append(out, c.name)
|
||||
}
|
||||
}
|
||||
if strings.Join(oldT.AutonomyImportantKeywords, "|") != strings.Join(newT.AutonomyImportantKeywords, "|") {
|
||||
out = append(out, "autonomy_important_keywords")
|
||||
}
|
||||
if oldCfg.Agents.Defaults.Heartbeat.PromptTemplate != newCfg.Agents.Defaults.Heartbeat.PromptTemplate {
|
||||
out = append(out, "heartbeat.prompt_template")
|
||||
}
|
||||
@@ -991,9 +966,6 @@ func buildAutonomyEngine(cfg *config.Config, msgBus *bus.MessageBus) *autonomy.E
|
||||
WaitingResumeDebounceSec: a.WaitingResumeDebounceSec,
|
||||
IdleRoundBudgetReleaseSec: idleRoundBudgetReleaseSec,
|
||||
AllowedTaskKeywords: a.AllowedTaskKeywords,
|
||||
ImportantKeywords: cfg.Agents.Defaults.Texts.AutonomyImportantKeywords,
|
||||
CompletionTemplate: cfg.Agents.Defaults.Texts.AutonomyCompletionTemplate,
|
||||
BlockedTemplate: cfg.Agents.Defaults.Texts.AutonomyBlockedTemplate,
|
||||
EKGConsecutiveErrorThreshold: a.EKGConsecutiveErrorThreshold,
|
||||
Workspace: cfg.WorkspacePath(),
|
||||
DefaultNotifyChannel: notifyChannel,
|
||||
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"clawgo/pkg/config"
|
||||
"clawgo/pkg/nodes"
|
||||
"clawgo/pkg/providers"
|
||||
)
|
||||
|
||||
func statusCmd() {
|
||||
cfg, err := loadConfig()
|
||||
if err != nil {
|
||||
@@ -75,7 +75,6 @@ func statusCmd() {
|
||||
cfg.Agents.Defaults.Heartbeat.EverySec,
|
||||
cfg.Agents.Defaults.Heartbeat.AckMaxChars,
|
||||
)
|
||||
printTemplateStatus(cfg)
|
||||
fmt.Printf("Cron Runtime: workers=%d sleep=%d-%ds\n",
|
||||
cfg.Cron.MaxWorkers,
|
||||
cfg.Cron.MinSleepSec,
|
||||
@@ -167,12 +166,24 @@ func statusCmd() {
|
||||
if n.Online {
|
||||
online++
|
||||
}
|
||||
if n.Capabilities.Run { caps["run"]++ }
|
||||
if n.Capabilities.Model { caps["model"]++ }
|
||||
if n.Capabilities.Camera { caps["camera"]++ }
|
||||
if n.Capabilities.Screen { caps["screen"]++ }
|
||||
if n.Capabilities.Location { caps["location"]++ }
|
||||
if n.Capabilities.Canvas { caps["canvas"]++ }
|
||||
if n.Capabilities.Run {
|
||||
caps["run"]++
|
||||
}
|
||||
if n.Capabilities.Model {
|
||||
caps["model"]++
|
||||
}
|
||||
if n.Capabilities.Camera {
|
||||
caps["camera"]++
|
||||
}
|
||||
if n.Capabilities.Screen {
|
||||
caps["screen"]++
|
||||
}
|
||||
if n.Capabilities.Location {
|
||||
caps["location"]++
|
||||
}
|
||||
if n.Capabilities.Canvas {
|
||||
caps["canvas"]++
|
||||
}
|
||||
}
|
||||
fmt.Printf("Nodes: total=%d online=%d\n", len(ns), online)
|
||||
fmt.Printf("Nodes Capabilities: run=%d model=%d camera=%d screen=%d location=%d canvas=%d\n", caps["run"], caps["model"], caps["camera"], caps["screen"], caps["location"], caps["canvas"])
|
||||
@@ -186,30 +197,6 @@ func statusCmd() {
|
||||
}
|
||||
}
|
||||
|
||||
func printTemplateStatus(cfg *config.Config) {
|
||||
if cfg == nil {
|
||||
return
|
||||
}
|
||||
defaults := config.DefaultConfig().Agents.Defaults.Texts
|
||||
cur := cfg.Agents.Defaults.Texts
|
||||
fmt.Println("Dialog Templates:")
|
||||
printTemplateField("system_rewrite_template", cur.SystemRewriteTemplate, defaults.SystemRewriteTemplate)
|
||||
printTemplateField("lang_usage", cur.LangUsage, defaults.LangUsage)
|
||||
printTemplateField("lang_invalid", cur.LangInvalid, defaults.LangInvalid)
|
||||
printTemplateField("runtime_compaction_note", cur.RuntimeCompactionNote, defaults.RuntimeCompactionNote)
|
||||
printTemplateField("startup_compaction_note", cur.StartupCompactionNote, defaults.StartupCompactionNote)
|
||||
printTemplateField("autonomy_completion_template", cur.AutonomyCompletionTemplate, defaults.AutonomyCompletionTemplate)
|
||||
printTemplateField("autonomy_blocked_template", cur.AutonomyBlockedTemplate, defaults.AutonomyBlockedTemplate)
|
||||
}
|
||||
|
||||
func printTemplateField(name, current, def string) {
|
||||
state := "custom"
|
||||
if strings.TrimSpace(current) == strings.TrimSpace(def) {
|
||||
state = "default"
|
||||
}
|
||||
fmt.Printf(" %s: %s\n", name, state)
|
||||
}
|
||||
|
||||
func summarizeAutonomyActions(statsJSON []byte) string {
|
||||
var payload struct {
|
||||
Counts map[string]int `json:"counts"`
|
||||
@@ -272,7 +259,9 @@ func autonomyControlState(workspace string) string {
|
||||
}
|
||||
ctrlPath := filepath.Join(memDir, "autonomy.control.json")
|
||||
if data, err := os.ReadFile(ctrlPath); err == nil {
|
||||
var c struct{ Enabled bool `json:"enabled"` }
|
||||
var c struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
if json.Unmarshal(data, &c) == nil {
|
||||
if c.Enabled {
|
||||
return "enabled"
|
||||
|
||||
Reference in New Issue
Block a user