feat(context): sannitize llm context by modalities (#4367)

* feat(context): 添加按模型能力清理历史上下文

* fix(config): 更新历史上下文清理提示信息

* chore: ruff format

* fix: simplify modality checks and sanitize context handling

* fix(config): disable context sanitization by modalities

* fix(agent): skip messages with empty roles in InternalAgentSubStage

* fix(agent): refine tool call handling in InternalAgentSubStage

---------

Co-authored-by: Soulter <905617992@qq.com>
This commit is contained in:
Futureppo
2026-01-11 15:39:23 +08:00
committed by GitHub
parent 2f3a3f354f
commit 2e172804e3
4 changed files with 117 additions and 2 deletions

View File

@@ -187,6 +187,10 @@
"show_tool_use_status": {
"description": "Output Function Call Status"
},
"sanitize_context_by_modalities": {
"description": "Sanitize History by Modalities",
"hint": "When enabled, sanitizes contexts before each LLM request by removing image blocks and tool-call structures that the current provider's modalities do not support (this changes what the model sees)."
},
"max_agent_step": {
"description": "Maximum Tool Call Rounds"
},
@@ -532,4 +536,4 @@
"helpMiddle": "or",
"helpSuffix": "."
}
}
}

View File

@@ -184,6 +184,10 @@
"show_tool_use_status": {
"description": "输出函数调用状态"
},
"sanitize_context_by_modalities": {
"description": "按模型能力清理历史上下文",
"hint": "开启后,在每次请求 LLM 前会按当前模型提供商中所选择的模型能力删除对话中不支持的图片/工具调用结构(会改变模型看到的历史)"
},
"max_agent_step": {
"description": "工具调用轮数上限"
},
@@ -530,4 +534,4 @@
"helpMiddle": "或",
"helpSuffix": "。"
}
}
}