fix: Claude模型请求前纠正 yi- 前缀处理顺序
在调用 Anthropic ChatCompletion 之前统一去除 yi- 模型前缀,避免传递错误的 model 参数导致请求异常
This commit is contained in:
@@ -515,14 +515,16 @@ public class AiGateWayManager : DomainService
|
||||
// 设置响应头,声明是 json
|
||||
//response.ContentType = "application/json; charset=UTF-8";
|
||||
var modelDescribe = await GetModelAsync(ModelApiTypeEnum.Claude, request.Model);
|
||||
var chatService =
|
||||
LazyServiceProvider.GetRequiredKeyedService<IAnthropicChatCompletionService>(modelDescribe.HandlerName);
|
||||
var data = await chatService.ChatCompletionsAsync(modelDescribe, request, cancellationToken);
|
||||
if (!string.IsNullOrEmpty(request.Model) &&
|
||||
request.Model.StartsWith("yi-", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
request.Model = request.Model[3..];
|
||||
}
|
||||
|
||||
var chatService =
|
||||
LazyServiceProvider.GetRequiredKeyedService<IAnthropicChatCompletionService>(modelDescribe.HandlerName);
|
||||
var data = await chatService.ChatCompletionsAsync(modelDescribe, request, cancellationToken);
|
||||
|
||||
data.SupplementalMultiplier(modelDescribe.Multiplier);
|
||||
|
||||
if (userId is not null)
|
||||
|
||||
Reference in New Issue
Block a user