From c2ba19c7c38126d6ba3a41dc951c7541c38edd62 Mon Sep 17 00:00:00 2001 From: GuoQing Zhang Date: Sat, 6 Jul 2024 13:04:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BB=8E=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E6=96=B0=E5=BB=BA=E6=8A=80=E8=83=BD=E6=97=B6=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E4=BF=9D=E5=AD=98=E5=AF=B9=E5=BA=94=E7=9A=84=E8=A1=A8?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/bisheng/api/services/flow.py | 8 +++++++- src/backend/bisheng/api/v1/flows.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/backend/bisheng/api/services/flow.py b/src/backend/bisheng/api/services/flow.py index 28b8c0710..5218e34eb 100644 --- a/src/backend/bisheng/api/services/flow.py +++ b/src/backend/bisheng/api/services/flow.py @@ -353,8 +353,14 @@ async def exec_flow_node(cls, inputs: Dict, tweaks: Dict, index: int, versions: return index, answer_result @classmethod - def create_flow_hook(cls, request: Request, login_user: UserPayload, flow_info: Flow) -> bool: + def create_flow_hook(cls, request: Request, login_user: UserPayload, flow_info: Flow, version_id) -> bool: logger.info(f'create_flow_hook flow: {flow_info.id}, user_payload: {login_user.user_id}') + # 将技能所需的表单写到数据库内 + try: + if flow_info.data and not get_L2_param_from_flow(flow_info.data, flow_info.id.hex, version_id): + logger.error(f'flow_id={flow_info.id} extract file_node fail') + except Exception: + pass # 将技能关联到对应的用户组下 user_group = UserGroupDao.get_user_group(login_user.user_id) if user_group: diff --git a/src/backend/bisheng/api/v1/flows.py b/src/backend/bisheng/api/v1/flows.py index 80cb6b871..85d761f14 100644 --- a/src/backend/bisheng/api/v1/flows.py +++ b/src/backend/bisheng/api/v1/flows.py @@ -45,7 +45,7 @@ def create_flow(*, request: Request, flow: FlowCreate, login_user: UserPayload = current_version = FlowVersionDao.get_version_by_flow(db_flow.id.hex) ret = FlowRead.model_validate(db_flow) ret.version_id = current_version.id - FlowService.create_flow_hook(request, login_user, db_flow) + FlowService.create_flow_hook(request, login_user, db_flow, ret.version_id) return resp_200(data=ret)