33# @Author : Spike
44# @Descr :
55from toolbox import update_ui
6- from toolbox import CatchException , report_execption , write_results_to_file
6+ from toolbox import CatchException , report_execption , write_results_to_file , get_log_folder
77from crazy_functions .crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
88
99
@@ -25,4 +25,19 @@ def 猜你想问(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt
2525 )
2626 chatbot [- 1 ] = (show_say , gpt_say )
2727 history .extend ([show_say , gpt_say ])
28+ yield from update_ui (chatbot = chatbot , history = history ) # 刷新界面
29+
30+
31+ @CatchException
32+ def 清除缓存 (txt , llm_kwargs , plugin_kwargs , chatbot , history , system_prompt , web_port ):
33+ chatbot .append (['清除本地缓存数据' , '执行中. 删除 gpt_log & private_upload' ])
34+ yield from update_ui (chatbot = chatbot , history = history ) # 刷新界面
35+
36+ import shutil , os
37+ gpt_log_dir = os .path .join (os .path .dirname (__file__ ), '..' , 'gpt_log' )
38+ private_upload_dir = os .path .join (os .path .dirname (__file__ ), '..' , 'private_upload' )
39+ shutil .rmtree (gpt_log_dir , ignore_errors = True )
40+ shutil .rmtree (private_upload_dir , ignore_errors = True )
41+
42+ chatbot .append (['清除本地缓存数据' , '执行完成' ])
2843 yield from update_ui (chatbot = chatbot , history = history ) # 刷新界面
0 commit comments