Merge pull request #188 from pikasTech/fix/issue-1297-websearch-command-summary
fix: 补齐 webSearch 工具命令摘要
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 {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user