(String text, int maxLength)
| 676 | } |
| 677 | |
| 678 | private String compactOneLine(String text, int maxLength) { |
| 679 | if (text == null || text.isBlank()) { |
| 680 | return ""; |
| 681 | } |
| 682 | String value = text.replace("\r\n", "\n") |
| 683 | .replace('\r', '\n') |
| 684 | .lines() |
| 685 | .map(String::trim) |
| 686 | .filter(line -> !line.isEmpty()) |
| 687 | .findFirst() |
| 688 | .orElse("") |
| 689 | .replaceAll("\\s+", " "); |
| 690 | return value.length() > maxLength ? value.substring(0, Math.max(0, maxLength - 3)) + "..." : value; |
| 691 | } |
| 692 | |
| 693 | private void appendImageToolMessages(List<ToolExecutionResult> toolResults) { |
| 694 | if (toolResults == null || toolResults.isEmpty()) { |
no test coverage detected