mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-02-28 17:01:08 +08:00
fix: drag sensitive bug
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
|
||||
1. 本项目遵循 [MIT开源协议](/LICENSE),仅用于技术研究和学习,使用本项目时需遵守所在地法律法规、相关政策以及企业章程,禁止用于任何违法或侵犯他人权益的行为
|
||||
2. 境内使用该项目时,请使用国内厂商的大模型服务,并进行必要的内容安全审核及过滤
|
||||
3. 本项目主要接入协同办公平台,请使用公众号、企微自建应用、钉钉、飞书等接入通道,其他通道为历史产物,已不再维护
|
||||
3. 本项目主要接入协同办公平台,推荐使用公众号、企微自建应用、钉钉、飞书等接入通道,其他通道为历史产物已不维护
|
||||
4. 任何个人、团队和企业,无论以何种方式使用该项目、对何对象提供服务,所产生的一切后果,本项目均不承担任何责任
|
||||
|
||||
## 社区
|
||||
|
||||
10
config.py
10
config.py
@@ -237,12 +237,14 @@ def drag_sensitive(config):
|
||||
conf_dict: dict = json.loads(config)
|
||||
for key in conf_dict:
|
||||
if "key" in key or "secret" in key:
|
||||
conf_dict[key] = conf_dict[key][0:3] + "*" * 5 + conf_dict[key][-3:]
|
||||
if isinstance(key, str):
|
||||
conf_dict[key] = conf_dict[key][0:3] + "*" * 5 + conf_dict[key][-3:]
|
||||
return json.dumps(conf_dict, indent=4)
|
||||
elif isinstance(config, dict):
|
||||
for key in config:
|
||||
if "key" in key or "secret" in key:
|
||||
config[key] = config[key][0:3] + "*" * 5 + config[key][-3:]
|
||||
if isinstance(key, str):
|
||||
config[key] = config[key][0:3] + "*" * 5 + config[key][-3:]
|
||||
return config
|
||||
|
||||
return config
|
||||
@@ -256,7 +258,7 @@ def load_config():
|
||||
config_path = "./config-template.json"
|
||||
|
||||
config_str = read_file(config_path)
|
||||
logger.debug("[INIT] config str: {}".format(drag_sensitive(config_str)))
|
||||
logger.debug("[INIT] config str: {}".format(config_str))
|
||||
|
||||
# 将json字符串反序列化为dict类型
|
||||
config = Config(json.loads(config_str))
|
||||
@@ -281,7 +283,7 @@ def load_config():
|
||||
logger.setLevel(logging.DEBUG)
|
||||
logger.debug("[INIT] set log level to DEBUG")
|
||||
|
||||
logger.info("[INIT] load config: {}".format(drag_sensitive(config)))
|
||||
logger.info("[INIT] load config: {}".format(config))
|
||||
|
||||
config.load_user_datas()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user