mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-09-27 04:33:38 +00:00
Align the prompt refinement action with the assistant button pattern
This commit is contained in:
parent
f94af9c07d
commit
002fc28fe8
@ -104,10 +104,11 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
|
||||
new ButtonData
|
||||
{
|
||||
Text = T("Improve further"),
|
||||
Tooltip = T("Moves the optimized prompt into the prompt field so you can optimize it again."),
|
||||
Icon = Icons.Material.Filled.Input,
|
||||
Color = Color.Default,
|
||||
AsyncAction = this.UseOptimizedPromptAsInput,
|
||||
DisabledActionParam = () => string.IsNullOrWhiteSpace(this.optimizedPrompt),
|
||||
DisabledActionParam = () => !this.CanImproveFurther,
|
||||
},
|
||||
new SendToButton
|
||||
{
|
||||
@ -253,6 +254,7 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
|
||||
|
||||
private bool ShowUpdatedPromptGuidelinesIndicator => !this.useCustomPromptGuide && this.hasUpdatedDefaultRecommendations;
|
||||
private bool CanPreviewCustomPromptGuide => this.useCustomPromptGuide && this.customPromptGuideFiles.Count > 0;
|
||||
private bool CanImproveFurther => !this.IsProcessing && !string.IsNullOrWhiteSpace(this.optimizedPrompt);
|
||||
private string CustomPromptGuideFileName => this.customPromptGuideFiles.Count switch
|
||||
{
|
||||
0 => T("No file selected"),
|
||||
@ -472,9 +474,18 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
|
||||
this.optimizedPrompt = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the optimized prompt into the input field so the user can optimize it once more.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The finished run is dropped along the way. Keeping it would append the next optimization to
|
||||
/// the chat thread of the previous one, and the earlier proposal would stay on screen next to
|
||||
/// the prompt it was already turned into. The recommendations and every selection stay as they
|
||||
/// are, though: they are what the user works with while refining the prompt.
|
||||
/// </remarks>
|
||||
private Task UseOptimizedPromptAsInput()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(this.optimizedPrompt))
|
||||
if (!this.CanImproveFurther)
|
||||
return Task.CompletedTask;
|
||||
|
||||
this.inputPrompt = this.optimizedPrompt;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user