mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-11 08:33:41 +08:00
feat: 避免请求出错时暴露渠道信息
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user