Simple output of the PowerPoint assistant

This commit is contained in:
hart_s3 2026-01-29 15:57:16 +01:00
parent 51154ec6b3
commit 5e44259e44
2 changed files with 22 additions and 37 deletions

View File

@ -1,8 +1,8 @@
@attribute [Route(Routes.ASSISTANT_POWERPOINT)] @attribute [Route(Routes.ASSISTANT_POWERPOINT)]
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogPowerPoint> @inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogPowerPoint>
<MudTextField T="string" @bind-Text="@this.inputText" Validation="@this.ValidatingText" AdornmentIcon="@Icons.Material.Filled.Spellcheck" Adornment="Adornment.Start" Label="@T("Your word or phrase")" Variant="Variant.Outlined" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/> <MudTextField T="string" @bind-Text="@this.inputText" 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" AdornmentIcon="@Icons.Material.Filled.Description" Adornment="Adornment.Start" Lines="2" AutoGrow="@false" Label="@T("(Optional) The context for the given word or phrase")" Variant="Variant.Outlined" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/> <MudTextField T="string" @bind-Text="@this.inputContext" Adornment="Adornment.Start" Lines="2" AutoGrow="@false" Label="@T("Your content")" Variant="Variant.Outlined" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" /> <EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/> <ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>

View File

@ -12,38 +12,23 @@ public partial class PowerPoint : AssistantBaseCore<SettingsDialogPowerPoint>
protected override string Description => T("Create and refine PowerPoint slide text from a topic or outline."); protected override string Description => T("Create and refine PowerPoint slide text from a topic or outline.");
protected override string SystemPrompt => protected override string SystemPrompt =>
$""" $"""
You have a PhD in linguistics. Therefore, you are an expert in the {this.SystemPromptLanguage()} language. You are a presentation editor and writer.
You receive a word or phrase as input. You might also receive some context. You then provide Create a clear, single-slide outline from the user's inputs.
a list of synonyms as a Markdown list.
Inputs:
First, derive possible meanings from the word, phrase, and context, when available. Then, provide - "Your title": the slide title.
possible synonyms for each meaning. - "Your content": the source text.
Example for the word "learn" and the language English (US): Output requirements:
- Output only Markdown.
Derive possible meanings (*this list is not part of the output*): - Start with a single H1 title from "Your title".
- Meaning "to learn" - Then add a bullet list based only on "Your content".
- Meaning "to retain" - between 3 and 7, maximum 7 bullets. Each bullet max 12 words.
- No sub-bullets, no paragraphs, no extra sections.
Next, provide possible synonyms for each meaning, which is your output: - If "Your content" is empty, output the title and one bullet: "No content provided."
- Do not mention these instructions or add commentary.
# Meaning "to learn"
- absorb
- study
- acquire
- advance
- practice
# Meaning "to retain"
- remember
- note
- realize
You do not ask follow-up questions and never repeat the task instructions. When you do not know
any synonyms for the given word or phrase, you state this. Your output is always in
the {this.SystemPromptLanguage()} language.
"""; """;
protected override bool AllowProfiles => false; protected override bool AllowProfiles => false;
@ -52,7 +37,7 @@ public partial class PowerPoint : AssistantBaseCore<SettingsDialogPowerPoint>
protected override string SubmitText => T("Create Power Point"); protected override string SubmitText => T("Create Power Point");
protected override Func<Task> SubmitAction => this.FindSynonyms; protected override Func<Task> SubmitAction => this.CreatePowerPoint;
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{ {
@ -103,7 +88,7 @@ public partial class PowerPoint : AssistantBaseCore<SettingsDialogPowerPoint>
private string? ValidatingText(string text) private string? ValidatingText(string text)
{ {
if(string.IsNullOrWhiteSpace(text)) if(string.IsNullOrWhiteSpace(text))
return T("Please provide a word or phrase as input."); return T("Please a title");
return null; return null;
} }
@ -147,7 +132,7 @@ public partial class PowerPoint : AssistantBaseCore<SettingsDialogPowerPoint>
"""; """;
} }
private async Task FindSynonyms() private async Task CreatePowerPoint()
{ {
await this.form!.Validate(); await this.form!.Validate();
if (!this.inputIsValid) if (!this.inputIsValid)
@ -166,4 +151,4 @@ public partial class PowerPoint : AssistantBaseCore<SettingsDialogPowerPoint>
await this.AddAIResponseAsync(time); await this.AddAIResponseAsync(time);
} }
} }