Improved the coding assistant by adding a button to delete a context

This commit is contained in:
Thorsten Sommer 2024-08-23 11:22:30 +02:00
parent aae5ad18db
commit b2ed0b2619
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
3 changed files with 15 additions and 1 deletions

View File

@ -5,7 +5,8 @@
@for (var contextIndex = 0; contextIndex < this.codingContexts.Count; contextIndex++) @for (var contextIndex = 0; contextIndex < this.codingContexts.Count; contextIndex++)
{ {
var codingContext = this.codingContexts[contextIndex]; var codingContext = this.codingContexts[contextIndex];
<ExpansionPanel HeaderText="@codingContext.Id" HeaderIcon="@Icons.Material.Filled.Code"> var index = contextIndex;
<ExpansionPanel HeaderText="@codingContext.Id" HeaderIcon="@Icons.Material.Filled.Code" ShowEndButton="@true" EndButtonColor="Color.Error" EndButtonIcon="@Icons.Material.Filled.Delete" EndButtonTooltip="Delete context" EndButtonClickAsync="@(() => this.DeleteContext(index))">
<CodingContextItem @bind-CodingContext="@codingContext"/> <CodingContextItem @bind-CodingContext="@codingContext"/>
</ExpansionPanel> </ExpansionPanel>
} }

View File

@ -105,6 +105,18 @@ public partial class AssistantCoding : AssistantBaseCore
}); });
} }
private ValueTask DeleteContext(int index)
{
if(this.codingContexts.Count < index + 1)
return ValueTask.CompletedTask;
this.codingContexts.RemoveAt(index);
this.form?.ResetValidation();
this.StateHasChanged();
return ValueTask.CompletedTask;
}
private async Task GetSupport() private async Task GetSupport()
{ {
await this.form!.Validate(); await this.form!.Validate();

View File

@ -1,6 +1,7 @@
# v0.8.12, build 174 # v0.8.12, build 174
- Added an e-mail writing assistant. - Added an e-mail writing assistant.
- Added the possibility to preselect some e-mail writing assistant options. - Added the possibility to preselect some e-mail writing assistant options.
- Improved the coding assistant by adding a button to delete a context.
- Improved chat page by scrolling to the bottom after loading (configurable; default is on). - Improved chat page by scrolling to the bottom after loading (configurable; default is on).
- Improved all assistants to provide a button to copy their respective result to the clipboard. - Improved all assistants to provide a button to copy their respective result to the clipboard.
- Improved the content validation for the agenda assistant. - Improved the content validation for the agenda assistant.