feat(error): Enhance error handling with optional detailed error messages

This commit is contained in:
1808837298@qq.com
2025-03-11 17:25:06 +08:00
parent 6f24dddcb2
commit 1819c4d5f5
7 changed files with 12 additions and 7 deletions

View File

@@ -155,7 +155,7 @@ func ImageHelper(c *gin.Context) *dto.OpenAIErrorWithStatusCode {
httpResp = resp.(*http.Response)
relayInfo.IsStream = relayInfo.IsStream || strings.HasPrefix(httpResp.Header.Get("Content-Type"), "text/event-stream")
if httpResp.StatusCode != http.StatusOK {
openaiErr := service.RelayErrorHandler(httpResp)
openaiErr := service.RelayErrorHandler(httpResp, false)
// reset status code 重置状态码
service.ResetStatusCode(openaiErr, statusCodeMappingStr)
return openaiErr