Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lua/avante/providers/openai.lua
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,15 @@ end

function M:add_tool_use_message(ctx, tool_use, state, opts)
local jsn = JsonParser.parse(tool_use.input_json)
-- Fix: Ensure empty arguments are encoded as {} (object) not [] (array)
if jsn == nil or (type(jsn) == "table" and vim.tbl_isempty(jsn)) then
jsn = vim.empty_dict()
end
local msg = HistoryMessage:new("assistant", {
type = "tool_use",
name = tool_use.name,
id = tool_use.id,
input = jsn or {},
input = jsn,
}, {
state = state,
uuid = tool_use.uuid,
Expand Down