(ToolExecutionResult result)
| 627 | } |
| 628 | |
| 629 | private String webSearchSummary(ToolExecutionResult result) { |
| 630 | String text = result.result() == null ? "" : result.result(); |
| 631 | if (text.startsWith("搜索失败") || text.startsWith("⚠️") || text.contains("未找到相关结果")) { |
| 632 | return compactOneLine(text, 120); |
| 633 | } |
| 634 | long count = text.lines().filter(line -> line.matches("^\\d+\\.\\s+.*")).count(); |
| 635 | String query = extractJsonArg(result.argumentsJson(), "query"); |
| 636 | String label = query.isBlank() ? "搜索结果" : "搜索 \"" + query + "\""; |
| 637 | return count > 0 |
| 638 | ? label + " 返回 " + count + " 条结果" |
| 639 | : label + " 已返回结果"; |
| 640 | } |
| 641 | |
| 642 | private String webFetchSummary(ToolExecutionResult result) { |
| 643 | String text = result.result() == null ? "" : result.result(); |
no test coverage detected