🐛 fix balance action error
This commit is contained in:
parent
fc284cc1f0
commit
ba654d8b81
@ -9,6 +9,10 @@ import (
|
||||
)
|
||||
|
||||
func (p *OpenAIProvider) Balance(channel *model.Channel) (float64, error) {
|
||||
if !p.BalanceAction {
|
||||
return 0, errors.New("不支持余额查询")
|
||||
}
|
||||
|
||||
fullRequestURL := p.GetFullRequestURL("/v1/dashboard/billing/subscription", "")
|
||||
headers := p.GetRequestHeaders()
|
||||
|
||||
|
@ -20,12 +20,15 @@ type OpenAIProviderFactory struct{}
|
||||
|
||||
// 创建 OpenAIProvider
|
||||
func (f OpenAIProviderFactory) Create(c *gin.Context) base.ProviderInterface {
|
||||
return CreateOpenAIProvider(c, "")
|
||||
openAIProvider := CreateOpenAIProvider(c, "")
|
||||
openAIProvider.BalanceAction = true
|
||||
return openAIProvider
|
||||
}
|
||||
|
||||
type OpenAIProvider struct {
|
||||
base.BaseProvider
|
||||
IsAzure bool
|
||||
BalanceAction bool
|
||||
}
|
||||
|
||||
// 创建 OpenAIProvider
|
||||
@ -51,6 +54,7 @@ func CreateOpenAIProvider(c *gin.Context, baseURL string) *OpenAIProvider {
|
||||
Context: c,
|
||||
},
|
||||
IsAzure: false,
|
||||
BalanceAction: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ export default function ChannelTableRow({ item, manageChannel, handleOpenModal,
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Tooltip title={'点击更新余额'} placement="top" onClick={updateChannelBalance}>
|
||||
{renderBalance(itemBalance)}
|
||||
{renderBalance(item.type, itemBalance)}
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
|
Loading…
Reference in New Issue
Block a user