# AI图片生成模块配置示例 ai: image: # 默认生成模式:LOCAL(本地模型)/CLOUD(云服务) default-mode: LOCAL # 本地模型配置 local-model: # Stable Diffusion API地址 sd-api-url: http://localhost:7860 # 默认模型名称 default-model: stable-diffusion-v1-5 # 超时时间(秒) timeout: 60 # 最大并发数 max-concurrency: 3 # 模型映射配置(可选) model-mapping: "portrait": "portrait-v1.0" "anime": "anime-v2.0" "realistic": "realistic-v3.0" # 云服务配置 cloud-service: # 云服务提供商:ALIYUN/BAIDU/TENCENT provider: ALIYUN # API密钥(从阿里云DashScope获取) api-key: your-dashscope-api-key # 密钥(可选) secret-key: your-secret-key # 区域 region: cn-shanghai # 超时时间(秒) timeout: 60 # 最大并发数 max-concurrency: 5 # 图片存储配置 storage: # OSS存储桶名称 bucket-name: ai-images # 存储路径前缀 path-prefix: ai/image/ # 是否生成缩略图 generate-thumbnail: true # 缩略图宽度 thumbnail-width: 200 # 缩略图高度 thumbnail-height: 200 # 限流配置 rate-limit: # 是否启用限流 enabled: true # 每秒最大请求数(QPS=10) max-requests-per-second: 10 # 每分钟最大请求数 max-requests-per-minute: 100 # 每小时最大请求数 max-requests-per-hour: 500 # 缓存配置 cache: # 是否启用缓存 enabled: true # 缓存过期时间(分钟) expire-minutes: 60 # 最大缓存数量 max-cache-size: 1000 # 示例:不同环境的配置 --- # 开发环境配置 spring: profiles: dev ai: image: default-mode: LOCAL local-model: sd-api-url: http://localhost:7860 cloud-service: api-key: dev-api-key --- # 测试环境配置 spring: profiles: test ai: image: default-mode: CLOUD cloud-service: api-key: test-api-key --- # 生产环境配置 spring: profiles: prod ai: image: default-mode: CLOUD cloud-service: api-key: prod-api-key rate-limit: max-requests-per-second: 20 max-requests-per-minute: 200 max-requests-per-hour: 1000