diff --git a/service/llm_service.go b/service/llm_service.go index 9c3953e..4464687 100644 --- a/service/llm_service.go +++ b/service/llm_service.go @@ -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,