turn off plugin hot-reload by default
This commit is contained in:
parent
2f148bada0
commit
2f2b869efd
@ -237,6 +237,10 @@ WHEN_TO_USE_PROXY = ["Download_LLM", "Download_Gradio_Theme", "Connect_Grobid",
|
|||||||
BLOCK_INVALID_APIKEY = False
|
BLOCK_INVALID_APIKEY = False
|
||||||
|
|
||||||
|
|
||||||
|
# 启用插件热加载
|
||||||
|
PLUGIN_HOT_RELOAD = False
|
||||||
|
|
||||||
|
|
||||||
# 自定义按钮的最大数量限制
|
# 自定义按钮的最大数量限制
|
||||||
NUM_CUSTOM_BASIC_BTN = 4
|
NUM_CUSTOM_BASIC_BTN = 4
|
||||||
|
|
||||||
|
24
toolbox.py
24
toolbox.py
@ -180,12 +180,15 @@ def HotReload(f):
|
|||||||
最后,使用yield from语句返回重新加载过的函数,并在被装饰的函数上执行。
|
最后,使用yield from语句返回重新加载过的函数,并在被装饰的函数上执行。
|
||||||
最终,装饰器函数返回内部函数。这个内部函数可以将函数的原始定义更新为最新版本,并执行函数的新版本。
|
最终,装饰器函数返回内部函数。这个内部函数可以将函数的原始定义更新为最新版本,并执行函数的新版本。
|
||||||
"""
|
"""
|
||||||
@wraps(f)
|
if get_conf('PLUGIN_HOT_RELOAD'):
|
||||||
def decorated(*args, **kwargs):
|
@wraps(f)
|
||||||
fn_name = f.__name__
|
def decorated(*args, **kwargs):
|
||||||
f_hot_reload = getattr(importlib.reload(inspect.getmodule(f)), fn_name)
|
fn_name = f.__name__
|
||||||
yield from f_hot_reload(*args, **kwargs)
|
f_hot_reload = getattr(importlib.reload(inspect.getmodule(f)), fn_name)
|
||||||
return decorated
|
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)
|
@lru_cache(maxsize=128)
|
||||||
def get_conf(*args):
|
def get_conf(*args):
|
||||||
# 建议您复制一个config_private.py放自己的秘密, 如API和代理网址, 避免不小心传github被别人看到
|
"""
|
||||||
|
本项目的所有配置都集中在config.py中。 修改配置有三种方法,您只需要选择其中一种即可:
|
||||||
|
- 直接修改config.py
|
||||||
|
- 创建并修改config_private.py
|
||||||
|
- 修改环境变量(修改docker-compose.yml等价于修改容器内部的环境变量)
|
||||||
|
|
||||||
|
注意:如果您使用docker-compose部署,请修改docker-compose(等价于修改容器内部的环境变量)
|
||||||
|
"""
|
||||||
res = []
|
res = []
|
||||||
for arg in args:
|
for arg in args:
|
||||||
r = read_single_conf_with_lru_cache(arg)
|
r = read_single_conf_with_lru_cache(arg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user