feat(aibox): 子代理输出转发开关 subagent_stream_output(默认开启)
将上一轮的「子代理实时输出可见化」固化为可配置开关,避免在生产环境刷屏或泄露中间过程。 - common/config.py: 默认配置新增 subagent_stream_output: true - aibox.py run_full_subagent: 读取该开关;关闭时 _effective_output_callback 置 None, 子代理在后台静默执行(主对话侧栏不显示其思考/工具调用/回答),开启时按原逻辑 转发 line/chunk/reasoning。 - 仅影响主对话侧栏可见性,不影响子代理执行与最终返回摘要;老用户配置缺该键默认 True(兼容)。
This commit is contained in:
1 parent
c9eaf988b3
commit
45bc019bfc
2 files changed
+14
-4
No files matched your search
+10
-3
@@ -5457,14 +5457,21 @@ def run_full_subagent(role, task, config, logger=None, model=None,
|
||||
|
||||
# 运行对话:think_and_respond 内部递归处理工具调用,
|
||||
# 直到 AI 返回纯文本无工具调用,或达到轮次限制
|
||||
# 将子代理的思考过程(reasoning)通过 output_callback 转发给父代理
|
||||
# 子代理输出转发开关:config.subagent_stream_output(默认开启)。
|
||||
# 关闭后子代理在后台静默执行,主对话侧栏不再显示其思考/工具调用/回答。
|
||||
_stream_subagent_output = True
|
||||
if config is not None:
|
||||
_stream_subagent_output = config.get("subagent_stream_output", True)
|
||||
_effective_output_callback = output_callback if _stream_subagent_output else None
|
||||
|
||||
# 将子代理的思考过程(reasoning)及工具执行/回答(line/chunk)通过 output_callback 转发给父代理
|
||||
def sub_think_callback(msg_type, content):
|
||||
# 转发子代理的实时输出:思考过程(reasoning)、工具执行过程(line)、回答文本(chunk)
|
||||
if output_callback is not None and msg_type in (
|
||||
if _effective_output_callback is not None and msg_type in (
|
||||
"reasoning_start", "reasoning", "reasoning_end",
|
||||
"line", "chunk",
|
||||
):
|
||||
output_callback(msg_type, content)
|
||||
_effective_output_callback(msg_type, content)
|
||||
|
||||
sub_chat.think_and_respond(task, output_callback=sub_think_callback)
|
||||
|
||||
|
||||
@@ -141,7 +141,10 @@ class ConfigManager:
|
||||
"weight_decay_factor": 0.01, # ?
|
||||
"max_input_chars": 6000, # 最大输入字符
|
||||
"llm_max_tokens": 1000 # 大模型最大输出词元
|
||||
}
|
||||
},
|
||||
|
||||
# 子代理输出
|
||||
"subagent_stream_output": True, # 是否将子代理的实时输出(思考/工具调用/回答)转发到主对话侧栏
|
||||
}
|
||||
|
||||
def _load_config(self):
|
||||
|
||||
Reference in new issue
Block a user