添加15个字,末尾标点符号处理
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s

This commit is contained in:
Song367 2025-08-14 18:27:27 +08:00
parent f299cf0145
commit 9aee63f624

View File

@ -467,7 +467,7 @@ func (s *LLMService) handleStreamingResponse(req *http.Request, data map[string]
if utf8.RuneCountInString(initialSessage) > 15 {
new_message = initialSessage
initialSessage = ""
} else if utf8.RuneCountInString(initialSessage) <= 15 && strings.HasSuffix(initialSessage, "。") {
} else if utf8.RuneCountInString(initialSessage) <= 15 && containsPunctuation(initialSessage) {
new_message = initialSessage
initialSessage = ""
} else {
@ -485,8 +485,8 @@ func (s *LLMService) handleStreamingResponse(req *http.Request, data map[string]
s_msg := strings.TrimSpace(new_message)
// Trim punctuation from the message
new_message = trimPunctuation(s_msg)
// fmt.Println("new_message", new_message)
fmt.Println("new_message", new_message)
// println(new_message)
// 最多重试一次
for i := 0; i < 1; i++ {
speechResp, err := s.SynthesizeSpeech(new_message, audio_type)