MCPcopy Create free account
hub / github.com/astercloud/aster / truncateString

Function truncateString

pkg/middleware/summarization.go:635–640  ·  view source on GitHub ↗

truncateString 截断字符串

(s string, maxLen int)

Source from the content-addressed store, hash-verified

633
634// truncateString 截断字符串
635func truncateString(s string, maxLen int) string {
636 if len(s) <= maxLen {
637 return s
638 }
639 return s[:maxLen] + "..."
640}
641
642// defaultTokenCounter 默认的 token 计数器(基于字符数估算)
643// 粗略估算: 4 个字符约等于 1 个 token

Callers 2

WrapModelCallMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected