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

Function chatTitleFromMessage

coderd/exp_chats.go:6313–6330  ·  view source on GitHub ↗
(message string)

Source from the content-addressed store, hash-verified

6311}
6312
6313func chatTitleFromMessage(message string) string {
6314 const maxWords = 6
6315 const maxRunes = 80
6316 words := strings.Fields(message)
6317 if len(words) == 0 {
6318 return "New Chat"
6319 }
6320 truncated := false
6321 if len(words) > maxWords {
6322 words = words[:maxWords]
6323 truncated = true
6324 }
6325 title := strings.Join(words, " ")
6326 if truncated {
6327 title += "…"
6328 }
6329 return truncateRunes(title, maxRunes)
6330}
6331
6332func truncateRunes(value string, maxLen int) string {
6333 if maxLen <= 0 {

Callers 1

postChatsMethod · 0.85

Calls 2

truncateRunesFunction · 0.70
FieldsMethod · 0.65

Tested by

no test coverage detected