Merge remote-tracking branch 'upstream/main'
This commit is contained in:
commit
203471d7a9
@ -8,7 +8,8 @@ import (
|
||||
)
|
||||
|
||||
func GetSubscription(c *gin.Context) {
|
||||
var quota int
|
||||
var remainQuota int
|
||||
var usedQuota int
|
||||
var err error
|
||||
var expirationDate int64
|
||||
|
||||
@ -18,10 +19,14 @@ func GetSubscription(c *gin.Context) {
|
||||
expirationDate = token.ExpiredTime
|
||||
|
||||
if common.DisplayTokenStatEnabled {
|
||||
quota = token.RemainQuota
|
||||
tokenId := c.GetInt("token_id")
|
||||
token, err = model.GetTokenById(tokenId)
|
||||
remainQuota = token.RemainQuota
|
||||
usedQuota = token.UsedQuota
|
||||
} else {
|
||||
userId := c.GetInt("id")
|
||||
quota, err = model.GetUserQuota(userId)
|
||||
remainQuota, err = model.GetUserQuota(userId)
|
||||
usedQuota, err = model.GetUserUsedQuota(userId)
|
||||
}
|
||||
if err != nil {
|
||||
openAIError := OpenAIError{
|
||||
@ -33,6 +38,7 @@ func GetSubscription(c *gin.Context) {
|
||||
})
|
||||
return
|
||||
}
|
||||
quota := remainQuota + usedQuota
|
||||
amount := float64(quota)
|
||||
if common.DisplayInCurrencyEnabled {
|
||||
amount /= common.QuotaPerUnit
|
||||
|
@ -59,19 +59,19 @@ const EditChannel = () => {
|
||||
data.models = [];
|
||||
} else {
|
||||
data.models = data.models.split(',');
|
||||
// setTimeout(() => {
|
||||
// let localModelOptions = [...modelOptions];
|
||||
// data.models.forEach((model) => {
|
||||
// if (!localModelOptions.find((option) => option.key === model)) {
|
||||
// localModelOptions.push({
|
||||
// key: model,
|
||||
// text: model,
|
||||
// value: model,
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// setModelOptions(localModelOptions);
|
||||
// }, 1000);
|
||||
setTimeout(() => {
|
||||
let localModelOptions = [...data.models];
|
||||
data.models.forEach((model) => {
|
||||
if (!localModelOptions.find((option) => option.key === model)) {
|
||||
localModelOptions.push({
|
||||
key: model,
|
||||
text: model,
|
||||
value: model
|
||||
});
|
||||
}
|
||||
});
|
||||
setModelOptions(localModelOptions);
|
||||
}, 1000);
|
||||
}
|
||||
if (data.group === '') {
|
||||
data.groups = [];
|
||||
|
Loading…
Reference in New Issue
Block a user