turn off plugin hot-reload by default

This commit is contained in:
binary-husky 2023-12-09 21:54:34 +08:00
parent 2f148bada0
commit 2f2b869efd
2 changed files with 21 additions and 7 deletions

View File

@ -237,6 +237,10 @@ WHEN_TO_USE_PROXY = ["Download_LLM", "Download_Gradio_Theme", "Connect_Grobid",
BLOCK_INVALID_APIKEY = False
# 启用插件热加载
PLUGIN_HOT_RELOAD = False
# 自定义按钮的最大数量限制
NUM_CUSTOM_BASIC_BTN = 4

View File

@ -180,12 +180,15 @@ def HotReload(f):
最后使用yield from语句返回重新加载过的函数并在被装饰的函数上执行
最终装饰器函数返回内部函数这个内部函数可以将函数的原始定义更新为最新版本并执行函数的新版本
"""
@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
if get_conf('PLUGIN_HOT_RELOAD'):
@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
else:
return f
"""
@ -916,7 +919,14 @@ def read_single_conf_with_lru_cache(arg):
@lru_cache(maxsize=128)
def get_conf(*args):
# 建议您复制一个config_private.py放自己的秘密, 如API和代理网址, 避免不小心传github被别人看到
"""
本项目的所有配置都集中在config.py中 修改配置有三种方法您只需要选择其中一种即可
- 直接修改config.py
- 创建并修改config_private.py
- 修改环境变量修改docker-compose.yml等价于修改容器内部的环境变量
注意如果您使用docker-compose部署请修改docker-compose等价于修改容器内部的环境变量
"""
res = []
for arg in args:
r = read_single_conf_with_lru_cache(arg)