Compare commits
4 Commits
6421644127
...
qiaoxinjiu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1e6563276 | ||
|
|
9a14acd32a | ||
|
|
3cc3dbe5d2 | ||
|
|
921b1f7cd8 |
0
__sync_prod_db.py
Normal file
0
__sync_prod_db.py
Normal file
@@ -97,8 +97,10 @@ class CaseController(BaseCrudController):
|
|||||||
if value not in (None, ''):
|
if value not in (None, ''):
|
||||||
filters.append(column == int(value))
|
filters.append(column == int(value))
|
||||||
is_ai_generated = self._get(self.req_data, 'isAiGenerated', 'is_ai_generated')
|
is_ai_generated = self._get(self.req_data, 'isAiGenerated', 'is_ai_generated')
|
||||||
|
is_ai_generated_val = None
|
||||||
if is_ai_generated not in (None, ''):
|
if is_ai_generated not in (None, ''):
|
||||||
filters.append(TestCase.is_ai_generated == int(is_ai_generated))
|
is_ai_generated_val = int(is_ai_generated)
|
||||||
|
filters.append(TestCase.is_ai_generated == is_ai_generated_val)
|
||||||
status = self._get(self.req_data, 'status')
|
status = self._get(self.req_data, 'status')
|
||||||
if status not in (None, ''):
|
if status not in (None, ''):
|
||||||
filters.append(TestCase.status == int(status))
|
filters.append(TestCase.status == int(status))
|
||||||
@@ -117,7 +119,7 @@ class CaseController(BaseCrudController):
|
|||||||
if created_by_name:
|
if created_by_name:
|
||||||
filters.append(User.real_name.like('%{}%'.format(created_by_name)))
|
filters.append(User.real_name.like('%{}%'.format(created_by_name)))
|
||||||
|
|
||||||
query = self.session.query(TestCase, Project.name.label('project_name'), Module.name.label('module_name'), Module.path.label('module_path'), User.real_name.label('created_by_name')).\
|
query = self.session.query(TestCase, Project.name.label('project_name'), Module.name.label('module_name'), Module.path.label('module_path'), Module.status.label('module_status'), User.real_name.label('created_by_name')).\
|
||||||
join(Project, TestCase.project_id == Project.id, isouter=True).\
|
join(Project, TestCase.project_id == Project.id, isouter=True).\
|
||||||
join(Module, TestCase.module_id == Module.id, isouter=True).\
|
join(Module, TestCase.module_id == Module.id, isouter=True).\
|
||||||
join(User, TestCase.created_by == User.id, isouter=True).\
|
join(User, TestCase.created_by == User.id, isouter=True).\
|
||||||
@@ -131,8 +133,11 @@ class CaseController(BaseCrudController):
|
|||||||
query = query.filter(or_(Module.is_delete == 0, Module.is_delete.is_(None)))
|
query = query.filter(or_(Module.is_delete == 0, Module.is_delete.is_(None)))
|
||||||
if hasattr(Module, 'status'):
|
if hasattr(Module, 'status'):
|
||||||
module_status = self._get(self.req_data, 'moduleStatus', 'module_status')
|
module_status = self._get(self.req_data, 'moduleStatus', 'module_status')
|
||||||
if module_status not in (None, ''):
|
# AI 用例列表需要展示对应模块数据,不能因为模块状态变化把用例隐藏掉
|
||||||
# 如果传入了module_status参数,按指定状态过滤
|
if is_ai_generated_val == 1:
|
||||||
|
pass
|
||||||
|
elif module_status not in (None, ''):
|
||||||
|
# 非 AI 场景下,仍支持按模块状态过滤
|
||||||
query = query.filter(Module.status == int(module_status))
|
query = query.filter(Module.status == int(module_status))
|
||||||
else:
|
else:
|
||||||
# 默认只查询状态为1的模块
|
# 默认只查询状态为1的模块
|
||||||
@@ -149,11 +154,13 @@ class CaseController(BaseCrudController):
|
|||||||
items = query.offset((page_num - 1) * page_size).limit(page_size).all()
|
items = query.offset((page_num - 1) * page_size).limit(page_size).all()
|
||||||
|
|
||||||
result_list = []
|
result_list = []
|
||||||
for case, project_name, module_name, module_path, created_by_name in items:
|
for case, project_name, module_name, module_path, module_status, created_by_name in items:
|
||||||
case_dict = self.serialize(case, ['is_delete'])
|
case_dict = self.serialize(case, ['is_delete'])
|
||||||
case_dict['project_name'] = project_name or ''
|
case_dict['project_name'] = project_name or ''
|
||||||
case_dict['module_name'] = module_name or ''
|
case_dict['module_name'] = module_name or ''
|
||||||
case_dict['module_path'] = module_path or ''
|
case_dict['module_path'] = module_path or ''
|
||||||
|
case_dict['module_id'] = case.module_id
|
||||||
|
case_dict['module_status'] = module_status
|
||||||
case_dict['case_key'] = case_dict.get('case_key', '')
|
case_dict['case_key'] = case_dict.get('case_key', '')
|
||||||
case_dict['created_by_name'] = created_by_name or ''
|
case_dict['created_by_name'] = created_by_name or ''
|
||||||
if not case_dict.get('steps'):
|
if not case_dict.get('steps'):
|
||||||
|
|||||||
@@ -225,15 +225,21 @@ class DocumentSourceService:
|
|||||||
def _extract_content_from_pdf(pdf_path):
|
def _extract_content_from_pdf(pdf_path):
|
||||||
"""提取PDF内容"""
|
"""提取PDF内容"""
|
||||||
try:
|
try:
|
||||||
|
from flask import current_app
|
||||||
from PyPDF2 import PdfReader
|
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)
|
reader = PdfReader(pdf_path)
|
||||||
content = ''
|
content = ''
|
||||||
for page in reader.pages:
|
for page in reader.pages:
|
||||||
page_content = page.extract_text()
|
page_content = page.extract_text()
|
||||||
if page_content:
|
if page_content:
|
||||||
content += page_content + '\n'
|
content += page_content + '\n'
|
||||||
|
current_app.logger.info(f'PDF内容提取完成: path={pdf_path}, pages={len(reader.pages)}, content_length={len(content)}')
|
||||||
return 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 ''
|
return ''
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -269,7 +275,8 @@ class DocumentSourceService:
|
|||||||
# 提取PDF内容
|
# 提取PDF内容
|
||||||
content = DocumentSourceService._extract_content_from_pdf(pdf_path)
|
content = DocumentSourceService._extract_content_from_pdf(pdf_path)
|
||||||
if not content:
|
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
|
continue
|
||||||
|
|
||||||
# 更新文档内容
|
# 更新文档内容
|
||||||
|
|||||||
@@ -5,7 +5,12 @@ AI大模型配置文件
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
try:
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
def load_dotenv(*args, **kwargs):
|
||||||
|
return False
|
||||||
|
|
||||||
# 加载项目根目录.env,避免进程工作目录不同导致读取到其他配置
|
# 加载项目根目录.env,避免进程工作目录不同导致读取到其他配置
|
||||||
ENV_PATH = Path(__file__).resolve().parents[1] / '.env'
|
ENV_PATH = Path(__file__).resolve().parents[1] / '.env'
|
||||||
|
|||||||
8
const.py
8
const.py
@@ -29,8 +29,8 @@ RES_CODE = {
|
|||||||
40013: 'scene_id不能为空!'
|
40013: 'scene_id不能为空!'
|
||||||
}
|
}
|
||||||
|
|
||||||
sparkatp_sql_uri = f'postgresql+psycopg2://postgres:{urlquote("difyai123456")}@39.170.26.156:8366/test'
|
# sparkatp_sql_uri = f'postgresql+psycopg2://postgres:{urlquote("difyai123456")}@39.170.26.156:8366/test'
|
||||||
# sparkatp_sql_uri = f'postgresql+psycopg2://postgres:{urlquote("difyai123456")}@39.170.26.156:8366/test-platform-prod'
|
sparkatp_sql_uri = f'postgresql+psycopg2://postgres:{urlquote("difyai123456")}@39.170.26.156:8366/test-platform-prod'
|
||||||
EXECUTE_DB_CONFIG = {
|
EXECUTE_DB_CONFIG = {
|
||||||
'ZHYY': {
|
'ZHYY': {
|
||||||
'st': {
|
'st': {
|
||||||
@@ -83,8 +83,8 @@ STRESS_URI = 'https://qe.bg.huohua.cn'
|
|||||||
QE_DOMAIN = 'https://qe.bg.huohua.cn'
|
QE_DOMAIN = 'https://qe.bg.huohua.cn'
|
||||||
|
|
||||||
PASSWORD = quote('AcUVeRb8lN')
|
PASSWORD = quote('AcUVeRb8lN')
|
||||||
# REDIS_URL = 'redis://127.0.0.1:7379/15'
|
REDIS_URL = 'redis://127.0.0.1:7379/15'
|
||||||
REDIS_URL = 'redis://124.220.32.45:7379/15'
|
# REDIS_URL = 'redis://124.220.32.45:7379/15'
|
||||||
|
|
||||||
JENKINS_BASE_URL = os.environ.get('JENKINS_BASE_URL', 'http://39.170.26.156:8256/')
|
JENKINS_BASE_URL = os.environ.get('JENKINS_BASE_URL', 'http://39.170.26.156:8256/')
|
||||||
JENKINS_USER = os.environ.get('JENKINS_USER', 'jenkins')
|
JENKINS_USER = os.environ.get('JENKINS_USER', 'jenkins')
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ PyMySQL~=0.10.0
|
|||||||
psycopg2-binary~=2.9.9
|
psycopg2-binary~=2.9.9
|
||||||
python-jenkins~=1.7.0
|
python-jenkins~=1.7.0
|
||||||
requests~=2.26.0
|
requests~=2.26.0
|
||||||
|
openai~=1.30.0
|
||||||
|
httpx~=0.27.0
|
||||||
|
PyPDF2~=3.0.1
|
||||||
Flask-Docs~=0.6.4
|
Flask-Docs~=0.6.4
|
||||||
flask_redis~=0.4.0
|
flask_redis~=0.4.0
|
||||||
jira~=3.0.1
|
jira~=3.0.1
|
||||||
|
python-dotenv~=1.0.1
|
||||||
Binary file not shown.
BIN
uploads/智慧运营/智慧运营V2.0/20260514174912-SZ采购工作台V2_0PRD-f77aac9e.pdf
Normal file
BIN
uploads/智慧运营/智慧运营V2.0/20260514174912-SZ采购工作台V2_0PRD-f77aac9e.pdf
Normal file
Binary file not shown.
BIN
uploads/智慧运营/智慧运营V2.0/20260514174912-回货单流程-aa48090c.pdf
Normal file
BIN
uploads/智慧运营/智慧运营V2.0/20260514174912-回货单流程-aa48090c.pdf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user