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

This commit is contained in:
takatost 2023-08-22 18:01:16 +08:00 committed by GitHub
parent 5623839c71
commit 5cba2e7087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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