🐛 fix: balance fail (#47)

This commit is contained in:
Buer
2024-01-20 03:01:13 +08:00
committed by GitHub
parent b42d4d44aa
commit 33bb1a04a7
5 changed files with 11 additions and 16 deletions

View File

@@ -2,10 +2,9 @@ package closeai
import (
"errors"
"one-api/model"
)
func (p *CloseaiProxyProvider) Balance(channel *model.Channel) (float64, error) {
func (p *CloseaiProxyProvider) Balance() (float64, error) {
fullRequestURL := p.GetFullRequestURL("/dashboard/billing/credit_grants", "")
headers := p.GetRequestHeaders()
@@ -21,7 +20,7 @@ func (p *CloseaiProxyProvider) Balance(channel *model.Channel) (float64, error)
return 0, errors.New(errWithCode.OpenAIError.Message)
}
channel.UpdateBalance(response.TotalAvailable)
p.Channel.UpdateBalance(response.TotalAvailable)
return response.TotalAvailable, nil
}