From 2932c87d96fe341757c197c213b9b3d8761d19e9 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Thu, 12 Sep 2024 22:50:53 +0200 Subject: [PATCH] Allow the selection of today introduced `o1` models --- app/MindWork AI Studio/Provider/OpenAI/ProviderOpenAI.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/MindWork AI Studio/Provider/OpenAI/ProviderOpenAI.cs b/app/MindWork AI Studio/Provider/OpenAI/ProviderOpenAI.cs index 70b80f2e..3ca5ac0e 100644 --- a/app/MindWork AI Studio/Provider/OpenAI/ProviderOpenAI.cs +++ b/app/MindWork AI Studio/Provider/OpenAI/ProviderOpenAI.cs @@ -153,18 +153,18 @@ public sealed class ProviderOpenAI(ILogger logger) : BaseProvider("https://api.o /// public Task> GetTextModels(string? apiKeyProvisional = null, CancellationToken token = default) { - return this.LoadModels("gpt-", token, apiKeyProvisional); + return this.LoadModels(["gpt-", "o1-"], token, apiKeyProvisional); } /// public Task> GetImageModels(string? apiKeyProvisional = null, CancellationToken token = default) { - return this.LoadModels("dall-e-", token, apiKeyProvisional); + return this.LoadModels(["dall-e-"], token, apiKeyProvisional); } #endregion - private async Task> LoadModels(string prefix, CancellationToken token, string? apiKeyProvisional = null) + private async Task> LoadModels(string[] prefixes, CancellationToken token, string? apiKeyProvisional = null) { var secretKey = apiKeyProvisional switch { @@ -187,6 +187,6 @@ public sealed class ProviderOpenAI(ILogger logger) : BaseProvider("https://api.o return []; var modelResponse = await response.Content.ReadFromJsonAsync(token); - return modelResponse.Data.Where(n => n.Id.StartsWith(prefix, StringComparison.InvariantCulture)); + return modelResponse.Data.Where(model => prefixes.Any(prefix => model.Id.StartsWith(prefix, StringComparison.InvariantCulture))); } } \ No newline at end of file