添加15个字,末尾标点符号处理
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
This commit is contained in:
parent
f299cf0145
commit
9aee63f624
@ -467,7 +467,7 @@ func (s *LLMService) handleStreamingResponse(req *http.Request, data map[string]
|
|||||||
if utf8.RuneCountInString(initialSessage) > 15 {
|
if utf8.RuneCountInString(initialSessage) > 15 {
|
||||||
new_message = initialSessage
|
new_message = initialSessage
|
||||||
initialSessage = ""
|
initialSessage = ""
|
||||||
} else if utf8.RuneCountInString(initialSessage) <= 15 && strings.HasSuffix(initialSessage, "。") {
|
} else if utf8.RuneCountInString(initialSessage) <= 15 && containsPunctuation(initialSessage) {
|
||||||
new_message = initialSessage
|
new_message = initialSessage
|
||||||
initialSessage = ""
|
initialSessage = ""
|
||||||
} else {
|
} else {
|
||||||
@ -485,8 +485,8 @@ func (s *LLMService) handleStreamingResponse(req *http.Request, data map[string]
|
|||||||
s_msg := strings.TrimSpace(new_message)
|
s_msg := strings.TrimSpace(new_message)
|
||||||
// Trim punctuation from the message
|
// Trim punctuation from the message
|
||||||
new_message = trimPunctuation(s_msg)
|
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++ {
|
for i := 0; i < 1; i++ {
|
||||||
speechResp, err := s.SynthesizeSpeech(new_message, audio_type)
|
speechResp, err := s.SynthesizeSpeech(new_message, audio_type)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user