Refactored default system prompt to use date and time (UTC & local)

This commit is contained in:
Thorsten Sommer 2026-01-15 21:48:54 +01:00
parent 9e55d5461f
commit 0b006cd330
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
15 changed files with 30 additions and 16 deletions

View File

@ -99,7 +99,7 @@ public partial class AssistantAgenda : AssistantBaseCore<SettingsDialogAgenda>
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
};
protected override void ResetForm()

View File

@ -120,7 +120,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<SettingsDialo
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
};
protected override void ResetForm()

View File

@ -28,7 +28,7 @@ public partial class AssistantEMail : AssistantBaseCore<SettingsDialogWritingEMa
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
};
protected override void ResetForm()

View File

@ -43,7 +43,7 @@ public partial class AssistantGrammarSpelling : AssistantBaseCore<SettingsDialog
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
};
protected override void ResetForm()

View File

@ -53,7 +53,7 @@ public partial class AssistantJobPostings : AssistantBaseCore<SettingsDialogJobP
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
};
protected override void ResetForm()

View File

@ -30,7 +30,7 @@ public partial class AssistantLegalCheck : AssistantBaseCore<SettingsDialogLegal
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
};
protected override void ResetForm()

View File

@ -33,7 +33,7 @@ public partial class AssistantMyTasks : AssistantBaseCore<SettingsDialogMyTasks>
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
};
protected override void ResetForm()

View File

@ -44,7 +44,7 @@ public partial class AssistantRewriteImprove : AssistantBaseCore<SettingsDialogR
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
};
protected override void ResetForm()

View File

@ -55,7 +55,7 @@ public partial class AssistantSynonyms : AssistantBaseCore<SettingsDialogSynonym
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
};
protected override void ResetForm()

View File

@ -32,7 +32,7 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
};
protected override void ResetForm()

View File

@ -31,7 +31,7 @@ public partial class AssistantTranslation : AssistantBaseCore<SettingsDialogTran
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
{
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
};
protected override void ResetForm()

View File

@ -1,6 +1,20 @@
using System.Globalization;
namespace AIStudio.Chat;
public static class SystemPrompts
{
public static readonly string DEFAULT = $"You are a helpful assistant! Today is {DateTime.Today:yyyy-MM-dd}.";
public static string Default
{
get
{
var nowUtc = DateTime.UtcNow;
var nowLocal = DateTime.Now;
return string.Create(
new CultureInfo("en-US"),
$"Today is {nowUtc:MMMM d, yyyy h:mm tt} (UTC) and {nowLocal:MMMM d, yyyy h:mm tt} (local time)."
);
}
}
}

View File

@ -439,7 +439,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
SelectedProvider = this.Provider.Id,
SelectedProfile = this.currentProfile.Id,
SelectedChatTemplate = this.currentChatTemplate.Id,
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
WorkspaceId = this.currentWorkspaceId,
ChatId = Guid.NewGuid(),
DataSourceOptions = this.earlyDataSourceOptions,
@ -679,7 +679,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
SelectedProvider = this.Provider.Id,
SelectedProfile = this.currentProfile.Id,
SelectedChatTemplate = this.currentChatTemplate.Id,
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
WorkspaceId = this.currentWorkspaceId,
ChatId = Guid.NewGuid(),
Name = string.Empty,

View File

@ -573,7 +573,7 @@ public partial class Workspaces : MSGComponentBase
WorkspaceId = workspaceId,
ChatId = Guid.NewGuid(),
Name = string.Empty,
SystemPrompt = SystemPrompts.DEFAULT,
SystemPrompt = SystemPrompts.Default,
Blocks = [],
};

View File

@ -263,7 +263,7 @@ public partial class ChatTemplateDialog : MSGComponentBase
private void UseDefaultSystemPrompt()
{
this.DataSystemPrompt = SystemPrompts.DEFAULT;
this.DataSystemPrompt = SystemPrompts.Default;
}
private void Cancel() => this.MudDialog.Cancel();