better traceback

这个提交包含在:
Your Name
2023-03-24 15:25:14 +08:00
父节点 ea4cd5a75a
当前提交 031232c986
共有 5 个文件被更改,包括 73 次插入88 次删除

查看文件

@@ -1,18 +1,7 @@
from functools import wraps
from predict import predict_no_ui
from toolbox import CatchException, report_execption
fast_debug = False
def CatchException(f):
@wraps(f)
def decorated(txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT):
try:
yield from f(txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT)
except Exception as e:
import traceback
tb_str = traceback.format_exc()
chatbot[-1] = (chatbot[-1][0], f"[Local Message] something error occured: \n {tb_str}")
yield chatbot, history, f'异常 {e}'
return decorated
@CatchException
@@ -66,12 +55,6 @@ def 解析项目本身(txt, top_p, temperature, chatbot, history, systemPromptTx
history.append(i_say); history.append(gpt_say)
yield chatbot, history, '正常'
def report_execption(chatbot, history, a, b):
chatbot.append((a, b))
history.append(a); history.append(b)
def 解析源代码(file_manifest, project_folder, top_p, temperature, chatbot, history, systemPromptTxt):