contentBlocksToText concatenates the text parts of SDK chat message parts into a single space-separated string.
(parts []codersdk.ChatMessagePart)
| 604 | // contentBlocksToText concatenates the text parts of SDK chat |
| 605 | // message parts into a single space-separated string. |
| 606 | func contentBlocksToText(parts []codersdk.ChatMessagePart) string { |
| 607 | texts := make([]string, 0, len(parts)) |
| 608 | for _, part := range parts { |
| 609 | if part.Type != codersdk.ChatMessagePartTypeText { |
| 610 | continue |
| 611 | } |
| 612 | text := strings.TrimSpace(part.Text) |
| 613 | if text == "" { |
| 614 | continue |
| 615 | } |
| 616 | texts = append(texts, text) |
| 617 | } |
| 618 | return strings.Join(texts, " ") |
| 619 | } |
| 620 | |
| 621 | func truncateRunes(value string, maxLen int) string { |
| 622 | if maxLen <= 0 { |
no outgoing calls
no test coverage detected