MCPcopy Index your code
hub / github.com/coder/coder / contentBlocksToText

Function contentBlocksToText

coderd/x/chatd/quickgen.go:606–619  ·  view source on GitHub ↗

contentBlocksToText concatenates the text parts of SDK chat message parts into a single space-separated string.

(parts []codersdk.ChatMessagePart)

Source from the content-addressed store, hash-verified

604// contentBlocksToText concatenates the text parts of SDK chat
605// message parts into a single space-separated string.
606func 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
621func truncateRunes(value string, maxLen int) string {
622 if maxLen <= 0 {

Callers 6

deriveChatDebugSeedFunction · 0.85
runChatMethod · 0.85
titleInputFunction · 0.85
extractManualTitleTurnsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected