@@ -647,7 +647,6 @@ class Operate(serializers.Serializer):
647647 application_id = serializers .UUIDField (required = True , error_messages = ErrMessage .uuid ("应用id" ))
648648 user_id = serializers .UUIDField (required = True , error_messages = ErrMessage .uuid ("用户id" ))
649649 model_id = serializers .UUIDField (required = False , error_messages = ErrMessage .uuid ("模型id" ))
650- ai_node_id = serializers .UUIDField (required = False , error_messages = ErrMessage .uuid ("AI节点id" ))
651650
652651 def is_valid (self , * , raise_exception = False ):
653652 super ().is_valid (raise_exception = True )
@@ -920,65 +919,6 @@ def list_dataset(self, with_valid=True):
920919 [self .data .get ('user_id' ) if self .data .get ('user_id' ) == str (application .user_id ) else None ,
921920 application .user_id , self .data .get ('user_id' )])
922921
923- def get_other_file_list (self ):
924- temperature = None
925- max_tokens = None
926- application_id = self .initial_data .get ("application_id" )
927- ai_node_id = self .initial_data .get ("ai_node_id" )
928- model_id = self .initial_data .get ("model_id" )
929-
930- application = Application .objects .filter (id = application_id ).first ()
931- if application :
932- if application .type == 'SIMPLE' :
933- setting_dict = application .model_setting
934- temperature = setting_dict .get ("temperature" )
935- max_tokens = setting_dict .get ("max_tokens" )
936- elif application .type == 'WORK_FLOW' :
937- work_flow = application .work_flow
938- api_node = next ((node for node in work_flow .get ('nodes' , []) if node .get ('id' ) == ai_node_id ), None )
939- if api_node :
940- node_data = api_node .get ('properties' , {}).get ('node_data' , {})
941- temperature = node_data .get ("temperature" )
942- max_tokens = node_data .get ("max_tokens" )
943-
944- model = Model .objects .filter (id = model_id ).first ()
945- if model :
946- res = ModelProvideConstants [model .provider ].value .get_model_credential (model .model_type ,
947- model .model_name ).get_other_fields (
948- model .model_name )
949- if temperature is not None and 'temperature' in res :
950- res ['temperature' ]['value' ] = temperature
951- if max_tokens is not None and 'max_tokens' in res :
952- res ['max_tokens' ]['value' ] = max_tokens
953- return res
954-
955- def save_other_config (self , data ):
956- application = Application .objects .filter (id = self .initial_data .get ("application_id" )).first ()
957- if not application :
958- return
959-
960- if application .type == 'SIMPLE' :
961- setting_dict = application .model_setting
962- for key in ['max_tokens' , 'temperature' ]:
963- if key in data :
964- setting_dict [key ] = data [key ]
965- application .model_setting = setting_dict
966-
967- elif application .type == 'WORK_FLOW' :
968- work_flow = application .work_flow
969- ai_node_id = data .get ("node_id" )
970- for api_node in work_flow .get ('nodes' , []):
971- if api_node .get ('id' ) == ai_node_id :
972- node_data = api_node .get ('properties' , {}).get ('node_data' , {})
973- for key in ['max_tokens' , 'temperature' ]:
974- if key in data :
975- node_data [key ] = data [key ]
976- api_node ['properties' ]['node_data' ] = node_data
977- break
978- application .work_flow = work_flow
979-
980- application .save ()
981-
982922 @staticmethod
983923 def get_work_flow_model (instance ):
984924 if 'nodes' not in instance .get ('work_flow' ):
0 commit comments