quivr/backend/core/parsers/html.py
ChloeMouret fdcdf581a8
refactor: clean backend, add typing, delete dead code (#835)
* type common dependencies

* delete unused code
2023-08-03 16:20:36 +02:00

31 lines
643 B
Python

import re
import unicodedata
import requests
from langchain.document_loaders import UnstructuredHTMLLoader
from models.files import File
from models.settings import CommonsDep
from .common import process_file
def process_html(
commons: CommonsDep, file: File, enable_summarization, brain_id, user_openai_api_key
):
return process_file(
commons,
file,
UnstructuredHTMLLoader,
enable_summarization,
brain_id,
user_openai_api_key,
)
def get_html(url):
response = requests.get(url)
if response.status_code == 200:
return response.text
else:
return None