feat: 兼容deepseek协议
This commit is contained in:
@@ -3,6 +3,7 @@ using Volo.Abp.Domain;
|
||||
using Yi.Framework.AiHub.Domain.AiGateWay;
|
||||
using Yi.Framework.AiHub.Domain.AiGateWay.Impl.ThorAzureDatabricks.Chats;
|
||||
using Yi.Framework.AiHub.Domain.AiGateWay.Impl.ThorAzureOpenAI.Chats;
|
||||
using Yi.Framework.AiHub.Domain.AiGateWay.Impl.ThorDeepSeek.Chats;
|
||||
using Yi.Framework.AiHub.Domain.Shared;
|
||||
using Yi.Framework.Mapster;
|
||||
|
||||
@@ -25,6 +26,8 @@ namespace Yi.Framework.AiHub.Domain
|
||||
nameof(AzureOpenAiChatCompletionCompletionsService));
|
||||
services.AddKeyedTransient<IChatCompletionService, AzureDatabricksChatCompletionsService>(
|
||||
nameof(AzureDatabricksChatCompletionsService));
|
||||
services.AddKeyedTransient<IChatCompletionService, DeepSeekChatCompletionsService>(
|
||||
nameof(DeepSeekChatCompletionsService));
|
||||
|
||||
//ai模型特殊性兼容处理
|
||||
Configure<SpecialCompatibleOptions>(options =>
|
||||
@@ -36,6 +39,15 @@ namespace Yi.Framework.AiHub.Domain
|
||||
request.Temperature = null;
|
||||
}
|
||||
});
|
||||
options.Handles.Add(request =>
|
||||
{
|
||||
if (request.Model.StartsWith("o3-mini") || request.Model.StartsWith("o4-mini"))
|
||||
{
|
||||
request.MaxCompletionTokens = request.MaxTokens;
|
||||
request.MaxTokens = null;
|
||||
request.Temperature = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user