fix: 修正模型名称规范化逻辑由去除后缀改为处理 yi- 前缀

This commit is contained in:
ccnetcore
2025-12-27 23:44:45 +08:00
parent 184467e482
commit 90c6022839

View File

@@ -94,12 +94,10 @@ public class AiGateWayManager : DomainService
} }
// ✅ 统一处理 -nx 后缀(网关层模型规范化) // ✅ 统一处理 -nx 后缀(网关层模型规范化)
if (!string.IsNullOrEmpty(aiModelDescribe.ModelId) && if (!string.IsNullOrEmpty(aiModelDescribe.ModelId) &&
aiModelDescribe.ModelId.EndsWith("-nx", StringComparison.OrdinalIgnoreCase)) aiModelDescribe.ModelId.StartsWith("yi-", StringComparison.OrdinalIgnoreCase))
{ {
aiModelDescribe.ModelId = aiModelDescribe.ModelId[..^3]; aiModelDescribe.ModelId = aiModelDescribe.ModelId[^3..];
} }
return aiModelDescribe; return aiModelDescribe;
} }
@@ -585,9 +583,9 @@ public class AiGateWayManager : DomainService
LazyServiceProvider.GetRequiredKeyedService<IAnthropicChatCompletionService>(modelDescribe.HandlerName); LazyServiceProvider.GetRequiredKeyedService<IAnthropicChatCompletionService>(modelDescribe.HandlerName);
if (!string.IsNullOrEmpty(request.Model) && if (!string.IsNullOrEmpty(request.Model) &&
request.Model.EndsWith("-nx", StringComparison.OrdinalIgnoreCase)) request.Model.StartsWith("yi-", StringComparison.OrdinalIgnoreCase))
{ {
request.Model = request.Model[..^3]; request.Model = request.Model[^3..];
} }
var completeChatResponse = chatService.StreamChatCompletionsAsync(modelDescribe, request, cancellationToken); var completeChatResponse = chatService.StreamChatCompletionsAsync(modelDescribe, request, cancellationToken);