mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-18 00:38:00 +00:00
Added explicit profile behavior choices (#696)
Build and Release / Read metadata (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Prepare & create release (push) Has been cancelled
Build and Release / Publish release (push) Has been cancelled
Build and Release / Read metadata (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Prepare & create release (push) Has been cancelled
Build and Release / Publish release (push) Has been cancelled
This commit is contained in:
1 parent
24e72de9a2
commit
4a8348b9df
16 files changed
+155
-50
No files matched your search
@@ -1,5 +1,6 @@
|
||||
@attribute [Route(Routes.ASSISTANT_DOCUMENT_ANALYSIS)]
|
||||
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.NoSettingsPanel>
|
||||
@using AIStudio.Settings
|
||||
@using AIStudio.Settings.DataModel
|
||||
|
||||
<PreviewBeta ApplyInnerScrollingFix="true"/>
|
||||
@@ -108,7 +109,7 @@ else
|
||||
|
||||
<ConfigurationProviderSelection Component="Components.DOCUMENT_ANALYSIS_ASSISTANT" Data="@this.availableLLMProviders" Disabled="@(() => this.IsNoPolicySelectedOrProtected)" SelectedValue="@(() => this.policyPreselectedProviderId)" SelectionUpdate="@(providerId => this.PolicyPreselectedProviderWasChanged(providerId))" ExplicitMinimumConfidence="@this.GetPolicyMinimumConfidenceLevel()"/>
|
||||
|
||||
<ProfileFormSelection Disabled="@this.IsNoPolicySelected" Profile="@this.currentProfile" ProfileChanged="@this.PolicyPreselectedProfileWasChangedAsync" />
|
||||
<ConfigurationSelect OptionDescription="@T("Preselect a profile behavior")" Disabled="@(() => this.IsNoPolicySelected)" SelectedValue="@(() => this.policyPreselectedProfile)" Data="@ConfigurationSelectDataFactory.GetComponentProfilesData(this.SettingsManager.ConfigurationData.Profiles)" SelectionUpdateAsync="@(async selection => await this.PolicyPreselectedProfileWasChangedAsync(selection))" OptionHelp="@T("Choose whether the policy should use the app default profile, no profile, or a specific profile.")"/>
|
||||
|
||||
<MudTextSwitch Disabled="@(this.IsNoPolicySelected || (this.selectedPolicy?.IsEnterpriseConfiguration ?? true))" Label="@T("Would you like to protect this policy so that you cannot accidentally edit or delete it?")" Value="@this.policyIsProtected" ValueChanged="async state => await this.PolicyProtectionWasChanged(state)" LabelOn="@T("Yes, protect this policy")" LabelOff="@T("No, the policy can be edited")" />
|
||||
|
||||
|
||||
+18
-11
@@ -176,7 +176,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
this.policyOutputRules = string.Empty;
|
||||
this.policyMinimumProviderConfidence = ConfidenceLevel.NONE;
|
||||
this.policyPreselectedProviderId = string.Empty;
|
||||
this.policyPreselectedProfileId = Profile.NO_PROFILE.Id;
|
||||
this.policyPreselectedProfile = ProfilePreselection.NoProfile;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
this.policyOutputRules = this.selectedPolicy.OutputRules;
|
||||
this.policyMinimumProviderConfidence = this.selectedPolicy.MinimumProviderConfidence;
|
||||
this.policyPreselectedProviderId = this.selectedPolicy.PreselectedProvider;
|
||||
this.policyPreselectedProfileId = string.IsNullOrWhiteSpace(this.selectedPolicy.PreselectedProfile) ? Profile.NO_PROFILE.Id : this.selectedPolicy.PreselectedProfile;
|
||||
this.policyPreselectedProfile = ProfilePreselection.FromStoredValue(this.selectedPolicy.PreselectedProfile);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
return;
|
||||
|
||||
// The preselected profile is always user-adjustable, even for protected policies and enterprise configurations:
|
||||
this.selectedPolicy.PreselectedProfile = this.policyPreselectedProfileId;
|
||||
this.selectedPolicy.PreselectedProfile = this.policyPreselectedProfile;
|
||||
|
||||
// Enterprise configurations cannot be modified at all:
|
||||
if(this.selectedPolicy.IsEnterpriseConfiguration)
|
||||
@@ -274,7 +274,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
private string policyOutputRules = string.Empty;
|
||||
private ConfidenceLevel policyMinimumProviderConfidence = ConfidenceLevel.NONE;
|
||||
private string policyPreselectedProviderId = string.Empty;
|
||||
private string policyPreselectedProfileId = Profile.NO_PROFILE.Id;
|
||||
private ProfilePreselection policyPreselectedProfile = ProfilePreselection.NoProfile;
|
||||
private HashSet<FileAttachment> loadedDocumentPaths = [];
|
||||
private readonly List<ConfigurationSelectData<string>> availableLLMProviders = new();
|
||||
|
||||
@@ -450,14 +450,21 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
|
||||
private Profile ResolveProfileSelection()
|
||||
{
|
||||
if (this.selectedPolicy is not null && !string.IsNullOrWhiteSpace(this.selectedPolicy.PreselectedProfile))
|
||||
if (this.selectedPolicy is null)
|
||||
return this.SettingsManager.GetPreselectedProfile(this.Component);
|
||||
|
||||
var policyProfilePreselection = ProfilePreselection.FromStoredValue(this.selectedPolicy.PreselectedProfile);
|
||||
if (policyProfilePreselection.DoNotPreselectProfile)
|
||||
return Profile.NO_PROFILE;
|
||||
|
||||
if (policyProfilePreselection.UseSpecificProfile)
|
||||
{
|
||||
var policyProfile = this.SettingsManager.ConfigurationData.Profiles.FirstOrDefault(x => x.Id == this.selectedPolicy.PreselectedProfile);
|
||||
var policyProfile = this.SettingsManager.ConfigurationData.Profiles.FirstOrDefault(x => x.Id == policyProfilePreselection.SpecificProfileId);
|
||||
if (policyProfile is not null)
|
||||
return policyProfile;
|
||||
}
|
||||
|
||||
return this.SettingsManager.GetPreselectedProfile(this.Component);
|
||||
return this.SettingsManager.GetAppPreselectedProfile();
|
||||
}
|
||||
|
||||
private async Task PolicyMinimumConfidenceWasChangedAsync(ConfidenceLevel level)
|
||||
@@ -479,11 +486,11 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
this.ApplyPolicyPreselection();
|
||||
}
|
||||
|
||||
private async Task PolicyPreselectedProfileWasChangedAsync(Profile profile)
|
||||
private async Task PolicyPreselectedProfileWasChangedAsync(ProfilePreselection selection)
|
||||
{
|
||||
this.policyPreselectedProfileId = profile.Id;
|
||||
this.policyPreselectedProfile = selection;
|
||||
if (this.selectedPolicy is not null)
|
||||
this.selectedPolicy.PreselectedProfile = this.policyPreselectedProfileId;
|
||||
this.selectedPolicy.PreselectedProfile = this.policyPreselectedProfile;
|
||||
|
||||
this.currentProfile = this.ResolveProfileSelection();
|
||||
await this.AutoSave();
|
||||
@@ -734,7 +741,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
return string.Empty;
|
||||
|
||||
var preselectedProvider = string.IsNullOrWhiteSpace(this.selectedPolicy.PreselectedProvider) ? string.Empty : this.selectedPolicy.PreselectedProvider;
|
||||
var preselectedProfile = string.IsNullOrWhiteSpace(this.selectedPolicy.PreselectedProfile) ? Profile.NO_PROFILE.Id : this.selectedPolicy.PreselectedProfile;
|
||||
var preselectedProfile = string.IsNullOrWhiteSpace(this.selectedPolicy.PreselectedProfile) ? string.Empty : this.selectedPolicy.PreselectedProfile;
|
||||
var id = string.IsNullOrWhiteSpace(this.selectedPolicy.Id) ? Guid.NewGuid().ToString() : this.selectedPolicy.Id;
|
||||
|
||||
return $$"""
|
||||
|
||||
Reference in new issue
Block a user