跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.langbot.app/llms.txt

Use this file to discover all available pages before exploring further.

配置系统运行的一些环境信息,文件位于 data/config.yaml。 一般不需要修改。
admins: []
api:
    port: 5300
    webhook_prefix: 'http://127.0.0.1:5300'
    extra_webhook_prefix: ''
command:
    enable: true
    prefix:
    - '!'
    - 
    privilege: {}
concurrency:
    pipeline: 20
    session: 1
proxy:
    http: ''
    https: ''
system:
    instance_id: ''
    edition: community
    recovery_key: ''
    allow_modify_login_info: true
    disabled_adapters: []
    limitation:
        max_bots: -1
        max_pipelines: -1
        max_extensions: -1
    task_retention:
        # 内存中最多保留的已完成异步任务记录数量
        completed_limit: 200
    jwt:
        expire: 604800
        secret: ''
database:
    use: sqlite
    sqlite:
        path: 'data/langbot.db'
    postgresql:
        host: '127.0.0.1'
        port: 5432
        user: 'postgres'
        password: 'postgres'
        database: 'postgres'
vdb:
    use: chroma
    qdrant:
        url: ''
        host: localhost
        port: 6333
        api_key: ''
    seekdb:
        mode: embedded  # 'embedded' 或 'server'
        # 嵌入式模式配置:
        path: './data/seekdb'
        database: 'langbot'
        # 服务器模式配置(mode='server' 时生效):
        host: 'localhost'
        port: 2881
        user: 'root'
        password: ''
        tenant: ''  # 可选,用于 OceanBase 多租户场景
    milvus:
        uri: 'http://127.0.0.1:19530'
        token: ''
        db_name: ''
    pgvector:
        host: '127.0.0.1'
        port: 5433
        database: 'langbot'
        user: 'postgres'
        password: 'postgres'
storage:
    use: local
    cleanup:
        # 是否定期清理本地/S3 上传文件和旧日志文件
        enabled: true
        # 清理检查间隔,单位为小时
        check_interval_hours: 1
        # 超过此天数的根目录上传文件会被删除
        uploaded_file_retention_days: 7
        # 最多保留此天数内的 LangBot 日志文件
        log_retention_days: 3
    s3:
        endpoint_url: ''
        access_key_id: ''
        secret_access_key: ''
        region: 'us-east-1'
        bucket: 'langbot-storage'
plugin:
    enable: true
    runtime_ws_url: 'ws://langbot_plugin_runtime:5400/control/ws'
    enable_marketplace: true
    display_plugin_debug_url: 'ws://localhost:5401/plugin/debug/ws'
    binary_storage:
        # 单个插件二进制存储值的最大字节数
        max_value_bytes: 10485760
monitoring:
    auto_cleanup:
        # 是否自动清理过期监控记录
        enabled: true
        # 监控记录保留天数,超过此天数的记录会被删除
        retention_days: 30
        # 清理检查间隔,单位为小时
        check_interval_hours: 1
        # 每个监控表单批删除的过期记录数量
        delete_batch_size: 1000
space:
    # Space 服务 URL
    url: 'https://space.langbot.app'
    # Space 模型请求 API URL(MaaS)
    models_gateway_api_url: 'https://api.langbot.cloud/v1'
    # OAuth 授权页面 URL
    oauth_authorize_url: 'https://space.langbot.app/auth/authorize'
    disable_models_service: false
    disable_telemetry: false

配置说明

  • storage.cleanup.uploaded_file_retention_days 只清理存储根目录下的临时上传文件,不会清理插件配置文件或带目录的内部对象。
  • storage.cleanup.log_retention_days 按日志文件名中的日期清理旧日志,默认最多保留 3 天。
  • SQLite 作为数据库时,监控记录自动清理后会直接释放数据库文件空间。
  • plugin.binary_storage.max_value_bytes 用于限制插件单个二进制存储值大小,默认 10 MiB。
  • WebUI 侧边栏的“存储分析”页面可查看数据库、日志、上传文件、向量库、插件、MCP、临时文件等空间占用和清理候选项。

通过环境变量设置

config.yaml 中的配置可以通过环境变量进行设置。环境变量名称为大写字母,使用双下划线连接,例如:API__PORT 代表 api.port
  • API__PORT 代表 api.port
  • CONCURRENCY__PIPELINE 代表 concurrency.pipeline
  • DATABASE__SQLITE__PATH 代表 database.sqlite.path
  • STORAGE__CLEANUP__UPLOADED_FILE_RETENTION_DAYS 代表 storage.cleanup.uploaded_file_retention_days
  • STORAGE__CLEANUP__LOG_RETENTION_DAYS 代表 storage.cleanup.log_retention_days
  • MONITORING__AUTO_CLEANUP__RETENTION_DAYS 代表 monitoring.auto_cleanup.retention_days
  • PLUGIN__BINARY_STORAGE__MAX_VALUE_BYTES 代表 plugin.binary_storage.max_value_bytes
在启动时,LangBot 会读取所有环境变量,将对应的配置应用到 config.yaml 中并写入到 data/config.yaml 文件中。