Skip to content

Commit

Permalink
chore: change test url
Browse files Browse the repository at this point in the history
  • Loading branch information
Leizhenpeng committed Mar 10, 2023
1 parent 70540e0 commit 0e9f844
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion code/services/gpt3.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ func (gpt *ChatGPT) initApiKeyUsage() {

func (gpt *ChatGPT) checkApiKeyAvailability(apiKey string) bool {
// 检查apikey的可用性
req, err := http.NewRequest("GET", BASEURL+"engines", nil)
fmt.Println("check api key availability" + apiKey)
req, err := http.NewRequest("GET", BASEURL+"models", nil)
fmt.Println("check api key availability" + req.URL.String())
if err != nil {
log.Printf("check api key %s failed: %v", apiKey, err)
return false
Expand All @@ -242,6 +244,7 @@ func (gpt *ChatGPT) checkApiKeyAvailability(apiKey string) bool {
log.Printf("check api key %s failed: %v", apiKey, err)
return false
}
fmt.Printf("check api key availability %s \n", response.Status)
if response.StatusCode/2 != 100 {
log.Printf("api key %s is not available: %s", apiKey, response.Status)
if response.StatusCode == 429 {
Expand Down

0 comments on commit 0e9f844

Please sign in to comment.