File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1103,11 +1103,14 @@ def run_task(self, in_chat: bool = True):
11031103 _fields_list .append (field if not _fields .get (field ) else _fields .get (field ))
11041104 data .append (_row )
11051105 _fields_skip = True
1106- df = pd .DataFrame (np .array (data ), columns = _fields_list )
1107- markdown_table = df .to_markdown (index = False )
1108- yield markdown_table + '\n \n '
11091106
1110- record = self .finish ()
1107+ if not data or not _fields_list :
1108+ yield 'The SQL execution result is empty.\n \n '
1109+ else :
1110+ df = pd .DataFrame (np .array (data ), columns = _fields_list )
1111+ markdown_table = df .to_markdown (index = False )
1112+ yield markdown_table + '\n \n '
1113+
11111114 if in_chat :
11121115 yield 'data:' + orjson .dumps ({'type' : 'finish' }).decode () + '\n \n '
11131116 else :
@@ -1135,6 +1138,8 @@ def run_task(self, in_chat: bool = True):
11351138 yield 'data:' + orjson .dumps ({'content' : error_msg , 'type' : 'error' }).decode () + '\n \n '
11361139 else :
11371140 yield f'> ❌ **ERROR**\n \n > \n \n > { error_msg } 。'
1141+ finally :
1142+ self .finish ()
11381143
11391144 def run_recommend_questions_task_async (self ):
11401145 self .future = executor .submit (self .run_recommend_questions_task_cache )
You can’t perform that action at this time.
0 commit comments