fix: log error channel

This commit is contained in:
ckt1031 2023-07-31 18:34:50 +08:00
parent fd5b3d11a6
commit b66f0ef15a

View File

@ -6,6 +6,7 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"one-api/common"
"one-api/model"
@ -64,6 +65,8 @@ func testChannel(channel *model.Channel, request ChatRequest) (error, *OpenAIErr
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
// Log: Channel (channel_id) Request Error (StatusCode)
log.Print(fmt.Sprintf("Channel (%d) Request Error (%d)", channel.Id, resp.StatusCode))
return errors.New(fmt.Sprintf("status code %d", resp.StatusCode)), nil
}