fix: search engine did not return correctly (#1801)
This commit is contained in:
@@ -64,7 +64,7 @@ M._defaults = {
|
|||||||
},
|
},
|
||||||
---@type WebSearchEngineProviderResponseBodyFormatter
|
---@type WebSearchEngineProviderResponseBodyFormatter
|
||||||
format_response_body = function(body)
|
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
|
if body.organic_results ~= nil then
|
||||||
local jsn = vim
|
local jsn = vim
|
||||||
.iter(body.organic_results)
|
.iter(body.organic_results)
|
||||||
|
|||||||
@@ -326,6 +326,7 @@ function M.web_search(opts, on_log)
|
|||||||
local jsn = vim.json.decode(resp.body)
|
local jsn = vim.json.decode(resp.body)
|
||||||
return search_engine.format_response_body(jsn)
|
return search_engine.format_response_body(jsn)
|
||||||
end
|
end
|
||||||
|
return nil, "Error: No search engine found"
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type AvanteLLMToolFunc<{ url: string }>
|
---@type AvanteLLMToolFunc<{ url: string }>
|
||||||
|
|||||||
Reference in New Issue
Block a user