mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 12:32:30 +08:00
Fix bugs for agent/tools. (#9930)
### What problem does this PR solve? 1 Fix typos 2 Fix agent/tools/crawler.py return bug. 3 Fix agent/tools/deepl.py component_name bug. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [x] Refactoring - [x] Performance Improvement Signed-off-by: zhanluxianshen <zhanluxianshen@163.com>
This commit is contained in:
@ -481,7 +481,7 @@ class Canvas(Graph):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception(e)
|
logging.exception(e)
|
||||||
|
|
||||||
def add_refernce(self, chunks: list[object], doc_infos: list[object]):
|
def add_reference(self, chunks: list[object], doc_infos: list[object]):
|
||||||
if not self.retrieval:
|
if not self.retrieval:
|
||||||
self.retrieval = [{"chunks": {}, "doc_aggs": {}}]
|
self.retrieval = [{"chunks": {}, "doc_aggs": {}}]
|
||||||
|
|
||||||
|
|||||||
@ -166,7 +166,7 @@ class ToolBase(ComponentBase):
|
|||||||
"count": 1,
|
"count": 1,
|
||||||
"url": url
|
"url": url
|
||||||
})
|
})
|
||||||
self._canvas.add_refernce(chunks, aggs)
|
self._canvas.add_reference(chunks, aggs)
|
||||||
self.set_output("formalized_content", "\n".join(kb_prompt({"chunks": chunks, "doc_aggs": aggs}, 200000, True)))
|
self.set_output("formalized_content", "\n".join(kb_prompt({"chunks": chunks, "doc_aggs": aggs}, 200000, True)))
|
||||||
|
|
||||||
def thoughts(self) -> str:
|
def thoughts(self) -> str:
|
||||||
|
|||||||
@ -64,5 +64,5 @@ class Crawler(ToolBase, ABC):
|
|||||||
elif self._param.extract_type == 'markdown':
|
elif self._param.extract_type == 'markdown':
|
||||||
return result.markdown
|
return result.markdown
|
||||||
elif self._param.extract_type == 'content':
|
elif self._param.extract_type == 'content':
|
||||||
result.extracted_content
|
return result.extracted_content
|
||||||
return result.markdown
|
return result.markdown
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class DeepLParam(ComponentParamBase):
|
|||||||
|
|
||||||
|
|
||||||
class DeepL(ComponentBase, ABC):
|
class DeepL(ComponentBase, ABC):
|
||||||
component_name = "GitHub"
|
component_name = "DeepL"
|
||||||
|
|
||||||
def _run(self, history, **kwargs):
|
def _run(self, history, **kwargs):
|
||||||
ans = self.get_input()
|
ans = self.get_input()
|
||||||
|
|||||||
@ -163,7 +163,7 @@ class Retrieval(ToolBase, ABC):
|
|||||||
self.set_output("formalized_content", self._param.empty_response)
|
self.set_output("formalized_content", self._param.empty_response)
|
||||||
return
|
return
|
||||||
|
|
||||||
self._canvas.add_refernce(kbinfos["chunks"], kbinfos["doc_aggs"])
|
self._canvas.add_reference(kbinfos["chunks"], kbinfos["doc_aggs"])
|
||||||
form_cnt = "\n".join(kb_prompt(kbinfos, 200000, True))
|
form_cnt = "\n".join(kb_prompt(kbinfos, 200000, True))
|
||||||
self.set_output("formalized_content", form_cnt)
|
self.set_output("formalized_content", form_cnt)
|
||||||
return form_cnt
|
return form_cnt
|
||||||
|
|||||||
Reference in New Issue
Block a user