fex(kb):知识库数据清洗针对pdf含有大量图片ocr清洗超时问题优化;perf(chat):问答回复点击doc移动端无法预览问题优化
This commit is contained in:
1 parent
0890c79070
commit
900a13722c
8 files changed
+170
-18
No files matched your search
@@ -1673,6 +1673,10 @@ def preview_file_raw():
|
||||
content = _convert_office_to_pdf(content, ext)
|
||||
ext = 'pdf'
|
||||
content_type = 'application/pdf'
|
||||
if name and '.' in name:
|
||||
name = f"{name.rsplit('.', 1)[0]}.pdf"
|
||||
elif name:
|
||||
name = f"{name}.pdf"
|
||||
except Exception as e:
|
||||
current_app.logger.error("[file-preview] LibreOffice conversion failed: %s", e)
|
||||
placeholder_text = _extract_placeholder_text(content)
|
||||
@@ -1680,6 +1684,10 @@ def preview_file_raw():
|
||||
content = placeholder_text.encode('utf-8')
|
||||
ext = 'txt'
|
||||
content_type = 'text/plain; charset=utf-8'
|
||||
if name and '.' in name:
|
||||
name = f"{name.rsplit('.', 1)[0]}.txt"
|
||||
elif name:
|
||||
name = f"{name}.txt"
|
||||
current_app.logger.info('[file-preview] office preview degraded to text placeholder for %s', file_url)
|
||||
else:
|
||||
raise AppError(
|
||||
|
||||
Reference in new issue
Block a user