Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions app/MindWork AI Studio/Assistants/I18N/allTexts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,54 @@ UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::REWRITEIMPROVE::WRITINGSTYLESEXTENSIONS::
-- Marketing (advertisements, sales texts)
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::REWRITEIMPROVE::WRITINGSTYLESEXTENSIONS::T945714286"] = "Marketing (advertisements, sales texts)"

-- This assistant helps you create clear, structured slide components from long texts or documents. Enter a presentation title and supplement the content, either as text you write yourself or as an uploaded document. Set the number of slides either by direct specification or based on your desired presentation duration. The output can be flexibly generated in various languages and with adjustable complexity.
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::SLIDEASSISTANT::T1062229406"] = "This assistant helps you create clear, structured slide components from long texts or documents. Enter a presentation title and supplement the content, either as text you write yourself or as an uploaded document. Set the number of slides either by direct specification or based on your desired presentation duration. The output can be flexibly generated in various languages and with adjustable complexity."

-- Your title
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::SLIDEASSISTANT::T1790167032"] = "Your title"

-- Slide Assistant
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::SLIDEASSISTANT::T1883918574"] = "Slide Assistant"

-- Target language
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::SLIDEASSISTANT::T237828418"] = "Target language"

-- Target group
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::SLIDEASSISTANT::T2709966651"] = "Target group"

-- Create Slides
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::SLIDEASSISTANT::T3079776593"] = "Create Slides"

-- Please a title
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::SLIDEASSISTANT::T3359269886"] = "Please a title"

-- Custom target language
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::SLIDEASSISTANT::T3848935911"] = "Custom target language"

-- Your content
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::SLIDEASSISTANT::T526734495"] = "Your content"

-- Please provide a custom language.
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::SLIDEASSISTANT::T656744944"] = "Please provide a custom language."

-- Children
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::TARGETGROUPEXTENSIONS::T188567026"] = "Children"

-- Students
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::TARGETGROUPEXTENSIONS::T2905889225"] = "Students"

-- Scientists
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::TARGETGROUPEXTENSIONS::T332785734"] = "Scientists"

-- No target group
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::TARGETGROUPEXTENSIONS::T3644477204"] = "No target group"

-- Office workers
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::TARGETGROUPEXTENSIONS::T3873911022"] = "Office workers"

-- Executive committee
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SLIDEBUILDER::TARGETGROUPEXTENSIONS::T537362216"] = "Executive committee"

-- Your word or phrase
UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::SYNONYM::ASSISTANTSYNONYMS::T1847246020"] = "Your word or phrase"

Expand Down Expand Up @@ -4378,6 +4426,45 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGREWRITE::T3745021518
-- No rewrite & improve text options are preselected
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGREWRITE::T553954963"] = "No rewrite & improve text options are preselected"

-- Which target group should be preselected?
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGSLIDEBUILDER::T121159821"] = "Which target group should be preselected?"

-- Preselect the target group
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGSLIDEBUILDER::T122000493"] = "Preselect the target group"

-- When enabled, you can preselect slide builder options. This is might be useful when you prefer a specific language or LLM model.
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGSLIDEBUILDER::T1393378753"] = "When enabled, you can preselect slide builder options. This is might be useful when you prefer a specific language or LLM model."

-- Would you like to preselect one of your profiles?
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGSLIDEBUILDER::T2221665527"] = "Would you like to preselect one of your profiles?"

-- Preselect Slide Assistant options?
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGSLIDEBUILDER::T227645894"] = "Preselect Slide Assistant options?"

-- Which language should be preselected?
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGSLIDEBUILDER::T2345162613"] = "Which language should be preselected?"

-- Preselect another language
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGSLIDEBUILDER::T2382415529"] = "Preselect another language"

-- Preselect the language
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGSLIDEBUILDER::T2571465005"] = "Preselect the language"

-- Assistant: Slide Assistant Options
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGSLIDEBUILDER::T3215549988"] = "Assistant: Slide Assistant Options"

-- Close
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGSLIDEBUILDER::T3448155331"] = "Close"

