Renamed the list to example conversation to follow the naming scheme in the dialog.

This commit is contained in:
Peer Schütt 2025-05-23 15:35:43 +02:00
parent 10edb1ec54
commit 061111bfaf
5 changed files with 13 additions and 13 deletions

View File

@ -435,7 +435,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
DataSourceOptions = this.earlyDataSourceOptions, DataSourceOptions = this.earlyDataSourceOptions,
Name = this.ExtractThreadName(this.userInput), Name = this.ExtractThreadName(this.userInput),
Seed = this.RNG.Next(), Seed = this.RNG.Next(),
Blocks = this.currentChatTemplate == default ? [] : this.currentChatTemplate.AdditionalMessages.Select(x => x.DeepClone()).ToList(), Blocks = this.currentChatTemplate == default ? [] : this.currentChatTemplate.ExampleConversation.Select(x => x.DeepClone()).ToList(),
}; };
await this.ChatThreadChanged.InvokeAsync(this.ChatThread); await this.ChatThreadChanged.InvokeAsync(this.ChatThread);
@ -666,7 +666,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
ChatId = Guid.NewGuid(), ChatId = Guid.NewGuid(),
Name = string.Empty, Name = string.Empty,
Seed = this.RNG.Next(), Seed = this.RNG.Next(),
Blocks = this.currentChatTemplate == default ? [] : this.currentChatTemplate.AdditionalMessages.Select(x => x.DeepClone()).ToList(), Blocks = this.currentChatTemplate == default ? [] : this.currentChatTemplate.ExampleConversation.Select(x => x.DeepClone()).ToList(),
}; };
} }

View File

@ -37,7 +37,7 @@ public partial class SettingsPanelChatTemplates : SettingsPanelBase
{ x => x.DataName, chatTemplate.Name }, { x => x.DataName, chatTemplate.Name },
{ x => x.DataSystemPrompt, chatTemplate.SystemPrompt }, { x => x.DataSystemPrompt, chatTemplate.SystemPrompt },
{ x => x.IsEditing, true }, { x => x.IsEditing, true },
{x => x.AdditionalMessages, chatTemplate.AdditionalMessages}, {x => x.ExampleConversation, chatTemplate.ExampleConversation},
}; };
var dialogReference = await this.DialogService.ShowAsync<ChatTemplateDialog>(T("Edit Chat Template"), dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<ChatTemplateDialog>(T("Edit Chat Template"), dialogParameters, DialogOptions.FULLSCREEN);

View File

@ -66,7 +66,7 @@
@T("Add messages of an example conversation (user prompt followed by assistant prompt) to demonstrate the desired interaction pattern. These examples help the AI understand your expectations by showing it the correct format, style, and content of responses before it receives actual user inputs.") @T("Add messages of an example conversation (user prompt followed by assistant prompt) to demonstrate the desired interaction pattern. These examples help the AI understand your expectations by showing it the correct format, style, and content of responses before it receives actual user inputs.")
</MudJustifiedText> </MudJustifiedText>
<MudTable CanCancelEdit="true" Class="mt-3 mb-6" CommitEditTooltip="@T("Commit Changes")" Elevation="10" FixedHeader="true" Items="@AdditionalMessages" Outlined="true" RowEditCancel="@this.ResetItemToOriginalValues" RowEditPreview="@this.BackupItem"> <MudTable CanCancelEdit="true" Class="mt-3 mb-6" CommitEditTooltip="@T("Commit Changes")" Elevation="10" FixedHeader="true" Items="@ExampleConversation" Outlined="true" RowEditCancel="@this.ResetItemToOriginalValues" RowEditPreview="@this.BackupItem">
<ColGroup> <ColGroup>
<col style="width: 16em;" /> <col style="width: 16em;" />
<col/> <col/>

View File

@ -42,7 +42,7 @@ public partial class ChatTemplateDialog : MSGComponentBase
public bool IsEditing { get; init; } public bool IsEditing { get; init; }
[Parameter] [Parameter]
public List<ContentBlock> AdditionalMessages { get; set; } = []; public List<ContentBlock> ExampleConversation { get; set; } = [];
[Inject] [Inject]
private ILogger<ProviderDialog> Logger { get; init; } = null!; private ILogger<ProviderDialog> Logger { get; init; } = null!;
@ -74,13 +74,13 @@ public partial class ChatTemplateDialog : MSGComponentBase
Name = this.DataName, Name = this.DataName,
SystemPrompt = this.DataSystemPrompt, SystemPrompt = this.DataSystemPrompt,
AdditionalMessages = this.AdditionalMessages, ExampleConversation = this.ExampleConversation,
AllowProfileUsage = allowProfileUsage, AllowProfileUsage = allowProfileUsage,
}; };
private void RemoveMessage(ContentBlock item) private void RemoveMessage(ContentBlock item)
{ {
this.AdditionalMessages.Remove(item); this.ExampleConversation.Remove(item);
} }
private void AddNewMessageToEnd() private void AddNewMessageToEnd()
@ -94,7 +94,7 @@ public partial class ChatTemplateDialog : MSGComponentBase
Time = DateTimeOffset.Now, Time = DateTimeOffset.Now,
}; };
this.AdditionalMessages.Add(newEntry); this.ExampleConversation.Add(newEntry);
} }
private void AddNewMessageBelow(ContentBlock currentItem) private void AddNewMessageBelow(ContentBlock currentItem)
@ -111,15 +111,15 @@ public partial class ChatTemplateDialog : MSGComponentBase
}; };
// Rest of the method remains the same // Rest of the method remains the same
var index = this.AdditionalMessages.IndexOf(currentItem); var index = this.ExampleConversation.IndexOf(currentItem);
if (index >= 0) if (index >= 0)
{ {
this.AdditionalMessages.Insert(index + 1, newEntry); this.ExampleConversation.Insert(index + 1, newEntry);
} }
else else
{ {
this.AdditionalMessages.Add(newEntry); this.ExampleConversation.Add(newEntry);
} }
} }

View File

@ -3,7 +3,7 @@ using AIStudio.Tools.PluginSystem;
namespace AIStudio.Settings; namespace AIStudio.Settings;
public readonly record struct ChatTemplate(uint Num, string Id, string Name, string SystemPrompt, List<ContentBlock> AdditionalMessages, bool AllowProfileUsage) public readonly record struct ChatTemplate(uint Num, string Id, string Name, string SystemPrompt, List<ContentBlock> ExampleConversation, bool AllowProfileUsage)
{ {
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(ChatTemplate).Namespace, nameof(ChatTemplate)); private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(ChatTemplate).Namespace, nameof(ChatTemplate));
@ -13,7 +13,7 @@ public readonly record struct ChatTemplate(uint Num, string Id, string Name, str
SystemPrompt = string.Empty, SystemPrompt = string.Empty,
Id = Guid.Empty.ToString(), Id = Guid.Empty.ToString(),
Num = uint.MaxValue, Num = uint.MaxValue,
AdditionalMessages = [], ExampleConversation = [],
AllowProfileUsage = true, AllowProfileUsage = true,
}; };