f17a6ccbac
- Make AI routing rules DB-driven (read from system_configs, removed from config.py) - Add translation quota tracking to LLM translation (OpenAIProvider) - Add Alibaba MT ECS RAM role support (STS token, no AccessKey needed) - Fix admin sidebar link for AI模型配置 page - Fix Quota.vue API path (quotas → translation-quotas) - Fix login auto-redirect to dashboard - Add provider dropdown selects to AI routing config UI - Clean up stale ai_provider_* system_configs records - Remove OpencodeGo, Spark providers (code + DB) - Update deploy config: nginx port 8000, systemd cwd
89 lines
2.4 KiB
Python
89 lines
2.4 KiB
Python
from pydantic_settings import BaseSettings
|
|
from typing import Optional
|
|
from pathlib import Path
|
|
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
|
ENV_FILE = PROJECT_ROOT / ".env"
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
class Config:
|
|
env_file = str(ENV_FILE)
|
|
env_file_encoding = "utf-8"
|
|
extra = "ignore"
|
|
|
|
APP_NAME: str = "TradeMate"
|
|
|
|
SECRET_KEY: str
|
|
JWT_ALGORITHM: str = "HS256"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60
|
|
REFRESH_TOKEN_EXPIRE_DAYS: int = 30
|
|
|
|
DATABASE_URL: str
|
|
DB_ECHO: bool = False
|
|
|
|
REDIS_URL: str = "redis://localhost:6379/0"
|
|
|
|
CELERY_BROKER_URL: str = "redis://localhost:6379/1"
|
|
CELERY_RESULT_BACKEND: str = "redis://localhost:6379/2"
|
|
|
|
SENSENOVA_API_KEY: Optional[str] = None
|
|
SENSENOVA_BASE_URL: str = "https://token.sensenova.cn/v1"
|
|
SENSENOVA_MODEL: str = "deepseek-v4-flash"
|
|
|
|
|
|
|
|
NVIDIA_API_KEY: Optional[str] = None
|
|
NVIDIA_BASE_URL: str = "https://integrate.api.nvidia.com/v1"
|
|
NVIDIA_MODEL: str = "stepfun-ai/step-3.5-flash"
|
|
|
|
WHATSAPP_API_TOKEN: Optional[str] = None
|
|
WHATSAPP_PHONE_NUMBER_ID: Optional[str] = None
|
|
WHATSAPP_WEBHOOK_VERIFY_TOKEN: Optional[str] = None
|
|
|
|
ALIBABA_ACCESS_KEY_ID: Optional[str] = None
|
|
ALIBABA_ACCESS_KEY_SECRET: Optional[str] = None
|
|
|
|
WECHAT_APP_ID: Optional[str] = None
|
|
WECHAT_APP_SECRET: Optional[str] = None
|
|
WECHAT_PUSH_TEMPLATE_ID: Optional[str] = None
|
|
|
|
PAY_API_KEY: Optional[str] = None
|
|
PAY_API_SECRET: Optional[str] = None
|
|
PAY_API_BASE_URL: str = "https://www.yzrcloud.cn/api/gateway"
|
|
PAY_WEBHOOK_URL: str = "https://example.com/api/v1/payment/webhook"
|
|
|
|
EXCHANGE_RATE_API_KEY: Optional[str] = None
|
|
|
|
GOOGLE_API_KEY: Optional[str] = None
|
|
GOOGLE_CSE_ID: Optional[str] = None
|
|
|
|
UPLOAD_DIR: str = "./uploads"
|
|
MAX_UPLOAD_SIZE: int = 10 * 1024 * 1024
|
|
|
|
FRONTEND_URL: str = "http://localhost:3000"
|
|
BACKEND_URL: str = "http://localhost:8000"
|
|
|
|
SENTRY_DSN: Optional[str] = None
|
|
DEBUG: bool = True
|
|
|
|
FREE_DAILY_TRANSLATE_CHARS: int = 5000
|
|
FREE_DAILY_REPLIES: int = 20
|
|
FREE_DAILY_MARKETING: int = 5
|
|
FREE_MAX_CUSTOMERS: int = 5
|
|
FREE_MAX_PRODUCTS: int = 1
|
|
FREE_DAILY_QUOTATIONS: int = 3
|
|
|
|
TRIAL_DAYS: int = 7
|
|
|
|
PRO_DAILY_TRANSLATE_CHARS: int = 50000
|
|
PRO_DAILY_REPLIES: int = 200
|
|
PRO_DAILY_MARKETING: int = 50
|
|
PRO_MAX_CUSTOMERS: int = 100
|
|
PRO_MAX_PRODUCTS: int = 20
|
|
PRO_DAILY_QUOTATIONS: int = 30
|
|
|
|
|
|
settings = Settings()
|