Enha: pw agent

This commit is contained in:
Grail Finder
2026-03-09 08:50:33 +03:00
parent 94769225cf
commit c2c90f6d2b
5 changed files with 536 additions and 10 deletions

View File

@@ -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)