mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-08-20 22:32:56 +00:00
There was a bug when updating a chat template. The AllowProfiles bool was not given, so the default true was always used.
This commit is contained in:
parent
a5b11f2305
commit
a06051ac6d
@ -91,7 +91,6 @@ public sealed record ChatThread
|
||||
/// <returns>The prepared system prompt.</returns>
|
||||
public string PrepareSystemPrompt(SettingsManager settingsManager, ChatThread chatThread, ILogger logger)
|
||||
{
|
||||
|
||||
//
|
||||
// Use the information from the chat template, if provided. Otherwise, use the default system prompt
|
||||
//
|
||||
|
@ -38,6 +38,7 @@ public partial class SettingsPanelChatTemplates : SettingsPanelBase
|
||||
{ x => x.DataSystemPrompt, chatTemplate.SystemPrompt },
|
||||
{ x => x.IsEditing, true },
|
||||
{x => x.ExampleConversation, chatTemplate.ExampleConversation},
|
||||
{x => x.AllowProfileUsage, chatTemplate.AllowProfileUsage},
|
||||
};
|
||||
|
||||
var dialogReference = await this.DialogService.ShowAsync<ChatTemplateDialog>(T("Edit Chat Template"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||
|
@ -55,7 +55,7 @@
|
||||
</MudTooltip>
|
||||
|
||||
<MudTooltip Text="@T("Using some chat templates in tandem with profiles might cause issues. Therefore, you can preliminarily block the usage of profiles here.")">
|
||||
<MudSwitch @bind-Value="allowProfileUsage" Class="mb-3" Color="Color.Primary" Label="@T("Allow the use of profiles together with this chat template?")" ThumbIcon="@Icons.Material.Filled.Person4" ThumbIconColor="Color.Default" />
|
||||
<MudSwitch @bind-Value="@this.AllowProfileUsage" Class="mb-3" Color="Color.Primary" Label="@T("Allow the use of profiles together with this chat template?")" ThumbIcon="@Icons.Material.Filled.Person4" ThumbIconColor="Color.Default" />
|
||||
</MudTooltip>
|
||||
|
||||
<MudText Typo="Typo.h6" Class="mb-3">
|
||||
|
@ -43,6 +43,9 @@ public partial class ChatTemplateDialog : MSGComponentBase
|
||||
|
||||
[Parameter]
|
||||
public List<ContentBlock> ExampleConversation { get; set; } = [];
|
||||
|
||||
[Parameter]
|
||||
public bool AllowProfileUsage { get; set; } = true;
|
||||
|
||||
[Inject]
|
||||
private ILogger<ProviderDialog> Logger { get; init; } = null!;
|
||||
@ -57,12 +60,9 @@ public partial class ChatTemplateDialog : MSGComponentBase
|
||||
private bool dataIsValid;
|
||||
private string[] dataIssues = [];
|
||||
private string dataEditingPreviousName = string.Empty;
|
||||
|
||||
|
||||
private ContentBlock messageEntryBeforeEdit;
|
||||
// private readonly List<ContentBlock> additionalMessagesEntries = [];
|
||||
// private readonly List<string> availableRoles = ["User", "Assistant"];
|
||||
private readonly IEnumerable<ChatRole> availableRoles = ChatRoles.ChatTemplateRoles().ToArray();
|
||||
private bool allowProfileUsage = true;
|
||||
|
||||
// We get the form reference from Blazor code to validate it manually:
|
||||
private MudForm form = null!;
|
||||
@ -75,7 +75,7 @@ public partial class ChatTemplateDialog : MSGComponentBase
|
||||
Name = this.DataName,
|
||||
SystemPrompt = this.DataSystemPrompt,
|
||||
ExampleConversation = this.ExampleConversation,
|
||||
AllowProfileUsage = allowProfileUsage,
|
||||
AllowProfileUsage = this.AllowProfileUsage,
|
||||
};
|
||||
|
||||
private void RemoveMessage(ContentBlock item)
|
||||
@ -85,6 +85,8 @@ public partial class ChatTemplateDialog : MSGComponentBase
|
||||
|
||||
private void AddNewMessageToEnd()
|
||||
{
|
||||
this.ExampleConversation ??= new List<ContentBlock>();
|
||||
|
||||
var newEntry = new ContentBlock
|
||||
{
|
||||
Role = ChatRole.USER, // Default to User
|
||||
|
Loading…
Reference in New Issue
Block a user