From 30b88e2b9134c3f211d052235ad3052755d10c61 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Tue, 9 Jul 2024 18:06:09 +0800 Subject: [PATCH] fix no resualt bugs (#1448) ### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- graph/canvas.py | 2 ++ graph/component/baidu.py | 6 +++--- graph/component/duckduckgosearch.py | 5 ++--- graph/component/message.py | 6 +++++- graph/templates/HR_callout_zh.json | 4 ++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/graph/canvas.py b/graph/canvas.py index de161be4e..530bb6fbe 100644 --- a/graph/canvas.py +++ b/graph/canvas.py @@ -220,6 +220,7 @@ class Canvas(ABC): prepare2run([p]) break traceback.print_exc() + break continue try: @@ -231,6 +232,7 @@ class Canvas(ABC): prepare2run([p]) break traceback.print_exc() + break if self.answer: cpn_id = self.answer[0] diff --git a/graph/component/baidu.py b/graph/component/baidu.py index ac1961854..69319a8fe 100644 --- a/graph/component/baidu.py +++ b/graph/component/baidu.py @@ -57,6 +57,6 @@ class Baidu(ComponentBase, ABC): in zip(url_res, title_res, body_res)] del body_res, url_res, title_res - br = pd.DataFrame(baidu_res, columns=['content']) - print(">>>>>>>>>>>>>>>>>>>>>>>>>>\n", br) - return br + print(baidu_res, ":::::::::::::::::::::::::::::::::") + return Baidu.be_output(baidu_res) + diff --git a/graph/component/duckduckgosearch.py b/graph/component/duckduckgosearch.py index 2f674f3dd..8e287bd46 100644 --- a/graph/component/duckduckgosearch.py +++ b/graph/component/duckduckgosearch.py @@ -57,6 +57,5 @@ class DuckDuckGoSearch(ComponentBase, ABC): duck_res = ['' + i["title"] + ' ' + i["body"] for i in ddgs.news(ans, max_results=self._param.top_n)] - dr = pd.DataFrame(duck_res, columns=['content']) - print(">>>>>>>>>>>>>>>>>>>>>>>>>>\n", dr) - return dr + print(duck_res, ":::::::::::::::::::::::::::::::::") + return DuckDuckGoSearch.be_output(duck_res) \ No newline at end of file diff --git a/graph/component/message.py b/graph/component/message.py index adbf4c8ad..87d290fef 100644 --- a/graph/component/message.py +++ b/graph/component/message.py @@ -46,7 +46,11 @@ class Message(ComponentBase, ABC): return Message.be_output(random.choice(self._param.messages)) def stream_output(self): + res = None if self._param.messages: - yield {"content": random.choice(self._param.messages)} + res = {"content": random.choice(self._param.messages)} + yield res + + self.set_output(res) diff --git a/graph/templates/HR_callout_zh.json b/graph/templates/HR_callout_zh.json index 5955b8a7a..80d54aec2 100644 --- a/graph/templates/HR_callout_zh.json +++ b/graph/templates/HR_callout_zh.json @@ -169,7 +169,7 @@ "component_name": "Message", "params": { "messages": [ - "我简单介绍以下:\nRAGFlow 是一款基于深度文档理解构建的开源 RAG(Retrieval-Augmented Generation)引擎。RAGFlow 可以为各种规模的企业及个人提供一套精简的 RAG 工作流程,结合大语言模型(LLM)针对用户各类不同的复杂格式数据提供可靠的问答以及有理有据的引用。https://github.com/infiniflow/ragflow\n您那边还有什么要了解的?" + "我简单介绍一下:\nRAGFlow 是一款基于深度文档理解构建的开源 RAG(Retrieval-Augmented Generation)引擎。RAGFlow 可以为各种规模的企业及个人提供一套精简的 RAG 工作流程,结合大语言模型(LLM)针对用户各类不同的复杂格式数据提供可靠的问答以及有理有据的引用。https://github.com/infiniflow/ragflow\n您那边还有什么要了解的?" ] } }, @@ -448,7 +448,7 @@ "data": { "form": { "messages": [ - "我简单介绍以下:\nRAGFlow 是一款基于深度文档理解构建的开源 RAG(Retrieval-Augmented Generation)引擎。RAGFlow 可以为各种规模的企业及个人提供一套精简的 RAG 工作流程,结合大语言模型(LLM)针对用户各类不同的复杂格式数据提供可靠的问答以及有理有据的引用。https://github.com/infiniflow/ragflow\n您那边还有什么要了解的?" + "我简单介绍一下:\nRAGFlow 是一款基于深度文档理解构建的开源 RAG(Retrieval-Augmented Generation)引擎。RAGFlow 可以为各种规模的企业及个人提供一套精简的 RAG 工作流程,结合大语言模型(LLM)针对用户各类不同的复杂格式数据提供可靠的问答以及有理有据的引用。https://github.com/infiniflow/ragflow\n您那边还有什么要了解的?" ] }, "label": "Message",