1 Star 0 Fork 0

Lance/chatgpt-on-wecom

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
config.py 688 Bytes
一键复制 编辑 原始数据 按行查看 历史
mostlittlebee 提交于 2023-02-16 20:58 +08:00 . 初始提交
# encoding:utf-8
import json
import os
from common.log import logger
config = {}
def load_config():
global config
config_path = "config.json"
if not os.path.exists(config_path):
raise Exception('配置文件不存在,请根据config-template.json模板创建config.json文件')
config_str = read_file(config_path)
# 将json字符串反序列化为dict类型
config = json.loads(config_str)
logger.info("[INIT] load config: {}".format(config))
def get_root():
return os.path.dirname(os.path.abspath( __file__ ))
def read_file(path):
with open(path, mode='r', encoding='utf-8') as f:
return f.read()
def conf():
return config
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lance521/chatgpt-on-wecom.git
git@gitee.com:lance521/chatgpt-on-wecom.git
lance521
chatgpt-on-wecom
chatgpt-on-wecom
main

搜索帮助