Added iterative prompt refinement action (#994)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
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, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions

Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
Peer HogeterpandThorsten Sommer authored and GitHub committed 2026-09-22 20:03:08 +02:00
1 parent ac0dc1e3d7
commit 146cf8380d
7 files changed
+65 -3

No files matched your search

@@ -753,9 +753,7 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
await this.AssistantSessionService.ClearAsync(this.assistantSessionKey);
this.MediaTranscriptionService.ClearOwnerState(this.CurrentMediaImportOwner);
this.assistantSessionId = null;
this.ChatThread = null;
this.LastUserPrompt = null;
this.ResultingContentBlock = null;
this.ClearConversationState();
this.ProviderSettings = Settings.Provider.NONE;
await this.JsRuntime.ClearDiv(BEFORE_RESULT_DIV_ID);
@@ -34,4 +34,18 @@ public abstract class AssistantLowerBase : MSGComponentBase
protected ContentBlock? ResultingContentBlock;
protected string[] InputIssues = [];
protected bool IsProcessing;
/// <summary>
/// Clears everything one assistant run has produced.
/// </summary>
/// <remarks>
/// Assistants call this whenever the previous run must not carry over: a follow-up run would
/// otherwise append to the old chat thread, and the old result would stay on screen.
/// </remarks>
protected void ClearConversationState()
{
this.ChatThread = null;
this.LastUserPrompt = null;
this.ResultingContentBlock = null;
}
}
@@ -2191,6 +2191,9 @@ UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER
-- View
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1582017048"] = "View"
-- Improve further
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1582753277"] = "Improve further"
-- Separate context, task, constraints, and output format with headings or markers.
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1626024580"] = "Separate context, task, constraints, and output format with headings or markers."
@@ -2287,6 +2290,9 @@ UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER
-- Use sequential steps
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T487578804"] = "Use sequential steps"
-- Moves the optimized prompt into the prompt field so you can optimize it again.
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T502438377"] = "Moves the optimized prompt into the prompt field so you can optimize it again."
-- Use clear, explicit instructions and directly state quality expectations.
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T596557540"] = "Use clear, explicit instructions and directly state quality expectations."
@@ -101,6 +101,15 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
protected override IReadOnlyList<IButtonData> FooterButtons =>
[
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 = () => !this.CanImproveFurther,
},
new SendToButton
{
Self = Tools.Components.PROMPT_OPTIMIZER_ASSISTANT,
@@ -245,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"),
@@ -464,6 +474,27 @@ 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 (!this.CanImproveFurther)
return Task.CompletedTask;
this.inputPrompt = this.optimizedPrompt;
this.ResetOutput();
this.ClearConversationState();
this.ClearInputIssues();
return Task.CompletedTask;
}
private void ResetGuidelineSummaryToDefault()
{
this.recClarityDirectness = T("Use clear, explicit instructions and directly state quality expectations.");