feat: 初始化 B2B AI Shopping Assistant 项目
- 配置 Docker Compose 多服务编排 - 实现 Chatwoot + Agent 集成 - 配置 Strapi MCP 知识库 - 支持 7 种语言的 FAQ 系统 - 实现 LangGraph AI 工作流 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
60
agent/config.py
Normal file
60
agent/config.py
Normal file
@@ -0,0 +1,60 @@
|
||||
"""
|
||||
Configuration management for B2B Shopping AI Assistant
|
||||
"""
|
||||
from typing import Optional
|
||||
from pydantic_settings import BaseSettings
|
||||
from pydantic import Field
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""Application settings loaded from environment variables"""
|
||||
|
||||
# ============ AI Model ============
|
||||
zhipu_api_key: str = Field(..., description="ZhipuAI API Key")
|
||||
zhipu_model: str = Field(default="glm-4", description="ZhipuAI Model name")
|
||||
|
||||
# ============ Redis ============
|
||||
redis_host: str = Field(default="localhost", description="Redis host")
|
||||
redis_port: int = Field(default=6379, description="Redis port")
|
||||
redis_password: Optional[str] = Field(default=None, description="Redis password")
|
||||
redis_db: int = Field(default=0, description="Redis database number")
|
||||
|
||||
# ============ Chatwoot ============
|
||||
chatwoot_api_url: str = Field(..., description="Chatwoot API URL")
|
||||
chatwoot_api_token: str = Field(..., description="Chatwoot API Token")
|
||||
chatwoot_webhook_secret: Optional[str] = Field(default=None, description="Chatwoot Webhook Secret")
|
||||
|
||||
# ============ Strapi CMS ============
|
||||
strapi_api_url: str = Field(..., description="Strapi API URL")
|
||||
strapi_api_token: str = Field(..., description="Strapi API Token")
|
||||
|
||||
# ============ Hyperf API ============
|
||||
hyperf_api_url: str = Field(..., description="Hyperf API URL")
|
||||
hyperf_api_token: str = Field(..., description="Hyperf API Token")
|
||||
|
||||
# ============ MCP Servers ============
|
||||
strapi_mcp_url: str = Field(default="http://localhost:8001", description="Strapi MCP URL")
|
||||
order_mcp_url: str = Field(default="http://localhost:8002", description="Order MCP URL")
|
||||
aftersale_mcp_url: str = Field(default="http://localhost:8003", description="Aftersale MCP URL")
|
||||
product_mcp_url: str = Field(default="http://localhost:8004", description="Product MCP URL")
|
||||
|
||||
# ============ Application Config ============
|
||||
log_level: str = Field(default="INFO", description="Log level")
|
||||
max_conversation_steps: int = Field(default=10, description="Max steps in conversation")
|
||||
conversation_timeout: int = Field(default=3600, description="Conversation timeout in seconds")
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
env_file_encoding = "utf-8"
|
||||
case_sensitive = False
|
||||
|
||||
|
||||
# Global settings instance
|
||||
settings = Settings()
|
||||
|
||||
|
||||
def get_redis_url() -> str:
|
||||
"""Get Redis connection URL"""
|
||||
if settings.redis_password and settings.redis_password.strip():
|
||||
return f"redis://:{settings.redis_password}@{settings.redis_host}:{settings.redis_port}/{settings.redis_db}"
|
||||
return f"redis://{settings.redis_host}:{settings.redis_port}/{settings.redis_db}"
|
||||
Reference in New Issue
Block a user