2026-10-16 17:22:23 +02:00
@using AIStudio.Tools.PluginSystem
2025-05-25 10:33:13 +02:00
@inherits SettingsDialogBase
2026-10-20 08:35:44 +02:00
<MudDialog ContentClass="dialog-content-aligned" ActionsClass="dialog-actions-aligned">
2025-05-25 10:33:13 +02:00
<TitleContent>
<MudText Typo="Typo.h6" Class="d-flex align-center">
2026-11-11 14:20:49 +01:00
<MudIcon Icon="@AppIcons.CHAT_TEMPLATE" Class="mr-2" />
2026-11-13 10:16:56 +01:00
@TA("Your Chat Templates")
2025-05-25 10:33:13 +02:00
</MudText>
</TitleContent>
<DialogContent>
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
2026-11-13 10:16:56 +01:00
@TA("Customize your AI experience with chat templates. Whether you want to experiment with prompt engineering, simply use a custom system prompt in the standard chat interface, or create a specialized assistant, our templates give you full control. Similar to common AI companies' playgrounds, you can define your own system prompts and leverage assistant prompts for providers that support them.")
2025-05-25 10:33:13 +02:00
</MudJustifiedText>
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
2026-11-13 10:16:56 +01:00
@TA("Note: This advanced feature is designed for users familiar with prompt engineering concepts. Furthermore, you have to make sure yourself that your chosen provider supports the use of assistant prompts.")
2025-05-25 10:33:13 +02:00
</MudJustifiedText>
<MudTable Items="@this.SettingsManager.ConfigurationData.ChatTemplates" Hover="@true" Class="border-dashed border rounded-lg">
<ColGroup>
<col style="width: 3em;"/>
<col/>
<col style="width: 16em;"/>
</ColGroup>
<HeaderContent>
<MudTh>#</MudTh>
<MudTh>@T("Chat Template Name")</MudTh>
<MudTh>@T("Actions")</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd>@context.Num</MudTd>
<MudTd>@context.Name</MudTd>
<MudTd>
2025-08-18 20:40:52 +02:00
@if (context.IsEnterpriseConfiguration)
{
2026-06-20 17:06:43 +02:00
<MudStack Row="true" Class="mb-2 mt-2" Wrap="Wrap.Wrap">
2026-11-13 10:16:56 +01:00
<MudTooltip Text="@TA("This template is managed by your organization.")">
2026-11-11 14:20:49 +01:00
<MudIconButton Color="Color.Info" Icon="@AppIcons.ORGANIZATION" Disabled="true"/>
2026-06-20 17:06:43 +02:00
</MudTooltip>
<MudTooltip Text="@T("View")">
2026-11-11 14:20:49 +01:00
<MudIconButton Color="Color.Info" Icon="@AppIcons.PREVIEW" OnClick="@(() => this.ViewChatTemplate(context))"/>
2026-06-20 17:06:43 +02:00
</MudTooltip>
</MudStack>
2025-08-18 20:40:52 +02:00
}
else
{
<MudStack Row="true" Class="mb-2 mt-2" Wrap="Wrap.Wrap">
<MudTooltip Text="@T("Edit")">
2026-11-11 14:20:49 +01:00
<MudIconButton Color="Color.Info" Icon="@AppIcons.EDIT" OnClick="@(() => this.EditChatTemplate(context))"/>
2025-08-18 20:40:52 +02:00
</MudTooltip>
2026-09-05 19:16:54 +02:00
@if (context.FileAttachments.Count == 0)
2026-05-22 15:46:03 +02:00
{
2026-09-05 19:16:54 +02:00
<AdminExportButton OnClick="@(() => this.ExportChatTemplateWithSharedAttachmentPaths(context))" />
}
else if (this.SettingsManager.ConfigurationData.App.ShowAdminSettings)
{
<MudTooltip Text="@T("Export configuration")">
2026-11-11 14:20:49 +01:00
<MudMenu Icon="@AppIcons.EXPORT_CONFIGURATION" Color="Color.Info" Variant="Variant.Text">
<MudMenuItem Icon="@AppIcons.LINK" OnClick="@(() => this.ExportChatTemplateWithSharedAttachmentPaths(context))">
2026-09-05 19:16:54 +02:00
@T("Use shared attachment paths")
</MudMenuItem>
2026-11-11 14:20:49 +01:00
<MudMenuItem Icon="@AppIcons.FOLDER" Disabled="@this.isPluginDirectoryDialogOpen" OnClick="@(() => this.ExportChatTemplateWithPackagedAttachments(context))">
2026-09-05 19:16:54 +02:00
@T("Copy attachments into plugin")
</MudMenuItem>
</MudMenu>
</MudTooltip>
2026-05-22 15:46:03 +02:00
}
2025-08-18 20:40:52 +02:00
<MudTooltip Text="@T("Delete")">
2026-11-11 14:20:49 +01:00
<MudIconButton Color="Color.Error" Icon="@AppIcons.DELETE" OnClick="@(() => this.DeleteChatTemplate(context))"/>
2025-08-18 20:40:52 +02:00
</MudTooltip>
</MudStack>
}
2025-05-25 10:33:13 +02:00
</MudTd>
</RowTemplate>
</MudTable>
@if(this.SettingsManager.ConfigurationData.ChatTemplates.Count == 0)
{
<MudText Typo="Typo.h6" Class="mt-3">
@T("No chat templates configured yet.")
</MudText>
}
2026-10-20 08:35:44 +02:00
</DialogContent>
<DialogActions>
@* In the footer, adding and importing stay in reach however long the table grows: *@
<MudStack Row="true" Wrap="Wrap.Wrap">
2026-11-11 14:20:49 +01:00
<MudButton Variant="Variant.Filled" Color="@Color.Primary" StartIcon="@AppIcons.ADD" OnClick="@this.AddChatTemplate">
2026-10-16 17:22:23 +02:00
@T("Add Chat Template")
</MudButton>
2026-11-11 14:20:49 +01:00
<LockableButton Text="@T("Import Chat Template")" IsLocked="@(() => !this.SettingsManager.ConfigurationData.App.CanImportConfigurationSnippet(PluginConfigurationObjectType.CHAT_TEMPLATE))" Icon="@AppIcons.IMPORT" OnClickAsync="@this.ImportChatTemplate" ButtonVariant="Variant.Outlined" NoMargin="true" />
2026-10-16 17:22:23 +02:00
</MudStack>
2026-10-20 08:35:44 +02:00
<MudSpacer/>
2025-05-25 10:33:13 +02:00
<MudButton OnClick="@this.Close" Variant="Variant.Filled">
@T("Close")
</MudButton>
</DialogActions>
</MudDialog>