feat(models): 模型目录与计费 - 按展示名分组并隔离管理员积分成本

This commit is contained in:
ddCat committed 2026-09-19 09:54:27 +08:00
1 parent 5ad05efb58
commit 237f2e2a6e
49 files changed
+802 -276

No files matched your search

+9 -1
View File
@@ -1203,7 +1203,15 @@ func (s *Service) switchTaskToNextRoute(task *model.Task, attempts []model.Route
replacement.Model = logicalModel.Code
}
previousRouteID := task.RouteID
if err := s.repo.SwitchTaskLogicalRoute(task.ID, previousRouteID, selected.Route.ID, string(encoded), task.BillingOrderID, selected.ChannelModel.ChannelID, selected.ChannelModel.ID, replacement); err != nil {
var costOrder model.BillingOrder
if replacement != nil {
costOrder.BillingCostSnapshot = replacement.BillingCostSnapshot
} else if task.BillingOrderID != "" {
config, _ := nextInput["config"].(map[string]any)
capability := selected.ChannelModel.Capability
snapshotCreditCost(&costOrder, channelModelPriceTierForIntent(selected.ChannelModel, intent), billingQuantity(capability, config["videoSeconds"]), estimateTaskBillingTokens(nextInput, capability))
}
if err := s.repo.SwitchTaskLogicalRoute(task.ID, previousRouteID, selected.Route.ID, string(encoded), task.BillingOrderID, selected.ChannelModel.ChannelID, selected.ChannelModel.ID, replacement, costOrder.BillingCostSnapshot); err != nil {
if errors.Is(err, repository.ErrInsufficientCredits) {
return nil, BadAuthRequest("模型服务价格发生变化,当前积分余额不足")
}