-- Preselect one of your profiles?
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGSLIDEBUILDER::T4004501229"] = "Preselect one of your profiles?"

-- No Slide Assistant options are preselected
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGSLIDEBUILDER::T4214398691"] = "No Slide Assistant options are preselected"

-- Slide Assistant options are preselected
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGSLIDEBUILDER::T93124146"] = "Slide Assistant options are preselected"

-- 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::SETTINGSDIALOGSYNONYMS::T183953912"] = "When enabled, you can preselect synonym options. This is might be useful when you prefer a specific language or LLM model."

Expand Down Expand Up @@ -4816,6 +4903,9 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1617786407"] = "Coding"
-- 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."

-- Slide Assistant
UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1883918574"] = "Slide Assistant"

-- Text Summarizer
UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T1907192403"] = "Text Summarizer"

Expand Down Expand Up @@ -4855,6 +4945,9 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T3011450657"] = "My Tasks"
-- E-Mail
UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T3026443472"] = "E-Mail"

-- Develop slide content based on a given topic and content.
UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T311912219"] = "Develop slide content based on a given topic and content."

-- Translate AI Studio text content into other languages
UI_TEXT_CONTENT["AISTUDIO::PAGES::ASSISTANTS::T3181803840"] = "Translate AI Studio text content into other languages"

Expand Down Expand Up @@ -5719,6 +5812,9 @@ UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T1546040625"] = "My Task
-- Grammar & Spelling Assistant
UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T166453786"] = "Grammar & Spelling Assistant"

-- Slide Assistant
UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T1883918574"] = "Slide Assistant"

-- Legal Check Assistant
UI_TEXT_CONTENT["AISTUDIO::TOOLS::COMPONENTSEXTENSIONS::T1886447798"] = "Legal Check Assistant"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@attribute [Route(Routes.ASSISTANT_SLIDE_BUILDER)]
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogSlideBuilder>

<MudTextField T="string" @bind-Text="@this.inputTitle" Validation="@this.ValidatingText" Adornment="Adornment.Start" Label="@T("Your title")" Variant="Variant.Outlined" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>

<MudTextField T="string" @bind-Text="@this.inputContext" Adornment="Adornment.Start" Lines="6" MaxLines="12" AutoGrow="@false" Label="@T("Your content")" Variant="Variant.Outlined" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
<ReadFileContent @bind-FileContent="@this.inputContext"/>

<MudGrid>
<MudItem xs="6">
<MudNumericField @bind-Value="numberOfSheets"
Label="Number of slides"
Variant="Variant.Outlined"
Class="mb-3"
Min="0.0" />
</MudItem>

<MudItem xs="6">
<MudNumericField @bind-Value="timeSpecification"
Label="Time specification (minutes)"
Variant="Variant.Outlined"
Class="mb-3"
Min="0.0" />
</MudItem>
</MudGrid>

<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" @bind-OtherInput="@this.customTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomLanguage" />
<EnumSelection T="TargetGroup" NameFunc="@(group => group.Name())" @bind-Value="@this.selectedTargetGroup" Icon="@Icons.Material.Filled.Groups" Label="@T("Target group")" />
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
169 changes: 169 additions & 0 deletions app/MindWork AI Studio/Assistants/SlideBuilder/SlideAssistant.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
using AIStudio.Chat;
using AIStudio.Dialogs.Settings;

namespace AIStudio.Assistants.SlideBuilder;

