fix: universal chat when default model invalid (#905)

This commit is contained in:
takatost
2023-08-18 16:20:42 +08:00
committed by GitHub
parent edb06f6aed
commit 1d9cc5ca05
8 changed files with 59 additions and 32 deletions

View File

@@ -65,7 +65,7 @@ class WebReaderTool(BaseTool):
summary_chunk_overlap: int = 0
summary_separators: list[str] = ["\n\n", "", ".", " ", ""]
continue_reading: bool = True
llm: BaseLanguageModel
llm: BaseLanguageModel = None
def _run(self, url: str, summary: bool = False, cursor: int = 0) -> str:
try:
@@ -78,7 +78,7 @@ class WebReaderTool(BaseTool):
except Exception as e:
return f'Read this website failed, caused by: {str(e)}.'
if summary:
if summary and self.llm:
character_splitter = RecursiveCharacterTextSplitter.from_tiktoken_encoder(
chunk_size=self.summary_chunk_tokens,
chunk_overlap=self.summary_chunk_overlap,