mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-05 14:09:07 +00:00
Improved the coding assistant by adding a button to delete a context (#90)
This commit is contained in:
parent
3fd0d4d5c1
commit
a6c5b3de23
@ -5,7 +5,8 @@
|
||||
@for (var contextIndex = 0; contextIndex < this.codingContexts.Count; 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"/>
|
||||
</ExpansionPanel>
|
||||
}
|
||||
|
@ -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()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
|
@ -3,6 +3,20 @@
|
||||
<div class="d-flex align-center">
|
||||
<MudIcon Icon="@this.HeaderIcon" Size="@this.IconSize" Color="@this.IconColor" class="mr-3"/>
|
||||
<MudText Typo="Typo.h6">@this.HeaderText</MudText>
|
||||
@if (this.ShowEndButton)
|
||||
{
|
||||
<MudSpacer/>
|
||||
if (!string.IsNullOrWhiteSpace(this.EndButtonTooltip))
|
||||
{
|
||||
<MudTooltip Text="@this.EndButtonTooltip">
|
||||
<MudIconButton Icon="@this.EndButtonIcon" Color="@this.EndButtonColor" Size="Size.Medium" OnClick="async () => await this.EndButtonClickAsync()"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudIconButton Icon="@this.EndButtonIcon" Color="@this.EndButtonColor" Size="Size.Medium" OnClick="async () => await this.EndButtonClickAsync()"/>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</TitleContent>
|
||||
<ChildContent>
|
||||
|
@ -21,4 +21,19 @@ public partial class ExpansionPanel : ComponentBase
|
||||
|
||||
[Parameter]
|
||||
public bool IsExpanded { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool ShowEndButton { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public Func<ValueTask> EndButtonClickAsync { get; set; } = () => ValueTask.CompletedTask;
|
||||
|
||||
[Parameter]
|
||||
public string EndButtonIcon { get; set; } = Icons.Material.Filled.Delete;
|
||||
|
||||
[Parameter]
|
||||
public Color EndButtonColor { get; set; } = Color.Error;
|
||||
|
||||
[Parameter]
|
||||
public string EndButtonTooltip { get; set; } = string.Empty;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
# v0.8.12, build 174
|
||||
- Added an e-mail writing assistant.
|
||||
- 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 all assistants to provide a button to copy their respective result to the clipboard.
|
||||
- Improved the content validation for the agenda assistant.
|
||||
|
Loading…
Reference in New Issue
Block a user