浏览代码

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

tags/0.6.10
Oliver Lee 1年前
父节点
当前提交
176d91937d
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1
    1
      api/core/rag/extractor/extract_processor.py
  2. 1
    1
      api/core/tools/utils/web_reader_tool.py

+ 1
- 1
api/core/rag/extractor/extract_processor.py 查看文件

@@ -29,7 +29,7 @@ from core.rag.models.document import Document
from extensions.ext_storage import storage
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"



+ 1
- 1
api/core/tools/utils/web_reader_tool.py 查看文件

@@ -54,7 +54,7 @@ def get_url(url: str, user_agent: str = None) -> str:
if content_type:
main_content_type = response.headers.get('Content-Type').split(';')[0].strip()
else:
content_disposition = response.headers.get('Content-Disposition')
content_disposition = response.headers.get('Content-Disposition', '')
filename_match = re.search(r'filename="([^"]+)"', content_disposition)
if filename_match:
filename = unquote(filename_match.group(1))

正在加载...
取消
保存