feat: 避免请求出错时暴露渠道信息

This commit is contained in:
CaIon
2023-09-15 17:50:54 +08:00
parent d9deda18c1
commit d1d789616f
3 changed files with 12 additions and 2 deletions

View File

@@ -106,6 +106,10 @@ func countTokenText(text string, model string) int {
}
func errorWrapper(err error, code string, statusCode int) *OpenAIErrorWithStatusCode {
if statusCode == http.StatusInternalServerError {
//避免暴露内部错误
err = fmt.Errorf("internal server error")
}
openAIError := OpenAIError{
Message: err.Error(),
Type: "one_api_error",