feat: refactoring fetch_node

This commit is contained in:
Marco Vinciguerra 2024-10-10 11:36:48 +02:00
parent 12f2b9946b
commit 39a029ed9a

View File

@ -124,7 +124,7 @@ class FetchNode(BaseNode):
return handlers[input_type](state, input_type, source) return handlers[input_type](state, input_type, source)
elif self.input == "pdf_dir": elif self.input == "pdf_dir":
return state return state
elif not source.startswith("http"): elif not source.startswith("http") or not source.startswith("www"):
return self.handle_local_source(state, source) return self.handle_local_source(state, source)
else: else:
return self.handle_web_source(state, source) return self.handle_web_source(state, source)
@ -307,6 +307,7 @@ class FetchNode(BaseNode):
if not document or not document[0].page_content.strip(): if not document or not document[0].page_content.strip():
raise ValueError("""No HTML body content found in raise ValueError("""No HTML body content found in
the document fetched by ChromiumLoader.""") the document fetched by ChromiumLoader.""")
parsed_content = document[0].page_content parsed_content = document[0].page_content
if (isinstance(self.llm_model, ChatOpenAI) \ if (isinstance(self.llm_model, ChatOpenAI) \