File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -1028,16 +1028,23 @@ def run_analysis_or_predict_task(self, action_type: str):
10281028 pass
10291029
10301030 def validate_history_ds (self ):
1031- _invalid_ds = False
10321031 _ds = self .ds
10331032 if not self .current_assistant :
10341033 current_ds = self .session .exec (CoreDatasource , _ds .id )
1035- _invalid_ds = not current_ds
1034+ if not current_ds :
1035+ raise Exception ('ds is invalid' )
10361036 else :
1037- _ds_list : list [dict ] = get_assistant_ds (session = self .session , llm_service = self )
1038- _invalid_ds = any (item .get ("id" ) == _ds .id for item in _ds_list )
1039- if _invalid_ds :
1040- yield orjson .dumps ({'content' : 'ds is invalid' , 'type' : 'error' }).decode () + '\n \n '
1037+ try :
1038+ _ds_list : list [dict ] = get_assistant_ds (session = self .session , llm_service = self )
1039+ match_ds = any (item .get ("id" ) == _ds .id for item in _ds_list )
1040+ if not match_ds :
1041+ type = self .current_assistant .type
1042+ msg = f"ds is invalid [please check ds list and public ds list]" if type == 0 else f"ds is invalid [please check ds api]"
1043+ raise Exception (msg )
1044+ except Exception as e :
1045+ raise Exception (f"ds is invalid [{ str (e )} ]" )
1046+
1047+
10411048
10421049def execute_sql_with_db (db : SQLDatabase , sql : str ) -> str :
10431050 """Execute SQL query using SQLDatabase
You can’t perform that action at this time.
0 commit comments