diff options
| author | Grail Finder <wohilas@gmail.com> | 2026-03-09 08:50:33 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2026-03-09 08:50:33 +0300 |
| commit | c2c90f6d2b766bbba30c8ea8087f799a6c21f525 (patch) | |
| tree | 75a60a98055b31e8341a83a3b6559e5810666e1d /agent/request.go | |
| parent | 94769225cfbcd4b0a30acab913915f45d6cb9f4b (diff) | |
Enha: pw agent
Diffstat (limited to 'agent/request.go')
| -rw-r--r-- | agent/request.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/agent/request.go b/agent/request.go index 4ca619d..754f16e 100644 --- a/agent/request.go +++ b/agent/request.go @@ -80,6 +80,20 @@ func (ag *AgentClient) FormMsg(msg string) (io.Reader, error) { return bytes.NewReader(b), nil } +func (ag *AgentClient) FormMsgWithToolCallID(msg, toolCallID string) (io.Reader, error) { + m := models.RoleMsg{ + Role: "tool", + Content: msg, + ToolCallID: toolCallID, + } + ag.chatBody.Messages = append(ag.chatBody.Messages, m) + b, err := ag.buildRequest() + if err != nil { + return nil, err + } + return bytes.NewReader(b), nil +} + // buildRequest creates the appropriate LLM request based on the current API endpoint. func (ag *AgentClient) buildRequest() ([]byte, error) { isCompletion, isChat, isDeepSeek, isOpenRouter := detectAPI(ag.cfg.CurrentAPI) |
