🐛 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:
Buer
2024-02-29 11:26:02 +08:00
committed by GitHub
parent 1ae0baa8cb
commit fab465e82a
6 changed files with 90 additions and 114 deletions

View File

@@ -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

View File

@@ -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") {