mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-05-28 00:58:52 +08:00
fix duckduckgo.py (#1497)
### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
eecec7b119
commit
38a90c32b2
@ -46,12 +46,12 @@ class DuckDuckGo(ComponentBase, ABC):
|
||||
if not ans:
|
||||
return DuckDuckGo.be_output(self._param.no)
|
||||
|
||||
if self.channel == "text":
|
||||
if self._param.channel == "text":
|
||||
with DDGS() as ddgs:
|
||||
# {'title': '', 'href': '', 'body': ''}
|
||||
duck_res = [{"content": '<a href="' + i["href"] + '">' + i["title"] + '</a> ' + i["body"]} for i in
|
||||
ddgs.text(ans, max_results=self._param.top_n)]
|
||||
elif self.channel == "news":
|
||||
elif self._param.channel == "news":
|
||||
with DDGS() as ddgs:
|
||||
# {'date': '', 'title': '', 'body': '', 'url': '', 'image': '', 'source': ''}
|
||||
duck_res = [{"content": '<a href="' + i["url"] + '">' + i["title"] + '</a> ' + i["body"]} for i in
|
||||
|
Loading…
x
Reference in New Issue
Block a user