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(
|
||||
|
||||
@@ -379,7 +379,6 @@ class Text2SQLService:
|
||||
- 严禁生成任何 INSERT、UPDATE、DELETE、MERGE、ALTER、DROP、TRUNCATE、CREATE 语句。
|
||||
- 仅允许输出单条 SELECT 或 WITH 开头的查询。
|
||||
- 必须使用 Schema 中出现的精确表名,包含完整前缀,如 ERP_VIEW_USER.ERP_FAJ_FILE_V。
|
||||
- 如果用户查询的是列表明细而非聚合总数(如“列出...”、“有哪些...”),你必须强制在 SQL 结尾添加 FETCH FIRST 50 ROWS ONLY,避免一次性返回几十万条数据导致系统崩溃。
|
||||
- 必须只使用 Schema 中明确出现过的字段名,禁止臆造通用字段名,例如 FILE_TYPE、STATUS_NAME、AMOUNT 等。
|
||||
- 优先选择最相关字段,避免 SELECT *。
|
||||
- 当问题涉及“多少、总额、平均值、数量、占比、排名”时,请使用清晰的聚合逻辑与英文别名。
|
||||
@@ -459,7 +458,8 @@ class Text2SQLService:
|
||||
cursor.execute(sql)
|
||||
|
||||
columns = [col[0] for col in cursor.description]
|
||||
rows = cursor.fetchall()
|
||||
# Use fetchmany(50) instead of LLM-generated FETCH FIRST to support older Oracle versions
|
||||
rows = cursor.fetchmany(50)
|
||||
|
||||
cursor.close()
|
||||
connection.close()
|
||||
|
||||
Reference in new issue
Block a user