dify插件初步构建

This commit is contained in:
2025-12-30 13:38:32 +08:00
parent 8011dec826
commit c07fe6b938
27 changed files with 820 additions and 0 deletions

38
difyPlugin/app/config.py Normal file
View File

@@ -0,0 +1,38 @@
"""应用配置管理"""
from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
"""应用配置"""
# 应用基础配置
APP_NAME: str = "DifyPlugin"
APP_VERSION: str = "1.0.0"
DEBUG: bool = False
# API配置
API_V1_PREFIX: str = "/api/v1"
HOST: str = "0.0.0.0"
API_HOST: str = "localhost" # OpenAPI servers 显示的地址
PORT: int = 8380
# 跨域配置
CORS_ORIGINS: list[str] = ["*"]
# Redis配置
REDIS_HOST: str = "localhost"
REDIS_PORT: int = 6379
REDIS_PASSWORD: str = "123456"
REDIS_DB: int = 0
class Config:
env_file = ".env"
case_sensitive = True
@lru_cache()
def get_settings() -> Settings:
return Settings()
settings = get_settings()