diff --git a/adapter/volcano/volcano.go b/adapter/volcano/volcano.go index 603ff7c..3453b76 100644 --- a/adapter/volcano/volcano.go +++ b/adapter/volcano/volcano.go @@ -132,8 +132,6 @@ func Synthesis(config *dto.ByteDanceTTSConfig, httpClient *HTTPClient, text stri if v3Resp.Usage != nil { log.Printf("TTS synthesis completed, usage: %+v", v3Resp.Usage) } - for scanner.Scan() { - } break } diff --git a/common/constants.go b/common/constants.go index ea7a6d9..853ca08 100644 --- a/common/constants.go +++ b/common/constants.go @@ -1,4 +1,4 @@ -package common +package common import "time" diff --git a/controller/tts.go b/controller/tts.go index 03c6297..7a40da9 100644 --- a/controller/tts.go +++ b/controller/tts.go @@ -58,10 +58,11 @@ func OpenaiTTSHandler(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, common.MaxRequestBodySize) body, err := io.ReadAll(r.Body) if err != nil { - if strings.Contains(err.Error(), "request body too large") { - return - } - http.Error(w, "Failed to read request body", http.StatusBadRequest) + if strings.Contains(err.Error(), "request body too large") { + http.Error(w, fmt.Sprintf("Request body too large (max %d bytes)", common.MaxRequestBodySize), http.StatusRequestEntityTooLarge) + return + } + http.Error(w, "Failed to read request body", http.StatusBadRequest) return }