fix: fetch llm tool no longer depends on system libssl.so (#1404)

This commit is contained in:
yetone
2025-02-26 17:36:01 +08:00
committed by GitHub
parent ef78c36e98
commit 6f98cb0ed6
11 changed files with 169 additions and 36 deletions

View File

@@ -135,7 +135,6 @@ end
---@field message string
---@param uri string
---@return AvanteRagServiceAddResourceResponse | nil
function M.add_resource(uri)
uri = M.to_container_uri(uri)
local resource_name = uri:match("([^/]+)/$")
@@ -171,20 +170,23 @@ function M.add_resource(uri)
end
end
end
local resp = curl.post(M.get_rag_service_url() .. "/api/v1/add_resource", {
headers = {
["Content-Type"] = "application/json",
},
body = vim.json.encode({
name = resource_name,
uri = uri,
}),
})
if resp.status ~= 200 then
Utils.error("failed to add resource: " .. resp.body)
return
end
return vim.json.decode(resp.body)
local cmd = {
"curl",
"-X",
"POST",
M.get_rag_service_url() .. "/api/v1/add_resource",
"-H",
"Content-Type: application/json",
"-d",
vim.json.encode({ name = resource_name, uri = uri }),
}
vim.system(cmd, { text = true }, function(output)
if output.code == 0 then
Utils.debug(string.format("Added resource: %s", uri))
else
Utils.error(string.format("Failed to add resource: %s; output: %s", uri, output.stderr))
end
end)
end
function M.remove_resource(uri)