Explorar o código

fix: web reader tool retrieve content empty (#957)

takatost hai 1 ano
pai
achega
5cba2e7087
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      api/core/tool/web_reader_tool.py

+ 3 - 0
api/core/tool/web_reader_tool.py

@@ -88,6 +88,9 @@ class WebReaderTool(BaseTool):
             texts = character_splitter.split_text(page_contents)
             docs = [Document(page_content=t) for t in texts]
 
+            if len(docs) == 0:
+                return "No content found."
+
             docs = docs[1:]
 
             # only use first 5 docs