| 1509 | } |
| 1510 | |
| 1511 | func subagentFallbackChatTitle(message string) string { |
| 1512 | const maxWords = 6 |
| 1513 | const maxRunes = 80 |
| 1514 | |
| 1515 | words := strings.Fields(message) |
| 1516 | if len(words) == 0 { |
| 1517 | return "New Chat" |
| 1518 | } |
| 1519 | |
| 1520 | truncated := false |
| 1521 | if len(words) > maxWords { |
| 1522 | words = words[:maxWords] |
| 1523 | truncated = true |
| 1524 | } |
| 1525 | |
| 1526 | title := strings.Join(words, " ") |
| 1527 | if truncated { |
| 1528 | title += "..." |
| 1529 | } |
| 1530 | |
| 1531 | return subagentTruncateRunes(title, maxRunes) |
| 1532 | } |
| 1533 | |
| 1534 | func subagentTruncateRunes(value string, maxRunes int) string { |
| 1535 | if maxRunes <= 0 { |