mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-11-23 09:30:21 +00:00
Fixed profile null / default checks
This commit is contained in:
parent
8bb7549c39
commit
73a2f3f028
@ -85,7 +85,7 @@ public partial class AssistantMyTasks : AssistantBaseCore<SettingsDialogMyTasks>
|
||||
|
||||
private string? ValidateProfile(Profile profile)
|
||||
{
|
||||
if(profile == default || profile == Profile.NO_PROFILE)
|
||||
if(profile == Profile.NO_PROFILE)
|
||||
return T("Please select one of your profiles.");
|
||||
|
||||
return null;
|
||||
|
||||
@ -801,11 +801,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
||||
|
||||
// Try to select the profile:
|
||||
if (!string.IsNullOrWhiteSpace(chatProfile))
|
||||
{
|
||||
this.currentProfile = this.SettingsManager.ConfigurationData.Profiles.FirstOrDefault(x => x.Id == chatProfile);
|
||||
if(this.currentProfile == default)
|
||||
this.currentProfile = Profile.NO_PROFILE;
|
||||
}
|
||||
this.currentProfile = this.SettingsManager.ConfigurationData.Profiles.FirstOrDefault(x => x.Id == chatProfile) ?? Profile.NO_PROFILE;
|
||||
|
||||
// Try to select the chat template:
|
||||
if (!string.IsNullOrWhiteSpace(chatChatTemplate))
|
||||
|
||||
@ -260,11 +260,11 @@ public sealed class SettingsManager
|
||||
public Profile GetPreselectedProfile(Tools.Components component)
|
||||
{
|
||||
var preselection = component.PreselectedProfile(this);
|
||||
if (preselection != default)
|
||||
if (preselection != Profile.NO_PROFILE)
|
||||
return preselection;
|
||||
|
||||
preselection = this.ConfigurationData.Profiles.FirstOrDefault(x => x.Id == this.ConfigurationData.App.PreselectedProfile);
|
||||
return preselection != default ? preselection : Profile.NO_PROFILE;
|
||||
return preselection ?? Profile.NO_PROFILE;
|
||||
}
|
||||
|
||||
public ChatTemplate GetPreselectedChatTemplate(Tools.Components component)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user