添加本地缓存删除功能
This commit is contained in:
parent
2ff8dc787e
commit
5e48fc98ed
@ -24,6 +24,7 @@ def get_crazy_functions():
|
|||||||
from crazy_functions.对话历史存档 import 对话历史存档
|
from crazy_functions.对话历史存档 import 对话历史存档
|
||||||
from crazy_functions.对话历史存档 import 载入对话历史存档
|
from crazy_functions.对话历史存档 import 载入对话历史存档
|
||||||
from crazy_functions.对话历史存档 import 删除所有本地对话历史记录
|
from crazy_functions.对话历史存档 import 删除所有本地对话历史记录
|
||||||
|
from crazy_functions.辅助功能 import 清除缓存
|
||||||
|
|
||||||
from crazy_functions.批量Markdown翻译 import Markdown英译中
|
from crazy_functions.批量Markdown翻译 import Markdown英译中
|
||||||
function_plugins = {
|
function_plugins = {
|
||||||
@ -40,7 +41,12 @@ def get_crazy_functions():
|
|||||||
"AsButton":False,
|
"AsButton":False,
|
||||||
"Function": HotReload(删除所有本地对话历史记录)
|
"Function": HotReload(删除所有本地对话历史记录)
|
||||||
},
|
},
|
||||||
"[测试功能] 解析Jupyter Notebook文件": {
|
"清除所有缓存文件(请谨慎操作)": {
|
||||||
|
"Color": "stop",
|
||||||
|
"AsButton": False, # 加入下拉菜单中
|
||||||
|
"Function": HotReload(清除缓存)
|
||||||
|
},
|
||||||
|
"解析Jupyter Notebook文件": {
|
||||||
"Color": "stop",
|
"Color": "stop",
|
||||||
"AsButton":False,
|
"AsButton":False,
|
||||||
"Function": HotReload(解析ipynb文件),
|
"Function": HotReload(解析ipynb文件),
|
||||||
@ -328,7 +334,7 @@ def get_crazy_functions():
|
|||||||
try:
|
try:
|
||||||
from crazy_functions.Langchain知识库 import 知识库问答
|
from crazy_functions.Langchain知识库 import 知识库问答
|
||||||
function_plugins.update({
|
function_plugins.update({
|
||||||
"[功能尚不稳定] 构建知识库(请先上传文件素材)": {
|
"构建知识库(请先上传文件素材)": {
|
||||||
"Color": "stop",
|
"Color": "stop",
|
||||||
"AsButton": False,
|
"AsButton": False,
|
||||||
"AdvancedArgs": True,
|
"AdvancedArgs": True,
|
||||||
@ -342,7 +348,7 @@ def get_crazy_functions():
|
|||||||
try:
|
try:
|
||||||
from crazy_functions.Langchain知识库 import 读取知识库作答
|
from crazy_functions.Langchain知识库 import 读取知识库作答
|
||||||
function_plugins.update({
|
function_plugins.update({
|
||||||
"[功能尚不稳定] 知识库问答": {
|
"知识库问答": {
|
||||||
"Color": "stop",
|
"Color": "stop",
|
||||||
"AsButton": False,
|
"AsButton": False,
|
||||||
"AdvancedArgs": True,
|
"AdvancedArgs": True,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# @Author : Spike
|
# @Author : Spike
|
||||||
# @Descr :
|
# @Descr :
|
||||||
from toolbox import update_ui
|
from toolbox import update_ui
|
||||||
from toolbox import CatchException, report_execption, write_results_to_file
|
from toolbox import CatchException, report_execption, write_results_to_file, get_log_folder
|
||||||
from crazy_functions.crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
|
from crazy_functions.crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
|
||||||
|
|
||||||
|
|
||||||
@ -25,4 +25,19 @@ def 猜你想问(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt
|
|||||||
)
|
)
|
||||||
chatbot[-1] = (show_say, gpt_say)
|
chatbot[-1] = (show_say, gpt_say)
|
||||||
history.extend([show_say, gpt_say])
|
history.extend([show_say, gpt_say])
|
||||||
|
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
||||||
|
|
||||||
|
|
||||||
|
@CatchException
|
||||||
|
def 清除缓存(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port):
|
||||||
|
chatbot.append(['清除本地缓存数据', '执行中. 删除 gpt_log & private_upload'])
|
||||||
|
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
||||||
|
|
||||||
|
import shutil, os
|
||||||
|
gpt_log_dir = os.path.join(os.path.dirname(__file__), '..', 'gpt_log')
|
||||||
|
private_upload_dir = os.path.join(os.path.dirname(__file__), '..', 'private_upload')
|
||||||
|
shutil.rmtree(gpt_log_dir, ignore_errors=True)
|
||||||
|
shutil.rmtree(private_upload_dir, ignore_errors=True)
|
||||||
|
|
||||||
|
chatbot.append(['清除本地缓存数据', '执行完成'])
|
||||||
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
Loading…
x
Reference in New Issue
Block a user