Fixed the state of the re-generate button in the chat thread

This commit is contained in:
Thorsten Sommer 2025-03-08 20:11:58 +01:00
parent b2328716ce
commit eb80c2eecc
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
4 changed files with 6 additions and 2 deletions

View File

@ -27,7 +27,7 @@
@if (this.IsLastContentBlock && this.Role is ChatRole.AI && this.RegenerateFunc is not null) @if (this.IsLastContentBlock && this.Role is ChatRole.AI && this.RegenerateFunc is not null)
{ {
<MudTooltip Text="Regenerate" Placement="Placement.Bottom"> <MudTooltip Text="Regenerate" Placement="Placement.Bottom">
<MudIconButton Icon="@Icons.Material.Filled.Recycling" Color="Color.Default" OnClick="@this.RegenerateBlock"/> <MudIconButton Icon="@Icons.Material.Filled.Recycling" Color="Color.Default" Disabled="@(!this.RegenerateEnabled())" OnClick="@this.RegenerateBlock"/>
</MudTooltip> </MudTooltip>
} }
@if (this.RemoveBlockFunc is not null) @if (this.RemoveBlockFunc is not null)

View File

@ -24,7 +24,7 @@
IsLastContentBlock="@isLastBlock" IsLastContentBlock="@isLastBlock"
IsSecondToLastBlock="@isSecondLastBlock" IsSecondToLastBlock="@isSecondLastBlock"
RegenerateFunc="@this.RegenerateBlock" RegenerateFunc="@this.RegenerateBlock"
RegenerateEnabled="@(() => this.IsProviderSelected)" RegenerateEnabled="@(() => this.IsProviderSelected && this.ChatThread.IsLLMProviderAllowed(this.Provider))"
EditLastBlockFunc="@this.EditLastBlock" EditLastBlockFunc="@this.EditLastBlock"
EditLastUserBlockFunc="@this.EditLastUserBlock"/> EditLastUserBlockFunc="@this.EditLastUserBlock"/>
} }

View File

@ -793,6 +793,9 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
if(this.ChatThread is null) if(this.ChatThread is null)
return; return;
if(!this.ChatThread.IsLLMProviderAllowed(this.Provider))
return;
this.ChatThread.Remove(aiBlock, removeForRegenerate: true); this.ChatThread.Remove(aiBlock, removeForRegenerate: true);
this.hasUnsavedChanges = true; this.hasUnsavedChanges = true;
this.StateHasChanged(); this.StateHasChanged();

View File

@ -10,4 +10,5 @@
- Fixed the chat thread we use for the data retrieval by removing the last block, which is meant to be for the final AI answer. - Fixed the chat thread we use for the data retrieval by removing the last block, which is meant to be for the final AI answer.
- Fixed the data source name for ERI data sources when performing data retrieval. - Fixed the data source name for ERI data sources when performing data retrieval.
- Fixed the default data source selection when replacing the current chat with a new one. - Fixed the default data source selection when replacing the current chat with a new one.
- Fixed the state of the re-generate button in the chat thread, when no provider is selected or the data security is preventing the use of cloud LLMs.
- Upgraded code dependencies. - Upgraded code dependencies.