diff --git a/__sync_prod_db.py b/__sync_prod_db.py new file mode 100644 index 0000000..e69de29 diff --git a/app/api/service/documentSourceService.py b/app/api/service/documentSourceService.py index 378900b..b6a934d 100644 --- a/app/api/service/documentSourceService.py +++ b/app/api/service/documentSourceService.py @@ -225,15 +225,21 @@ class DocumentSourceService: def _extract_content_from_pdf(pdf_path): """提取PDF内容""" try: + from flask import current_app from PyPDF2 import PdfReader + file_size = os.path.getsize(pdf_path) if os.path.exists(pdf_path) else 0 + current_app.logger.info(f'开始提取PDF内容: path={pdf_path}, size={file_size}') reader = PdfReader(pdf_path) content = '' for page in reader.pages: page_content = page.extract_text() if page_content: content += page_content + '\n' + current_app.logger.info(f'PDF内容提取完成: path={pdf_path}, pages={len(reader.pages)}, content_length={len(content)}') return content - except Exception: + except Exception as e: + from flask import current_app + current_app.logger.exception(f'PDF内容提取失败: path={pdf_path}, error={str(e)}') return '' @staticmethod @@ -269,7 +275,8 @@ class DocumentSourceService: # 提取PDF内容 content = DocumentSourceService._extract_content_from_pdf(pdf_path) if not content: - failed_docs.append({'documentId': doc_id, 'error': 'PDF内容为空'}) + file_size = os.path.getsize(pdf_path) if os.path.exists(pdf_path) else 0 + failed_docs.append({'documentId': doc_id, 'error': f'PDF内容为空,文件大小:{file_size} bytes。请检查服务器是否安装PyPDF2、文件是否为扫描件或加密PDF'}) continue # 更新文档内容 diff --git a/requirements.txt b/requirements.txt index 6538bb6..0159120 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,6 +7,9 @@ PyMySQL~=0.10.0 psycopg2-binary~=2.9.9 python-jenkins~=1.7.0 requests~=2.26.0 +openai~=1.30.0 +httpx~=0.27.0 +PyPDF2~=3.0.1 Flask-Docs~=0.6.4 flask_redis~=0.4.0 jira~=3.0.1 \ No newline at end of file diff --git a/uploads/智慧运营/智慧运营V2.0/20260514163427-回货单上传异常校验与错误提示规范-c2ee5327.pdf b/uploads/智慧运营/智慧运营V2.0/20260514163427-回货单上传异常校验与错误提示规范-c2ee5327.pdf new file mode 100644 index 0000000..9d382bb Binary files /dev/null and b/uploads/智慧运营/智慧运营V2.0/20260514163427-回货单上传异常校验与错误提示规范-c2ee5327.pdf differ diff --git a/uploads/智慧运营/智慧运营V2.0/20260514174912-SZ采购工作台V2_0PRD-f77aac9e.pdf b/uploads/智慧运营/智慧运营V2.0/20260514174912-SZ采购工作台V2_0PRD-f77aac9e.pdf new file mode 100644 index 0000000..724480c Binary files /dev/null and b/uploads/智慧运营/智慧运营V2.0/20260514174912-SZ采购工作台V2_0PRD-f77aac9e.pdf differ diff --git a/uploads/智慧运营/智慧运营V2.0/20260514174912-回货单流程-aa48090c.pdf b/uploads/智慧运营/智慧运营V2.0/20260514174912-回货单流程-aa48090c.pdf new file mode 100644 index 0000000..1e3f152 Binary files /dev/null and b/uploads/智慧运营/智慧运营V2.0/20260514174912-回货单流程-aa48090c.pdf differ diff --git a/uploads/智慧运营/智慧运营V2.0/20260515180204-HK1销售助理工作台V2_0PRD-3e35b16e.pdf b/uploads/智慧运营/智慧运营V2.0/20260515180204-HK1销售助理工作台V2_0PRD-3e35b16e.pdf new file mode 100644 index 0000000..c18cf06 Binary files /dev/null and b/uploads/智慧运营/智慧运营V2.0/20260515180204-HK1销售助理工作台V2_0PRD-3e35b16e.pdf differ diff --git a/uploads/智慧运营/智慧运营V2.0/20260518112102-HK1销售助理工作台V2_0PRD-8ce12359.pdf b/uploads/智慧运营/智慧运营V2.0/20260518112102-HK1销售助理工作台V2_0PRD-8ce12359.pdf new file mode 100644 index 0000000..c18cf06 Binary files /dev/null and b/uploads/智慧运营/智慧运营V2.0/20260518112102-HK1销售助理工作台V2_0PRD-8ce12359.pdf differ