mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-Nonebot.git
synced 2026-04-01 22:04:51 +00:00
refactor(config):重构api_config.py
This commit is contained in:
parent
874de4a571
commit
27791fedb5
3 changed files with 98 additions and 76 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -17,7 +17,7 @@ bili.cookie
|
|||
*.log
|
||||
*.mp4
|
||||
/bili.cookie
|
||||
/src/configs/api_config.py
|
||||
|
||||
/src/configs/jm_config.yml
|
||||
/src/resources/temp
|
||||
/update_remote_code.py
|
||||
|
|
|
|||
97
src/configs/api_config.py
Normal file
97
src/configs/api_config.py
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
import yaml
|
||||
from pathlib import Path
|
||||
|
||||
CURRENT_FILE = Path(__file__).resolve()
|
||||
ROOT_DIR = CURRENT_FILE.parent.parent.parent # config -> src -> project root
|
||||
CONFIG_PATH = ROOT_DIR / "config.yaml"
|
||||
|
||||
with open(CONFIG_PATH, "r", encoding="utf-8") as f:
|
||||
config = yaml.safe_load(f)
|
||||
|
||||
#print(data)
|
||||
app_id = config['bot']['app_id']
|
||||
bot_account = config['bot']['bot_account']
|
||||
"""
|
||||
谷歌邮箱配置
|
||||
"""
|
||||
google_enabled = config['mail']['google']['enabled']
|
||||
google_smtp_server = config['mail']['google']['smtp_server']
|
||||
google_email = config['mail']['google']['email']
|
||||
google_password = config['mail']['google']['password']
|
||||
"""
|
||||
qq 邮箱配置
|
||||
"""
|
||||
qq_enabled = config['mail']['qq']['enabled']
|
||||
qq_smtp_server = config['mail']['qq']['smtp_server']
|
||||
qq_email = config['mail']['qq']['email']
|
||||
qq_password = config['mail']['qq']['password']
|
||||
|
||||
"""
|
||||
自建邮箱配置
|
||||
"""
|
||||
server_enabled = config['mail']['server']['enabled']
|
||||
server_smtp_server = config['mail']['server']['smtp_server']
|
||||
server_email = config['mail']['server']['email']
|
||||
server_password = config['mail']['server']['password']
|
||||
server_port = int(config['mail']['server']['port'])
|
||||
|
||||
"""
|
||||
图床配置
|
||||
"""
|
||||
# SMMS图床相关配置
|
||||
smms_enabled = config['image_hosting']['smms']['enabled']
|
||||
smms_token= config['image_hosting']['smms']['token']
|
||||
smms_image_upload_history= config['image_hosting']['smms']['smms_image_upload_history']
|
||||
|
||||
# 聚合图床相关配置
|
||||
ju_he_enabled = config['image_hosting']['superbed']['enabled']
|
||||
ju_he_token= config['image_hosting']['superbed']['token']
|
||||
ju_he_image_list= config['image_hosting']['superbed']['superbed_image_list']
|
||||
|
||||
#随机图 anosu
|
||||
anosu_url = config['image_hosting']['random_pic']
|
||||
|
||||
# 搜番/acg api
|
||||
animetrace_url = config['image_hosting']['animetrace']['url']
|
||||
"""
|
||||
AI
|
||||
"""
|
||||
admin_password= config['ai']['admin']['password']
|
||||
# 图灵机器人相关配置
|
||||
v3_enabled = config['ai']['api']['v3']['enabled']
|
||||
v3url= config['ai']['api']['v3']['url']
|
||||
v3key= config['ai']['api']['v3']['key']
|
||||
# DeepSeek相关配置
|
||||
deepseek_enabled = config['ai']['api']['deepseek']['enabled']
|
||||
deepseek_url= config['ai']['api']['deepseek']['url']
|
||||
deepseek_key= config['ai']['api']['deepseek']['key']
|
||||
|
||||
#硅基流动
|
||||
silicon_flow_enabled = config['ai']['api']['silicon_flow']['enabled']
|
||||
silicon_flow_url = config['ai']['api']['silicon_flow']['url']
|
||||
silicon_flow_key = config['ai']['api']['silicon_flow']['key']
|
||||
silicon_flow_model = config['ai']['api']['silicon_flow']['model']
|
||||
|
||||
"""
|
||||
Wenku8账号
|
||||
"""
|
||||
wenku8_username = config['wenku8']['user_name']
|
||||
wenku8_password = config['wenku8']['password']
|
||||
|
||||
"""
|
||||
多米HTTP代理api
|
||||
"""
|
||||
proxy_enabled = config['proxy']['enabled']
|
||||
proxy_api = config['proxy']['key']
|
||||
|
||||
"""
|
||||
二维码生成 API 参数
|
||||
"""
|
||||
qrserver_url = config['qr']['url']
|
||||
qrserver_size= config['qr']['size']
|
||||
|
||||
"""
|
||||
CodeForces API
|
||||
"""
|
||||
codeforces_key = config['codeforces']['key']
|
||||
codeforces_secret = config['codeforces']['secret']
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
app_id="<KEY>"
|
||||
bot_account= "<KEY>"
|
||||
"""
|
||||
谷歌邮箱配置
|
||||
"""
|
||||
google_smtp_server = "smtp.gmail.com"
|
||||
google_email ="xxxxxx@gmail.com"
|
||||
google_password = "1234567891234567" #16位应用码
|
||||
"""
|
||||
qq 邮箱配置
|
||||
"""
|
||||
qq_smtp_server = "smtp.qq.com"
|
||||
qq_email = "xxxxxxxxxx@qq.com"
|
||||
qq_password = "123456789123456789" #应用码
|
||||
|
||||
"""
|
||||
自建邮箱配置
|
||||
"""
|
||||
server_smtp_server = "example.com"
|
||||
server_email = ""
|
||||
server_password = "xxx"
|
||||
server_port = 587
|
||||
|
||||
"""
|
||||
图床配置
|
||||
"""
|
||||
# SMMS图床相关配置
|
||||
smms_token= "<KEY>" # sm.ms图床的token
|
||||
smms_image_upload_history= "https://sm.ms/api/v2/upload_history" # sm.ms图床获取上传图片历史API地址
|
||||
|
||||
# 聚合图床相关配置
|
||||
ju_he_token= "<KEY>" # 聚合图床的token
|
||||
ju_he_image_list= "https://api.superbed.cn/timeline" # 聚合图床获取上传图片历史API地址
|
||||
|
||||
#随机图 anosu
|
||||
anosu_url = "https://image.anosu.top/pixiv/json"
|
||||
|
||||
# 搜番/acg api
|
||||
animetrace_url = "https://api.animetrace.com/v1/search"
|
||||
"""
|
||||
AI
|
||||
"""
|
||||
admin_password= "123456" # 默认注册管理员密码
|
||||
# 图灵机器人相关配置
|
||||
v3url= "https://api.vveai.com/v1/chat/completions"
|
||||
v3key= "<KEY>"
|
||||
# DeepSeek相关配置
|
||||
deepseek_url= "https://api.deepseek.com"
|
||||
deepseek_key= "<KEY>"
|
||||
|
||||
#硅基流动
|
||||
silicon_flow_key = "<KEY>"
|
||||
|
||||
"""
|
||||
Wenku8账号
|
||||
"""
|
||||
wenku8_username = "<user_name>"
|
||||
wenku8_password = "<passwd>"
|
||||
|
||||
"""
|
||||
多米HTTP代理api
|
||||
"""
|
||||
proxy_api = "<KEY>"
|
||||
|
||||
"""
|
||||
二维码生成 API 参数
|
||||
"""
|
||||
qrserver_url = "https://api.qrserver.com/v1/create-qr-code/"
|
||||
qrserver_size= "200x200"
|
||||
|
||||
"""
|
||||
CodeForces API
|
||||
"""
|
||||
codeforces_key = "<KEY>"
|
||||
codeforces_secret = "<KEY>"
|
||||
Loading…
Reference in a new issue