-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsettings.py
71 lines (53 loc) · 1.83 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from functools import lru_cache
from typing import Any
from pydantic_settings import BaseSettings, SettingsConfigDict
from utils.path import PROJECT_PATH
class Settings(BaseSettings):
app_name: str = "uni-api"
version: str = "0.5.0"
admin_email: str = "shawninjuly@gmail.com"
@property
def repo(self):
return f"https://github.com/cs-magic/{self.app_name}"
@property
def app_title(self):
return " ".join([i.capitalize() for i in self.app_name.split("-")])
@property
def description(self):
return f"聚合AGI行业的主流API,提供动态key管理、算法调度、前端监控、可扩展性配置等功能 (opensource: {self.repo})"
# ref: https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-tags
tags: Any = [{"name": "Account", }, {"name": "LLM", }, {"name": "Spider", }, {"name": "OSS", "description": "todo"},
{"name": "Cases", }, {"name": "Rama", }, {"name": "default", }, ]
DATABASE_URL: str
DATABASE_BACKEND_URL: str
# LLM
MOONSHOT_API_KEY: str
OPENAI_API_KEY: str
ZHIPU_API_KEY: str
MINIMAX_API_KEY: str
MINIMAX_GROUP_ID: str
DASHSCOPE_API_KEY: str
DOUBAO_AK: str
DOUBAO_SK: str
DOUBAO_API_KEY: str
ANTHROPIC_API_KEY: str
# auth
SECRET_KEY: str
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
wechat_app_id: str = ""
wechat_app_secret: str = ""
google_client_id: str = ""
google_client_secret: str = ""
github_client_id: str = ""
github_client_secret: str = ""
# payment
STRIPE_SECRET_KEY: str
STRIPE_WEBHOOK_SECRET: str
# others
FRONTEND_BASEURL: str
model_config = SettingsConfigDict(env_file=PROJECT_PATH.joinpath(".env"), extra="ignore")
@lru_cache
def get_settings():
return Settings()
settings = get_settings()