wired up the preconfigured settings with the assistant builder by overwriting MightPreselectValues

This commit is contained in:
Nils Kruthoff 2026-08-10 17:24:12 +02:00
parent 7ec8859855
commit 2d23198933
No known key found for this signature in database
GPG Key ID: A5C0151B4DDB172C
2 changed files with 24 additions and 7 deletions

View File

@ -1,7 +1,7 @@
@attribute [Route(Routes.ASSISTANT_META_ASSISTANT)]
@using AIStudio.Agents.AssistantAudit
@using AIStudio.Tools.PluginSystem.Assistants.DataModel
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.NoSettingsPanel>
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogAssistantBuilder>
<PreviewBeta ApplyInnerScrollingFix="true"/>

View File

@ -11,7 +11,7 @@ using DialogOptions = AIStudio.Dialogs.DialogOptions;
namespace AIStudio.Assistants.Builder;
public partial class AssistantBuilder : AssistantBaseCore<NoSettingsPanel>
public partial class AssistantBuilder : AssistantBaseCore<SettingsDialogAssistantBuilder>
{
[Inject]
private IDialogService DialogService { get; init; } = null!;
@ -64,7 +64,6 @@ public partial class AssistantBuilder : AssistantBaseCore<NoSettingsPanel>
protected override bool ShowProfileSelection => false;
protected override bool ShowCopyResult => this.step is BuilderStep.DONE;
protected override bool HasSettingsPanel => false;
protected override Func<string> Result2Copy => () => !string.IsNullOrWhiteSpace(this.generatedLuaAssistant)
? this.generatedLuaAssistant
: this.generatedAssistantSpec;
@ -209,9 +208,7 @@ public partial class AssistantBuilder : AssistantBaseCore<NoSettingsPanel>
this.typicalInput = string.Empty;
this.expectedOutput = string.Empty;
this.selectedAssistantComponents = [];
this.selectedOutputLanguage = CommonLanguages.AS_IS;
this.customOutputLanguage = string.Empty;
this.allowGeneratedAssistantProfiles = true;
this.ApplyDefaultBuilderOptions();
this.extraRules = string.Empty;
this.exampleRequest = string.Empty;
this.generatedAssistantSpec = string.Empty;
@ -220,7 +217,27 @@ public partial class AssistantBuilder : AssistantBaseCore<NoSettingsPanel>
this.ResetInstallFlow();
}
protected override bool MightPreselectValues() => false;
protected override bool MightPreselectValues()
{
this.ApplyDefaultBuilderOptions();
return true;
}
private void ApplyDefaultBuilderOptions()
{
var defaults = this.SettingsManager.ConfigurationData.AssistantBuilder;
if (!defaults.PreselectOptions)
{
this.selectedOutputLanguage = CommonLanguages.AS_IS;
this.customOutputLanguage = string.Empty;
this.allowGeneratedAssistantProfiles = true;
return;
}
this.selectedOutputLanguage = defaults.PreselectedOutputLanguage;
this.customOutputLanguage = defaults.PreselectedOtherOutputLanguage;
this.allowGeneratedAssistantProfiles = true;
}
/// <inheritdoc />
protected override void CaptureCustomAssistantSessionState(AssistantSessionStateWriter state)