fix: summarize web search tool calls
This commit is contained in:
@@ -985,13 +985,13 @@ function toolCallName(item: JsonRecord, itemType: string): string {
|
|||||||
function toolCallCommandSummary(item: JsonRecord, itemType: string, toolName: string): string | null {
|
function toolCallCommandSummary(item: JsonRecord, itemType: string, toolName: string): string | null {
|
||||||
const direct = typeof item.command === "string" && item.command.trim().length > 0 ? item.command : null;
|
const direct = typeof item.command === "string" && item.command.trim().length > 0 ? item.command : null;
|
||||||
if (direct) return direct;
|
if (direct) return direct;
|
||||||
if (itemType !== "mcpToolCall" && itemType !== "dynamicToolCall") return null;
|
|
||||||
const input = toolCallInputSummary(item);
|
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 {
|
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;
|
if (!Object.prototype.hasOwnProperty.call(item, key)) continue;
|
||||||
const value = item[key];
|
const value = item[key];
|
||||||
if (value === null || value === undefined) continue;
|
if (value === null || value === undefined) continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user