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

Function metadataKeyWords

coderd/x/chatd/chatloop/chatloop.go:2124–2156  ·  view source on GitHub ↗
(key string)

Source from the content-addressed store, hash-verified

2122}
2123
2124func metadataKeyWords(key string) []string {
2125 words := make([]string, 0, 4)
2126 var current strings.Builder
2127
2128 flush := func() {
2129 if current.Len() == 0 {
2130 return
2131 }
2132 words = append(words, current.String())
2133 current.Reset()
2134 }
2135
2136 var prev rune
2137 var hasPrev bool
2138 for _, r := range key {
2139 if !unicode.IsLetter(r) {
2140 flush()
2141 hasPrev = false
2142 continue
2143 }
2144
2145 if hasPrev && unicode.IsUpper(r) && unicode.IsLower(prev) {
2146 flush()
2147 }
2148
2149 _, _ = current.WriteRune(unicode.ToLower(r))
2150 prev = r
2151 hasPrev = true
2152 }
2153
2154 flush()
2155 return words
2156}
2157
2158func numericContextLimitValue(value any) (int64, bool) {
2159 switch typed := value.(type) {

Callers 2

isContextLimitKeyFunction · 0.85
TestMetadataKeyWordsFunction · 0.85

Calls 4

flushFunction · 0.85
ResetMethod · 0.65
LenMethod · 0.45
StringMethod · 0.45

Tested by 1

TestMetadataKeyWordsFunction · 0.68