config.yaml 示例

openclaw 中文openclaw 2

很高兴为您介绍 OpenClaw 的配置信息,OpenClaw 是一个功能强大的多平台下载工具,支持多种协议和功能。

config.yaml 示例-第1张图片-OpenClaw下载中文-AI中文智能体

主要配置文件位置

Linux/macOS

~/.config/openclaw/config.yaml
~/.config/openclaw/claw.yaml

Windows

%APPDATA%\OpenClaw\config.yaml
%APPDATA%\OpenClaw\claw.yaml

基本配置示例

  level: info  # debug, info, warn, error
  file: ~/.config/openclaw/openclaw.log
download:
  dir: ~/Downloads  # 默认下载目录
  max_concurrent: 5  # 最大并发下载数
  max_speed: 0  # 0为不限速,单位 KB/s
  timeout: 30  # 超时时间(秒)
  retry: 3  # 重试次数
http:
  user_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
  proxy: ""  # 代理设置,如:http://127.0.0.1:1080
  referer: ""  # 默认Referer
server:
  host: "127.0.0.1"
  port: 6800
  secret: ""  # RPC密钥

详细配置说明

下载设置

download:
  # 基础设置
  dir: "~/Downloads"  # 下载目录
  split: 16  # 分片数
  max_concurrent: 5  # 同时下载任务数
  # 速度限制
  max_download_speed: 0  # 单个任务下载速度限制
  max_upload_speed: 0  # 上传速度限制
  global_speed_limit: 0  # 全局速度限制
  # 连接设置
  timeout: 30
  retry: 3
  retry_interval: 5
  # 磁盘缓存
  disk_cache: 64M  # 磁盘缓存大小
  file_allocation: "falloc"  # 文件分配方式:none, prealloc, falloc, trunc

协议特定配置

# HTTP/FTP 配置
http:
  user_agent: "OpenClaw/1.0"
  proxy: ""
  proxy_user: ""
  proxy_pass: ""
  continue: true  # 支持断点续传
# BitTorrent 配置
bittorrent:
  max_peers: 55
  seed_ratio: 1.0  # 做种分享率
  seed_time: 30  # 做种时间(分钟)
  tracker:
    - "udp://tracker.opentrackr.org:1337/announce"
    - "http://tracker.opentrackr.org:1337/announce"
# 视频提取配置
extractor:
  youtube:
    format: "bestvideo+bestaudio/best"
    subtitles: true
    thumbnail: true
  bilibili:
    cookie_file: "~/bilibili.cookies"

服务器配置(用于Web UI/RPC)

server:
  enable: true
  host: "0.0.0.0"
  port: 6800
  rpc_secret: "your_secret_key"
  rpc_user: ""
  rpc_pass: ""
  webui:
    enable: true
    host: "0.0.0.0"
    port: 6801
    username: "admin"
    password: "admin"

插件配置

plugins:
  auto_extract: true  # 自动识别链接类型
  virus_check: false  # 病毒检查
  auto_unzip: true  # 自动解压
  # 下载完成后执行脚本
  post_hook: |
    #!/bin/bash
    echo "Download completed: $1"

命令行配置示例

启动带配置文件

# 指定配置文件
openclaw --config=/path/to/config.yaml
# 使用特定配置启动
openclaw --log-level=debug --download-dir=/tmp/downloads

常用命令行选项

# 基础选项
openclaw add "http://example.com/file.zip"  # 添加下载
openclaw add --dir=/path/to/dir URL  # 指定保存目录
# 控制选项
openclaw pause ID  # 暂停任务
openclaw resume ID  # 恢复任务
openclaw remove ID  # 删除任务
openclaw list  # 列出任务
# 服务器选项
openclaw start --enable-rpc  # 启用RPC服务
openclaw daemon  # 后台运行

高级配置技巧

不同站点专用配置

site_specific:
  "youtube.com":
    format: "bestvideo[height<=1080]+bestaudio/best"
    extract_audio: true
    audio_format: "mp3"
  "bilibili.com":
    cookie_file: "~/bilibili.cookies"
    quality: "1080p"
    subtitle: "zh-Hans"

计划任务配置

scheduler:
  enable: true
  rules:
    - time: "00:00-06:00"
      max_speed: 102400  # 夜间全速
    - time: "06:00-24:00"
      max_speed: 20480   # 白天限速

通知配置

notification:
  enable: true
  methods:
    desktop: true  # 桌面通知
    email:
      enable: false
      smtp_server: "smtp.example.com"
      from: "sender@example.com"
      to: "receiver@example.com"
    webhook:
      enable: false
      url: "https://hook.example.com"

调试配置

如果需要调试,可以使用以下配置:

log:
  level: debug
  file: /tmp/openclaw-debug.log
  console: true
  rotate:
    enable: true
    size: 10M
    count: 5
debug:
  save_session: true  # 保存会话信息
  http_trace: false   # HTTP跟踪

注意事项

  1. 配置优先级:命令行参数 > 配置文件 > 默认值
  2. 配置文件格式:确保使用正确的YAML格式(缩进使用空格)
  3. 路径处理:可以使用 表示用户目录
  4. 重载配置:修改配置后需要重启服务生效

需要更具体的配置帮助吗?

标签: yaml 示例

抱歉,评论功能暂时关闭!