mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-10-08 19:40:21 +00:00
Changed the System Prompt to incorporate the user's wishes.
This commit is contained in:
parent
4ebef7f97a
commit
c584da2b9d
@ -10,5 +10,5 @@
|
||||
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputText" Validation="@this.ValidatingText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Your input")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||
<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="Complexity" NameFunc="@(complexity => complexity.Name())" @bind-Value="@this.selectedComplexity" Icon="@Icons.Material.Filled.Layers" Label="@T("Target complexity")" AllowOther="@true" @bind-OtherInput="@this.expertInField" OtherValue="Complexity.SCIENTIFIC_LANGUAGE_OTHER_EXPERTS" LabelOther="@T("Your expertise")" ValidateOther="@this.ValidateExpertInField" />
|
||||
<MudTextField T="string" AutoGrow="true" @bind-Text="@this.importantAspects" class="mb-3" HelperText="@T("Specify aspects for the LLM to focus on when generating a summary, such as summary length or specific topics to emphasize.")" Label="@T("Important Aspects")" Lines="2" ShrinkLabel="true" Variant="Variant.Outlined" />
|
||||
<MudTextField T="string" AutoGrow="true" Lines="2" @bind-Text="@this.importantAspects" class="mb-3" Label="@T("(Optional) Important Aspects")" HelperText="@T("(Optional) Specify aspects for the LLM to focus on when generating a summary, such as summary length or specific topics to emphasize.")" ShrinkLabel="true" Variant="Variant.Outlined" />
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
@ -12,13 +12,13 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
|
||||
protected override string Description => T("Summarize long text into a shorter version while retaining the main points. You might want to change the language of the summary to make it more readable. It is also possible to change the complexity of the summary to make it easy to understand.");
|
||||
|
||||
protected override string SystemPrompt =>
|
||||
"""
|
||||
You get a long text as input. The user wants to get a summary of the text.
|
||||
The user might want to change the language of the summary. In this case,
|
||||
you should provide a summary in the requested language. Eventually, the user
|
||||
want to change the complexity of the text. In this case, you should provide
|
||||
a summary with the requested complexity. In any case, do not add any information.
|
||||
""";
|
||||
$"""
|
||||
You get a long text as input. The text is marked with ```. The user wants to get a summary of the text.
|
||||
{this.selectedTargetLanguage.PromptSummarizing(this.customTargetLanguage)}
|
||||
{this.selectedComplexity.Prompt(this.expertInField)}
|
||||
{this.PromptImportantAspects(this.importantAspects)}
|
||||
In any case, only use information that is provided in the text for the summary.
|
||||
""";
|
||||
|
||||
protected override bool AllowProfiles => false;
|
||||
|
||||
@ -108,6 +108,17 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
|
||||
return null;
|
||||
}
|
||||
|
||||
private string PromptImportantAspects(string importantAspectsForPrompt)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(importantAspectsForPrompt))
|
||||
return string.Empty;
|
||||
|
||||
return $"""
|
||||
Emphasize the following aspects in your summary:
|
||||
{importantAspectsForPrompt}
|
||||
""";
|
||||
}
|
||||
|
||||
private async Task SummarizeText()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
@ -117,16 +128,7 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
|
||||
this.CreateChatThread();
|
||||
var time = this.AddUserRequest(
|
||||
$"""
|
||||
{this.selectedTargetLanguage.PromptSummarizing(this.customTargetLanguage)}
|
||||
{this.selectedComplexity.Prompt(this.expertInField)}
|
||||
|
||||
Put an emphasis on the following aspects when writing your summary:
|
||||
```
|
||||
{this.importantAspects}
|
||||
```
|
||||
|
||||
Please summarize the following text. Only the language of this text is important for your instructions.
|
||||
|
||||
Please summarize the following text:
|
||||
```
|
||||
{this.inputText}
|
||||
```
|
||||
|
@ -46,7 +46,7 @@ public static class CommonLanguageExtensions
|
||||
|
||||
public static string PromptSummarizing(this CommonLanguages language, string customLanguage) => language switch
|
||||
{
|
||||
CommonLanguages.AS_IS => "Do not change the language of the text.",
|
||||
CommonLanguages.AS_IS => "Use the language the text is written in for the summary.",
|
||||
CommonLanguages.OTHER => $"Output your summary in {customLanguage}.",
|
||||
|
||||
_ => $"Output your summary in {language.Name()} ({language}).",
|
||||
|
Loading…
Reference in New Issue
Block a user