feat: AI聊天室多Agent协作讨论平台
- 实现Agent管理,支持AI辅助生成系统提示词 - 支持多个AI提供商(OpenRouter、智谱、MiniMax等) - 实现聊天室和讨论引擎 - WebSocket实时消息推送 - 前端使用React + Ant Design - 后端使用FastAPI + MongoDB Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
50
backend/config.py
Normal file
50
backend/config.py
Normal file
@@ -0,0 +1,50 @@
|
||||
"""
|
||||
应用配置模块
|
||||
从环境变量加载配置项
|
||||
"""
|
||||
from pydantic_settings import BaseSettings
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""应用配置类"""
|
||||
|
||||
# MongoDB配置
|
||||
MONGODB_URL: str = "mongodb://localhost:27017"
|
||||
MONGODB_DB: str = "ai_chatroom"
|
||||
|
||||
# 服务配置
|
||||
HOST: str = "0.0.0.0"
|
||||
PORT: int = 8000
|
||||
DEBUG: bool = True
|
||||
|
||||
# 安全配置
|
||||
SECRET_KEY: str = "your-secret-key-change-in-production"
|
||||
ENCRYPTION_KEY: str = "your-encryption-key-32-bytes-long"
|
||||
|
||||
# CORS配置
|
||||
CORS_ORIGINS: list = ["http://localhost:3000", "http://127.0.0.1:3000"]
|
||||
|
||||
# WebSocket配置
|
||||
WS_HEARTBEAT_INTERVAL: int = 30
|
||||
|
||||
# 默认AI配置
|
||||
DEFAULT_TIMEOUT: int = 60
|
||||
DEFAULT_MAX_TOKENS: int = 2000
|
||||
DEFAULT_TEMPERATURE: float = 0.7
|
||||
|
||||
# 代理配置(全局默认)
|
||||
DEFAULT_HTTP_PROXY: Optional[str] = None
|
||||
DEFAULT_HTTPS_PROXY: Optional[str] = None
|
||||
|
||||
# 速率限制
|
||||
RATE_LIMIT_REQUESTS: int = 100
|
||||
RATE_LIMIT_PERIOD: int = 60 # 秒
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
env_file_encoding = "utf-8"
|
||||
|
||||
|
||||
# 全局配置实例
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user