enhance: add Content-Type to OpenAI request headers

This commit is contained in:
leo 2024-09-13 20:50:11 +08:00
parent ab54ecee42
commit 817f8919fd
No known key found for this signature in database

View file

@ -105,6 +105,7 @@ namespace SourceGit.Models
chat.AddMessage("user", question);
var client = new HttpClient() { Timeout = TimeSpan.FromSeconds(60) };
client.DefaultRequestHeaders.Add("Content-Type", "application/json");
if (!string.IsNullOrEmpty(ApiKey))
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}");