spring:
  application:
    name: pharmacopoeia-ai
  datasource:
    url: jdbc:postgresql://localhost:5432/pharmacopoeia
    username: postgres
    password: pharma2025
    driver-class-name: org.postgresql.Driver

  jpa:
    hibernate:
      ddl-auto: none
    show-sql: false
    properties:
      hibernate:
        dialect: org.hibernate.dialect.PostgreSQLDialect
        format_sql: true

  data:
    redis:
      host: localhost
      port: 6379

  jackson:
    serialization:
      write-dates-as-timestamps: false

  servlet:
    multipart:
      max-file-size: 50MB
      max-request-size: 55MB

server:
  port: 9000

# ============================================
# Qwen API 配置
# ============================================
qwen:
  api-key: ${QWEN_API_KEY:}
  base-url: https://dashscope.aliyuncs.com/compatible-mode/v1
  model: qwen3.7-max
  max-tokens: 4096
  temperature: 0.0
  # 视觉模型（图片分析+OCR）
  # 多模态模型（图片/视频分析，原生 API）
  vl-model: qwen3.7-plus
  multimodal-url: https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation
  enable-web-search: true
  # 嵌入模型
  embedding-model: text-embedding-v3
  embedding-url: https://dashscope.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding
  embedding-dim: 1024

# ============================================
# 鉴权
# ============================================
auth:
  enabled: false       # true=上线后需要 JWT token
  admin-token: ""     # 运营端管理 token（与 JWT 无关，单独配置）

# ============================================
# JWT
# ============================================
jwt:
  secret: YourSuperSecretKeyForJWTTokenGenerationMustBeAtLeast256BitsLong!!
  expiration: 86400000  # 24小时 (ms)

# ============================================
# 微信小程序
# ============================================
wechat:
  app-id: ${WECHAT_APPID:}
  secret: ${WECHAT_SECRET:}

# ============================================
# 百炼（DashScope）API 全局限流
# 控制后端 → 百炼的总调用量，与用户侧限流独立
# 最终是否限制、限制多少由客户确认后配置
# ============================================
dashscope:
  rate-limit:
    enabled: false   # 客户确认后改为 true
    per-minute: 100
    per-hour: 2000
    per-day: 50000
# ============================================
# 限流
# ============================================
rate-limit:
  per-minute: 60      # 每 IP 每分钟最多 60 次 chat 请求
  per-hour: 999999    # 极大=不限
  per-day: 999999     # 极大=不限

logging:
  level:
    com.pharmacopoeia: INFO
    org.springframework.web: WARN
    org.springframework.security: INFO
  file:
    path: ${LOG_DIR:/var/log/pharmacopoeia}
