From 38a90c32b20b461e37caffd0caa3208119e08f0b Mon Sep 17 00:00:00 2001
From: H <43509927+guoyuhao2330@users.noreply.github.com>
Date: Fri, 12 Jul 2024 19:43:18 +0800
Subject: [PATCH] fix duckduckgo.py (#1497)
### What problem does this PR solve?
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
---
graph/component/duckduckgo.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/graph/component/duckduckgo.py b/graph/component/duckduckgo.py
index 08cab52ea9b..95ce3e8576d 100644
--- a/graph/component/duckduckgo.py
+++ b/graph/component/duckduckgo.py
@@ -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": '' + i["title"] + ' ' + 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": '' + i["title"] + ' ' + i["body"]} for i in