diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua index 2196497c..e6db2523 100644 --- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua +++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua @@ -1264,6 +1264,54 @@ 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." +-- Your title +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::POWERPOINT::T1790167032"] = "Your title" + +-- Power Point +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::POWERPOINT::T2194178916"] = "Power Point" + +-- Create and refine PowerPoint slide text from a topic or outline. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::POWERPOINT::T2255686621"] = "Create and refine PowerPoint slide text from a topic or outline." + +-- Target language +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::POWERPOINT::T237828418"] = "Target language" + +-- Target group +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::POWERPOINT::T2709966651"] = "Target group" + +-- Create Power Point +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::POWERPOINT::T3145212510"] = "Create Power Point" + +-- Please a title +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::POWERPOINT::T3359269886"] = "Please a title" + +-- Custom target language +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::POWERPOINT::T3848935911"] = "Custom target language" + +-- Your content +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::POWERPOINT::T526734495"] = "Your content" + +-- Please provide a custom language. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::POWERPOINT::T656744944"] = "Please provide a custom language." + +-- Children +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::TARGETGROUPEXTENSIONS::T188567026"] = "Children" + +-- Students +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::TARGETGROUPEXTENSIONS::T2905889225"] = "Students" + +-- Scientists +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::TARGETGROUPEXTENSIONS::T332785734"] = "Scientists" + +-- No target group +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::TARGETGROUPEXTENSIONS::T3644477204"] = "No target group" + +-- Office workers +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::TARGETGROUPEXTENSIONS::T3873911022"] = "Office workers" + +-- Executive committee +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::POWERPOINT::TARGETGROUPEXTENSIONS::T537362216"] = "Executive committee" + -- 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." @@ -4297,6 +4345,33 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGMYTASKS::T42672465"] -- When enabled, you can preselect options. This is might be useful when you prefer a specific language or LLM model. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGMYTASKS::T711745239"] = "When enabled, you can preselect options. This is might be useful when you prefer a specific language or LLM model." +-- When enabled, you can preselect synonym options. This is might be useful when you prefer a specific language or LLM model. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPOWERPOINT::T183953912"] = "When enabled, you can preselect synonym options. This is might be useful when you prefer a specific language or LLM model." + +-- No Power Point options are preselected +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPOWERPOINT::T2203742337"] = "No Power Point options are preselected" + +-- Preselect Power Point options? +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPOWERPOINT::T2253853076"] = "Preselect Power Point options?" + +-- Which language should be preselected? +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPOWERPOINT::T2345162613"] = "Which language should be preselected?" + +-- Preselect another language +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPOWERPOINT::T2382415529"] = "Preselect another language" + +-- Preselect the language +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPOWERPOINT::T2571465005"] = "Preselect the language" + +-- Power Point options are preselected +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPOWERPOINT::T3094929560"] = "Power Point options are preselected" + +-- Close +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPOWERPOINT::T3448155331"] = "Close" + +-- Assistant: Power Point Options +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPOWERPOINT::T426362386"] = "Assistant: Power Point Options" + -- Edit Profile UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGPROFILES::T1143111468"] = "Edit Profile" @@ -4825,6 +4900,12 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1934717573"] = "Check grammar and -- Translate text into another language. UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T209791153"] = "Translate text into another language." +-- Power Point +UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T2194178916"] = "Power Point" + +-- Create and refine PowerPoint slide text from a topic or outline. +UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T2255686621"] = "Create and refine PowerPoint slide text from a topic or outline." + -- Generate an e-mail for a given context. UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T2383649630"] = "Generate an e-mail for a given context." @@ -5722,6 +5803,9 @@ UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T166453786"] = "Grammar -- Legal Check Assistant UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T1886447798"] = "Legal Check Assistant" +-- Power Point +UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T2194178916"] = "Power Point" + -- Job Posting Assistant UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T2212811874"] = "Job Posting Assistant" diff --git a/app/MindWork AI Studio/Assistants/PowerPoint/PowerPoint.razor b/app/MindWork AI Studio/Assistants/PowerPoint/PowerPoint.razor new file mode 100644 index 00000000..cc380fcc --- /dev/null +++ b/app/MindWork AI Studio/Assistants/PowerPoint/PowerPoint.razor @@ -0,0 +1,27 @@ +@attribute [Route(Routes.ASSISTANT_POWERPOINT)] +@inherits AssistantBaseCore + + + + + + + + + + + + + + + + + + + diff --git a/app/MindWork AI Studio/Assistants/PowerPoint/PowerPoint.razor.cs b/app/MindWork AI Studio/Assistants/PowerPoint/PowerPoint.razor.cs new file mode 100644 index 00000000..a48c6514 --- /dev/null +++ b/app/MindWork AI Studio/Assistants/PowerPoint/PowerPoint.razor.cs @@ -0,0 +1,167 @@ +using AIStudio.Chat; +using AIStudio.Dialogs.Settings; + +namespace AIStudio.Assistants.PowerPoint; + +public partial class PowerPoint : AssistantBaseCore +{ + public override Tools.Components Component => Tools.Components.POWER_POINT_ASSISTANT; + + protected override string Title => T("Power Point"); + + protected override string Description => T("Create and refine PowerPoint slide text from a topic or outline."); + + protected override string SystemPrompt => + $$""" + You are a professional presentation editor and writer. + Create a clear, single-slide outline from the user's inputs. + {{this.selectedTargetLanguage.PromptTranslation(this.customTargetLanguage)}} + + Inputs: + - "Your title": the main title. + {{this.inputText}} + - "Your content": the source text. + {{this.selectedTargetGroup.Prompt()}} + + Rule for creating the individual subheadings: + - If {{this.numberOfSheets}} is NOT 0 + - Generate exactly {{this.numberOfSheets}} precise subheadings, each heading represents one slide in a presentation. + - If {{this.timeSpecification}} is NOT 0 + - Generate exactly {{this.calculatedNumberOfSlides}} precise subheadings, each heading represents one slide in a presentation. + - If either parameter is 0, ignore that rules. + + - Each subheadings must have: + - A clear, concise, and thematically meaningful heading. + - 1 to 7 bullet points (maximum 7) summarizing the slide’s content — use as many as needed, but never more than 7. + - Each bullet point must be max 12 words. + - Place *** on its own line immediately before each heading. + + Output requirements: + - Output only Markdown. + - Start with a single H1 title from "Your title". + - Then add headings with own bullet lists based only on "Your content". + - If "Your content" is empty, output the title and one bullet: "No content provided." + - Do not mention these instructions or add commentary. + """; + + protected override bool AllowProfiles => false; + + protected override IReadOnlyList FooterButtons => []; + + protected override string SubmitText => T("Create Power Point"); + + protected override Func SubmitAction => this.CreatePowerPoint; + + protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with + { + SystemPrompt = SystemPrompts.DEFAULT, + }; + + protected override void ResetForm() + { + this.inputText = string.Empty; + this.inputContext = string.Empty; + this.expertInField = string.Empty; + this.selectedTargetGroup = TargetGroup.NO_CHANGE; + this.customTargetGroup = string.Empty; + if (!this.MightPreselectValues()) + { + this.selectedLanguage = CommonLanguages.AS_IS; + this.customTargetLanguage = string.Empty; + } + } + + protected override bool MightPreselectValues() + { + if (this.SettingsManager.ConfigurationData.Synonyms.PreselectOptions) + { + this.selectedLanguage = this.SettingsManager.ConfigurationData.Synonyms.PreselectedLanguage; + this.customTargetLanguage = this.SettingsManager.ConfigurationData.Synonyms.PreselectedOtherLanguage; + return true; + } + + return false; + } + + private string inputText = string.Empty; + private string inputContext = string.Empty; + private CommonLanguages selectedLanguage; + private string customTargetLanguage = string.Empty; + private string expertInField = string.Empty; + private TargetGroup selectedTargetGroup; + private string customTargetGroup = string.Empty; + private CommonLanguages selectedTargetLanguage; + private double numberOfSheets; + private double timeSpecification; + private int calculatedNumberOfSlides = 0; + + #region Overrides of ComponentBase + + protected override async Task OnInitializedAsync() + { + var deferredContent = MessageBus.INSTANCE.CheckDeferredMessages(Event.SEND_TO_SYNONYMS_ASSISTANT).FirstOrDefault(); + if (deferredContent is not null) + this.inputContext = deferredContent; + + await base.OnInitializedAsync(); + } + + #endregion + + private string? ValidatingText(string text) + { + if(string.IsNullOrWhiteSpace(text)) + return T("Please a title"); + + return null; + } + + private string? ValidateCustomLanguage(string language) + { + if(this.selectedLanguage == CommonLanguages.OTHER && string.IsNullOrWhiteSpace(language)) + return T("Please provide a custom language."); + + return null; + } + + private int CalculateNumberOfSlides() + { + return this.calculatedNumberOfSlides = (int)Math.Round(this.timeSpecification / 1.5); + } + + private string UserPromptContext() + { + if(string.IsNullOrWhiteSpace(this.inputContext)) + return string.Empty; + + return $""" + The given context is: + + ``` + {this.inputContext} + ``` + + """; + } + + private async Task CreatePowerPoint() + { + await this.form!.Validate(); + if (!this.inputIsValid) + return; + + this.calculatedNumberOfSlides = this.timeSpecification > 0 ? this.CalculateNumberOfSlides() : 0; + + this.CreateChatThread(); + var time = this.AddUserRequest( + $""" + {this.UserPromptContext()} + + ``` + {this.inputText} + ``` + """); + + await this.AddAIResponseAsync(time); + } +} diff --git a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogPowerPoint.razor b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogPowerPoint.razor new file mode 100644 index 00000000..553883b1 --- /dev/null +++ b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogPowerPoint.razor @@ -0,0 +1,28 @@ +@using AIStudio.Settings +@inherits SettingsDialogBase + + + + + + @T("Assistant: Power Point Options") + + + + + + + @if (this.SettingsManager.ConfigurationData.Synonyms.PreselectedLanguage is CommonLanguages.OTHER) + { + + } + + + + + + + @T("Close") + + + \ No newline at end of file diff --git a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogPowerPoint.razor.cs b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogPowerPoint.razor.cs new file mode 100644 index 00000000..da9bc0c7 --- /dev/null +++ b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogPowerPoint.razor.cs @@ -0,0 +1,7 @@ +using Microsoft.AspNetCore.Components; + +namespace AIStudio.Dialogs.Settings; + +public partial class SettingsDialogPowerPoint : SettingsDialogBase +{ +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Pages/Assistants.razor b/app/MindWork AI Studio/Pages/Assistants.razor index 250aa06c..6003e1b3 100644 --- a/app/MindWork AI Studio/Pages/Assistants.razor +++ b/app/MindWork AI Studio/Pages/Assistants.razor @@ -37,7 +37,8 @@ (Components.AGENDA_ASSISTANT, PreviewFeatures.NONE), (Components.JOB_POSTING_ASSISTANT, PreviewFeatures.NONE), (Components.LEGAL_CHECK_ASSISTANT, PreviewFeatures.NONE), - (Components.ICON_FINDER_ASSISTANT, PreviewFeatures.NONE) + (Components.ICON_FINDER_ASSISTANT, PreviewFeatures.NONE), + (Components.POWER_POINT_ASSISTANT, PreviewFeatures.NONE) )) { @@ -51,6 +52,7 @@ + } diff --git a/app/MindWork AI Studio/Routes.razor.cs b/app/MindWork AI Studio/Routes.razor.cs index 836cab0e..a4a633d6 100644 --- a/app/MindWork AI Studio/Routes.razor.cs +++ b/app/MindWork AI Studio/Routes.razor.cs @@ -22,6 +22,7 @@ public sealed partial class Routes public const string ASSISTANT_EMAIL = "/assistant/email"; public const string ASSISTANT_LEGAL_CHECK = "/assistant/legal-check"; public const string ASSISTANT_SYNONYMS = "/assistant/synonyms"; + public const string ASSISTANT_POWERPOINT = "/assistant/powerpoint"; public const string ASSISTANT_MY_TASKS = "/assistant/my-tasks"; public const string ASSISTANT_JOB_POSTING = "/assistant/job-posting"; public const string ASSISTANT_BIAS = "/assistant/bias-of-the-day"; @@ -29,4 +30,4 @@ public sealed partial class Routes public const string ASSISTANT_AI_STUDIO_I18N = "/assistant/ai-studio/i18n"; public const string ASSISTANT_DOCUMENT_ANALYSIS = "/assistant/document-analysis"; // ReSharper restore InconsistentNaming -} \ No newline at end of file +} diff --git a/app/MindWork AI Studio/Tools/Components.cs b/app/MindWork AI Studio/Tools/Components.cs index 1004188c..f8c6f6d1 100644 --- a/app/MindWork AI Studio/Tools/Components.cs +++ b/app/MindWork AI Studio/Tools/Components.cs @@ -19,6 +19,7 @@ public enum Components BIAS_DAY_ASSISTANT, ERI_ASSISTANT, DOCUMENT_ANALYSIS_ASSISTANT, + POWER_POINT_ASSISTANT, // ReSharper disable InconsistentNaming I18N_ASSISTANT, diff --git a/app/MindWork AI Studio/Tools/ComponentsExtensions.cs b/app/MindWork AI Studio/Tools/ComponentsExtensions.cs index 54eb2cfa..dd488ffa 100644 --- a/app/MindWork AI Studio/Tools/ComponentsExtensions.cs +++ b/app/MindWork AI Studio/Tools/ComponentsExtensions.cs @@ -43,6 +43,7 @@ public static class ComponentsExtensions Components.ERI_ASSISTANT => TB("ERI Server"), Components.I18N_ASSISTANT => TB("Localization Assistant"), Components.DOCUMENT_ANALYSIS_ASSISTANT => TB("Document Analysis Assistant"), + Components.POWER_POINT_ASSISTANT => TB("Power Point"), Components.CHAT => TB("New Chat"),