56 lines
1.5 KiB
Python
56 lines
1.5 KiB
Python
"""
|
||
配置管理
|
||
"""
|
||
import os
|
||
from typing import List
|
||
from pydantic_settings import BaseSettings
|
||
|
||
|
||
class Settings(BaseSettings):
|
||
"""应用配置"""
|
||
|
||
# 基础配置
|
||
DEBUG: bool = True
|
||
API_PORT: int = 8000
|
||
|
||
# CORS 配置 - 支持环境变量覆盖
|
||
CORS_ORIGINS: List[str] = [
|
||
"http://localhost:5173",
|
||
"http://127.0.0.1:5173",
|
||
"http://interview.test.ai.ireborn.com.cn",
|
||
"https://interview.test.ai.ireborn.com.cn"
|
||
]
|
||
|
||
# Coze 配置
|
||
COZE_API_BASE: str = "https://api.coze.cn"
|
||
COZE_PAT_TOKEN: str = "pat_nd1wU47WyPS9GCIyJ1clnH8h1WOQXGrYELX8w73TnSZaYbFdYD4swIhzcETBUbfT"
|
||
COZE_BOT_ID: str = "7595113005181386792"
|
||
|
||
# Coze 语音配置(从测试结果获取)
|
||
COZE_VOICE_ID: str = "7426725529589661723"
|
||
|
||
# 文件存储配置
|
||
UPLOAD_DIR: str = "uploads" # 本地上传文件存储目录(临时)
|
||
|
||
# 远程文件服务器配置(用于 Coze 工作流访问文件)
|
||
FILE_SERVER_UPLOAD_URL: str = "http://files.test.ai.ireborn.com.cn/upload.php"
|
||
FILE_SERVER_TOKEN: str = "" # PHP 上传接口的验证令牌
|
||
|
||
# 公网隧道 URL(已弃用,改用远程文件服务器)
|
||
TUNNEL_URL: str = ""
|
||
NGROK_URL: str = ""
|
||
|
||
class Config:
|
||
env_file = ".env"
|
||
env_file_encoding = "utf-8"
|
||
case_sensitive = True
|
||
|
||
|
||
def get_settings() -> Settings:
|
||
"""获取配置"""
|
||
return Settings()
|
||
|
||
|
||
# 直接实例化,每次导入时读取最新 .env
|
||
settings = Settings()
|