fix: summary no docs (#1073)

This commit is contained in:
takatost 2023-08-31 20:19:26 +08:00 committed by GitHub
parent 2191312bb9
commit 78e26f8b75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,11 +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: if len(docs) == 0 or docs[0].page_content.endswith('TEXT:'):
return "No content found." return "No content found."
docs = docs[1:]
# only use first 5 docs # only use first 5 docs
if len(docs) > 5: if len(docs) > 5:
docs = docs[:5] docs = docs[:5]