diff options
| author | Grail Finder <wohilas@gmail.com> | 2025-12-19 12:46:22 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2025-12-19 12:46:22 +0300 |
| commit | a875abcf198dd2f85c518f8bf2c599db66d3e69f (patch) | |
| tree | ddf43281a7eb19aadf6366247e3059aa775b75ef /agent/webagent.go | |
| parent | 67ea1aef0dafb9dc6f82e009cc1ecc613f71e520 (diff) | |
Enha: agentclient log
Diffstat (limited to 'agent/webagent.go')
| -rw-r--r-- | agent/webagent.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/agent/webagent.go b/agent/webagent.go index 0087e8e..ff6cd86 100644 --- a/agent/webagent.go +++ b/agent/webagent.go @@ -2,19 +2,17 @@ package agent import ( "fmt" - "log/slog" ) // WebAgentB is a simple agent that applies formatting functions type WebAgentB struct { *AgentClient sysprompt string - log slog.Logger } // NewWebAgentB creates a WebAgentB that uses the given formatting function -func NewWebAgentB(sysprompt string) *WebAgentB { - return &WebAgentB{sysprompt: sysprompt} +func NewWebAgentB(client *AgentClient, sysprompt string) *WebAgentB { + return &WebAgentB{AgentClient: client, sysprompt: sysprompt} } // Process applies the formatting function to raw output @@ -22,12 +20,12 @@ func (a *WebAgentB) Process(args map[string]string, rawOutput []byte) []byte { msg, err := a.FormMsg(a.sysprompt, fmt.Sprintf("request:\n%+v\ntool response:\n%v", args, string(rawOutput))) if err != nil { - a.log.Error("failed to process the request", "error", err) + a.Log().Error("failed to process the request", "error", err) return []byte("failed to process the request; err: " + err.Error()) } resp, err := a.LLMRequest(msg) if err != nil { - a.log.Error("failed to process the request", "error", err) + a.Log().Error("failed to process the request", "error", err) return []byte("failed to process the request; err: " + err.Error()) } return resp |
