🐛 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

@@ -3,11 +3,10 @@ package openai
import (
"errors"
"fmt"
"one-api/model"
"time"
)
func (p *OpenAIProvider) Balance(channel *model.Channel) (float64, error) {
func (p *OpenAIProvider) Balance() (float64, error) {
if !p.BalanceAction {
return 0, errors.New("不支持余额查询")
}
@@ -46,6 +45,6 @@ func (p *OpenAIProvider) Balance(channel *model.Channel) (float64, error) {
}
balance := subscription.HardLimitUSD - usage.TotalUsage/100
channel.UpdateBalance(balance)
p.Channel.UpdateBalance(balance)
return balance, nil
}