124 lines
8.8 KiB
YAML
124 lines
8.8 KiB
YAML
# config.example.yml —— agent-core 专属配置模板:与 server/config.js 的 DEFAULTS 一一对应。
|
||
# ⚠️ 本文件(及其生成物 config.yml)只给 core 进程读:内含平台 api_key / 登录 secret,
|
||
# executor、wxbot 等其他组件一律不挂、不读(bind mount 只挂给 agent-core),它们的接线全部由根 compose 经 .env 注入 env。
|
||
# 部署推荐用 scripts/init.sh 生成 config.yml(只写 platforms/auth/mcp_servers/public_link,其余走默认值);
|
||
# 手动部署才整份复制本文件。platforms 为空则无模型可用,可在前端设置页添加后重启。
|
||
|
||
# 模型平台池:每平台 {name, url, type?, models:[{id, ...}], keys:[{api_key, concurrency?}]}。
|
||
platforms: []
|
||
|
||
# 全局工具黑名单:profile 未配 tools_deny 时继承它;allow 先、deny 后叠加(deny 赢,与 mcp_servers 同构)。
|
||
# 写数组即整体覆盖默认值,写 [] 即清空。默认屏蔽元工具 lab。
|
||
tools_deny: [lab]
|
||
|
||
# 模型 profile:prompt + tools 名单组合,模型用 profile: <名> 引用(不配 = 默认全量,profile-default.txt)。
|
||
model_profiles:
|
||
lab: # 统一入口自测:tools 只有 lab,其余能力经 lab(help) 现场发现
|
||
tools_allow: [lab]
|
||
tools_deny: [] # 必须显式清空全局黑名单,否则 lab 自己也被 deny → 零工具
|
||
system_prompt_file: profile-lab.txt # 相对 server/templates/(也接受绝对路径)
|
||
zero: # 纯文本对话:一个工具都不发
|
||
tools_allow: []
|
||
system_prompt_file: profile-zero.txt
|
||
|
||
port: 8090 # 服务监听端口
|
||
workspace_root: "/workspace/tasks" # 任务工作区根目录,AI 文件操作限制在此
|
||
data_root: "/workspace/data" # 数据根目录:SQLite 与 prompt dump
|
||
db_path: "" # 留空取 data_root/.agent.db
|
||
log_level: "info" # debug < info < warn < error < none(仅 core 自身;executor/wxbot 的日志等级另走 EXECUTOR_LOG_LEVEL / WXBOT_LOG_LEVEL env,compose 注)
|
||
|
||
# executor(命令执行)与 wxbot(微信接入)均**不是本文件的配置项**,接线全走根 compose 注入的 env(见 README「环境变量」):
|
||
# EXECUTOR_URL / EXECUTOR_TOKEN;WXBOT_URL(默认 http://agent-wxbot:8093,置空=微信入口静默关闭)/ WXBOT_TOKEN(init.sh 生成,两侧同值)。
|
||
|
||
terminal:
|
||
default_timeout_ms: 30000 # 命令默认超时(ms)
|
||
max_output_chars: 10000 # 回传模型的最大输出字符数
|
||
|
||
fetch:
|
||
timeout_ms: 30000 # 抓取总超时(ms),覆盖响应头到 body 读完
|
||
max_bytes: 1048576 # 单次响应最多抓多少字节,超限即断开(下载不占上下文,可宽松)
|
||
max_chars: 12000 # 返回给模型的默认字符上限(与下载上限解耦;超窗尾部提示 offset 续读)
|
||
max_chars_hard: 64000 # 模型显式传 max_chars 时的硬帽
|
||
allow_private: false # SSRF 防护:false=拒抓解析到内网/回环地址的目标;确需抓内网服务才开 true
|
||
|
||
agent:
|
||
temperature: 1.0 # 采样温度
|
||
max_tool_iterations: 100 # 单轮最大迭代数(含工具调用)
|
||
max_retries: 2 # 上游失败重试次数
|
||
language: "Simplified Chinese" # 强制回复语言;留空不限
|
||
auto_compress_tokens: 60000 # In token 超此值弹「自动压缩」提议;0=关
|
||
# 历史重放占位裁剪(省 token):某条工具调用/回执距对话尾部 ≥rounds 个 assistant 轮后,
|
||
# 把可再生的重负载换成单行占位再发给上游(DB/UI 不动,盘上可重读/重抓)。rounds=0 或
|
||
# 不写这条规则 = 不裁;整段 rules: [] = 全关。
|
||
# 下面是内置默认(与 config.js 的 DEFAULTS.agent.trim.rules 同步);写了本段就整体替换默认。
|
||
# side=args 裁调用参数(fields 点名顶层字符串参数);side=result 裁整段回执正文。
|
||
# tool 用模型看到的最终工具名(MCP 重名时含 server__ 前缀)。
|
||
trim:
|
||
min_chars: 600 # 短于此长度的正文不裁(占位自身也有成本);单条规则可用 min_chars 覆盖
|
||
rules:
|
||
- tool: write_file # 参数正文只是写盘时的快照,后续 edit_file 一次就失真
|
||
side: args
|
||
fields: [content]
|
||
rounds: 1
|
||
- tool: fetch # 页面可重抓;status_regex 取第一个捕获组写进占位(YAML 用单引号,避免 \d 被当转义)
|
||
side: result
|
||
rounds: 2
|
||
status_regex: '^HTTP (\d{3})'
|
||
- tool: read_file # 文件在盘上,可重读
|
||
side: result
|
||
rounds: 2
|
||
- tool: web_search # 栈内免费搜索 MCP;可重搜,但结果会随时间变化
|
||
side: result
|
||
rounds: 2
|
||
auto_complete_ms: 1800000 # 保持中(held)超此时长自动收口为已完成;0=关(纯状态动作,历史/模型绑定不动)
|
||
|
||
# 长期记忆(日记,memory.js):收口时一条几十字第一人称碎片入当日条目;存储默认永久,旧记忆靠回忆下钻
|
||
memory:
|
||
inject_max: 3 # 新会话开场注入最近几条碎片;0=只记录不注入
|
||
retain_days: 0 # 存储裁剪窗;0=永不删,正数=超窗硬删
|
||
wrap_idle_ms: 14400000 # 空闲超此时长自动收口(碎片+归档+微信解绑);0=关
|
||
|
||
upload:
|
||
image_compress_threshold_kb: 1536 # 大图压缩提示阈值(KB)
|
||
image_max_dim: 2000 # 压缩后长边上限(px)
|
||
image_quality: 0.85 # JPEG 质量
|
||
confirm_size_mb: 10 # 任意文件二次确认阈值(MB)
|
||
paste_to_file_threshold_chars: 2000 # 粘贴超长文本自动转 .txt 附件(字符数,0=关)
|
||
|
||
skills:
|
||
skills_root: "" # 留空取 workspace_root 同级 skills 目录
|
||
timeout_ms: 120000 # 单个技能执行超时(ms)
|
||
|
||
# 旧版 model_hold(模型保持租约)已废弃删除:key 不再独占也不排队,回合结束后的 held 不再自动到期。
|
||
|
||
auth: # users 留空 = 不启用登录认证
|
||
secret: "" # 登录态签名密钥;留空则每次重启随机(需重新登录)
|
||
ttl_ms: 2592000000 # 登录态有效期(ms,默认 30 天)
|
||
users:
|
||
- user: admin # 默认账号
|
||
password: "admin" # 默认密码,请务必修改
|
||
role: admin # admin=管理员(全部设置 + 用户管理);user 或缺省=普通用户(仅账户页)
|
||
# model: qwen-tp/qwen3.8-flash # 选填:该用户新建会话时锁定的模型(内部键「平台名/模型id」)
|
||
|
||
# MCP 服务列表(仓库自带的 mcp/ 服务,或栈外服务):每项 {name?, url, headers?, mode?(默认 advertise), timeout_ms?, tools_allow?, tools_deny?}。
|
||
# mode 三态:advertise=工具下发给模型;skill=不下发,改为以技能形式暴露(get 返回原始 input_schema,run 转发);
|
||
# disable=不连接、不发现。旧字段 enable 已废弃;mode: silent 已移除(改用 skill),写进配置会启动报错。
|
||
#
|
||
# 语音识别(mcp/asr)建议用 skill:转写音频是低频能力,不必把 schema 塞进每轮请求。
|
||
# 上游参数(key / base_url / model)由 core 随请求带给 mcp_asr,容器自己不存密钥,
|
||
# 也不预设任何平台——任何 OpenAI 兼容的 /audio/transcriptions 都行。免鉴权的自建服务可省 Authorization。
|
||
# - name: asr
|
||
# url: "http://mcp_asr:3000/mcp"
|
||
# headers:
|
||
# Authorization: Bearer <key>
|
||
# X-ASR-Base-Url: "https://<host>/v1"
|
||
# X-ASR-Model: "whisper-1"
|
||
# mode: skill
|
||
# 注意:输入框里的语音输入走的是 core 的 /api/asr(由 compose 的 ASR_URL 接线),也读这一段的 headers;
|
||
# 不经工具、不消耗 token。mode: disable 或删掉这段 = 麦克风入口关闭。
|
||
mcp_servers: []
|
||
|
||
public_link:
|
||
base_url: "" # 留空关闭 mint_public_link;填本服务对外地址
|
||
ttl_ms: 1800000 # 链接有效期(ms)
|