fix(node): 移除被过滤工具调用的回退重发并对齐 Go 行为

This commit is contained in:
CJACK. committed 2026-02-22 23:05:40 +08:00
1 parent d4017b87c1
commit 1e678ecc1a
2 files changed
+9 -9

No files matched your search

+9 -1
View File
@@ -52,11 +52,19 @@ test('parseToolCalls keeps non-object argument strings as _raw (Go parity)', ()
]);
});
test('parseToolCalls still intercepts unknown schema names to avoid leaks', () => {
test('parseToolCalls drops unknown schema names when toolNames is provided', () => {
const payload = JSON.stringify({
tool_calls: [{ name: 'not_in_schema', input: { q: 'go' } }],
});
const calls = parseToolCalls(payload, ['search']);
assert.equal(calls.length, 0);
});
test('parseToolCalls keeps unknown names when toolNames is empty', () => {
const payload = JSON.stringify({
tool_calls: [{ name: 'not_in_schema', input: { q: 'go' } }],
});
const calls = parseToolCalls(payload, []);
assert.equal(calls.length, 1);
assert.equal(calls[0].name, 'not_in_schema');
});