@@ -80,6 +80,7 @@ def inner():
8080
8181 return await asyncio .to_thread (inner )
8282
83+
8384@router .get ("/record/{chat_record_id}/data_live" , summary = f"{ PLACEHOLDER_PREFIX } get_chart_data_live" )
8485async def chat_record_data_live (session : SessionDep , current_user : CurrentUser , chat_record_id : int ):
8586 def inner ():
@@ -88,6 +89,7 @@ def inner():
8889
8990 return await asyncio .to_thread (inner )
9091
92+
9193@router .get ("/record/{chat_record_id}/predict_data" , summary = f"{ PLACEHOLDER_PREFIX } get_chart_predict_data" )
9294async def chat_predict_data (session : SessionDep , current_user : CurrentUser , chat_record_id : int ):
9395 def inner ():
@@ -275,7 +277,8 @@ async def question_answer(session: SessionDep, current_user: CurrentUser, reques
275277async def question_answer_inner (session : SessionDep , current_user : CurrentUser , request_question : ChatQuestion ,
276278 current_assistant : Optional [CurrentAssistant ] = None , in_chat : bool = True ,
277279 stream : bool = True ,
278- finish_step : ChatFinishStep = ChatFinishStep .GENERATE_CHART , embedding : bool = False ):
280+ finish_step : ChatFinishStep = ChatFinishStep .GENERATE_CHART , embedding : bool = False ,
281+ return_img : bool = True ):
279282 try :
280283 command , text_before_command , record_id , warning_info = parse_quick_command (request_question .question )
281284 if command :
@@ -331,7 +334,7 @@ async def question_answer_inner(session: SessionDep, current_user: CurrentUser,
331334 request_question .question = text_before_command
332335 request_question .regenerate_record_id = rec_id
333336 return await stream_sql (session , current_user , request_question , current_assistant , in_chat , stream ,
334- finish_step , embedding )
337+ finish_step , embedding , return_img )
335338
336339 elif command == QuickCommand .ANALYSIS :
337340 return await analysis_or_predict (session , current_user , rec_id , 'analysis' , current_assistant , in_chat ,
@@ -344,7 +347,7 @@ async def question_answer_inner(session: SessionDep, current_user: CurrentUser,
344347 raise Exception (f'Unknown command: { command .value } ' )
345348 else :
346349 return await stream_sql (session , current_user , request_question , current_assistant , in_chat , stream ,
347- finish_step , embedding )
350+ finish_step , embedding , return_img )
348351 except Exception as e :
349352 traceback .print_exc ()
350353
@@ -366,12 +369,13 @@ def _err(_e: Exception):
366369
367370async def stream_sql (session : SessionDep , current_user : CurrentUser , request_question : ChatQuestion ,
368371 current_assistant : Optional [CurrentAssistant ] = None , in_chat : bool = True , stream : bool = True ,
369- finish_step : ChatFinishStep = ChatFinishStep .GENERATE_CHART , embedding : bool = False ):
372+ finish_step : ChatFinishStep = ChatFinishStep .GENERATE_CHART , embedding : bool = False ,
373+ return_img : bool = True ):
370374 try :
371375 llm_service = await LLMService .create (session , current_user , request_question , current_assistant ,
372376 embedding = embedding )
373377 llm_service .init_record (session = session )
374- llm_service .run_task_async (in_chat = in_chat , stream = stream , finish_step = finish_step )
378+ llm_service .run_task_async (in_chat = in_chat , stream = stream , finish_step = finish_step , return_img = return_img )
375379 except Exception as e :
376380 traceback .print_exc ()
377381
@@ -536,7 +540,8 @@ async def export_excel(session: SessionDep, current_user: CurrentUser, chat_reco
536540
537541 def inner ():
538542
539- data_list = DataFormat .convert_large_numbers_in_object_array (obj_array = _data + _predict_data , int_threshold = 1e11 )
543+ data_list = DataFormat .convert_large_numbers_in_object_array (obj_array = _data + _predict_data ,
544+ int_threshold = 1e11 )
540545
541546 md_data , _fields_list = DataFormat .convert_object_array_for_pandas (fields , data_list )
542547
0 commit comments