AddToolMessage 追加一个 role=tool 的消息,把客户端执行工具的结果回传给上游。 toolName 形如 "bash";result 是工具返回的字符串(可能含换行)。
(toolName, result string)
| 107 | // AddToolMessage 追加一个 role=tool 的消息,把客户端执行工具的结果回传给上游。 |
| 108 | // toolName 形如 "bash";result 是工具返回的字符串(可能含换行)。 |
| 109 | func (c *ChatGPTRequest) AddToolMessage(toolName, result string) { |
| 110 | // 包成 "Tool (Resultado da ferramenta bash): ..." 文本格式以兼容 协议 |
| 111 | text := "Tool (Resultado da ferramenta " + toolName + "): " + result |
| 112 | c.AddMessage("tool", text) |
| 113 | } |
| 114 | |
| 115 | func isStringPart(part interface{}) bool { |
| 116 | _, ok := part.(string) |
no test coverage detected