feat: add TOOLS_PASSTHROUGH env var override for Docker support

This commit is contained in:
小海
2026-03-20 09:18:13 +08:00
parent 70d077b27a
commit 7c2422ce60
3 changed files with 11 additions and 0 deletions

View File

@@ -112,6 +112,7 @@ tools:
# 工具调用仍使用 ```json action``` 格式,响应解析不受影响
# false: [默认] 使用标准模式buildToolInstructions + 多类别 few-shot 注入)
# Claude Code 推荐此模式,兼容性和工具调用覆盖率更好
# 环境变量: TOOLS_PASSTHROUGH=true|false
# passthrough: true
# ==================== 响应内容清洗(可选,默认关闭) ====================

View File

@@ -51,6 +51,10 @@ services:
# 默认使用本地 OCR零配置如需外部 Vision API 请在 config.yaml 中修改 vision.mode 为 'api'
# 并配置 vision.base_url / vision.api_key / vision.model
# ── 工具透传模式(推荐 Roo Code / Cline 等非 Claude Code 客户端) ──
# 开启后跳过 few-shot 注入,直接嵌入工具定义,减少身份冲突
# - TOOLS_PASSTHROUGH=true
# ── 响应内容清洗 ──
# 开启后会将响应中 Cursor 身份引用替换为 Claude默认关闭
# - SANITIZE_RESPONSE=true

View File

@@ -145,6 +145,12 @@ function applyEnvOverrides(cfg: AppConfig): void {
if (!cfg.logging) cfg.logging = { file_enabled: false, dir: './logs', max_days: 7 };
cfg.logging.dir = process.env.LOG_DIR;
}
// 工具透传模式环境变量覆盖
if (process.env.TOOLS_PASSTHROUGH !== undefined) {
if (!cfg.tools) cfg.tools = { schemaMode: 'full', descriptionMaxLength: 0 };
cfg.tools.passthrough = process.env.TOOLS_PASSTHROUGH === 'true' || process.env.TOOLS_PASSTHROUGH === '1';
}
// 响应内容清洗环境变量覆盖
if (process.env.SANITIZE_RESPONSE !== undefined) {
cfg.sanitizeEnabled = process.env.SANITIZE_RESPONSE === 'true' || process.env.SANITIZE_RESPONSE === '1';