将配置文件读取目录网上一层,增加安全性
This commit is contained in:
10
config.py
10
config.py
@ -1,6 +1,16 @@
|
||||
# [step 1]>> 例如: API_KEY = "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" (此key无效)
|
||||
API_KEY = "sk-此处填API密钥" # 可同时填写多个API-KEY,用英文逗号分割,例如API_KEY = "sk-openaikey1,sk-openaikey2,fkxxxx-api2dkey1,fkxxxx-api2dkey2"
|
||||
|
||||
prompt_list = {'key': ['所有人', '个人'], 'value': []}
|
||||
|
||||
switch_model = {'key': ['input加密', '隐私模式'], 'value': ['input加密']}
|
||||
|
||||
private_key = 'uhA51pHtjisfjij'
|
||||
|
||||
import func_box
|
||||
import os
|
||||
devs_document = "/file="+os.path.join(func_box.base_path, 'README.md')
|
||||
|
||||
# [step 2]>> 改为True应用代理,如果直接在海外服务器部署,此处不修改
|
||||
USE_PROXY = False
|
||||
if USE_PROXY:
|
||||
|
||||
@ -13,6 +13,7 @@ import shutil
|
||||
import os
|
||||
import time
|
||||
import glob
|
||||
import sys
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
############################### 插件输入输出接驳区 #######################################
|
||||
|
||||
@ -647,6 +648,12 @@ def read_single_conf_with_lru_cache(arg):
|
||||
except:
|
||||
try:
|
||||
# 优先级2. 获取config_private中的配置
|
||||
# 获取当前文件所在目录的路径
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# 获取上一层目录的路径
|
||||
parent_dir = os.path.dirname(current_dir)
|
||||
# 将上一层目录添加到Python的搜索路径中
|
||||
sys.path.append(parent_dir)
|
||||
r = getattr(importlib.import_module('config_private'), arg)
|
||||
except:
|
||||
# 优先级3. 获取config中的配置
|
||||
|
||||
Reference in New Issue
Block a user