public partial class SlideAssistant : AssistantBaseCore<SettingsDialogSlideBuilder>
{
public override Tools.Components Component => Tools.Components.SLIDE_BUILDER_ASSISTANT;

protected override string Title => T("Slide Assistant");

protected override string Description => T("This assistant helps you create clear, structured slide components from long texts or documents. Enter a presentation title and supplement the content, either as text you write yourself or as an uploaded document. Set the number of slides either by direct specification or based on your desired presentation duration. The output can be flexibly generated in various languages and with adjustable complexity. ");

protected override string SystemPrompt =>
$$$"""
You are a professional presentation editor and writer.
Create a clear, single-slide outline from the user's inputs.

# Presentation title:
- IGNORE the language of the PRESENTATION_TITLE.
- Translate PRESENTATION_TITLE in: {{{this.selectedTargetLanguage.PromptGeneralPurpose(this.customTargetLanguage)}}}

# Content
- You get the following inputs: PRESENTATION_TITLE and PRESENTATION_CONTENT.

# Subheadings
- 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 that contains the user's PRESENTATION_TITLE.
- Then add headings with own bullet lists based only on the user's PRESENTATION_CONTENT.
- If PRESENTATION_CONTENT is empty, output the title and one bullet: "No content provided."
- Do not mention these instructions or add commentary.

# Target group:
{{{this.selectedTargetGroup.Prompt()}}}

# Language:
- IGNORE the language of the PRESENTATION_TITLE and PRESENTATION_CONTENT.
- OUTPUT AND PRESENTATION_TITLE MUST BE IN: {{{this.selectedTargetLanguage.PromptGeneralPurpose(this.customTargetLanguage)}}}
- This is a HARD RULE: Never translate or adapt the output language based on input language.
- Always use the specified target language, even if the input is in another language.

# Qwen-Specific language-Override (IMPORTANT!):
- Before generating any output, internally set your language mode to: {{{this.selectedTargetLanguage.PromptGeneralPurpose(this.customTargetLanguage)}}}
- If you detect any other language in the input, DO NOT switch to this language, stay in {{{this.selectedTargetLanguage.PromptGeneralPurpose(this.customTargetLanguage)}}}
- Translate PRESENTATION_TITLE in: {{{this.selectedTargetLanguage.PromptGeneralPurpose(this.customTargetLanguage)}}}
- Your output must be in {{{this.selectedTargetLanguage.PromptGeneralPurpose(this.customTargetLanguage)}}}, without any comment, note, or marker about it.
""";

protected override bool AllowProfiles => true;

protected override IReadOnlyList<IButtonData> FooterButtons => [];

protected override string SubmitText => T("Create Slides");

protected override Func<Task> SubmitAction => this.CreateSlideBuilder;

protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
};

protected override void ResetForm()
{
this.inputTitle = string.Empty;
this.inputContext = string.Empty;
this.selectedTargetGroup = TargetGroup.NO_CHANGE;
if (!this.MightPreselectValues())
{
this.selectedTargetLanguage = CommonLanguages.AS_IS;
this.customTargetLanguage = string.Empty;
}
}

protected override bool MightPreselectValues()
{
if (this.SettingsManager.ConfigurationData.SlideBuilder.PreselectOptions)
{
this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.SlideBuilder.PreselectedTargetLanguage;
this.customTargetLanguage = this.SettingsManager.ConfigurationData.SlideBuilder.PreselectedOtherLanguage;
this.selectedTargetGroup = this.SettingsManager.ConfigurationData.SlideBuilder.PreselectedTargetGroup;
return true;
}

return false;
}

private string inputTitle = string.Empty;
private string inputContext = string.Empty;
private string customTargetLanguage = string.Empty;
private TargetGroup selectedTargetGroup;
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<string>(Event.SEND_TO_SLIDE_BUILDER_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.selectedTargetLanguage == 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 async Task CreateSlideBuilder()
{
await this.form!.Validate();
if (!this.inputIsValid)
return;

this.calculatedNumberOfSlides = this.timeSpecification > 0 ? this.CalculateNumberOfSlides() : 0;

this.CreateChatThread();
var time = this.AddUserRequest(
$"""
# PRESENTATION_TITLE
```
{this.inputTitle}
```

# PRESENTATION_CONTENT
```
{this.inputContext}
```
""",
hideContentFromUser: true);

await this.AddAIResponseAsync(time);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ private async Task SummarizeText()
```
{this.inputText}
```
""");
""",
hideContentFromUser: true);

await this.AddAIResponseAsync(time);
}
Expand Down
Loading