feat: 完成ai网关改造
This commit is contained in:
@@ -25,7 +25,10 @@ public class AzureChatService : IChatService
|
||||
new AzureKeyCredential(apiKey));
|
||||
ChatClient chatClient = azureClient.GetChatClient(deploymentName);
|
||||
|
||||
var response = chatClient.CompleteChatStreamingAsync(messages, cancellationToken: cancellationToken);
|
||||
var response = chatClient.CompleteChatStreamingAsync(messages, new ChatCompletionOptions()
|
||||
{
|
||||
MaxOutputTokenCount = 2048
|
||||
}, cancellationToken: cancellationToken);
|
||||
|
||||
await foreach (StreamingChatCompletionUpdate update in response)
|
||||
{
|
||||
|
||||
@@ -19,14 +19,6 @@ public class AzureRestChatService : IChatService
|
||||
{
|
||||
// 设置API URL
|
||||
var apiUrl = $"{aiModelDescribe.Endpoint}models/chat/completions";
|
||||
|
||||
|
||||
var ss = messages.Select(x => new
|
||||
{
|
||||
role = x.GetRoleAsString(),
|
||||
content = x.Content.FirstOrDefault()?.Text
|
||||
}).ToList();
|
||||
|
||||
// 准备请求内容
|
||||
var requestBody = new
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user