fix: tool_use_id is nil

This commit is contained in:
yetone
2025-07-17 14:28:35 +08:00
parent cf5234b4d9
commit cd81fbf8af
2 changed files with 4 additions and 0 deletions

View File

@@ -154,6 +154,7 @@ function M.generate_todos(user_input, cb)
local result = LLMTools.process_tool_use(tools, pending_tool, {
session_ctx = {},
on_complete = function() cb() end,
tool_use_id = pending_tool.id,
})
if result ~= nil then cb() end
end
@@ -850,6 +851,7 @@ function M._stream(opts)
on_log = opts.on_tool_log,
set_tool_use_store = opts.set_tool_use_store,
on_complete = handle_tool_result,
tool_use_id = partial_tool_use.id,
})
if result ~= nil or error ~= nil then return handle_tool_result(result, error) end
end

View File

@@ -1324,6 +1324,8 @@ function M.process_tool_use(tools, tool_use, opts)
end
on_complete(result, err)
end,
streaming = opts.streaming,
tool_use_id = opts.tool_use_id,
})
-- Result and error being nil means that the tool was executed asynchronously