mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Fix web search and template max tokens (#1564)
### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -44,7 +44,7 @@ class DuckDuckGo(ComponentBase, ABC):
|
||||
ans = self.get_input()
|
||||
ans = " - ".join(ans["content"]) if "content" in ans else ""
|
||||
if not ans:
|
||||
return DuckDuckGo.be_output(self._param.no)
|
||||
return DuckDuckGo.be_output("")
|
||||
|
||||
if self._param.channel == "text":
|
||||
with DDGS() as ddgs:
|
||||
@ -57,6 +57,9 @@ class DuckDuckGo(ComponentBase, ABC):
|
||||
duck_res = [{"content": '<a href="' + i["url"] + '">' + i["title"] + '</a> ' + i["body"]} for i in
|
||||
ddgs.news(ans, max_results=self._param.top_n)]
|
||||
|
||||
if not duck_res:
|
||||
return DuckDuckGo.be_output("")
|
||||
|
||||
df = pd.DataFrame(duck_res)
|
||||
print(df, ":::::::::::::::::::::::::::::::::")
|
||||
if DEBUG: print(df, ":::::::::::::::::::::::::::::::::")
|
||||
return df
|
||||
|
||||
Reference in New Issue
Block a user