fix: react prompts (#2537)

This commit is contained in:
yetone
2025-07-26 16:06:56 +08:00
committed by GitHub
parent bd69ae14f6
commit 8bc149ccd8
14 changed files with 448 additions and 173 deletions

View File

@@ -1579,11 +1579,11 @@ end
---@param tool_use AvanteLLMToolUse
function M.tool_use_to_xml(tool_use)
local xml = string.format("<tool_use>\n<%s>\n", tool_use.name)
for k, v in pairs(tool_use.input or {}) do
xml = xml .. string.format("<%s>%s</%s>\n", k, tostring(v), k)
end
xml = xml .. "</" .. tool_use.name .. ">\n</tool_use>"
local tool_use_json = vim.json.encode({
name = tool_use.name,
input = tool_use.input,
})
local xml = string.format("<tool_use>%s</tool_use>", tool_use_json)
return xml
end