Fixed and improved the system prompt of chats started from assistants (#1172)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-06 17:44:58 +01:00
1 parent bbf4dc2231
commit 31862f5ecd
50 files changed
+1112 -107

No files matched your search

@@ -12,6 +12,9 @@ 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.");
// The prompt of this assistant asks for the summary only, so the chat gets a prompt of its own, which keeps the settings of the summary:
protected override ChatSystemPromptChoice ChatSystemPrompt => ChatSystemPromptChoice.Custom(this.CreateChatSystemPrompt);
protected override string SystemPrompt =>
$"""
You get a long text as input. The text is marked with ```. The user wants to get a summary of the text.
@@ -20,6 +23,24 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
{this.PromptImportantAspects()}
In any case, only use information that is provided in the text for the summary.
""";
/// <summary>
/// Creates the system prompt of a chat which continues a summary, for follow-up questions about it.
/// </summary>
private string CreateChatSystemPrompt() =>
$"""
You are an expert in summarizing texts. The user had a long text summarized: the conversation so far holds the
text and its summary. Now you answer the user's follow-up questions about the text and the summary, e.g., what
a passage means or why the summary leaves something out, and you revise the summary when the user asks for it.
A summary uses only information which the text provides. When an answer goes beyond the text, say so.
The user chose these settings for the summary, which a revised summary keeps unless the user asks otherwise:
{this.selectedTargetLanguage.PromptSummarizing(this.customTargetLanguage)}
{this.selectedComplexity.Prompt(this.expertInField)}
{this.PromptImportantAspects()}
Answer questions in the language the user writes in.
""";
protected override bool AllowProfiles => false;