1- import importlib
21import os
32import random
43import shutil
1110from builder_core import (beauty_output , gen_response_and_process ,
1211 init_builder_chatbot_agent )
1312from config_utils import (DEFAULT_AGENT_DIR , Config , get_avatar_image ,
14- get_ci_dir , get_user_cfg_file , get_user_dir ,
13+ get_ci_dir , get_user_dir ,
1514 is_valid_plugin_configuration , parse_configuration ,
1615 save_avatar_image , save_builder_configuration ,
1716 save_plugin_configuration )
@@ -34,10 +33,10 @@ def init_user(uuid_str, state):
3433 state ['user_agent' ] = user_agent
3534 state ['user_memory' ] = user_memory
3635 except Exception as e :
37- logger .error (
36+ logger .query_error (
3837 uuid = uuid_str ,
3938 error = str (e ),
40- content = {'error_traceback' : traceback .format_exc ()})
39+ details = {'error_traceback' : traceback .format_exc ()})
4140 return state
4241
4342
@@ -47,10 +46,10 @@ def init_builder(uuid_str, state):
4746 state ['builder_agent' ] = builder_agent
4847 state ['builder_memory' ] = builder_memory
4948 except Exception as e :
50- logger .error (
49+ logger .query_error (
5150 uuid = uuid_str ,
5251 error = str (e ),
53- content = {'error_traceback' : traceback .format_exc ()})
52+ details = {'error_traceback' : traceback .format_exc ()})
5453 return state
5554
5655
@@ -60,10 +59,10 @@ def update_builder(uuid_str, state):
6059 builder_agent = init_builder_chatbot_agent (uuid_str )
6160 state ['builder_agent' ] = builder_agent
6261 except Exception as e :
63- logger .error (
62+ logger .query_error (
6463 uuid = uuid_str ,
6564 error = str (e ),
66- content = {'error_traceback' : traceback .format_exc ()})
65+ details = {'error_traceback' : traceback .format_exc ()})
6766
6867 return state
6968
@@ -292,10 +291,10 @@ def check_uuid(uuid_str):
292291
293292 # 初始化表单
294293 def init_ui_config (uuid_str , _state , builder_cfg , model_cfg , tool_cfg ):
295- logger .info (
294+ logger .query_info (
296295 uuid = uuid_str ,
297296 message = 'builder_cfg' ,
298- content = {'builder_cfg' : str (builder_cfg )})
297+ details = {'builder_cfg' : str (builder_cfg )})
299298 # available models
300299 models = list (model_cfg .keys ())
301300 capabilities = [(tool_cfg [tool_key ]['name' ], tool_key )
@@ -408,8 +407,8 @@ def create_send_message(chatbot, input, _state, uuid_str):
408407 llm_result = frame .get ('llm_text' , '' )
409408 exec_result = frame .get ('exec_result' , '' )
410409 step_result = frame .get ('step' , '' )
411- logger .info (
412- uuid = uuid_str , message = 'frame' , content = {'frame' : str (frame )})
410+ logger .query_info (
411+ uuid = uuid_str , message = 'frame' , details = {'frame' : str (frame )})
413412 if len (exec_result ) != 0 :
414413 if isinstance (exec_result , dict ):
415414 exec_result = exec_result ['result' ]
@@ -506,10 +505,10 @@ def process_configuration(uuid_str, bot_avatar, name, description,
506505 if is_valid_plugin_configuration (openapi_plugin_cfg ):
507506 save_plugin_configuration (openapi_plugin_cfg , uuid_str )
508507 except Exception as e :
509- logger .error (
508+ logger .query_error (
510509 uuid = uuid_str ,
511510 error = str (e ),
512- content = {'error_traceback' : traceback .format_exc ()})
511+ details = {'error_traceback' : traceback .format_exc ()})
513512
514513 save_builder_configuration (builder_cfg , uuid_str )
515514 update_builder (uuid_str , state )
@@ -585,7 +584,8 @@ def preview_send_message(chatbot, input, _state, uuid_str):
585584 input .text ,
586585 history = history ,
587586 ref_doc = ref_doc ,
588- append_files = append_files ):
587+ append_files = append_files ,
588+ uuid_str = uuid_str ):
589589 # append_files=new_file_paths):
590590 # important! do not change this
591591 response += frame
0 commit comments