Skip to content

Commit

Permalink
fix duckduckgo.py (#1497)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?



### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
guoyuhao2330 authored Jul 12, 2024
1 parent eecec7b commit 38a90c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions graph/component/duckduckgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ def _run(self, history, **kwargs):
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
Expand Down

0 comments on commit 38a90c3

Please sign in to comment.