mirror of
https://github.com/Kakune55/PyGetGPT.git
synced 2025-12-16 01:03:55 +08:00
添加对SQLite3数据库的支持
This commit is contained in:
16
config.py
16
config.py
@@ -2,4 +2,18 @@ import json
|
||||
|
||||
def readConf():
|
||||
with open('config.json') as f:
|
||||
return json.load(f)
|
||||
return json.load(f)
|
||||
|
||||
def updateConf(data_dict):
|
||||
# 打开JSON文件并读取内容
|
||||
file_path = 'config.json'
|
||||
with open(file_path, 'r') as json_file:
|
||||
existing_data = json.load(json_file)
|
||||
|
||||
# 将新的数据合并到现有的数据中
|
||||
existing_data.update(data_dict)
|
||||
|
||||
# 再次打开文件(这次是以写模式),并将更新后的数据保存回文件
|
||||
with open(file_path, 'w') as json_file:
|
||||
json.dump(existing_data, json_file, indent=4, ensure_ascii=False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user