mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-08 07:03:42 +08:00
feat: 完善模型价格页面
This commit is contained in:
@@ -35,27 +35,18 @@ func GetPricing(user *User, openAIModels []dto.OpenAIModels) []dto.ModelPricing
|
||||
}
|
||||
|
||||
func updatePricing(openAIModels []dto.OpenAIModels) {
|
||||
modelRatios := common.GetModelRatios()
|
||||
//modelRatios := common.GetModelRatios()
|
||||
enabledModels := GetEnabledModels()
|
||||
allModels := make(map[string]string)
|
||||
for _, openAIModel := range openAIModels {
|
||||
if common.StringsContains(enabledModels, openAIModel.Id) {
|
||||
allModels[openAIModel.Id] = openAIModel.OwnedBy
|
||||
}
|
||||
}
|
||||
for model, _ := range modelRatios {
|
||||
if common.StringsContains(enabledModels, model) {
|
||||
if _, ok := allModels[model]; !ok {
|
||||
allModels[model] = "custom"
|
||||
}
|
||||
}
|
||||
allModels := make(map[string]int)
|
||||
for i, model := range enabledModels {
|
||||
allModels[model] = i
|
||||
}
|
||||
|
||||
pricingMap = make([]dto.ModelPricing, 0)
|
||||
for model, ownerBy := range allModels {
|
||||
for model, _ := range allModels {
|
||||
pricing := dto.ModelPricing{
|
||||
Available: true,
|
||||
ModelName: model,
|
||||
OwnerBy: ownerBy,
|
||||
}
|
||||
modelPrice, findPrice := common.GetModelPrice(model, false)
|
||||
if findPrice {
|
||||
|
||||
Reference in New Issue
Block a user