初始项目

This commit is contained in:
mark.tian
2025-12-02 17:25:37 +08:00
parent 46f24dbe6c
commit 4cf817eadf
10 changed files with 696 additions and 0 deletions

28
app/config.py Normal file
View File

@@ -0,0 +1,28 @@
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
# 数据库配置
database_url: str = "postgresql+asyncpg://user:password@localhost:5432/ai_talk_callback_db"
# Redis配置
redis_url: str = "redis://localhost:6379/0"
redis_lock_timeout: int = 30 # 锁超时时间(秒)
redis_lock_retry_delay: float = 0.1 # 锁重试延迟(秒)
redis_lock_max_retries: int = 100 # 最大重试次数
# 业务配置
count_threshold: int = 3 # count阈值,大于等于此值直接返回
external_api_retry_max: int = 4 # 外部API最大重试次数
external_api_url: str = "https://external.com/api/openapi/customerApi/aiTaskResultFail"
# 应用配置
app_name: str = "AI Talk Callback API"
debug: bool = False
class Config:
env_file = ".env"
case_sensitive = False
settings = Settings()