server:
  port: 8111
  address: 0.0.0.0
  shutdown: graceful
  # 启用HTTP响应压缩
  compression:
    enabled: true
  servlet:
    encoding:
      enabled: true
      charset: UTF-8 # 必须设置 UTF-8，避免 WebFlux 流式返回（AI 场景）会乱码问题
      force: true

spring:
  profiles:
    active: dev
  lifecycle:
    timeout-per-shutdown-phase: 30s
  datasource:
    # ！！！ 注意：useInformationSchema=true 是必须的，用于支持 MyBatis-Flex 正确读取表注释。
    url: jdbc:mysql://127.0.0.1:33306/easyflow?useInformationSchema=true&characterEncoding=utf-8
    username: root
    password: root
    hikari:
      maximum-pool-size: 12
      minimum-idle: 2
      connection-timeout: 5000
      validation-timeout: 3000
      idle-timeout: 600000
      max-lifetime: 1800000
  flyway:
    enabled: true
    locations: classpath:db/migration/mysql
    baseline-on-migrate: false
    validate-on-migrate: true
    clean-disabled: true
  data:
    redis:
      host: 127.0.0.1
      port: 36379
      database: 0
      password: ${REDIS_PASSWORD:123456}
      timeout: 5s
  servlet:
    multipart:
      max-file-size: 100MB
      max-request-size: 100MB
  web:
    resources:
      # 示例：windows【file: C:\easyflow\attachment】 linux【file: /www/easyflow/attachment】
      static-locations: file:/Users/slience/postgraduate/easyflow/attachment
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher
    # 静态资源路径，用于访问本地文件
    # ！！！ 注意，这里要和下面的 easyflow.storage.local.prefix 后面的路径 /attachment 保持一致！
    static-path-pattern: /attachment/**
  # quartz 相关配置
  quartz:
    startup-delay: 1
    job-store-type: jdbc
    jdbc:
      platform: mysql
      initialize-schema: never
    properties:
      org:
        quartz:
          scheduler:
            instanceName: easyflowScheduler
            instanceId: AUTO
          jobStore:
            misfireThreshold: 1000
            isClustered: true
            clusterCheckinInterval: 15000
            # 如果数据库大小写敏感，可将ddl里的相关表名改为大写
            tablePrefix: TB_QRTZ_
            driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
          threadPool:
            threadCount: 8
            threadPriority: 5
  threads:
    virtual:
      enabled: true

easyflow:
  license:
    location: classpath:easyflow.lic
  chat:
    # SSE 超时时间（毫秒），默认 10 分钟，可按需调整
    sse-timeout-ms: 600000
    cache:
      session-list-ttl: 300s
      session-summary-ttl: 600s
      session-tail-ttl: 1800s
      tail-size: 50
    sync:
      #是否启用分析数据同步，启用分析数据库后，此处应同步开启
      enabled: true
      batch-size: 500
      fixed-delay: 30000
      repair-lookback-days: 3
      retention-months: 3
  mq:
    enabled: true
    type: redis
    redis:
      database: 1
      stream-prefix: easyflow:mq
      consumer-instance-id: ${EASYFLOW_INSTANCE_ID:${HOSTNAME:${random.uuid}}}
      chat-persist-shard-count: 4
      consumer-batch-size: 200
      consumer-block-timeout: 2000ms
      pending-claim-idle: 60000ms
      max-retry: 16
      consumer-executor:
        core-size: 16
        max-size: 24
        queue-capacity: 64
        keep-alive-seconds: 60
      pool:
        max-active: 12
        max-idle: 8
        min-idle: 1
  analytical-db:
    # 是否启用分析数据库
    enabled: true
    url: jdbc:clickhouse://114.66.22.180:38123/easyflow_dev?jdbc_ignore_unsupported_values=true&socket_timeout=30000&compress=false&ssl=false
    username: easyflow
    password: 123456
    driver-class-name: com.clickhouse.jdbc.ClickHouseDriver
    pool:
      max-pool-size: 10
      min-idle: 1
      connection-timeout: 5000
      validation-timeout: 3000
      idle-timeout: 600000
      max-lifetime: 1800000
  flyway:
    analytical-db:
      locations: classpath:db/migration/analyticaldb
      table: flyway_schema_history_analytical_db
      baseline-on-migrate: false
      validate-on-migrate: true
  # 语音播放、识别服务（阿里云）
  audio:
    type: aliAudioService
    ali:
      access-key-id: xxx
      access-key-secret: xxx
      app-key: xxx
      voice: siyue
  agent:
    runtime:
      instance-id: ${EASYFLOW_INSTANCE_ID:${HOSTNAME:${random.uuid}}}
      route-ttl: 24h
      command-topic-prefix: easyflow:agent-runtime-command
      command-result-timeout: 5s
      command-result-ttl: 5m
  login:
    # 放行接口路径
    excludes: /api/v1/auth/**, /static/**, /userCenter/auth/**, /userCenter/public/**
    dev-bypass:
      enabled: true
      account: admin
      loopback-only: true
  storage:
    # local / xFileStorage
    type: xFileStorage
    # 本地文件存储配置（兼容保留，可作为回退）
    local:
      # 示例：windows【C:\easyflow\attachment】 linux【/www/easyflow/attachment】
      root: /Users/slience/postgraduate/easyflow/attachment
      # 后端接口地址，用于拼接完整 url
      prefix: http://localhost:8111/attachment
  ai:
    rag:
      health:
        cache-ttl: 5s
    document-import:
      status-broadcast-channel: easyflow:document-import:status
      parse-monitor:
        fixed-delay: 10000
        initial-delay: 10000
        batch-size: 10
  thread-pool:
    sse:
      core-size: 4
      max-size: 16
      queue-capacity: 2000
      keep-alive-seconds: 30
      allow-core-thread-timeout: true
    document-import:
      core-size: 2
      max-size: 4
      queue-capacity: 200
      keep-alive-seconds: 60
      allow-core-thread-timeout: true
    scheduler:
      pool-size: 4

# xFileStorage存储文件配置
# 文档：https://x-file-storage.xuyanwu.cn/
dromara:
  x-file-storage:
    default-platform: minio-1
    minio:
      - platform: minio-1
        enable-storage: true
        access-key: easyflowadmin
        secret-key: easyflowadmin123
        end-point: http://127.0.0.1:39000
        bucket-name: easyflow
        # minio 对象对外访问链接
        domain: http://127.0.0.1:39000/easyflow/
        base-path: attachment

# easy-agents 文档解析统一配置
easy-agents:
  document:
    ocr:
      provider: mineru
      mineru:
        # 统一文档解析桥接层直接复用 easy-agents 的 provider 配置，不在 easyflow 再复制一套配置体系
        base-url: https://hub.wust.edu.cn/modelServer/mineru-api
        default-lang-list:
          - ch

# 自定义节点相关配置
node:
  # 文件内容提取节点，默认使用简单文档读取器，可自行实现 ReadDocService
  reader: 'defaultReader'
  # gitee 文档读取的实现，需要配置gitee的appKey
  gitee:
    appKey: 'xxx'
  # 搜索引擎节点 - 目前只支持博查搜索
  bochaai:
    apiKey: 'xxx'
  code-engine:
    python:
      enabled: true
      command: python3
      timeout-ms: 5000
      max-output-bytes: 262144
      working-dir: /tmp

jetcache:
  # 缓存类型，可选值：local/remote/both CacheConfig 类初始化
  cacheType: remote
  statIntervalMinutes: 15
  areaInCacheName: false
  local:
    default:
      type: linkedhashmap
      keyConvertor: fastjson
  remote:
    default:
      type: redis
      keyConvertor: fastjson2
      broadcastChannel: easyflow-cache
      valueEncoder: java
      valueDecoder: java
      poolConfig:
        minIdle: 1
        maxIdle: 12
        maxTotal: 32
      host: ${spring.data.redis.host}
      port: ${spring.data.redis.port}
      password: ${spring.data.redis.password}
      database: ${spring.data.redis.database}

# 多路召回搜索引擎配置
rag:
  # 搜索引擎选择，lucene/ES
  engine: lucene
  # 向量数据库配置
  milvus:
    uri: http://127.0.0.1:39530
    databaseName: default
    token:
    username: easyflowadmin
    password: easyflowadmin123
    autoCreateCollection: true
  # 搜索引擎配置
  searcher:
    lucene:
      indexDirPath: /Users/slience/data/easyflow/luceneKnowledge
    elastic:
      host: http://127.0.0.1:39200
      userName: elastic
      password: elastic
      indexName: easyflow

logging:
  file:
    path: .logs/
    name: easyflow.log
  level:
    root: info
    tech.easyflow.ai: debug

# 行为验证码配置
captcha:
  # 初始化默认资源
  init-default-resource: true
  # 开启二次验证
  secondary:
    enabled: true

management:
  endpoint:
    health:
      probes:
        enabled: true
      show-details: always
  endpoints:
    web:
      exposure:
        include: health,info
