fix: 处理 Anthropic 模型名称带 -nx 后缀的情况
This commit is contained in:
@@ -584,6 +584,12 @@ public class AiGateWayManager : DomainService
|
|||||||
var chatService =
|
var chatService =
|
||||||
LazyServiceProvider.GetRequiredKeyedService<IAnthropicChatCompletionService>(modelDescribe.HandlerName);
|
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);
|
var completeChatResponse = chatService.StreamChatCompletionsAsync(modelDescribe, request, cancellationToken);
|
||||||
ThorUsageResponse? tokenUsage = null;
|
ThorUsageResponse? tokenUsage = null;
|
||||||
StringBuilder backupSystemContent = new StringBuilder();
|
StringBuilder backupSystemContent = new StringBuilder();
|
||||||
|
|||||||
Reference in New Issue
Block a user