fix: summarize web search tool calls

This commit is contained in:
lyon
2026-06-16 00:59:49 +08:00
parent 06e94a9135
commit a5ab078132
+3 -3
View File
@@ -985,13 +985,13 @@ function toolCallName(item: JsonRecord, itemType: string): string {
function toolCallCommandSummary(item: JsonRecord, itemType: string, toolName: string): string | null {
const direct = typeof item.command === "string" && item.command.trim().length > 0 ? item.command : null;
if (direct) return direct;
if (itemType !== "mcpToolCall" && itemType !== "dynamicToolCall") return null;
const input = toolCallInputSummary(item);
return input ? `${toolName} ${input}` : toolName;
if (itemType === "webSearch" || itemType === "mcpToolCall" || itemType === "dynamicToolCall") return input ? `${toolName} ${input}` : toolName;
return null;
}
function toolCallInputSummary(item: JsonRecord): string | null {
for (const key of ["arguments", "args", "input", "params", "parameters"] as const) {
for (const key of ["arguments", "args", "input", "params", "parameters", "query", "searchQuery", "url", "urls"] as const) {
if (!Object.prototype.hasOwnProperty.call(item, key)) continue;
const value = item[key];
if (value === null || value === undefined) continue;