From 57124c2d2c22fa814ba8d3a1ee1ef185540d32a3 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Mon, 26 Aug 2024 14:53:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E6=A8=A1=E5=9E=8B=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/application/flow/workflow_manage.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/application/flow/workflow_manage.py b/apps/application/flow/workflow_manage.py index b48c2853e..0fc9c27f4 100644 --- a/apps/application/flow/workflow_manage.py +++ b/apps/application/flow/workflow_manage.py @@ -13,6 +13,7 @@ from typing import List, Dict from django.db.models import QuerySet from langchain_core.messages import AIMessage from langchain_core.prompts import PromptTemplate +from rest_framework.exceptions import ErrorDetail, ValidationError from application.flow import tools from application.flow.i_step_node import INode, WorkFlowPostHandler, NodeResult @@ -131,6 +132,8 @@ class Flow: node_list = [node for node in self.nodes if (node.type == 'ai-chat-node' or node.type == 'question-node')] for node in node_list: model = QuerySet(Model).filter(id=node.properties.get('node_data', {}).get('model_id')).first() + if model is None: + raise ValidationError(ErrorDetail(f'节点{node.properties.get("stepName")} 模型不存在')) credential = get_model_credential(model.provider, model.model_type, model.model_name) model_params_setting = node.properties.get('node_data', {}).get('model_params_setting') model_params_setting_form = credential.get_model_params_setting_form(