mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-16 13:13:41 +08:00
🐛 fix: fix some issues (#77)
* 🐛 fix: Incorrect word spelling * ♻️ refactor: split function * 🐛 fix: Delete the disabled channels without deleting the abilities table
This commit is contained in:
@@ -187,11 +187,12 @@ func HandleErrorResp(resp *http.Response, toOpenAIError HttpErrorHandler) *types
|
||||
|
||||
if errorResponse != nil && errorResponse.Message != "" {
|
||||
openAIErrorWithStatusCode.OpenAIError = *errorResponse
|
||||
openAIErrorWithStatusCode.OpenAIError.Message = fmt.Sprintf("Provider API error: %s", openAIErrorWithStatusCode.OpenAIError.Message)
|
||||
}
|
||||
}
|
||||
|
||||
if openAIErrorWithStatusCode.OpenAIError.Message == "" {
|
||||
openAIErrorWithStatusCode.OpenAIError.Message = fmt.Sprintf("bad response status code %d", resp.StatusCode)
|
||||
openAIErrorWithStatusCode.OpenAIError.Message = fmt.Sprintf("Provider API error: bad response status code %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
return openAIErrorWithStatusCode
|
||||
|
||||
@@ -26,7 +26,7 @@ func InitTokenEncoders() {
|
||||
if err != nil {
|
||||
FatalLog(fmt.Sprintf("failed to get gpt-4 token encoder: %s", err.Error()))
|
||||
}
|
||||
for model, _ := range ModelRatio {
|
||||
for model := range ModelRatio {
|
||||
if strings.HasPrefix(model, "gpt-3.5") {
|
||||
tokenEncoderMap[model] = gpt35TokenEncoder
|
||||
} else if strings.HasPrefix(model, "gpt-4") {
|
||||
|
||||
Reference in New Issue
Block a user