RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix baidusearch and duckduckgosearch (#1488)
Hd5618749c98b
diff --git a/graph/component/baidu.py b/graph/component/baidu.pyindex 69319a8fec..5a7779553c 100644--- a/graph/component/baidu.py+++ b/graph/component/baidu.py@@ -53,10 +53,11 @@ class Baidu(ComponentBase, ABC):url_res = re.findall(r"'url': \\\"(.*?)\\\"}", response.text)title_res = re.findall(r"'title': \\\"(.*?)\\\",\\n", response.text)body_res = re.findall(r"\"contentText\":\"(.*?)\"", response.text)- baidu_res = [re.sub('<em>|</em>', '', '<a href="' + url + '">' + title + '</a> ' + body) for url, title, body- in zip(url_res, title_res, body_res)]+ baidu_res = [{"content": re.sub('<em>|</em>', '', '<a href="' + url + '">' + title + '</a> ' + body)} for url, title, body in zip(url_res, title_res, body_res)]del body_res, url_res, title_res- print(baidu_res, ":::::::::::::::::::::::::::::::::")- return Baidu.be_output(baidu_res)+ df = pd.DataFrame(baidu_res)+ print(df, ":::::::::::::::::::::::::::::::::")++ return dfdiff --git a/graph/component/duckduckgosearch.py b/graph/component/duckduckgosearch.pyindex 8e287bd468..8f8f20604e 100644--- a/graph/component/duckduckgosearch.py+++ b/graph/component/duckduckgosearch.py@@ -44,18 +44,19 @@ class DuckDuckGoSearch(ComponentBase, ABC):ans = self.get_input()ans = " - ".join(ans["content"]) if "content" in ans else ""if not ans:- return Baidu.be_output(self._param.no)+ return DuckDuckGoSearch.be_output(self._param.no)if self.channel == "text":with DDGS() as ddgs:# {'title': '', 'href': '', 'body': ''}- duck_res = ['<a href="' + i["href"] + '">' + i["title"] + '</a> ' + i["body"] for i in+ duck_res = [{"content": '<a href="' + i["href"] + '">' + i["title"] + '</a> ' + i["body"]} for i inddgs.text(ans, max_results=self._param.top_n)]elif self.channel == "news":with DDGS() as ddgs:# {'date': '', 'title': '', 'body': '', 'url': '', 'image': '', 'source': ''}- duck_res = ['<a href="' + i["url"] + '">' + i["title"] + '</a> ' + i["body"] for i in+ duck_res = [{"content": '<a href="' + i["url"] + '">' + i["title"] + '</a> ' + i["body"]} for i inddgs.news(ans, max_results=self._param.top_n)]- print(duck_res, ":::::::::::::::::::::::::::::::::")- return DuckDuckGoSearch.be_output(duck_res)\ No newline at end of file+ df = pd.DataFrame(duck_res)+ print(df, ":::::::::::::::::::::::::::::::::")+ return df