Adding a custom OpenAI endpoint

This commit is contained in:
Gil Zhang 2024-12-17 12:07:15 +08:00
parent 713c58bfbb
commit 9ff2b6895e

View file

@ -9,8 +9,10 @@ public class ProviderHelper
{
var settingsService = services.GetRequiredService<ILlmProviderService>();
var settings = settingsService.GetSetting(provider, model);
var client = new OpenAIClient(new ApiKeyCredential(settings.ApiKey));
return client;
var options = string.IsNullOrEmpty(settings.Endpoint)
? null
: new OpenAIClientOptions { Endpoint = new Uri(settings.Endpoint) };
return new OpenAIClient(new ApiKeyCredential(settings.ApiKey), options);
}
public static List<RoleDialogModel> GetChatSamples(List<string> lines)