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

Function subagentFallbackChatTitle

coderd/x/chatd/subagent.go:1511–1532  ·  view source on GitHub ↗
(message string)

Source from the content-addressed store, hash-verified

1509}
1510
1511func 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
1534func subagentTruncateRunes(value string, maxRunes int) string {
1535 if maxRunes <= 0 {

Calls 2

subagentTruncateRunesFunction · 0.85
FieldsMethod · 0.65

Tested by 1