Skip to content

Commit

Permalink
修复空输入触发的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-sky committed Jul 31, 2023
1 parent 37afcc7 commit 484f16e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions crazy_functions/批量Markdown翻译.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 484f16e

Please sign in to comment.