Commit 294dc8d8 by CaIon

修复tts异常时仍然扣费的问题

parent 5b2218c9
...@@ -129,6 +129,11 @@ func relayAudioHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode ...@@ -129,6 +129,11 @@ func relayAudioHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode
if err != nil { if err != nil {
return errorWrapper(err, "close_request_body_failed", http.StatusInternalServerError) return errorWrapper(err, "close_request_body_failed", http.StatusInternalServerError)
} }
if resp.StatusCode != http.StatusOK {
return relayErrorHandler(resp)
}
var audioResponse AudioResponse var audioResponse AudioResponse
defer func(ctx context.Context) { defer func(ctx context.Context) {
......
...@@ -147,6 +147,11 @@ func relayImageHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode ...@@ -147,6 +147,11 @@ func relayImageHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode
if err != nil { if err != nil {
return errorWrapper(err, "close_request_body_failed", http.StatusInternalServerError) return errorWrapper(err, "close_request_body_failed", http.StatusInternalServerError)
} }
if resp.StatusCode != http.StatusOK {
return relayErrorHandler(resp)
}
var textResponse ImageResponse var textResponse ImageResponse
defer func(ctx context.Context) { defer func(ctx context.Context) {
if consumeQuota { if consumeQuota {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment