From 3239c0393c0e5e3ccb0ff1bdcb1cfa6c9fb618a4 Mon Sep 17 00:00:00 2001 From: Peer Hogeterp <20603780+peerschuett@users.noreply.github.com> Date: Tue, 22 Sep 2026 16:03:26 +0200 Subject: [PATCH 1/5] Add iterative prompt refinement actio --- .../Assistants/I18N/allTexts.lua | 3 +++ .../AssistantPromptOptimizer.razor.cs | 22 +++++++++++++++++++ .../plugin.lua | 3 +++ .../plugin.lua | 3 +++ .../wwwroot/changelog/v26.9.1.md | 1 + 5 files changed, 32 insertions(+) diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua index d3ea7596c..d153e9d3b 100644 --- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua +++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua @@ -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." diff --git a/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs b/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs index 63238103e..11694b70a 100644 --- a/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs +++ b/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs @@ -101,6 +101,14 @@ Verify each recommendation states how to improve a future prompt version. protected override IReadOnlyList FooterButtons => [ + new ButtonData + { + Text = T("Improve further"), + Icon = Icons.Material.Filled.Input, + Color = Color.Default, + AsyncAction = this.UseOptimizedPromptAsInput, + DisabledActionParam = () => string.IsNullOrWhiteSpace(this.optimizedPrompt), + }, new SendToButton { Self = Tools.Components.PROMPT_OPTIMIZER_ASSISTANT, @@ -464,6 +472,20 @@ private void ResetOutput() this.optimizedPrompt = string.Empty; } + private Task UseOptimizedPromptAsInput() + { + if (string.IsNullOrWhiteSpace(this.optimizedPrompt)) + return Task.CompletedTask; + + this.inputPrompt = this.optimizedPrompt; + this.ResetOutput(); + this.ChatThread = null; + this.LastUserPrompt = null; + this.ResultingContentBlock = null; + this.ClearInputIssues(); + return Task.CompletedTask; + } + private void ResetGuidelineSummaryToDefault() { this.recClarityDirectness = T("Use clear, explicit instructions and directly state quality expectations."); diff --git a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua index c0e2d70dc..33850ef5c 100644 --- a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua @@ -2193,6 +2193,9 @@ UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER -- View UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1582017048"] = "Anzeigen" +-- Improve further +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1582753277"] = "Weiter verbessern" + -- Separate context, task, constraints, and output format with headings or markers. UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1626024580"] = "Trennen Sie Kontext, Aufgabe, Einschränkungen und Ausgabeformat mit Überschriften oder Markierungen." diff --git a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua index 4725c5246..7b5879de4 100644 --- a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua @@ -2193,6 +2193,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." diff --git a/app/MindWork AI Studio/wwwroot/changelog/v26.9.1.md b/app/MindWork AI Studio/wwwroot/changelog/v26.9.1.md index e0d15144d..76f0f3c20 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v26.9.1.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v26.9.1.md @@ -10,6 +10,7 @@ - Added organization-wide management for tools. Among other options, IT departments can switch tools off entirely, disable individual ones, or define the provider trust a tool requires. You do not have to write any of it by hand: set a tool up in the app, then export its configuration as ready-made Lua code for your plugin, with encrypted API keys if you want them. - Added tool calling to the abilities you can state yourself in the expert provider settings. When you use a model AI Studio does not recognize as tool-capable, you can now declare that it is, the same way you already could for image input or reasoning. It works in the other direction as well: a model AI Studio has never heard of is offered tools, because most models can use them by now. Should one turn out not to be able to, AI Studio says so in plain words and points you to the same setting to switch the ability off again, instead of only passing the provider's error on. - Added support for OpenAI's GPT-6 Astra. +- Added a way to refine an optimized prompt again in the Prompt Optimizer. Select "Use as input" to move the latest proposal back into the editable prompt while keeping your recommendations and selections, then make any changes you want before you optimize it again. - Added the context window to what AI Studio knows about a model, wherever its metadata states one. - Added a live read of that context window at the providers which report it, among them Mistral, Groq, OpenRouter, and self-hosted vLLM servers. You then get the window your own server was started with, not the one the model card advertises. - Added a token count below the message field, so you always see how much of the conversation you have used. It counts everything that travels along: your messages, the files you attached, what your data sources contributed, and the tools you offered the AI. It can be an estimate when a provider does not give AI Studio everything it needs to count exactly. From f94af9c07d281cb278076607842a97a557a6b479 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 22 Sep 2026 19:48:32 +0200 Subject: [PATCH 2/5] Share the conversation reset across assistants --- .../Assistants/AssistantBase.razor.cs | 4 +--- .../Assistants/AssistantLowerBase.cs | 14 ++++++++++++++ .../AssistantPromptOptimizer.razor.cs | 4 +--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs b/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs index 4d6fde091..f655ea771 100644 --- a/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs +++ b/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs @@ -753,9 +753,7 @@ private async Task InnerResetForm() 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); diff --git a/app/MindWork AI Studio/Assistants/AssistantLowerBase.cs b/app/MindWork AI Studio/Assistants/AssistantLowerBase.cs index fff83be6e..bfde4c2d5 100644 --- a/app/MindWork AI Studio/Assistants/AssistantLowerBase.cs +++ b/app/MindWork AI Studio/Assistants/AssistantLowerBase.cs @@ -34,4 +34,18 @@ public abstract class AssistantLowerBase : MSGComponentBase protected ContentBlock? ResultingContentBlock; protected string[] InputIssues = []; protected bool IsProcessing; + + /// + /// Clears everything one assistant run has produced. + /// + /// + /// 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. + /// + protected void ClearConversationState() + { + this.ChatThread = null; + this.LastUserPrompt = null; + this.ResultingContentBlock = null; + } } \ No newline at end of file diff --git a/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs b/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs index 11694b70a..9aa018324 100644 --- a/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs +++ b/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs @@ -479,9 +479,7 @@ private Task UseOptimizedPromptAsInput() this.inputPrompt = this.optimizedPrompt; this.ResetOutput(); - this.ChatThread = null; - this.LastUserPrompt = null; - this.ResultingContentBlock = null; + this.ClearConversationState(); this.ClearInputIssues(); return Task.CompletedTask; } From 002fc28fe8f6a13f3a235aa416a382ff303b205f Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 22 Sep 2026 19:53:45 +0200 Subject: [PATCH 3/5] Align the prompt refinement action with the assistant button pattern --- .../AssistantPromptOptimizer.razor.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs b/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs index 9aa018324..ae86f9d01 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 @@ Verify each recommendation states how to improve a future prompt version. 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 @@ protected override void RestoreCustomAssistantSessionState(AssistantSessionState 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 @@ private void ResetOutput() this.optimizedPrompt = string.Empty; } + /// + /// 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; From 820367414748dfa388628aa4d3b53a897c2f8127 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 22 Sep 2026 19:58:45 +0200 Subject: [PATCH 4/5] Collect the I18N text of the prompt refinement tooltip --- app/MindWork AI Studio/Assistants/I18N/allTexts.lua | 3 +++ .../de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua | 3 +++ .../en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua | 3 +++ 3 files changed, 9 insertions(+) diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua index 4d8ff3b25..f09f9d566 100644 --- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua +++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua @@ -2290,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." diff --git a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua index 9054c072e..8b52aa1d5 100644 --- a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua @@ -2292,6 +2292,9 @@ UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER -- Use sequential steps UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T487578804"] = "Schrittweise vorgehen" +-- Moves the optimized prompt into the prompt field so you can optimize it again. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T502438377"] = "Übernimmt den optimierten Prompt als neue Eingabe, damit Sie ihn erneut optimieren können." + -- Use clear, explicit instructions and directly state quality expectations. UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T596557540"] = "Verwenden Sie klare, explizite Anweisungen und geben Sie direkt die Qualitätsmerkmale an." diff --git a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua index 02b414096..8ef7f094a 100644 --- a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua @@ -2292,6 +2292,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." From 5e4db5969d762f2684e541f3f1bb904bbeecce13 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 22 Sep 2026 20:01:19 +0200 Subject: [PATCH 5/5] Name the right button in the prompt refinement changelog entry --- app/MindWork AI Studio/wwwroot/changelog/v26.9.1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/MindWork AI Studio/wwwroot/changelog/v26.9.1.md b/app/MindWork AI Studio/wwwroot/changelog/v26.9.1.md index 0dd4b6c56..79853800c 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v26.9.1.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v26.9.1.md @@ -12,7 +12,7 @@ - Added organization-wide management for tools. Among other options, IT departments can switch tools off entirely, disable individual ones, or define the provider trust a tool requires. You do not have to write any of it by hand: set a tool up in the app, then export its configuration as ready-made Lua code for your plugin, with encrypted API keys if you want them. - Added tool calling to the abilities you can state yourself in the expert provider settings. When you use a model AI Studio does not recognize as tool-capable, you can now declare that it is, the same way you already could for image input or reasoning. It works in the other direction as well: a model AI Studio has never heard of is offered tools, because most models can use them by now. Should one turn out not to be able to, AI Studio says so in plain words and points you to the same setting to switch the ability off again, instead of only passing the provider's error on. - Added support for OpenAI's GPT-6 Astra. -- Added a way to refine an optimized prompt again in the Prompt Optimizer. Select "Use as input" to move the latest proposal back into the editable prompt while keeping your recommendations and selections, then make any changes you want before you optimize it again. +- Added a way to keep improving a prompt in the Prompt Optimizer. Select "Improve further" to move the latest proposal back into the prompt field, edit it the way you want, and optimize it again. Your recommendations and everything you selected stay as they are. - Added the context window to what AI Studio knows about a model, wherever its metadata states one. - Added a live read of that context window at the providers which report it, among them Mistral, Groq, OpenRouter, and self-hosted vLLM servers. You then get the window your own server was started with, not the one the model card advertises. - Added a token count below the message field, so you always see how much of the conversation you have used. It counts everything that travels along: your messages, the files you attached, what your data sources contributed, and the tools you offered the AI. It can be an estimate when a provider does not give AI Studio everything it needs to count exactly.