fix(models): 模型规格价格 - 修复主线兼容与参考图 SKU 匹配

This commit is contained in:
ddCat committed 2026-08-22 17:28:22 +08:00
1 parent c5e2312968
commit f4b62b8e11
9 files changed
+112 -46

No files matched your search

+12 -7
View File
@@ -825,14 +825,19 @@ func (s *Service) resolveProviderConfig(config providerConfig) (providerConfig,
modelKey = requestedModel
}
if modelKey == "" {
models := channelModelNames(*channel)
if len(models) == 0 {
return providerConfig{}, errors.New("系统渠道未配置可用模型")
channelModels, listErr := s.repo.ChannelModels(channel.ID, false)
if listErr != nil {
return providerConfig{}, listErr
}
if len(channelModels) > 0 {
modelKey = channelModels[0].ModelKey
} else {
models := channelModelNames(*channel)
if len(models) == 0 {
return providerConfig{}, errors.New("系统渠道未配置可用模型")
}
modelKey = models[0]
}
modelKey = models[0]
}
if !stringInSlice(modelKey, channelModelNames(*channel)) {
return providerConfig{}, errors.New("当前系统渠道未授权该模型")
}
if _, err := s.validateChannelOutboundURL(channel.BaseURL, channel.AllowLocalChannel, false); err != nil {
return providerConfig{}, err