fix: search engine did not return correctly (#1801)

This commit is contained in:
yetone
2025-04-02 20:32:58 +08:00
committed by GitHub
parent 0828d32346
commit 89a86f0fc1
2 changed files with 2 additions and 1 deletions

View File

@@ -64,7 +64,7 @@ M._defaults = {
},
---@type WebSearchEngineProviderResponseBodyFormatter
format_response_body = function(body)
if body.answer_box ~= nil then return body.answer_box.result, nil end
if body.answer_box ~= nil and body.answer_box.result ~= nil then return body.answer_box.result, nil end
if body.organic_results ~= nil then
local jsn = vim
.iter(body.organic_results)

View File

@@ -326,6 +326,7 @@ function M.web_search(opts, on_log)
local jsn = vim.json.decode(resp.body)
return search_engine.format_response_body(jsn)
end
return nil, "Error: No search engine found"
end
---@type AvanteLLMToolFunc<{ url: string }>