diff --git a/app/MindWork AI Studio/Assistants/AssistantBase.razor b/app/MindWork AI Studio/Assistants/AssistantBase.razor index 3268612d..53d6b642 100644 --- a/app/MindWork AI Studio/Assistants/AssistantBase.razor +++ b/app/MindWork AI Studio/Assistants/AssistantBase.razor @@ -8,6 +8,13 @@ @this.Title + + + + @if (this.HeaderActions is not null) + { + @this.HeaderActions + } @if (this.HasSettingsPanel) { @@ -31,7 +38,7 @@ - + @this.SubmitText @if (this.isProcessing && this.cancellationTokenSource is not null) @@ -71,6 +78,11 @@ } } } + + @if (this.ShowResult && this.AfterResultContent is not null) + { + @this.AfterResultContent + }
diff --git a/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs b/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs index 632722ab..1b1503b6 100644 --- a/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs +++ b/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs @@ -81,6 +81,10 @@ public abstract partial class AssistantBase : AssistantLowerBase wher protected virtual ChatThread ConvertToChatThread => this.chatThread ?? new(); + private protected virtual RenderFragment? HeaderActions => null; + + private protected virtual RenderFragment? AfterResultContent => null; + protected virtual IReadOnlyList FooterButtons => []; protected virtual bool HasSettingsPanel => typeof(TSettings) != typeof(NoSettingsPanel); diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua index e899d79a..5ecd2297 100644 --- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua +++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua @@ -1288,6 +1288,150 @@ UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::MYTASKS::ASSISTANTMYTASKS::T534887559"] = -- Please provide a custom language. UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::MYTASKS::ASSISTANTMYTASKS::T656744944"] = "Please provide a custom language." +-- The custom prompt guide file is empty or could not be read. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1173408044"] = "The custom prompt guide file is empty or could not be read." + +-- Use English for complex prompts and explicitly request response language if needed. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T119999744"] = "Use English for complex prompts and explicitly request response language if needed." + +-- The selected custom prompt guide file could not be found. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1300996373"] = "The selected custom prompt guide file could not be found." + +-- Define a role for the model to focus output style and expertise. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1316122151"] = "Define a role for the model to focus output style and expertise." + +-- Use headings or markers to separate context, task, and constraints. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1435532298"] = "Use headings or markers to separate context, task, and constraints." + +-- Custom Prompt Guide Preview +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1526658372"] = "Custom Prompt Guide Preview" + +-- The model response was not in the expected JSON format. The raw response is shown as optimized prompt. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1548376553"] = "The model response was not in the expected JSON format. The raw response is shown as optimized prompt." + +-- View +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1582017048"] = "View" + +-- 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." + +-- Add short examples and background context for your specific use case. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1666841672"] = "Add short examples and background context for your specific use case." + +-- Assign a role to shape tone, expertise, and focus. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1679211785"] = "Assign a role to shape tone, expertise, and focus." + +-- Structure with markers +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1695758233"] = "Structure with markers" + +-- Please attach and load a valid custom prompt guide file. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1760468309"] = "Please attach and load a valid custom prompt guide file." + +-- Prompt Optimizer +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1777666968"] = "Prompt Optimizer" + +-- Add clearer goals and explicit quality expectations. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1833795299"] = "Add clearer goals and explicit quality expectations." + +-- Optimize prompt +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1857716344"] = "Optimize prompt" + +-- Break the task into numbered steps if order matters. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2185953360"] = "Break the task into numbered steps if order matters." + +-- Please provide a prompt or prompt description. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2228130444"] = "Please provide a prompt or prompt description." + +-- Add examples and context +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2386806593"] = "Add examples and context" + +-- Custom prompt guide file +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2458417590"] = "Custom prompt guide file" + +-- Use an LLM to optimize your prompt by following either the default or your individual prompt guidelines and get targeted recommendations for future versions of the prompt. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2466607250"] = "Use an LLM to optimize your prompt by following either the default or your individual prompt guidelines and get targeted recommendations for future versions of the prompt." + +-- Replaced the previously selected custom prompt guide file. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2698103422"] = "Replaced the previously selected custom prompt guide file." + +-- (Optional) Important Aspects for the prompt +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2713431429"] = "(Optional) Important Aspects for the prompt" + +-- Use the prompt recommendations from the custom prompt guide. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2830307837"] = "Use the prompt recommendations from the custom prompt guide." + +-- Be clear and direct +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2880063041"] = "Be clear and direct" + +-- The prompting guideline file could not be loaded. Please verify 'prompting_guideline.md' in Assistants/PromptOptimizer. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T30321193"] = "The prompting guideline file could not be loaded. Please verify 'prompting_guideline.md' in Assistants/PromptOptimizer." + +-- Custom language +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3032662264"] = "Custom language" + +-- Give the model a role +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3420218291"] = "Give the model a role" + +-- Failed to load custom prompt guide content. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3488117809"] = "Failed to load custom prompt guide content." + +-- No file selected +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3522202289"] = "No file selected" + +-- Use custom prompt guide +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3528575759"] = "Use custom prompt guide" + +-- Prefer numbered steps when task order matters. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3558299393"] = "Prefer numbered steps when task order matters." + +-- Recommendations for your prompt +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3577149599"] = "Recommendations for your prompt" + +-- (Optional) Specify aspects the optimizer should emphasize in the resulting prompt, such as output structure, or constraints. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3686962588"] = "(Optional) Specify aspects the optimizer should emphasize in the resulting prompt, such as output structure, or constraints." + +-- View default prompt guide +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T4017099405"] = "View default prompt guide" + +-- Prompt or prompt description +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T4058791116"] = "Prompt or prompt description" + +-- Include short examples and context that explain the purpose behind your requirements. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T4143206140"] = "Include short examples and context that explain the purpose behind your requirements." + +-- Prompting Guideline +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T4250996615"] = "Prompting Guideline" + +-- Use sequential steps +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T487578804"] = "Use sequential steps" + +-- 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." + +-- Choose prompt language deliberately +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T616613304"] = "Choose prompt language deliberately" + +-- Prompt recommendations were updated based on your latest optimization. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T633382478"] = "Prompt recommendations were updated based on your latest optimization." + +-- Please provide a custom language. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T656744944"] = "Please provide a custom language." + +-- No further recommendation in this area. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T659636347"] = "No further recommendation in this area." + +-- The prompting guideline file could not be loaded. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T666817418"] = "The prompting guideline file could not be loaded." + +-- Language for the optimized prompt +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T773621440"] = "Language for the optimized prompt" + +-- Use these recommendations, that are based on the default prompt guide, to improve your prompts. The suggestions are updated based on your latest prompt optimization. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T805885769"] = "Use these recommendations, that are based on the default prompt guide, to improve your prompts. The suggestions are updated based on your latest prompt optimization." + +-- For complex tasks, write prompts in English. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T85710437"] = "For complex tasks, write prompts in English." + -- Please provide a text as input. You might copy the desired text from a document or a website. UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::REWRITEIMPROVE::ASSISTANTREWRITEIMPROVE::T137304886"] = "Please provide a text as input. You might copy the desired text from a document or a website." @@ -3712,6 +3856,15 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROFILEDIALOG::T900713019"] = "Cancel" -- The profile name must be unique; the chosen name is already in use. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROFILEDIALOG::T911748898"] = "The profile name must be unique; the chosen name is already in use." +-- Close +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROMPTINGGUIDELINEDIALOG::T3448155331"] = "Close" + +-- The full prompting guideline used by the Prompt Optimizer. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROMPTINGGUIDELINEDIALOG::T384594633"] = "The full prompting guideline used by the Prompt Optimizer." + +-- Prompting Guideline +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROMPTINGGUIDELINEDIALOG::T4250996615"] = "Prompting Guideline" + -- Please be aware: This section is for experts only. You are responsible for verifying the correctness of the additional parameters you provide to the API call. By default, AI Studio uses the OpenAI-compatible chat completions API, when that it is supported by the underlying service and model. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROVIDERDIALOG::T1017509792"] = "Please be aware: This section is for experts only. You are responsible for verifying the correctness of the additional parameters you provide to the API call. By default, AI Studio uses the OpenAI-compatible chat completions API, when that it is supported by the underlying service and model." @@ -4639,6 +4792,39 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROFILES::T55364659" -- Are you a project manager in a research facility? You might want to create a profile for your project management activities, one for your scientific work, and a profile for when you need to write program code. In these profiles, you can record how much experience you have or which methods you like or dislike using. Later, you can choose when and where you want to use each profile. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROFILES::T56359901"] = "Are you a project manager in a research facility? You might want to create a profile for your project management activities, one for your scientific work, and a profile for when you need to write program code. In these profiles, you can record how much experience you have or which methods you like or dislike using. Later, you can choose when and where you want to use each profile." +-- Preselect the target language +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T1417990312"] = "Preselect the target language" + +-- Preselect another target language +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T1462295644"] = "Preselect another target language" + +-- Assistant: Prompt Optimizer Options +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T2309650422"] = "Assistant: Prompt Optimizer Options" + +-- Preselect aspects the optimizer should emphasize, such as role clarity, structure, or output constraints. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T2365571378"] = "Preselect aspects the optimizer should emphasize, such as role clarity, structure, or output constraints." + +-- No prompt optimizer options are preselected +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T2506620531"] = "No prompt optimizer options are preselected" + +-- Prompt optimizer options are preselected +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T2576287692"] = "Prompt optimizer options are preselected" + +-- Preselect prompt optimizer options? +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3159686278"] = "Preselect prompt optimizer options?" + +-- Close +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3448155331"] = "Close" + +-- Which target language should be preselected? +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3547337928"] = "Which target language should be preselected?" + +-- When enabled, you can preselect target language, important aspects, and provider defaults for the prompt optimizer assistant. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3570338905"] = "When enabled, you can preselect target language, important aspects, and provider defaults for the prompt optimizer assistant." + +-- Preselect important aspects +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3705987833"] = "Preselect important aspects" + -- Which writing style should be preselected? UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGREWRITE::T1173034744"] = "Which writing style should be preselected?" @@ -5176,9 +5362,15 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1614176092"] = "Assistants" -- Coding UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1617786407"] = "Coding" +-- Optimize your prompt using a structured guideline. +UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1709976267"] = "Optimize your prompt using a structured guideline." + -- Analyze a text or an email for tasks you need to complete. UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1728590051"] = "Analyze a text or an email for tasks you need to complete." +-- Prompt Optimizer +UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1777666968"] = "Prompt Optimizer" + -- Slide Assistant UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1883918574"] = "Slide Assistant" @@ -6145,6 +6337,9 @@ UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T1883918574"] = "Slide A -- Legal Check Assistant UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T1886447798"] = "Legal Check Assistant" +-- Prompt Optimizer Assistant +UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T1993795352"] = "Prompt Optimizer Assistant" + -- Job Posting Assistant UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T2212811874"] = "Job Posting Assistant" diff --git a/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor b/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor new file mode 100644 index 00000000..a1ad067c --- /dev/null +++ b/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor @@ -0,0 +1,124 @@ +@attribute [Route(Routes.ASSISTANT_PROMPT_OPTIMIZER)] +@inherits AssistantBaseCore + + + + + + + + + @T("Recommendations for your prompt") + + +@if (this.ShowUpdatedPromptGuidelinesIndicator) +{ + + + @T("Prompt recommendations were updated based on your latest optimization.") + + +} + +@if (!this.useCustomPromptGuide) +{ + @T("Use these recommendations, that are based on the default prompt guide, to improve your prompts. The suggestions are updated based on your latest prompt optimization.") + + + + + + + + + + + + + + + + + + + + + +} + +@if (this.useCustomPromptGuide) +{ +@T("Use the prompt recommendations from the custom prompt guide.") +} + + + + @T("View default prompt guide") + + + + @T("Use custom prompt guide") + + + @if (this.useCustomPromptGuide) + { + + } + + + + + @T("View") + + + + diff --git a/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs b/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs new file mode 100644 index 00000000..5b485e91 --- /dev/null +++ b/app/MindWork AI Studio/Assistants/PromptOptimizer/AssistantPromptOptimizer.razor.cs @@ -0,0 +1,571 @@ +using System.Text.Json; +using System.Text.RegularExpressions; + +using AIStudio.Chat; +using AIStudio.Dialogs; +using AIStudio.Dialogs.Settings; +using Microsoft.AspNetCore.Components; + +#if !DEBUG +using System.Reflection; +using Microsoft.Extensions.FileProviders; +#endif + +namespace AIStudio.Assistants.PromptOptimizer; + +public partial class AssistantPromptOptimizer : AssistantBaseCore +{ + private static readonly Regex JSON_CODE_FENCE_REGEX = new( + pattern: """```(?:json)?\s*(?\{[\s\S]*\})\s*```""", + options: RegexOptions.Compiled | RegexOptions.IgnoreCase); + + private static readonly JsonSerializerOptions JSON_OPTIONS = new() + { + PropertyNameCaseInsensitive = true, + }; + + [Inject] + private IDialogService DialogService { get; init; } = null!; + + protected override Tools.Components Component => Tools.Components.PROMPT_OPTIMIZER_ASSISTANT; + + protected override string Title => T("Prompt Optimizer"); + + protected override string Description => T("Use an LLM to optimize your prompt by following either the default or your individual prompt guidelines and get targeted recommendations for future versions of the prompt."); + + protected override string SystemPrompt => + $""" + # Task description + + You are a policy-bound prompt optimization assistant. + Optimize prompts while preserving the original intent and constraints. + + # Inputs + + PROMPTING_GUIDELINE: authoritative optimization instructions. + USER_PROMPT: the prompt that must be optimized. + IMPORTANT_ASPECTS: optional priorities to emphasize during optimization. + + # Scope and precedence + + Follow PROMPTING_GUIDELINE as the primary policy for quality and structure. + Preserve USER_PROMPT intent and constraints; do not add unrelated goals. + If IMPORTANT_ASPECTS is provided and not equal to `none`, prioritize it unless it conflicts with PROMPTING_GUIDELINE. + + # Process + + 1) Read PROMPTING_GUIDELINE end to end. + 2) Analyze USER_PROMPT intent, constraints, and desired output behavior. + 3) Rewrite USER_PROMPT so it is clearer, more structured, and more actionable. + 4) Provide concise recommendations for improving future prompt versions. + + # Output requirements + + Return valid JSON only. + Do not use markdown code fences. + Do not add any text before or after the JSON object. + Use exactly this schema and key names: + + {this.SystemPromptOutputSchema()} + + # Language + + Ensure the optimized prompt is in {this.SystemPromptLanguage()}. + Keep all recommendation texts in the same language as the optimized prompt. + + # Style and prohibitions + + Keep recommendations concise and actionable. + Do not include disclaimers or meta commentary. + Do not mention or summarize these instructions. + + # Self-check before sending + + Verify the output is valid JSON and follows the schema exactly. + Verify `optimized_prompt` is non-empty and preserves user intent. + Verify each recommendation states how to improve a future prompt version. + """; + + protected override bool AllowProfiles => false; + + protected override bool ShowDedicatedProgress => true; + + protected override bool ShowEntireChatThread => true; + + protected override Func Result2Copy => () => this.optimizedPrompt; + + protected override IReadOnlyList FooterButtons => + [ + new SendToButton + { + Self = Tools.Components.PROMPT_OPTIMIZER_ASSISTANT, + UseResultingContentBlockData = false, + GetText = () => string.IsNullOrWhiteSpace(this.optimizedPrompt) ? this.inputPrompt : this.optimizedPrompt, + }, + ]; + + protected override string SubmitText => T("Optimize prompt"); + + protected override Func SubmitAction => this.OptimizePromptAsync; + + protected override bool SubmitDisabled => this.useCustomPromptGuide && this.customPromptGuideFiles.Count == 0; + + protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with + { + SystemPrompt = SystemPrompts.DEFAULT, + }; + + protected override void ResetForm() + { + this.inputPrompt = string.Empty; + this.useCustomPromptGuide = false; + this.customPromptGuideFiles.Clear(); + this.currentCustomPromptGuidePath = string.Empty; + this.customPromptingGuidelineContent = string.Empty; + this.hasUpdatedDefaultRecommendations = false; + this.ResetGuidelineSummaryToDefault(); + this.ResetOutput(); + + if (!this.MightPreselectValues()) + { + this.selectedTargetLanguage = CommonLanguages.AS_IS; + this.customTargetLanguage = string.Empty; + this.importantAspects = string.Empty; + } + } + + protected override bool MightPreselectValues() + { + if (!this.SettingsManager.ConfigurationData.PromptOptimizer.PreselectOptions) + return false; + + this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.PromptOptimizer.PreselectedTargetLanguage; + this.customTargetLanguage = this.SettingsManager.ConfigurationData.PromptOptimizer.PreselectedOtherLanguage; + this.importantAspects = this.SettingsManager.ConfigurationData.PromptOptimizer.PreselectedImportantAspects; + return true; + } + + protected override async Task OnInitializedAsync() + { + this.ResetGuidelineSummaryToDefault(); + this.hasUpdatedDefaultRecommendations = false; + + var deferredContent = MessageBus.INSTANCE.CheckDeferredMessages(Event.SEND_TO_PROMPT_OPTIMIZER_ASSISTANT).FirstOrDefault(); + if (deferredContent is not null) + this.inputPrompt = deferredContent; + + await base.OnInitializedAsync(); + } + + private string inputPrompt = string.Empty; + private CommonLanguages selectedTargetLanguage = CommonLanguages.AS_IS; + private string customTargetLanguage = string.Empty; + private string importantAspects = string.Empty; + private bool useCustomPromptGuide; + private HashSet customPromptGuideFiles = []; + private string currentCustomPromptGuidePath = string.Empty; + private string customPromptingGuidelineContent = string.Empty; + private bool isLoadingCustomPromptGuide; + private bool hasUpdatedDefaultRecommendations; + + private string optimizedPrompt = string.Empty; + private string recClarityDirectness = string.Empty; + private string recExamplesContext = string.Empty; + private string recSequentialSteps = string.Empty; + private string recStructureMarkers = string.Empty; + private string recRoleDefinition = string.Empty; + private string recLanguageChoice = string.Empty; + + private bool ShowUpdatedPromptGuidelinesIndicator => !this.useCustomPromptGuide && this.hasUpdatedDefaultRecommendations; + private bool CanPreviewCustomPromptGuide => this.useCustomPromptGuide && this.customPromptGuideFiles.Count > 0; + private string CustomPromptGuideFileName => this.customPromptGuideFiles.Count switch + { + 0 => T("No file selected"), + _ => this.customPromptGuideFiles.First().FileName + }; + + private string? ValidateInputPrompt(string text) + { + if (string.IsNullOrWhiteSpace(text)) + return T("Please provide a prompt or prompt description."); + + return null; + } + + private string? ValidateCustomLanguage(string language) + { + if (this.selectedTargetLanguage == CommonLanguages.OTHER && string.IsNullOrWhiteSpace(language)) + return T("Please provide a custom language."); + + return null; + } + + private string SystemPromptLanguage() + { + var language = this.selectedTargetLanguage switch + { + CommonLanguages.AS_IS => "the source language of the input prompt", + CommonLanguages.OTHER => this.customTargetLanguage, + _ => this.selectedTargetLanguage.Name(), + }; + + if (string.IsNullOrWhiteSpace(language)) + return "the source language of the input prompt"; + + return language; + } + + private async Task OptimizePromptAsync() + { + await this.form!.Validate(); + if (!this.inputIsValid) + return; + + this.ClearInputIssues(); + this.ResetOutput(); + this.hasUpdatedDefaultRecommendations = false; + + var promptingGuideline = await this.GetPromptingGuidelineForOptimizationAsync(); + if (string.IsNullOrWhiteSpace(promptingGuideline)) + { + if (this.useCustomPromptGuide) + this.AddInputIssue(T("Please attach and load a valid custom prompt guide file.")); + else + this.AddInputIssue(T("The prompting guideline file could not be loaded. Please verify 'prompting_guideline.md' in Assistants/PromptOptimizer.")); + return; + } + + this.CreateChatThread(); + var requestTime = this.AddUserRequest(this.BuildOptimizationRequest(promptingGuideline), hideContentFromUser: true); + var aiResponse = await this.AddAIResponseAsync(requestTime, hideContentFromUser: true); + + if (!TryParseOptimizationResult(aiResponse, out var parsedResult)) + { + this.optimizedPrompt = aiResponse.Trim(); + if (!this.useCustomPromptGuide) + { + this.ApplyFallbackRecommendations(); + this.MarkRecommendationsUpdated(); + } + + this.AddInputIssue(T("The model response was not in the expected JSON format. The raw response is shown as optimized prompt.")); + this.AddVisibleOptimizedPromptBlock(); + return; + } + + this.ApplyOptimizationResult(parsedResult); + this.AddVisibleOptimizedPromptBlock(); + } + + private string BuildOptimizationRequest(string promptingGuideline) + { + return + $$""" + # PROMPTING_GUIDELINE + + {{promptingGuideline}} + + + # USER_PROMPT + + {{this.inputPrompt}} + + + {{this.PromptImportantAspects()}} + """; + } + + private string PromptImportantAspects() + { + return string.IsNullOrWhiteSpace(this.importantAspects) ? string.Empty : $""" + # IMPORTANT_ASPECTS + + {this.importantAspects} + + """; + } + + private string SystemPromptOutputSchema() => + """ + { + "optimized_prompt": "string", + "recommendations": { + "clarity_and_directness": "string", + "examples_and_context": "string", + "sequential_steps": "string", + "structure_with_markers": "string", + "role_definition": "string", + "language_choice": "string" + } + } + """; + + private static bool TryParseOptimizationResult(string rawResponse, out PromptOptimizationResult parsedResult) + { + parsedResult = new(); + + if (TryDeserialize(rawResponse, out parsedResult)) + return true; + + var codeFenceMatch = JSON_CODE_FENCE_REGEX.Match(rawResponse); + if (codeFenceMatch.Success) + { + var codeFenceJson = codeFenceMatch.Groups["json"].Value; + if (TryDeserialize(codeFenceJson, out parsedResult)) + return true; + } + + var firstBrace = rawResponse.IndexOf('{'); + var lastBrace = rawResponse.LastIndexOf('}'); + if (firstBrace >= 0 && lastBrace > firstBrace) + { + var objectText = rawResponse[firstBrace..(lastBrace + 1)]; + if (TryDeserialize(objectText, out parsedResult)) + return true; + } + + return false; + } + + private static bool TryDeserialize(string json, out PromptOptimizationResult parsedResult) + { + parsedResult = new(); + + if (string.IsNullOrWhiteSpace(json)) + return false; + + try + { + var probe = JsonSerializer.Deserialize(json, JSON_OPTIONS); + if (probe is null || string.IsNullOrWhiteSpace(probe.OptimizedPrompt)) + return false; + + probe.Recommendations ??= new PromptOptimizationRecommendations(); + parsedResult = probe; + return true; + } + catch + { + return false; + } + } + + private void ApplyOptimizationResult(PromptOptimizationResult optimizationResult) + { + this.optimizedPrompt = optimizationResult.OptimizedPrompt.Trim(); + if (this.useCustomPromptGuide) + return; + + this.ApplyRecommendations(optimizationResult.Recommendations); + this.MarkRecommendationsUpdated(); + } + + private void MarkRecommendationsUpdated() + { + this.hasUpdatedDefaultRecommendations = true; + } + + private void ApplyRecommendations(PromptOptimizationRecommendations recommendations) + { + this.recClarityDirectness = this.EmptyFallback(recommendations.ClarityAndDirectness); + this.recExamplesContext = this.EmptyFallback(recommendations.ExamplesAndContext); + this.recSequentialSteps = this.EmptyFallback(recommendations.SequentialSteps); + this.recStructureMarkers = this.EmptyFallback(recommendations.StructureWithMarkers); + this.recRoleDefinition = this.EmptyFallback(recommendations.RoleDefinition); + this.recLanguageChoice = this.EmptyFallback(recommendations.LanguageChoice); + } + + private void ApplyFallbackRecommendations() + { + this.recClarityDirectness = T("Add clearer goals and explicit quality expectations."); + this.recExamplesContext = T("Add short examples and background context for your specific use case."); + this.recSequentialSteps = T("Break the task into numbered steps if order matters."); + this.recStructureMarkers = T("Use headings or markers to separate context, task, and constraints."); + this.recRoleDefinition = T("Define a role for the model to focus output style and expertise."); + this.recLanguageChoice = T("Use English for complex prompts and explicitly request response language if needed."); + } + + private string EmptyFallback(string text) + { + if (string.IsNullOrWhiteSpace(text)) + return T("No further recommendation in this area."); + + return text.Trim(); + } + + private void ResetOutput() + { + this.optimizedPrompt = string.Empty; + } + + private void ResetGuidelineSummaryToDefault() + { + this.recClarityDirectness = T("Use clear, explicit instructions and directly state quality expectations."); + this.recExamplesContext = T("Include short examples and context that explain the purpose behind your requirements."); + this.recSequentialSteps = T("Prefer numbered steps when task order matters."); + this.recStructureMarkers = T("Separate context, task, constraints, and output format with headings or markers."); + this.recRoleDefinition = T("Assign a role to shape tone, expertise, and focus."); + this.recLanguageChoice = T("For complex tasks, write prompts in English."); + } + + private void AddVisibleOptimizedPromptBlock() + { + if (string.IsNullOrWhiteSpace(this.optimizedPrompt)) + return; + + if (this.chatThread is null) + return; + + var visibleResponseContent = new ContentText + { + Text = this.optimizedPrompt, + }; + + this.chatThread.Blocks.Add(new ContentBlock + { + Time = DateTimeOffset.Now, + ContentType = ContentType.TEXT, + Role = ChatRole.AI, + HideFromUser = false, + Content = visibleResponseContent, + }); + } + + private static async Task ReadPromptingGuidelineAsync() + { +#if DEBUG + var guidelinePath = Path.Join(Environment.CurrentDirectory, "Assistants", "PromptOptimizer", "prompting_guideline.md"); + return File.Exists(guidelinePath) + ? await File.ReadAllTextAsync(guidelinePath) + : string.Empty; +#else + var resourceFileProvider = new ManifestEmbeddedFileProvider(Assembly.GetAssembly(type: typeof(Program))!, "Assistants/PromptOptimizer"); + var file = resourceFileProvider.GetFileInfo("prompting_guideline.md"); + if (!file.Exists) + return string.Empty; + + await using var fileStream = file.CreateReadStream(); + using var reader = new StreamReader(fileStream); + return await reader.ReadToEndAsync(); +#endif + } + + private async Task GetPromptingGuidelineForOptimizationAsync() + { + if (!this.useCustomPromptGuide) + return await ReadPromptingGuidelineAsync(); + + if (this.customPromptGuideFiles.Count == 0) + return string.Empty; + + if (!string.IsNullOrWhiteSpace(this.customPromptingGuidelineContent)) + return this.customPromptingGuidelineContent; + + var fileAttachment = this.customPromptGuideFiles.First(); + await this.LoadCustomPromptGuidelineContentAsync(fileAttachment); + return this.customPromptingGuidelineContent; + } + + private async Task SetUseCustomPromptGuide(bool useCustom) + { + this.useCustomPromptGuide = useCustom; + if (!useCustom) + return; + + if (this.customPromptGuideFiles.Count == 0) + return; + + var fileAttachment = this.customPromptGuideFiles.First(); + if (string.IsNullOrWhiteSpace(this.customPromptingGuidelineContent)) + await this.LoadCustomPromptGuidelineContentAsync(fileAttachment); + } + + private async Task OnCustomPromptGuideFilesChanged(HashSet files) + { + if (files.Count == 0) + { + this.customPromptGuideFiles.Clear(); + this.currentCustomPromptGuidePath = string.Empty; + this.customPromptingGuidelineContent = string.Empty; + return; + } + + var selected = files.FirstOrDefault(file => !string.Equals(file.FilePath, this.currentCustomPromptGuidePath, StringComparison.OrdinalIgnoreCase)) + ?? files.First(); + + var replacedPrevious = !string.IsNullOrWhiteSpace(this.currentCustomPromptGuidePath) && + !string.Equals(this.currentCustomPromptGuidePath, selected.FilePath, StringComparison.OrdinalIgnoreCase); + + this.customPromptGuideFiles = [ selected ]; + this.currentCustomPromptGuidePath = selected.FilePath; + + if (files.Count > 1 || replacedPrevious) + this.Snackbar.Add(T("Replaced the previously selected custom prompt guide file."), Severity.Info); + + await this.LoadCustomPromptGuidelineContentAsync(selected); + } + + private async Task LoadCustomPromptGuidelineContentAsync(FileAttachment fileAttachment) + { + if (!fileAttachment.Exists) + { + this.customPromptingGuidelineContent = string.Empty; + this.Snackbar.Add(T("The selected custom prompt guide file could not be found."), Severity.Warning); + return; + } + + try + { + this.isLoadingCustomPromptGuide = true; + this.customPromptingGuidelineContent = await UserFile.LoadFileData(fileAttachment.FilePath, this.RustService, this.DialogService); + if (string.IsNullOrWhiteSpace(this.customPromptingGuidelineContent)) + this.Snackbar.Add(T("The custom prompt guide file is empty or could not be read."), Severity.Warning); + } + catch + { + this.customPromptingGuidelineContent = string.Empty; + this.Snackbar.Add(T("Failed to load custom prompt guide content."), Severity.Error); + } + finally + { + this.isLoadingCustomPromptGuide = false; + this.StateHasChanged(); + } + } + + private async Task OpenPromptingGuidelineDialog() + { + var promptingGuideline = await ReadPromptingGuidelineAsync(); + if (string.IsNullOrWhiteSpace(promptingGuideline)) + { + this.Snackbar.Add(T("The prompting guideline file could not be loaded."), Severity.Warning); + return; + } + + var dialogParameters = new DialogParameters + { + { x => x.GuidelineMarkdown, promptingGuideline } + }; + + var dialogReference = await this.DialogService.ShowAsync(T("Prompting Guideline"), dialogParameters, AIStudio.Dialogs.DialogOptions.FULLSCREEN); + await dialogReference.Result; + } + + private async Task OpenCustomPromptGuideDialog() + { + if (this.customPromptGuideFiles.Count == 0) + return; + + var fileAttachment = this.customPromptGuideFiles.First(); + if (string.IsNullOrWhiteSpace(this.customPromptingGuidelineContent) && !this.isLoadingCustomPromptGuide) + await this.LoadCustomPromptGuidelineContentAsync(fileAttachment); + + var dialogParameters = new DialogParameters + { + { x => x.Document, fileAttachment }, + { x => x.FileContent, this.customPromptingGuidelineContent }, + }; + + await this.DialogService.ShowAsync(T("Custom Prompt Guide Preview"), dialogParameters, AIStudio.Dialogs.DialogOptions.FULLSCREEN); + } +} diff --git a/app/MindWork AI Studio/Assistants/PromptOptimizer/PromptOptimizationResult.cs b/app/MindWork AI Studio/Assistants/PromptOptimizer/PromptOptimizationResult.cs new file mode 100644 index 00000000..88a78374 --- /dev/null +++ b/app/MindWork AI Studio/Assistants/PromptOptimizer/PromptOptimizationResult.cs @@ -0,0 +1,33 @@ +using System.Text.Json.Serialization; + +namespace AIStudio.Assistants.PromptOptimizer; + +public sealed class PromptOptimizationResult +{ + [JsonPropertyName("optimized_prompt")] + public string OptimizedPrompt { get; set; } = string.Empty; + + [JsonPropertyName("recommendations")] + public PromptOptimizationRecommendations Recommendations { get; set; } = new(); +} + +public sealed class PromptOptimizationRecommendations +{ + [JsonPropertyName("clarity_and_directness")] + public string ClarityAndDirectness { get; set; } = string.Empty; + + [JsonPropertyName("examples_and_context")] + public string ExamplesAndContext { get; set; } = string.Empty; + + [JsonPropertyName("sequential_steps")] + public string SequentialSteps { get; set; } = string.Empty; + + [JsonPropertyName("structure_with_markers")] + public string StructureWithMarkers { get; set; } = string.Empty; + + [JsonPropertyName("role_definition")] + public string RoleDefinition { get; set; } = string.Empty; + + [JsonPropertyName("language_choice")] + public string LanguageChoice { get; set; } = string.Empty; +} diff --git a/app/MindWork AI Studio/Assistants/PromptOptimizer/prompting_guideline.md b/app/MindWork AI Studio/Assistants/PromptOptimizer/prompting_guideline.md new file mode 100644 index 00000000..701018e4 --- /dev/null +++ b/app/MindWork AI Studio/Assistants/PromptOptimizer/prompting_guideline.md @@ -0,0 +1,85 @@ +# 1 – Be Clear and Direct + +LLMs respond best to clear, explicit instructions. Being specific about your desired output improves results. If you want high-quality work, ask for it directly rather than expecting the model to guess. + +Think of the LLM as a skilled new employee: They do not know your specific workflows yet. The more precisely you explain what you want, the better the result. + +**Golden Rule:** If a colleague would be confused by your prompt without extra context, the LLM will be too. + +**Less Effective:** +```text +Create an analytics dashboard +``` + +**More Effective:** +```text +Create an analytics dashboard. Include relevant features and interactions. Go beyond the basics to create a fully-featured implementation. +``` + +# 2 – Add Examples and Context to Improve Performance + +Providing examples, context, or the reason behind your instructions helps the model understand your goals. + +**Less Effective:** +```text +NEVER use ellipses +``` + +**More Effective:** +```text +Your response will be read aloud by a text-to-speech engine, so never use ellipses since the engine will not know how to pronounce them. +``` + +The model can generalize from the explanation. + +# 3 – Use Sequential Steps + +When the order of tasks matters, provide instructions as a numbered list. + +**Example:** +```text +1. Analyze the provided text for key themes. +2. Extract the top 5 most frequent terms. +3. Format the output as a table with columns: Term, Frequency, Context. +``` + +# 4 – Structure Prompts with Markers + +Headings (e.g., `#` or `###`) or backticks (` `````` `) help the model parse complex prompts, especially when mixing instructions, context, and data. + +**Less Effective:** +```text +{text input here} + +Summarize the text above as a bullet point list of the most important points. +``` + +**More Effective:** +```text +# Text: +```{text input here}``` + +# Task: +Summarize the text above as a bullet point list of the most important points. +``` + +# 5 – Give the LLM a Role + +Setting a role in your prompt focuses the LLM's behavior and tone. Even a single sentence makes a difference. + +**Example:** +```text +You are a helpful coding assistant specializing in Python. +``` +```text +You are a senior marketing expert with 10 years of experience in the aerospace industry. +``` + +# 6 – Prompt Language + +LLMs are primarily trained on English text. They generally perform best with prompts written in **English**, especially for complex tasks. + +* **Recommendation:** Write your prompts in English. +* **If needed:** You can ask the LLM to respond in your native language (e.g., "Answer in German"). +* **Note:** This is especially important for smaller models, which may have limited multilingual capabilities. + diff --git a/app/MindWork AI Studio/Dialogs/PromptingGuidelineDialog.razor b/app/MindWork AI Studio/Dialogs/PromptingGuidelineDialog.razor new file mode 100644 index 00000000..db50e32b --- /dev/null +++ b/app/MindWork AI Studio/Dialogs/PromptingGuidelineDialog.razor @@ -0,0 +1,26 @@ +@inherits MSGComponentBase + + + + + @T("The full prompting guideline used by the Prompt Optimizer.") + + + +
+ +
+
+
+ + + @T("Close") + + +
diff --git a/app/MindWork AI Studio/Dialogs/PromptingGuidelineDialog.razor.cs b/app/MindWork AI Studio/Dialogs/PromptingGuidelineDialog.razor.cs new file mode 100644 index 00000000..f8672cd9 --- /dev/null +++ b/app/MindWork AI Studio/Dialogs/PromptingGuidelineDialog.razor.cs @@ -0,0 +1,22 @@ +using Microsoft.AspNetCore.Components; +using AIStudio.Components; + +namespace AIStudio.Dialogs; + +public partial class PromptingGuidelineDialog : MSGComponentBase +{ + [CascadingParameter] + private IMudDialogInstance MudDialog { get; set; } = null!; + + [Parameter] + public string GuidelineMarkdown { get; set; } = string.Empty; + + private void Close() => this.MudDialog.Cancel(); + + private CodeBlockTheme CodeColorPalette => this.SettingsManager.IsDarkMode ? CodeBlockTheme.Dark : CodeBlockTheme.Default; + + private MudMarkdownStyling MarkdownStyling => new() + { + CodeBlock = { Theme = this.CodeColorPalette }, + }; +} diff --git a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogPromptOptimizer.razor b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogPromptOptimizer.razor new file mode 100644 index 00000000..e34028f5 --- /dev/null +++ b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogPromptOptimizer.razor @@ -0,0 +1,29 @@ +@using AIStudio.Settings +@inherits SettingsDialogBase + + + + + + @T("Assistant: Prompt Optimizer Options") + + + + + + + @if (this.SettingsManager.ConfigurationData.PromptOptimizer.PreselectedTargetLanguage is CommonLanguages.OTHER) + { + + } + + + + + + + + @T("Close") + + + diff --git a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogPromptOptimizer.razor.cs b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogPromptOptimizer.razor.cs new file mode 100644 index 00000000..c12ec0c3 --- /dev/null +++ b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogPromptOptimizer.razor.cs @@ -0,0 +1,3 @@ +namespace AIStudio.Dialogs.Settings; + +public partial class SettingsDialogPromptOptimizer : SettingsDialogBase; diff --git a/app/MindWork AI Studio/Pages/Assistants.razor b/app/MindWork AI Studio/Pages/Assistants.razor index 8e4896dc..72ee0efe 100644 --- a/app/MindWork AI Studio/Pages/Assistants.razor +++ b/app/MindWork AI Studio/Pages/Assistants.razor @@ -15,6 +15,7 @@ (Components.TRANSLATION_ASSISTANT, PreviewFeatures.NONE), (Components.GRAMMAR_SPELLING_ASSISTANT, PreviewFeatures.NONE), (Components.REWRITE_ASSISTANT, PreviewFeatures.NONE), + (Components.PROMPT_OPTIMIZER_ASSISTANT, PreviewFeatures.NONE), (Components.SYNONYMS_ASSISTANT, PreviewFeatures.NONE) )) { @@ -26,6 +27,7 @@ +
} 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 0a94f7a7..f3082806 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 @@ -1290,6 +1290,150 @@ UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::MYTASKS::ASSISTANTMYTASKS::T534887559"] = -- Please provide a custom language. UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::MYTASKS::ASSISTANTMYTASKS::T656744944"] = "Bitte wählen Sie eine eigene Sprache aus." +-- The custom prompt guide file is empty or could not be read. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1173408044"] = "Der benutzerdefinierte Prompting Leitfaden ist leer oder konnte nicht gelesen werden." + +-- Use English for complex prompts and explicitly request response language if needed. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T119999744"] = "Verwenden Sie Englisch für komplexe Prompts und fordern Sie dann explizit die gewünschte Antwortsprache im Prompt an." + +-- The selected custom prompt guide file could not be found. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1300996373"] = "Der ausgewählte benutzerdefinierte Prompting Leitfaden konnte nicht gefunden werden." + +-- Define a role for the model to focus output style and expertise. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1316122151"] = "Definieren Sie eine Rolle für das Modell, um den Ausgabestil und die Expertise vorzugeben." + +-- Use headings or markers to separate context, task, and constraints. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1435532298"] = "Verwenden Sie Überschriften oder Markierungen, um Kontext, Aufgabe und Einschränkungen zu trennen." + +-- Custom Prompt Guide Preview +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1526658372"] = "Vorschau des benutzerdefinierten Prompting-Leitfadens." + +-- The model response was not in the expected JSON format. The raw response is shown as optimized prompt. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1548376553"] = "Die Modellantwort war nicht im erwarteten JSON-Format. Die Rohantwort wird als optimierter Prompt angezeigt." + +-- View +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1582017048"] = "Anzeigen" + +-- 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." + +-- Add short examples and background context for your specific use case. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1666841672"] = "Fügen Sie kurze Beispiele und Kontext für Ihren spezifischen Anwendungsfall hinzu." + +-- Assign a role to shape tone, expertise, and focus. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1679211785"] = "Weisen Sie eine Rolle zu, um Ton, Expertise und Fokus zu gestalten." + +-- Structure with markers +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1695758233"] = "Mit Markierungen strukturieren" + +-- Please attach and load a valid custom prompt guide file. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1760468309"] = "Bitte hängen Sie einen gültigen Prompting-Leitfaden an." + +-- Prompt Optimizer +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1777666968"] = "Prompt-Optimierer" + +-- Add clearer goals and explicit quality expectations. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1833795299"] = "Fügen Sie klarere Ziele und explizite Qualitätsanforderungen hinzu." + +-- Optimize prompt +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1857716344"] = "Prompt optimieren" + +-- Break the task into numbered steps if order matters. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2185953360"] = "Zerlegen Sie die Aufgabe in nummerierte Schritte, wenn die Reihenfolge wichtig ist." + +-- Please provide a prompt or prompt description. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2228130444"] = "Bitte geben Sie einen Prompt oder eine Beschreibung des Prompts an." + +-- Add examples and context +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2386806593"] = "Beispiele und Kontext hinzufügen" + +-- Custom prompt guide file +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2458417590"] = "Benutzerdefinierter Prompting-Leitfaden" + +-- Use an LLM to optimize your prompt by following either the default or your individual prompt guidelines and get targeted recommendations for future versions of the prompt. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2466607250"] = "Verwenden Sie ein LLM, um Ihren Prompt zu optimieren, indem Sie entweder den Standard- oder Ihren individuellen Prompting-Leitfaden verwenden, und erhalten Sie gezielte Empfehlungen für zukünftige Versionen des Prompts." + +-- Replaced the previously selected custom prompt guide file. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2698103422"] = "Der zuvor ausgewählte benutzerdefinierte Prompting-Leitfaden wurde ersetzt." + +-- (Optional) Important Aspects for the prompt +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2713431429"] = "(Optional) Wichtige Aspekte für die Eingabe" + +-- Use the prompt recommendations from the custom prompt guide. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2830307837"] = "Verwenden Sie die Prompt-Empfehlungen aus dem benutzerdefinierten Prompting-Leitfaden." + +-- Be clear and direct +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2880063041"] = "Sei klar und direkt" + +-- The prompting guideline file could not be loaded. Please verify 'prompting_guideline.md' in Assistants/PromptOptimizer. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T30321193"] = "Die Standarddatei mit den Anweisungen für das Prompting konnte nicht geladen werden. Bitte überprüfen Sie „prompting_guideline.md“ im Ordner Assistants/PromptOptimizer." + +-- Custom language +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3032662264"] = "Benutzerdefinierte Sprache" + +-- Give the model a role +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3420218291"] = "Geben Sie dem Modell eine Rolle" + +-- Failed to load custom prompt guide content. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3488117809"] = "Fehler beim Laden des Inhalts des benutzerdefinierten Prompting-Leitfadens." + +-- No file selected +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3522202289"] = "Keine Datei ausgewählt" + +-- Use custom prompt guide +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3528575759"] = "Benutzerdefinierten Prompting-Leitfaden verwenden" + +-- Prefer numbered steps when task order matters. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3558299393"] = "Bevorzugen Sie nummerierte Schritte, wenn die Reihenfolge der Aufgaben wichtig ist." + +-- Recommendations for your prompt +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3577149599"] = "Empfehlungen für den Prompt" + +-- (Optional) Specify aspects the optimizer should emphasize in the resulting prompt, such as output structure, or constraints. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3686962588"] = "(Optional) Geben Sie Aspekte an, auf die der Optimierer bei der Erstellung des Prompts achten soll, z. B. die Struktur der Ausgabe oder Einschränkungen." + +-- View default prompt guide +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T4017099405"] = "Standard-Prompting-Leitfaden anzeigen" + +-- Prompt or prompt description +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T4058791116"] = "Prompt oder Beschreibung des Prompts" + +-- Include short examples and context that explain the purpose behind your requirements. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T4143206140"] = "Fügen Sie kurze Beispiele und Kontext hinzu, die den Zweck Ihrer Anforderungen erläutern." + +-- Prompting Guideline +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T4250996615"] = "Prompting-Leitfaden" + +-- Use sequential steps +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T487578804"] = "Schrittweise vorgehen" + +-- 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." + +-- Choose prompt language deliberately +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T616613304"] = "Wählen Sie die Prompt-Sprache bewusst aus" + +-- Prompt recommendations were updated based on your latest optimization. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T633382478"] = "Die Prompt-Empfehlungen wurden basierend auf Ihrer letzten Optimierung aktualisiert." + +-- Please provide a custom language. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T656744944"] = "Bitte geben Sie eine benutzerdefinierte Sprache an." + +-- No further recommendation in this area. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T659636347"] = "Keine weiteren Empfehlungen in diesem Bereich." + +-- The prompting guideline file could not be loaded. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T666817418"] = "Die Anleitung für das Prompting konnte nicht geladen werden." + +-- Language for the optimized prompt +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T773621440"] = "Sprache für den optimierten Prompt" + +-- Use these recommendations, that are based on the default prompt guide, to improve your prompts. The suggestions are updated based on your latest prompt optimization. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T805885769"] = "Verwenden Sie diese Empfehlungen, die auf dem Standard-Prompting-Leitfaden basieren, um Ihre Prompts zu verbessern. Die Vorschläge werden basierend auf Ihrer letzten Prompt-Optimierung aktualisiert." + +-- For complex tasks, write prompts in English. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T85710437"] = "Schreiben Sie die Prompts für komplexe Aufgaben in Englisch." + -- Please provide a text as input. You might copy the desired text from a document or a website. UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::REWRITEIMPROVE::ASSISTANTREWRITEIMPROVE::T137304886"] = "Bitte geben Sie einen Text ein. Sie können den gewünschten Text aus einem Dokument oder einer Website kopieren." @@ -3714,6 +3858,15 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROFILEDIALOG::T900713019"] = "Abbrechen" -- The profile name must be unique; the chosen name is already in use. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROFILEDIALOG::T911748898"] = "Der Profilname muss eindeutig sein; der ausgewählte Name wird bereits verwendet." +-- Close +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROMPTINGGUIDELINEDIALOG::T3448155331"] = "Schließen" + +-- The full prompting guideline used by the Prompt Optimizer. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROMPTINGGUIDELINEDIALOG::T384594633"] = "Der vollständige Prompting-Leitfaden, der standardmäßig vom Prompt-Optimierer verwendet wird." + +-- Prompting Guideline +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROMPTINGGUIDELINEDIALOG::T4250996615"] = "Prompting-Leitfaden" + -- Please be aware: This section is for experts only. You are responsible for verifying the correctness of the additional parameters you provide to the API call. By default, AI Studio uses the OpenAI-compatible chat completions API, when that it is supported by the underlying service and model. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROVIDERDIALOG::T1017509792"] = "Bitte beachten Sie: Dieser Bereich ist nur für Expertinnen und Experten. Sie sind dafür verantwortlich, die Korrektheit der zusätzlichen Parameter zu überprüfen, die Sie beim API‑Aufruf angeben. Standardmäßig verwendet AI Studio die OpenAI‑kompatible Chat Completions-API, sofern diese vom zugrunde liegenden Dienst und Modell unterstützt wird." @@ -4641,6 +4794,39 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROFILES::T55364659" -- Are you a project manager in a research facility? You might want to create a profile for your project management activities, one for your scientific work, and a profile for when you need to write program code. In these profiles, you can record how much experience you have or which methods you like or dislike using. Later, you can choose when and where you want to use each profile. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROFILES::T56359901"] = "Sind Sie Projektleiter in einer Forschungseinrichtung? Dann möchten Sie vielleicht ein Profil für ihre Projektmanagement-Aktivitäten anlegen, eines für ihre wissenschaftliche Arbeit und ein weiteres Profil, wenn Sie Programmcode schreiben müssen. In diesen Profilen können Sie festhalten, wie viel Erfahrung Sie haben oder welche Methoden Sie bevorzugen oder nicht gerne verwenden. Später können Sie dann auswählen, wann und wo Sie jedes Profil nutzen möchten." +-- Preselect the target language +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T1417990312"] = "Zielsprache vorwählen" + +-- Preselect another target language +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T1462295644"] = "Wählen Sie eine andere Zielsprache vor" + +-- Assistant: Prompt Optimizer Options +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T2309650422"] = "Assistent: Optionen für die Prompt-Optimierung" + +-- Preselect aspects the optimizer should emphasize, such as role clarity, structure, or output constraints. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T2365571378"] = "Wählen Sie im Voraus Aspekte aus, die der Optimierer betonen soll, wie z. B. Rollenklarheit, Struktur oder Ausgabebeschränkungen." + +-- No prompt optimizer options are preselected +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T2506620531"] = "Keine Prompt-Optimierer-Optionen sind vorausgewählt." + +-- Prompt optimizer options are preselected +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T2576287692"] = "Optionen für den Prompt-Optimizer sind vorausgewählt" + +-- Preselect prompt optimizer options? +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3159686278"] = "Voreingestellte Optionen für den Prompt-Optimierer auswählen?" + +-- Close +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3448155331"] = "Schließen" + +-- Which target language should be preselected? +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3547337928"] = "Welche Zielsprache soll standardmäßig ausgewählt werden?" + +-- When enabled, you can preselect target language, important aspects, and provider defaults for the prompt optimizer assistant. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3570338905"] = "Wenn aktiviert, können Sie die Zielsprache, wichtige Aspekte und Standardwerte des Anbieters für den Prompt-Optimierungs-Assistenten vorab auswählen." + +-- Preselect important aspects +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3705987833"] = "Wichtige Aspekte vorwählen" + -- Which writing style should be preselected? UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGREWRITE::T1173034744"] = "Welcher Schreibstil soll standardmäßig ausgewählt werden?" @@ -5178,9 +5364,15 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1614176092"] = "Assistenten" -- Coding UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1617786407"] = "Programmieren" +-- Optimize your prompt using a structured guideline. +UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1709976267"] = "Optimieren Sie Ihren Prompt mithilfe eines strukturierten Leitfadens." + -- Analyze a text or an email for tasks you need to complete. UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1728590051"] = "Analysieren Sie einen Text oder eine E-Mail nach Aufgaben, die Sie erledigen müssen." +-- Prompt Optimizer +UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1777666968"] = "Prompt-Optimierer" + -- Slide Assistant UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1883918574"] = "Folienassistent" @@ -6147,6 +6339,9 @@ UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T1883918574"] = "Foliena -- Legal Check Assistant UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T1886447798"] = "Rechtlichen Prüfungs-Assistent" +-- Prompt Optimizer Assistant +UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T1993795352"] = "Assistent zur Prompt-Optimierung" + -- Job Posting Assistant UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T2212811874"] = "Stellenanzeigen-Assistent" 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 2849c6d2..783a5ff2 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 @@ -1290,6 +1290,150 @@ UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::MYTASKS::ASSISTANTMYTASKS::T534887559"] = -- Please provide a custom language. UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::MYTASKS::ASSISTANTMYTASKS::T656744944"] = "Please provide a custom language." +-- The custom prompt guide file is empty or could not be read. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1173408044"] = "The custom prompt guide file is empty or could not be read." + +-- Use English for complex prompts and explicitly request response language if needed. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T119999744"] = "Use English for complex prompts and explicitly request response language if needed." + +-- The selected custom prompt guide file could not be found. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1300996373"] = "The selected custom prompt guide file could not be found." + +-- Define a role for the model to focus output style and expertise. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1316122151"] = "Define a role for the model to focus output style and expertise." + +-- Use headings or markers to separate context, task, and constraints. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1435532298"] = "Use headings or markers to separate context, task, and constraints." + +-- Custom Prompt Guide Preview +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1526658372"] = "Custom Prompt Guide Preview" + +-- The model response was not in the expected JSON format. The raw response is shown as optimized prompt. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1548376553"] = "The model response was not in the expected JSON format. The raw response is shown as optimized prompt." + +-- View +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1582017048"] = "View" + +-- 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." + +-- Add short examples and background context for your specific use case. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1666841672"] = "Add short examples and background context for your specific use case." + +-- Assign a role to shape tone, expertise, and focus. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1679211785"] = "Assign a role to shape tone, expertise, and focus." + +-- Structure with markers +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1695758233"] = "Structure with markers" + +-- Please attach and load a valid custom prompt guide file. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1760468309"] = "Please attach and load a valid custom prompt guide file." + +-- Prompt Optimizer +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1777666968"] = "Prompt Optimizer" + +-- Add clearer goals and explicit quality expectations. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1833795299"] = "Add clearer goals and explicit quality expectations." + +-- Optimize prompt +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T1857716344"] = "Optimize prompt" + +-- Break the task into numbered steps if order matters. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2185953360"] = "Break the task into numbered steps if order matters." + +-- Please provide a prompt or prompt description. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2228130444"] = "Please provide a prompt or prompt description." + +-- Add examples and context +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2386806593"] = "Add examples and context" + +-- Custom prompt guide file +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2458417590"] = "Custom prompt guide file" + +-- Use an LLM to optimize your prompt by following either the default or your individual prompt guidelines and get targeted recommendations for future versions of the prompt. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2466607250"] = "Use an LLM to optimize your prompt by following either the default or your individual prompt guidelines and get targeted recommendations for future versions of the prompt." + +-- Replaced the previously selected custom prompt guide file. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2698103422"] = "Replaced the previously selected custom prompt guide file." + +-- (Optional) Important Aspects for the prompt +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2713431429"] = "(Optional) Important Aspects for the prompt" + +-- Use the prompt recommendations from the custom prompt guide. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2830307837"] = "Use the prompt recommendations from the custom prompt guide." + +-- Be clear and direct +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T2880063041"] = "Be clear and direct" + +-- The prompting guideline file could not be loaded. Please verify 'prompting_guideline.md' in Assistants/PromptOptimizer. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T30321193"] = "The prompting guideline file could not be loaded. Please verify 'prompting_guideline.md' in Assistants/PromptOptimizer." + +-- Custom language +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3032662264"] = "Custom language" + +-- Give the model a role +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3420218291"] = "Give the model a role" + +-- Failed to load custom prompt guide content. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3488117809"] = "Failed to load custom prompt guide content." + +-- No file selected +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3522202289"] = "No file selected" + +-- Use custom prompt guide +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3528575759"] = "Use custom prompt guide" + +-- Prefer numbered steps when task order matters. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3558299393"] = "Prefer numbered steps when task order matters." + +-- Recommendations for your prompt +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3577149599"] = "Recommendations for your prompt" + +-- (Optional) Specify aspects the optimizer should emphasize in the resulting prompt, such as output structure, or constraints. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T3686962588"] = "(Optional) Specify aspects the optimizer should emphasize in the resulting prompt, such as output structure, or constraints." + +-- View default prompt guide +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T4017099405"] = "View default prompt guide" + +-- Prompt or prompt description +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T4058791116"] = "Prompt or prompt description" + +-- Include short examples and context that explain the purpose behind your requirements. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T4143206140"] = "Include short examples and context that explain the purpose behind your requirements." + +-- Prompting Guideline +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T4250996615"] = "Prompting Guideline" + +-- Use sequential steps +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T487578804"] = "Use sequential steps" + +-- 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." + +-- Choose prompt language deliberately +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T616613304"] = "Choose prompt language deliberately" + +-- Prompt recommendations were updated based on your latest optimization. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T633382478"] = "Prompt recommendations were updated based on your latest optimization." + +-- Please provide a custom language. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T656744944"] = "Please provide a custom language." + +-- No further recommendation in this area. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T659636347"] = "No further recommendation in this area." + +-- The prompting guideline file could not be loaded. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T666817418"] = "The prompting guideline file could not be loaded." + +-- Language for the optimized prompt +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T773621440"] = "Language for the optimized prompt" + +-- Use these recommendations, that are based on the default prompt guide, to improve your prompts. The suggestions are updated based on your latest prompt optimization. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T805885769"] = "Use these recommendations, that are based on the default prompt guide, to improve your prompts. The suggestions are updated based on your latest prompt optimization." + +-- For complex tasks, write prompts in English. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::PROMPTOPTIMIZER::ASSISTANTPROMPTOPTIMIZER::T85710437"] = "For complex tasks, write prompts in English." + -- Please provide a text as input. You might copy the desired text from a document or a website. UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::REWRITEIMPROVE::ASSISTANTREWRITEIMPROVE::T137304886"] = "Please provide a text as input. You might copy the desired text from a document or a website." @@ -3714,6 +3858,15 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROFILEDIALOG::T900713019"] = "Cancel" -- The profile name must be unique; the chosen name is already in use. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROFILEDIALOG::T911748898"] = "The profile name must be unique; the chosen name is already in use." +-- Close +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROMPTINGGUIDELINEDIALOG::T3448155331"] = "Close" + +-- The full prompting guideline used by the Prompt Optimizer. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROMPTINGGUIDELINEDIALOG::T384594633"] = "The full prompting guideline used by the Prompt Optimizer." + +-- Prompting Guideline +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROMPTINGGUIDELINEDIALOG::T4250996615"] = "Prompting Guideline" + -- Please be aware: This section is for experts only. You are responsible for verifying the correctness of the additional parameters you provide to the API call. By default, AI Studio uses the OpenAI-compatible chat completions API, when that it is supported by the underlying service and model. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::PROVIDERDIALOG::T1017509792"] = "Please be aware: This section is for experts only. You are responsible for verifying the correctness of the additional parameters you provide to the API call. By default, AI Studio uses the OpenAI-compatible chat completions API, when that it is supported by the underlying service and model." @@ -4641,6 +4794,39 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROFILES::T55364659" -- Are you a project manager in a research facility? You might want to create a profile for your project management activities, one for your scientific work, and a profile for when you need to write program code. In these profiles, you can record how much experience you have or which methods you like or dislike using. Later, you can choose when and where you want to use each profile. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROFILES::T56359901"] = "Are you a project manager in a research facility? You might want to create a profile for your project management activities, one for your scientific work, and a profile for when you need to write program code. In these profiles, you can record how much experience you have or which methods you like or dislike using. Later, you can choose when and where you want to use each profile." +-- Preselect the target language +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T1417990312"] = "Preselect the target language" + +-- Preselect another target language +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T1462295644"] = "Preselect another target language" + +-- Assistant: Prompt Optimizer Options +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T2309650422"] = "Assistant: Prompt Optimizer Options" + +-- Preselect aspects the optimizer should emphasize, such as role clarity, structure, or output constraints. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T2365571378"] = "Preselect aspects the optimizer should emphasize, such as role clarity, structure, or output constraints." + +-- No prompt optimizer options are preselected +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T2506620531"] = "No prompt optimizer options are preselected" + +-- Prompt optimizer options are preselected +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T2576287692"] = "Prompt optimizer options are preselected" + +-- Preselect prompt optimizer options? +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3159686278"] = "Preselect prompt optimizer options?" + +-- Close +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3448155331"] = "Close" + +-- Which target language should be preselected? +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3547337928"] = "Which target language should be preselected?" + +-- When enabled, you can preselect target language, important aspects, and provider defaults for the prompt optimizer assistant. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3570338905"] = "When enabled, you can preselect target language, important aspects, and provider defaults for the prompt optimizer assistant." + +-- Preselect important aspects +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROMPTOPTIMIZER::T3705987833"] = "Preselect important aspects" + -- Which writing style should be preselected? UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGREWRITE::T1173034744"] = "Which writing style should be preselected?" @@ -5178,9 +5364,15 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1614176092"] = "Assistants" -- Coding UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1617786407"] = "Coding" +-- Optimize your prompt using a structured guideline. +UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1709976267"] = "Optimize your prompt using a structured guideline." + -- Analyze a text or an email for tasks you need to complete. UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1728590051"] = "Analyze a text or an email for tasks you need to complete." +-- Prompt Optimizer +UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1777666968"] = "Prompt Optimizer" + -- Slide Assistant UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1883918574"] = "Slide Assistant" @@ -6147,6 +6339,9 @@ UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T1883918574"] = "Slide A -- Legal Check Assistant UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T1886447798"] = "Legal Check Assistant" +-- Prompt Optimizer Assistant +UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T1993795352"] = "Prompt Optimizer Assistant" + -- Job Posting Assistant UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T2212811874"] = "Job Posting Assistant" diff --git a/app/MindWork AI Studio/Routes.razor.cs b/app/MindWork AI Studio/Routes.razor.cs index 92ff3067..594170ac 100644 --- a/app/MindWork AI Studio/Routes.razor.cs +++ b/app/MindWork AI Studio/Routes.razor.cs @@ -14,6 +14,7 @@ public sealed partial class Routes // ReSharper disable InconsistentNaming public const string ASSISTANT_TRANSLATION = "/assistant/translation"; public const string ASSISTANT_REWRITE = "/assistant/rewrite-improve"; + public const string ASSISTANT_PROMPT_OPTIMIZER = "/assistant/prompt-optimizer"; public const string ASSISTANT_ICON_FINDER = "/assistant/icons"; public const string ASSISTANT_GRAMMAR_SPELLING = "/assistant/grammar-spelling"; public const string ASSISTANT_SUMMARIZER = "/assistant/summarizer"; diff --git a/app/MindWork AI Studio/Settings/ConfigurableAssistant.cs b/app/MindWork AI Studio/Settings/ConfigurableAssistant.cs index f1076d9e..3b9bb625 100644 --- a/app/MindWork AI Studio/Settings/ConfigurableAssistant.cs +++ b/app/MindWork AI Studio/Settings/ConfigurableAssistant.cs @@ -11,6 +11,7 @@ public enum ConfigurableAssistant GRAMMAR_SPELLING_ASSISTANT, ICON_FINDER_ASSISTANT, REWRITE_ASSISTANT, + PROMPT_OPTIMIZER_ASSISTANT, TRANSLATION_ASSISTANT, AGENDA_ASSISTANT, CODING_ASSISTANT, diff --git a/app/MindWork AI Studio/Settings/DataModel/Data.cs b/app/MindWork AI Studio/Settings/DataModel/Data.cs index 0013fe92..3bc52668 100644 --- a/app/MindWork AI Studio/Settings/DataModel/Data.cs +++ b/app/MindWork AI Studio/Settings/DataModel/Data.cs @@ -115,6 +115,8 @@ public sealed class Data public DataGrammarSpelling GrammarSpelling { get; init; } = new(); public DataRewriteImprove RewriteImprove { get; init; } = new(); + + public DataPromptOptimizer PromptOptimizer { get; init; } = new(); public DataEMail EMail { get; init; } = new(); @@ -131,4 +133,4 @@ public sealed class Data public DataBiasOfTheDay BiasOfTheDay { get; init; } = new(); public DataI18N I18N { get; init; } = new(); -} \ No newline at end of file +} diff --git a/app/MindWork AI Studio/Settings/DataModel/DataPromptOptimizer.cs b/app/MindWork AI Studio/Settings/DataModel/DataPromptOptimizer.cs new file mode 100644 index 00000000..3495393a --- /dev/null +++ b/app/MindWork AI Studio/Settings/DataModel/DataPromptOptimizer.cs @@ -0,0 +1,36 @@ +using AIStudio.Provider; + +namespace AIStudio.Settings.DataModel; + +public sealed class DataPromptOptimizer +{ + /// + /// Preselect prompt optimizer options? + /// + public bool PreselectOptions { get; set; } + + /// + /// Preselect the target language? + /// + public CommonLanguages PreselectedTargetLanguage { get; set; } = CommonLanguages.AS_IS; + + /// + /// Preselect a custom target language when "Other" is selected? + /// + public string PreselectedOtherLanguage { get; set; } = string.Empty; + + /// + /// Preselect important aspects for the optimization. + /// + public string PreselectedImportantAspects { get; set; } = string.Empty; + + /// + /// The minimum confidence level required for a provider to be considered. + /// + public ConfidenceLevel MinimumProviderConfidence { get; set; } = ConfidenceLevel.NONE; + + /// + /// Preselect a provider? + /// + public string PreselectedProvider { get; set; } = string.Empty; +} diff --git a/app/MindWork AI Studio/Tools/AssistantVisibilityExtensions.cs b/app/MindWork AI Studio/Tools/AssistantVisibilityExtensions.cs index cb4e7fdc..8ab8eb88 100644 --- a/app/MindWork AI Studio/Tools/AssistantVisibilityExtensions.cs +++ b/app/MindWork AI Studio/Tools/AssistantVisibilityExtensions.cs @@ -47,6 +47,7 @@ public static bool IsAssistantVisible(this SettingsManager settingsManager, Comp Components.GRAMMAR_SPELLING_ASSISTANT => ConfigurableAssistant.GRAMMAR_SPELLING_ASSISTANT, Components.ICON_FINDER_ASSISTANT => ConfigurableAssistant.ICON_FINDER_ASSISTANT, Components.REWRITE_ASSISTANT => ConfigurableAssistant.REWRITE_ASSISTANT, + Components.PROMPT_OPTIMIZER_ASSISTANT => ConfigurableAssistant.PROMPT_OPTIMIZER_ASSISTANT, Components.TRANSLATION_ASSISTANT => ConfigurableAssistant.TRANSLATION_ASSISTANT, Components.AGENDA_ASSISTANT => ConfigurableAssistant.AGENDA_ASSISTANT, Components.CODING_ASSISTANT => ConfigurableAssistant.CODING_ASSISTANT, diff --git a/app/MindWork AI Studio/Tools/Components.cs b/app/MindWork AI Studio/Tools/Components.cs index 02718736..4b8f47f3 100644 --- a/app/MindWork AI Studio/Tools/Components.cs +++ b/app/MindWork AI Studio/Tools/Components.cs @@ -7,6 +7,7 @@ public enum Components GRAMMAR_SPELLING_ASSISTANT, ICON_FINDER_ASSISTANT, REWRITE_ASSISTANT, + PROMPT_OPTIMIZER_ASSISTANT, TRANSLATION_ASSISTANT, AGENDA_ASSISTANT, CODING_ASSISTANT, @@ -32,4 +33,4 @@ public enum Components AGENT_TEXT_CONTENT_CLEANER, AGENT_DATA_SOURCE_SELECTION, AGENT_RETRIEVAL_CONTEXT_VALIDATION, -} \ No newline at end of file +} diff --git a/app/MindWork AI Studio/Tools/ComponentsExtensions.cs b/app/MindWork AI Studio/Tools/ComponentsExtensions.cs index 70f06380..45167161 100644 --- a/app/MindWork AI Studio/Tools/ComponentsExtensions.cs +++ b/app/MindWork AI Studio/Tools/ComponentsExtensions.cs @@ -35,6 +35,7 @@ public static class ComponentsExtensions Components.ICON_FINDER_ASSISTANT => TB("Icon Finder Assistant"), Components.TRANSLATION_ASSISTANT => TB("Translation Assistant"), Components.REWRITE_ASSISTANT => TB("Rewrite Assistant"), + Components.PROMPT_OPTIMIZER_ASSISTANT => TB("Prompt Optimizer Assistant"), Components.AGENDA_ASSISTANT => TB("Agenda Assistant"), Components.CODING_ASSISTANT => TB("Coding Assistant"), Components.EMAIL_ASSISTANT => TB("E-Mail Assistant"), @@ -57,6 +58,7 @@ public static class ComponentsExtensions Components.AGENDA_ASSISTANT => new(Event.SEND_TO_AGENDA_ASSISTANT, Routes.ASSISTANT_AGENDA), Components.CODING_ASSISTANT => new(Event.SEND_TO_CODING_ASSISTANT, Routes.ASSISTANT_CODING), Components.REWRITE_ASSISTANT => new(Event.SEND_TO_REWRITE_ASSISTANT, Routes.ASSISTANT_REWRITE), + Components.PROMPT_OPTIMIZER_ASSISTANT => new(Event.SEND_TO_PROMPT_OPTIMIZER_ASSISTANT, Routes.ASSISTANT_PROMPT_OPTIMIZER), Components.EMAIL_ASSISTANT => new(Event.SEND_TO_EMAIL_ASSISTANT, Routes.ASSISTANT_EMAIL), Components.TRANSLATION_ASSISTANT => new(Event.SEND_TO_TRANSLATION_ASSISTANT, Routes.ASSISTANT_TRANSLATION), Components.ICON_FINDER_ASSISTANT => new(Event.SEND_TO_ICON_FINDER_ASSISTANT, Routes.ASSISTANT_ICON_FINDER), @@ -79,6 +81,7 @@ public static class ComponentsExtensions Components.GRAMMAR_SPELLING_ASSISTANT => settingsManager.ConfigurationData.GrammarSpelling.PreselectOptions ? settingsManager.ConfigurationData.GrammarSpelling.MinimumProviderConfidence : default, Components.ICON_FINDER_ASSISTANT => settingsManager.ConfigurationData.IconFinder.PreselectOptions ? settingsManager.ConfigurationData.IconFinder.MinimumProviderConfidence : default, Components.REWRITE_ASSISTANT => settingsManager.ConfigurationData.RewriteImprove.PreselectOptions ? settingsManager.ConfigurationData.RewriteImprove.MinimumProviderConfidence : default, + Components.PROMPT_OPTIMIZER_ASSISTANT => settingsManager.ConfigurationData.PromptOptimizer.PreselectOptions ? settingsManager.ConfigurationData.PromptOptimizer.MinimumProviderConfidence : default, Components.TRANSLATION_ASSISTANT => settingsManager.ConfigurationData.Translation.PreselectOptions ? settingsManager.ConfigurationData.Translation.MinimumProviderConfidence : default, Components.AGENDA_ASSISTANT => settingsManager.ConfigurationData.Agenda.PreselectOptions ? settingsManager.ConfigurationData.Agenda.MinimumProviderConfidence : default, Components.CODING_ASSISTANT => settingsManager.ConfigurationData.Coding.PreselectOptions ? settingsManager.ConfigurationData.Coding.MinimumProviderConfidence : default, @@ -107,6 +110,7 @@ public static AIStudio.Settings.Provider PreselectedProvider(this Components com Components.GRAMMAR_SPELLING_ASSISTANT => settingsManager.ConfigurationData.GrammarSpelling.PreselectOptions ? settingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == settingsManager.ConfigurationData.GrammarSpelling.PreselectedProvider) : null, Components.ICON_FINDER_ASSISTANT => settingsManager.ConfigurationData.IconFinder.PreselectOptions ? settingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == settingsManager.ConfigurationData.IconFinder.PreselectedProvider) : null, Components.REWRITE_ASSISTANT => settingsManager.ConfigurationData.RewriteImprove.PreselectOptions ? settingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == settingsManager.ConfigurationData.RewriteImprove.PreselectedProvider) : null, + Components.PROMPT_OPTIMIZER_ASSISTANT => settingsManager.ConfigurationData.PromptOptimizer.PreselectOptions ? settingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == settingsManager.ConfigurationData.PromptOptimizer.PreselectedProvider) : null, Components.TRANSLATION_ASSISTANT => settingsManager.ConfigurationData.Translation.PreselectOptions ? settingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == settingsManager.ConfigurationData.Translation.PreselectedProvider) : null, Components.AGENDA_ASSISTANT => settingsManager.ConfigurationData.Agenda.PreselectOptions ? settingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == settingsManager.ConfigurationData.Agenda.PreselectedProvider) : null, Components.CODING_ASSISTANT => settingsManager.ConfigurationData.Coding.PreselectOptions ? settingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == settingsManager.ConfigurationData.Coding.PreselectedProvider) : null, @@ -167,4 +171,4 @@ public static ProfilePreselection GetProfilePreselection(this Components compone _ => ChatTemplate.NO_CHAT_TEMPLATE, }; -} \ No newline at end of file +} diff --git a/app/MindWork AI Studio/Tools/Event.cs b/app/MindWork AI Studio/Tools/Event.cs index 6e899a79..a9a4f223 100644 --- a/app/MindWork AI Studio/Tools/Event.cs +++ b/app/MindWork AI Studio/Tools/Event.cs @@ -45,6 +45,7 @@ public enum Event SEND_TO_GRAMMAR_SPELLING_ASSISTANT, SEND_TO_ICON_FINDER_ASSISTANT, SEND_TO_REWRITE_ASSISTANT, + SEND_TO_PROMPT_OPTIMIZER_ASSISTANT, SEND_TO_TRANSLATION_ASSISTANT, SEND_TO_AGENDA_ASSISTANT, SEND_TO_CODING_ASSISTANT,