fix: 处理 Anthropic 模型名称带 -nx 后缀的情况

This commit is contained in:
ccnetcore
2025-12-27 23:21:49 +08:00
parent 68045d6458
commit 184467e482

View File

@@ -584,6 +584,12 @@ public class AiGateWayManager : DomainService
var chatService =
LazyServiceProvider.GetRequiredKeyedService<IAnthropicChatCompletionService>(modelDescribe.HandlerName);
if (!string.IsNullOrEmpty(request.Model) &&
request.Model.EndsWith("-nx", StringComparison.OrdinalIgnoreCase))
{
request.Model = request.Model[..^3];
}
var completeChatResponse = chatService.StreamChatCompletionsAsync(modelDescribe, request, cancellationToken);
ThorUsageResponse? tokenUsage = null;
StringBuilder backupSystemContent = new StringBuilder();