fix(channel): 模型限制以原始请求模型检查定价列表,而非映射后模型

开启 restrict_models 时,应用原始模型名查定价列表;
定价列表未命中即拒绝,不因通配符映射而绕过限制。
This commit is contained in:
erio
2026-03-31 20:38:02 +08:00
parent 705131e172
commit dfe3fdc1cc

View File

@@ -429,8 +429,9 @@ func (s *ChannelService) ResolveChannelMappingAndRestrict(ctx context.Context, g
if groupID == nil {
return mapping, false
}
// 先用原始模型检查定价列表限制,再做映射
restricted := s.IsModelRestricted(ctx, *groupID, model)
mapping = s.ResolveChannelMapping(ctx, *groupID, model)
restricted := s.IsModelRestricted(ctx, *groupID, mapping.MappedModel)
return mapping, restricted
}