Skip to content

Commit

Permalink
fix: 修复从模板新建技能时没有保存对应的表单
Browse files Browse the repository at this point in the history
  • Loading branch information
zgqgit committed Jul 6, 2024
1 parent b4ab640 commit c2ba19c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/backend/bisheng/api/services/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/backend/bisheng/api/v1/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit c2ba19c

Please sign in to comment.