Working on it

This commit is contained in:
Peer Schütt 2026-03-23 09:40:39 +01:00
parent b69fa215f8
commit 5e9575e926
3 changed files with 24 additions and 9 deletions

View File

@ -38,7 +38,7 @@
</CascadingValue> </CascadingValue>
<MudStack Row="true" AlignItems="AlignItems.Center" StretchItems="StretchItems.Start" Class="mb-3"> <MudStack Row="true" AlignItems="AlignItems.Center" StretchItems="StretchItems.Start" Class="mb-3">
<MudButton Disabled="@this.SubmitDisabled" Variant="Variant.Filled" OnClick="@(async () => await this.Start())" Style="@this.SubmitButtonStyle"> <MudButton Disabled="@(this.SubmitDisabled || this.isProcessing)" Variant="Variant.Filled" OnClick="@(async () => await this.Start())" Style="@this.SubmitButtonStyle">
@this.SubmitText @this.SubmitText
</MudButton> </MudButton>
@if (this.isProcessing && this.cancellationTokenSource is not null) @if (this.isProcessing && this.cancellationTokenSource is not null)

View File

@ -39,17 +39,20 @@
<MudStack Row="true" AlignItems="AlignItems.Center" Class="mb-2"> <MudStack Row="true" AlignItems="AlignItems.Center" Class="mb-2">
<MudText Typo="Typo.h6">@T("Prompt Recommendations")</MudText> <MudText Typo="Typo.h6">@T("Prompt Recommendations")</MudText>
</MudStack>
@if (this.ShowUpdatedPromptGuidelinesIndicator) @if (this.ShowUpdatedPromptGuidelinesIndicator)
{ {
<MudTooltip Text="@T("Prompt recommendations updated from your latest optimization.")"> <MudAlert Severity="Severity.Info" Dense="true" Variant="Variant.Outlined" Class="mb-3">
<MudIcon Icon="@Icons.Material.Filled.AutoFixHigh" Color="Color.Info" Size="Size.Medium" Class="ml-2"/> <MudStack Row="true" AlignItems="AlignItems.Center" Wrap="Wrap.Wrap">
</MudTooltip> <MudText Typo="Typo.body2">@T("Prompt recommendations were updated based on your latest optimization.")</MudText>
}
</MudStack> </MudStack>
</MudAlert>
}
@if (!this.useCustomPromptGuide) @if (!this.useCustomPromptGuide)
{ {
<MudJustifiedText Class="mb-3">@T("Use these recommendations, that are based on our own prompt guide, to improve the clarity, directness, and relevance of your prompts. The suggestions are updated based on your latest prompt optimization.")</MudJustifiedText> <MudJustifiedText Class="mb-3">@T("Use these recommendations, that are based on the default prompt guide, to improve the clarity, directness, and relevance of your prompts. The suggestions are updated based on your latest prompt optimization.")</MudJustifiedText>
<MudGrid Class="mb-3"> <MudGrid Class="mb-3">
<MudItem xs="12" sm="6" md="4"> <MudItem xs="12" sm="6" md="4">
@ -73,6 +76,11 @@
</MudGrid> </MudGrid>
} }
@if (this.useCustomPromptGuide)
{
<MudJustifiedText Class="mb-3">@T("Use the prompt recommendations from the custom prompt guide that was provided by the user.")</MudJustifiedText>
}
<MudStack Row="true" AlignItems="AlignItems.Center" Wrap="Wrap.Wrap" StretchItems="StretchItems.None" Class="mb-3"> <MudStack Row="true" AlignItems="AlignItems.Center" Wrap="Wrap.Wrap" StretchItems="StretchItems.None" Class="mb-3">
<MudButton Variant="Variant.Outlined" <MudButton Variant="Variant.Outlined"
StartIcon="@Icons.Material.Filled.MenuBook" StartIcon="@Icons.Material.Filled.MenuBook"

View File

@ -62,6 +62,8 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
protected override Func<Task> SubmitAction => this.OptimizePromptAsync; protected override Func<Task> SubmitAction => this.OptimizePromptAsync;
protected override bool SubmitDisabled => this.useCustomPromptGuide && this.customPromptGuideFiles.Count == 0;
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{ {
SystemPrompt = SystemPrompts.DEFAULT, SystemPrompt = SystemPrompts.DEFAULT,
@ -197,7 +199,7 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
if (!this.useCustomPromptGuide) if (!this.useCustomPromptGuide)
{ {
this.ApplyFallbackRecommendations(); this.ApplyFallbackRecommendations();
this.hasUpdatedDefaultRecommendations = true; this.MarkRecommendationsUpdated();
} }
this.AddInputIssue(T("The model response was not in the expected JSON format. The raw response is shown as optimized prompt.")); this.AddInputIssue(T("The model response was not in the expected JSON format. The raw response is shown as optimized prompt."));
@ -319,6 +321,11 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
return; return;
this.ApplyRecommendations(optimizationResult.Recommendations); this.ApplyRecommendations(optimizationResult.Recommendations);
this.MarkRecommendationsUpdated();
}
private void MarkRecommendationsUpdated()
{
this.hasUpdatedDefaultRecommendations = true; this.hasUpdatedDefaultRecommendations = true;
} }