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

Function fallbackChatTitle

coderd/x/chatd/quickgen.go:581–602  ·  view source on GitHub ↗
(message string)

Source from the content-addressed store, hash-verified

579}
580
581func fallbackChatTitle(message string) string {
582 const maxWords = 6
583 const maxRunes = 80
584
585 words := strings.Fields(message)
586 if len(words) == 0 {
587 return "New Chat"
588 }
589
590 truncated := false
591 if len(words) > maxWords {
592 words = words[:maxWords]
593 truncated = true
594 }
595
596 title := strings.Join(words, " ")
597 if truncated {
598 return truncateRunes(title, maxRunes-1) + "…"
599 }
600
601 return truncateRunes(title, maxRunes)
602}
603
604// contentBlocksToText concatenates the text parts of SDK chat
605// message parts into a single space-separated string.

Calls 2

truncateRunesFunction · 0.70
FieldsMethod · 0.65