mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-09 00:33:20 +08:00
fix(qq): drop per-tool notices, keep errors and interim text
Real agent turns invoke tools constantly; one 'Tool call X' message per call flooded the chat with near-zero information. Tool frames now only flush the pending interim explanation text; successful tool results stay silent, and failures still push the tool name with the error detail.
This commit is contained in:
parent
46acf5a425
commit
81b9535ed5
3 changed files with 8 additions and 6 deletions
File diff suppressed because one or more lines are too long
|
|
@ -675,11 +675,12 @@ export class QqHarnessBridge {
|
|||
return;
|
||||
}
|
||||
if (update.type === 'tool') {
|
||||
// 工具调用本身不推送:agent 任务工具调用频繁,逐条推送会刷屏;
|
||||
// 它只作为边界把上一段说明文本定稿推送。失败时随错误详情带出工具名。
|
||||
if (nonEmptyString(pendingStepText)) {
|
||||
await pushNotice(pendingStepText.trim());
|
||||
}
|
||||
pendingStepText = null;
|
||||
await pushNotice(`Tool call ${update.name}`);
|
||||
return;
|
||||
}
|
||||
if (update.error) {
|
||||
|
|
|
|||
|
|
@ -616,7 +616,8 @@ test('QQ pushes one notice per tool call and ignores status frames', async () =>
|
|||
});
|
||||
|
||||
await bridge.accept(message({ messageId: 'msg-status-frame' }));
|
||||
assert.deepEqual(sent, ['Tool call bash', 'Tool call read', '最终回答']);
|
||||
// 工具调用本身不推送,避免多工具任务刷屏。
|
||||
assert.deepEqual(sent, ['最终回答']);
|
||||
});
|
||||
|
||||
test('QQ pushes a failed tool error and any interim explanation text', async () => {
|
||||
|
|
@ -637,6 +638,7 @@ test('QQ pushes a failed tool error and any interim explanation text', async ()
|
|||
toolName: 'add_observations',
|
||||
error: 'Error calling add_observations. Status code: 404.',
|
||||
});
|
||||
await onUpdate({ type: 'text', text: '改用创建实体的方式:' });
|
||||
await onUpdate({ type: 'tool', name: 'create_entities' });
|
||||
await onUpdate({ type: 'status', text: '正在整理结果…', toolName: 'create_entities' });
|
||||
return '已存入两套记忆。';
|
||||
|
|
@ -654,9 +656,8 @@ test('QQ pushes a failed tool error and any interim explanation text', async ()
|
|||
await bridge.accept(message({ messageId: 'msg-tool-error' }));
|
||||
assert.deepEqual(sent, [
|
||||
'实体不存在,先创建再添加观察:',
|
||||
'Tool call add_observations',
|
||||
'Tool call add_observations\nError: Error calling add_observations. Status code: 404.',
|
||||
'Tool call create_entities',
|
||||
'改用创建实体的方式:',
|
||||
'已存入两套记忆。',
|
||||
]);
|
||||
});
|
||||
|
|
@ -757,7 +758,7 @@ test('QQ announces a stopped turn after any tool notices already pushed', async
|
|||
|
||||
await bridge.accept(message({ messageId: 'qq-stopped-stream' }));
|
||||
|
||||
assert.deepEqual(sent, ['Tool call bash', '已停止。']);
|
||||
assert.deepEqual(sent, ['已停止。']);
|
||||
assert.equal(loggedErrors, 0);
|
||||
assert.equal(fixture.seen.has('qq-stopped-stream'), true);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue