Your Name 3deaa7dcaa fix: 修正 AI 服务配置说明
- 明确使用 OneAPI/OneInAll 等中转服务商,不直连 AI 厂商
- 创建 CONVENTIONS.md 记录项目约定,避免误解

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 12:52:13 +08:00

42 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""应用配置"""
from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
"""应用设置"""
# 应用
APP_NAME: str = "秒思智能审核平台"
APP_VERSION: str = "1.0.0"
DEBUG: bool = False
# 数据库
DATABASE_URL: str = "postgresql+asyncpg://postgres:postgres@localhost:5432/miaosi"
# Redis
REDIS_URL: str = "redis://localhost:6379/0"
# JWT
SECRET_KEY: str = "your-secret-key-change-in-production"
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
# AI 服务(使用 OneAPI/OneInAll 等中转服务商,不直连厂商)
# 中转服务商统一了不同 AI 厂商的接口,只需配置中转商的 API
AI_PROVIDER: str = "oneapi" # oneapi | oneinall | openrouter 等中转服务商
AI_API_KEY: str = "" # 中转服务商的 API Key
AI_API_BASE_URL: str = "" # 中转服务商的 Base URL如 https://api.oneinall.ai/v1
class Config:
env_file = ".env"
case_sensitive = True
@lru_cache()
def get_settings() -> Settings:
"""获取配置单例"""
return Settings()
settings = get_settings()