mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
fix: safe startup info map access to prevent panic on nil agent
This commit is contained in:
BIN
Binary file not shown.
@@ -56,12 +56,17 @@ func agentCmd(message, sessionKey, model string, debug bool) error {
|
|||||||
|
|
||||||
// Print agent startup info (only for interactive mode)
|
// Print agent startup info (only for interactive mode)
|
||||||
startupInfo := agentLoop.GetStartupInfo()
|
startupInfo := agentLoop.GetStartupInfo()
|
||||||
logger.InfoCF("agent", "Agent initialized",
|
toolsInfo, _ := startupInfo["tools"].(map[string]any)
|
||||||
map[string]any{
|
skillsInfo, _ := startupInfo["skills"].(map[string]any)
|
||||||
"tools_count": startupInfo["tools"].(map[string]any)["count"],
|
logFields := map[string]any{}
|
||||||
"skills_total": startupInfo["skills"].(map[string]any)["total"],
|
if toolsInfo != nil {
|
||||||
"skills_available": startupInfo["skills"].(map[string]any)["available"],
|
logFields["tools_count"] = toolsInfo["count"]
|
||||||
})
|
}
|
||||||
|
if skillsInfo != nil {
|
||||||
|
logFields["skills_total"] = skillsInfo["total"]
|
||||||
|
logFields["skills_available"] = skillsInfo["available"]
|
||||||
|
}
|
||||||
|
logger.InfoCF("agent", "Agent initialized", logFields)
|
||||||
|
|
||||||
if message != "" {
|
if message != "" {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|||||||
Reference in New Issue
Block a user