Skip to content

Commit

Permalink
Fixed unsorted AI models list (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpeyr committed Jan 14, 2024
1 parent a5ab8b7 commit ea9cc51
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ColorPicker/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,10 @@ private async void RefreshModelsBtn_Click(object sender, RoutedEventArgs e)
OpenAIService sdk = new(new() { ApiKey = Global.Settings.ApiKey });
var modelList = await sdk.Models.ListModel();

Global.Settings.SupportedModels = modelList.Models.Select(m => m.Id).Where(m => m.StartsWith("gpt")).ToArray();
var sortedModels = modelList.Models.Select(m => m.Id).Where(m => m.StartsWith("gpt")).ToList();
sortedModels.Sort();

Global.Settings.SupportedModels = sortedModels.ToArray();
XmlSerializerManager.SaveToXml(Global.Settings, Global.SettingsPath);

ModelComboBox.Items.Clear();
Expand Down

0 comments on commit ea9cc51

Please sign in to comment.