feat: 修改超时,改成10分钟
This commit is contained in:
@@ -23,12 +23,16 @@ public class AzureChatService : IChatService
|
||||
|
||||
AzureOpenAIClient azureClient = new(
|
||||
endpoint,
|
||||
new AzureKeyCredential(apiKey));
|
||||
new AzureKeyCredential(apiKey), new AzureOpenAIClientOptions()
|
||||
{
|
||||
NetworkTimeout = TimeSpan.FromSeconds(600),
|
||||
});
|
||||
|
||||
ChatClient chatClient = azureClient.GetChatClient(deploymentName);
|
||||
|
||||
var response = chatClient.CompleteChatStreamingAsync(messages, new ChatCompletionOptions()
|
||||
{
|
||||
// MaxOutputTokenCount = 2048
|
||||
// MaxOutputTokenCount = 2048
|
||||
}, cancellationToken: cancellationToken);
|
||||
|
||||
await foreach (StreamingChatCompletionUpdate update in response)
|
||||
|
||||
@@ -41,7 +41,11 @@ public class AzureRestChatService : IChatService
|
||||
// 序列化请求内容为JSON
|
||||
string jsonBody = JsonConvert.SerializeObject(requestBody);
|
||||
|
||||
using var httpClient = new HttpClient();
|
||||
using var httpClient = new HttpClient()
|
||||
{
|
||||
//10分钟超时
|
||||
Timeout = TimeSpan.FromSeconds(600)
|
||||
};
|
||||
// 设置请求头
|
||||
httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {aiModelDescribe.ApiKey}");
|
||||
// 其他头信息如Content-Type在StringContent中设置
|
||||
|
||||
Reference in New Issue
Block a user