mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-05-14 20:08:33 +08:00
- 在 gemini_routes.py 中添加 verify_key 路由,用于验证 API 密钥的有效性 - 在 keys_status 页面中添加验证按钮和相关逻辑 - 优化 keys_status 页面的样式,增加密钥验证相关 CSS 类 - 在 config.py 中添加 TEST_MODEL 设置,用于密钥验证测试
31 lines
873 B
Python
31 lines
873 B
Python
from pydantic_settings import BaseSettings
|
|
from typing import List
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
API_KEYS: List[str]
|
|
ALLOWED_TOKENS: List[str]
|
|
BASE_URL: str = "https://generativelanguage.googleapis.com/v1beta"
|
|
MODEL_SEARCH: List[str] = ["gemini-2.0-flash-exp"]
|
|
TOOLS_CODE_EXECUTION_ENABLED: bool = False
|
|
SHOW_SEARCH_LINK: bool = True
|
|
SHOW_THINKING_PROCESS: bool = True
|
|
AUTH_TOKEN: str = ""
|
|
MAX_FAILURES: int = 3
|
|
PAID_KEY: str = ""
|
|
CREATE_IMAGE_MODEL: str = "imagen-3.0-generate-002"
|
|
UPLOAD_PROVIDER: str = "smms"
|
|
SMMS_SECRET_TOKEN: str = ""
|
|
TEST_MODEL: str = "gemini-1.5-flash"
|
|
|
|
def __init__(self):
|
|
super().__init__()
|
|
if not self.AUTH_TOKEN:
|
|
self.AUTH_TOKEN = self.ALLOWED_TOKENS[0] if self.ALLOWED_TOKENS else ""
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
|
|
|
|
settings = Settings()
|