From 484f16e3656cbbb39d7a76524911426ca9ab679c Mon Sep 17 00:00:00 2001 From: qingxu fu <505030475@qq.com> Date: Mon, 31 Jul 2023 12:08:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A9=BA=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crazy_functions/批量Markdown翻译.py | 1 + toolbox.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/crazy_functions/批量Markdown翻译.py b/crazy_functions/批量Markdown翻译.py index 3f89c01..ea8dee9 100644 --- a/crazy_functions/批量Markdown翻译.py +++ b/crazy_functions/批量Markdown翻译.py @@ -113,6 +113,7 @@ def 多文件翻译(file_manifest, project_folder, llm_kwargs, plugin_kwargs, ch def get_files_from_everything(txt, preference=''): + if txt == "": return False, None, None success = True if txt.startswith('http'): import requests diff --git a/toolbox.py b/toolbox.py index 0fc4b0c..0c553d1 100644 --- a/toolbox.py +++ b/toolbox.py @@ -117,20 +117,20 @@ def CatchException(f): """ @wraps(f) - def decorated(txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT=-1): + def decorated(main_input, llm_kwargs, plugin_kwargs, chatbot_with_cookie, history, *args, **kwargs): try: - yield from f(txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT) + yield from f(main_input, llm_kwargs, plugin_kwargs, chatbot_with_cookie, history, *args, **kwargs) except Exception as e: from check_proxy import check_proxy from toolbox import get_conf proxies, = get_conf('proxies') tb_str = '```\n' + trimmed_format_exc() + '```' - if len(chatbot) == 0: - chatbot.clear() - chatbot.append(["插件调度异常", "异常原因"]) - chatbot[-1] = (chatbot[-1][0], + if len(chatbot_with_cookie) == 0: + chatbot_with_cookie.clear() + chatbot_with_cookie.append(["插件调度异常", "异常原因"]) + chatbot_with_cookie[-1] = (chatbot_with_cookie[-1][0], f"[Local Message] 实验性函数调用出错: \n\n{tb_str} \n\n当前代理可用性: \n\n{check_proxy(proxies)}") - yield from update_ui(chatbot=chatbot, history=history, msg=f'异常 {e}') # 刷新界面 + yield from update_ui(chatbot=chatbot_with_cookie, history=history, msg=f'异常 {e}') # 刷新界面 return decorated @@ -1002,7 +1002,7 @@ def get_plugin_default_kwargs(): # txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port default_plugin_kwargs = { - "main_inputs": "./README.md", + "main_input": "./README.md", "llm_kwargs": llm_kwargs, "plugin_kwargs": {}, "chatbot_with_cookie": chatbot,