f0af1cfe8e
Co-Authored-By: Claude Code <noreply@anthropic.com>
51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
from pydantic_settings import BaseSettings
|
|
from pathlib import Path
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
APP_HOST: str = "0.0.0.0"
|
|
APP_PORT: int = 8000
|
|
APP_DEBUG: bool = False
|
|
|
|
AI_PROVIDER: str = "glm"
|
|
ZHIPU_API_KEY: str = ""
|
|
# 留空=用 SDK 默认地址(标准套餐 https://open.bigmodel.cn/api/paas/v4)
|
|
# coding 套餐填 https://open.bigmodel.cn/api/coding/paas/v4
|
|
ZHIPU_BASE_URL: str = ""
|
|
AI_MODEL: str = "glm-4-flash"
|
|
|
|
DATABASE_URL: str = "sqlite+aiosqlite:///./data/hesupipe_ai_kefu.db"
|
|
|
|
SMTP_HOST: str = ""
|
|
SMTP_PORT: int = 465
|
|
SMTP_USER: str = ""
|
|
SMTP_PASS: str = ""
|
|
NOTIFY_EMAIL: str = ""
|
|
|
|
# 询盘推送 UniService(docs/superpowers/specs/2026-09-28-lead-push-to-uniservice-design.md)
|
|
PUSH_ENABLED: bool = False
|
|
PUSH_API_URL: str = "https://uniservice.server.hnxinyouhe.com/open/v1/inquiry/push"
|
|
PUSH_API_KEY: str = ""
|
|
PUSH_EXTERNAL_KEY_PREFIX: str = "ai-kefu"
|
|
PUSH_TIMEOUT_SECONDS: float = 10.0
|
|
PUSH_MAX_ATTEMPTS: int = 3
|
|
PUSH_RETRY_BACKOFF_BASE: float = 1.0 # 尝试间隔 1s/2s(3 次尝试、2 次间隔)
|
|
|
|
ADMIN_PASSWORD: str = "admin123"
|
|
|
|
model_config = {
|
|
"env_file": ".env",
|
|
"env_file_encoding": "utf-8",
|
|
}
|
|
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
DATA_DIR = BASE_DIR / "data"
|
|
STATIC_DIR = BASE_DIR / "static"
|
|
|
|
settings = Settings()
|
|
|
|
|
|
def ensure_dirs():
|
|
DATA_DIR.mkdir(exist_ok=True)
|