diff --git a/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs b/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs index 9aa01832..ae86f9d0 100644 --- a/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs +++ b/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs @@ -104,10 +104,11 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore string.IsNullOrWhiteSpace(this.optimizedPrompt), + DisabledActionParam = () => !this.CanImproveFurther, }, new SendToButton { @@ -253,6 +254,7 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore !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 + /// Moves the optimized prompt into the input field so the user can optimize it once more. + /// + /// + /// 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. + /// private Task UseOptimizedPromptAsInput() { - if (string.IsNullOrWhiteSpace(this.optimizedPrompt)) + if (!this.CanImproveFurther) return Task.CompletedTask; this.inputPrompt = this.optimizedPrompt;