tokenCount 通过空格粗略估算 token 数量,用于简单过滤。
(text string)
| 97 | |
| 98 | // tokenCount 通过空格粗略估算 token 数量,用于简单过滤。 |
| 99 | func tokenCount(text string) int { |
| 100 | text = strings.TrimSpace(text) |
| 101 | if text == "" { |
| 102 | return 0 |
| 103 | } |
| 104 | return len(strings.Fields(text)) |
| 105 | } |
no outgoing calls
no test coverage detected