Explorar el Código

fix 'NoneType' and new ContentType supported. (#4818)

tags/0.6.10
Oliver Lee hace 1 año
padre
commit
176d91937d
No account linked to committer's email address

+ 1
- 1
api/core/rag/extractor/extract_processor.py Ver fichero

from extensions.ext_storage import storage from extensions.ext_storage import storage
from models.model import UploadFile from models.model import UploadFile


SUPPORT_URL_CONTENT_TYPES = ['application/pdf', 'text/plain']
SUPPORT_URL_CONTENT_TYPES = ['application/pdf', 'text/plain', 'application/json']
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"





+ 1
- 1
api/core/tools/utils/web_reader_tool.py Ver fichero

if content_type: if content_type:
main_content_type = response.headers.get('Content-Type').split(';')[0].strip() main_content_type = response.headers.get('Content-Type').split(';')[0].strip()
else: else:
content_disposition = response.headers.get('Content-Disposition')
content_disposition = response.headers.get('Content-Disposition', '')
filename_match = re.search(r'filename="([^"]+)"', content_disposition) filename_match = re.search(r'filename="([^"]+)"', content_disposition)
if filename_match: if filename_match:
filename = unquote(filename_match.group(1)) filename = unquote(filename_match.group(1))

Cargando…
Cancelar
Guardar