MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / filterChineseContent

Function filterChineseContent

relay/relay-text.go:92–104  ·  view source on GitHub ↗

过滤并只保留汉字内容

(content string)

Source from the content-addressed store, hash-verified

90
91// 过滤并只保留汉字内容
92func filterChineseContent(content string) string {
93 // 使用正则表达式匹配汉字
94 var chineseContent strings.Builder
95 for _, r := range content {
96 // 检查字符是否为汉字
97 if unicode.Is(unicode.Scripts["Han"], r) {
98 chineseContent.WriteRune(r)
99 }
100 }
101
102 // 返回过滤后的汉字内容
103 return chineseContent.String()
104}
105
106func getAndValidateTextRequest(c *gin.Context, relayInfo *relaycommon.RelayInfo) (*dto.GeneralOpenAIRequest, error) {
107 textRequest := &dto.GeneralOpenAIRequest{}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected