Skip to content

Commit 89a86f0

Browse files
authored
fix: search engine did not return correctly (#1801)
1 parent 0828d32 commit 89a86f0

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lua/avante/config.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ M._defaults = {
6464
},
6565
---@type WebSearchEngineProviderResponseBodyFormatter
6666
format_response_body = function(body)
67-
if body.answer_box ~= nil then return body.answer_box.result, nil end
67+
if body.answer_box ~= nil and body.answer_box.result ~= nil then return body.answer_box.result, nil end
6868
if body.organic_results ~= nil then
6969
local jsn = vim
7070
.iter(body.organic_results)

lua/avante/llm_tools/init.lua

+1
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ function M.web_search(opts, on_log)
326326
local jsn = vim.json.decode(resp.body)
327327
return search_engine.format_response_body(jsn)
328328
end
329+
return nil, "Error: No search engine found"
329330
end
330331

331332
---@type AvanteLLMToolFunc<{ url: string }>

0 commit comments

Comments
 (0)