From 7db2b10bd283eca3b756d3b1515fbf75b3a76840 Mon Sep 17 00:00:00 2001 From: mudler Date: Mon, 15 Apr 2024 12:09:22 +0200 Subject: [PATCH] Do not let age to be either a string or an int --- agent/state.go | 2 +- example/webui/agentpool.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/agent/state.go b/agent/state.go index 6cb976a..8cdf369 100644 --- a/agent/state.go +++ b/agent/state.go @@ -22,7 +22,7 @@ type PromptHUD struct { type Character struct { Name string `json:"name"` - Age string `json:"age"` + Age any `json:"age"` Occupation string `json:"job_occupation"` Hobbies []string `json:"hobbies"` MusicTaste []string `json:"music_taste"` diff --git a/example/webui/agentpool.go b/example/webui/agentpool.go index 7f39ca9..318e5ed 100644 --- a/example/webui/agentpool.go +++ b/example/webui/agentpool.go @@ -423,7 +423,12 @@ func (a *AgentPool) Stop(name string) { func (a *AgentPool) Start(name string) error { if agent, ok := a.agents[name]; ok { - return agent.Run() + err := agent.Run() + if err != nil { + return fmt.Errorf("agent %s failed to start: %w", name, err) + } + slog.Info("Agent started", "name", name) + return nil } if config, ok := a.pool[name]; ok { return a.startAgentWithConfig(name, &config)