🔖 chore: Remove invalid code

This commit is contained in:
MartialBE
2024-05-29 04:38:56 +08:00
parent b5a4283b28
commit 021f8c65da
43 changed files with 46 additions and 341 deletions

View File

@@ -90,7 +90,7 @@ func fetchChannel(c *gin.Context, modelName string) (channel *model.Channel, fai
}
func fetchChannelById(channelId int) (*model.Channel, error) {
channel, err := model.GetChannelById(channelId, true)
channel, err := model.GetChannelById(channelId)
if err != nil {
return nil, errors.New("无效的渠道 Id")
}

View File

@@ -4,12 +4,10 @@ import (
"crypto/md5"
"encoding/hex"
"fmt"
"github.com/gin-gonic/gin"
"one-api/common"
"one-api/common/config"
"one-api/common/utils"
"one-api/model"
"github.com/gin-gonic/gin"
)
type ChatCacheProps struct {
@@ -31,24 +29,6 @@ type CacheDriver interface {
Set(hash string, props *ChatCacheProps, expire int64) error
}
func GetDebugList(userId int) ([]*ChatCacheProps, error) {
caches, err := model.GetChatCacheListByUserId(userId)
if err != nil {
return nil, err
}
var props []*ChatCacheProps
for _, cache := range caches {
prop, err := utils.UnmarshalString[ChatCacheProps](cache.Data)
if err != nil {
continue
}
props = append(props, &prop)
}
return props, nil
}
func NewChatCacheProps(c *gin.Context, allow bool) *ChatCacheProps {
props := &ChatCacheProps{
Cache: false,

View File

@@ -99,7 +99,7 @@ func (q *Quota) completedQuotaConsumption(usage *types.Usage, tokenName string,
quota = int(1000 * q.inputRatio)
} else {
completionRatio := q.price.GetOutput() * q.groupRatio
quota = int(math.Ceil(((float64(promptTokens) * q.inputRatio) + (float64(completionTokens) * completionRatio))))
quota = int(math.Ceil((float64(promptTokens) * q.inputRatio) + (float64(completionTokens) * completionRatio)))
}
if q.inputRatio != 0 && quota <= 0 {