jijo
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 53s

This commit is contained in:
Song367 2025-06-18 19:14:11 +08:00
parent 7f89c584c0
commit f4b35f4596

View File

@ -167,6 +167,7 @@ func (s *LLMService) handleStreamingResponse(req *http.Request, data map[string]
}
messageChan := make(chan Message, 100) // Buffered channel for better performance
all_message := ""
initialSessage := ""
go func() {
defer resp.Body.Close()
@ -256,6 +257,7 @@ func (s *LLMService) handleStreamingResponse(req *http.Request, data map[string]
}
new_message := ""
initialSessage += answer
all_message += answer
if containsPunctuation(initialSessage) {
segments := splitByPunctuation(initialSessage)
// fmt.Printf("原始文本: %s\n", initialSessage)
@ -341,10 +343,10 @@ func (s *LLMService) handleStreamingResponse(req *http.Request, data map[string]
}
break // 获取到音频就退出
}
fmt.Println("audio is empty, retry", speechResp)
// fmt.Println("audio is empty, retry", speechResp)
// time.Sleep(1 * time.Second)
}
fmt.Println("所有消息:", all_message)
messageChan <- Message{
Answer: new_message,
IsEnd: false,