Merge pull request #194 from fulyaec/enhance-chataca

修改AUTHENTICATION的判断,使得AUTHENTICATION为None/[]/""时都可以正确判断
这个提交包含在:
binary-husky
2023-03-31 19:49:40 +08:00
提交者 GitHub
当前提交 e6034b6928
共有 4 个文件被更改,包括 26 次插入9 次删除

查看文件

@@ -1,4 +1,4 @@
import markdown, mdtex2html, threading, importlib, traceback
import markdown, mdtex2html, threading, importlib, traceback, importlib, inspect
from show_math import convert as convert_math
from functools import wraps
import re
@@ -89,6 +89,17 @@ def CatchException(f):
yield chatbot, history, f'异常 {e}'
return decorated
def HotReload(f):
"""
装饰器函数,实现函数插件热更新
"""
@wraps(f)
def decorated(*args, **kwargs):
fn_name = f.__name__
f_hot_reload = getattr(importlib.reload(inspect.getmodule(f)), fn_name)
yield from f_hot_reload(*args, **kwargs)
return decorated
def report_execption(chatbot, history, a, b):
"""
向chatbot中添加错误信息