mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 03:32:33 +08:00
perf: 完整性检查忽略__开头的属性
This commit is contained in:
parent
85c623fb0f
commit
49f4ab0ec8
12
main.py
12
main.py
|
@ -129,11 +129,15 @@ def main(first_time_init=False):
|
||||||
|
|
||||||
config = importlib.import_module('config')
|
config = importlib.import_module('config')
|
||||||
|
|
||||||
#配置完整性校验
|
init_runtime_log_file()
|
||||||
|
|
||||||
|
sh = reset_logging()
|
||||||
|
|
||||||
|
# 配置完整性校验
|
||||||
is_integrity = True
|
is_integrity = True
|
||||||
config_template = importlib.import_module('config-template')
|
config_template = importlib.import_module('config-template')
|
||||||
for key in dir(config_template):
|
for key in dir(config_template):
|
||||||
if not hasattr(config, key):
|
if not key.startswith("__") and not hasattr(config, key):
|
||||||
setattr(config, key, getattr(config_template, key))
|
setattr(config, key, getattr(config_template, key))
|
||||||
logging.warning("[{}]不存在".format(key))
|
logging.warning("[{}]不存在".format(key))
|
||||||
is_integrity = False
|
is_integrity = False
|
||||||
|
@ -145,10 +149,6 @@ def main(first_time_init=False):
|
||||||
import pkg.utils.context
|
import pkg.utils.context
|
||||||
pkg.utils.context.set_config(config)
|
pkg.utils.context.set_config(config)
|
||||||
|
|
||||||
init_runtime_log_file()
|
|
||||||
|
|
||||||
sh = reset_logging()
|
|
||||||
|
|
||||||
# 检查是否设置了管理员
|
# 检查是否设置了管理员
|
||||||
if not (hasattr(config, 'admin_qq') and config.admin_qq != 0):
|
if not (hasattr(config, 'admin_qq') and config.admin_qq != 0):
|
||||||
# logging.warning("未设置管理员QQ,管理员权限指令及运行告警将无法使用,如需设置请修改config.py中的admin_qq字段")
|
# logging.warning("未设置管理员QQ,管理员权限指令及运行告警将无法使用,如需设置请修改config.py中的admin_qq字段")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user