You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The SSL connection could not be established, see inner exception.
I'm using .NET Core 8 and encountering an issue when calling the ChatGPT-4 API through a WebAPI. The WebAPI does not use SSL, and its local address is http://localhost:5273/. It was working initially, but then the error started occurring.
[HttpPost("AIChat")]
public async Task AIChat([FromBody] ChatGPT_Request request)
{
try
{
OpenAIAPI api = new OpenAIAPI(_openAIOption.APIKey);
//api.HttpClientFactory = _httpClientFactory;
var chat = api.Chat.CreateConversation();
chat.Model = OpenAI_API.Models.Model.GPT4;
chat.RequestParameters.Temperature = 0.7;
chat.RequestParameters.MaxTokens = 2000;
foreach (var message in request.messages)
{
if (message.role == "user")
chat.AppendUserInput(message.content, ImageArrayToImageListArray(message.images));
if (message.role == "assistant")
chat.AppendMessage(new ChatMessage(ChatMessageRole.Assistant, message.content));
if (message.role == "system")
chat.AppendMessage(new ChatMessage(ChatMessageRole.System, message.content));
}
await foreach (var res in chat.StreamResponseEnumerableFromChatbotAsync())
{
if (isfirst)
{
isfirst = false;
var p1Tag = Encoding.UTF8.GetBytes("<p>");
await Response.Body.WriteAsync(p1Tag, 0, p1Tag.Length);
//await Response.Body.FlushAsync();
}
Console.WriteLine($"{res}");
}
catch (Exception ex)
{
Console.WriteLine($"Message: {ex.Message}");
await Response.Body.WriteAsync(Encoding.UTF8.GetBytes(ex.Message));
//await Response.Body.FlushAsync();
}
}
The text was updated successfully, but these errors were encountered:
The SSL connection could not be established, see inner exception.
I'm using .NET Core 8 and encountering an issue when calling the ChatGPT-4 API through a WebAPI. The WebAPI does not use SSL, and its local address is http://localhost:5273/. It was working initially, but then the error started occurring.
[HttpPost("AIChat")]
public async Task AIChat([FromBody] ChatGPT_Request request)
{
try
{
OpenAIAPI api = new OpenAIAPI(_openAIOption.APIKey);
//api.HttpClientFactory = _httpClientFactory;
}
The text was updated successfully, but these errors were encountered: