Added possibility to change the result area and to add content after

This commit is contained in:
Thorsten Sommer 2024-08-12 20:12:04 +02:00
parent 1dec7de24e
commit 2c05af1d5b
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 23 additions and 3 deletions

View File

@ -16,10 +16,20 @@
} }
</MudForm> </MudForm>
<Issues IssuesData="@this.inputIssues"/> <Issues IssuesData="@this.inputIssues"/>
@if (this.ShowResult && this.resultingContentBlock is not null) @if (this.isProcessing)
{ {
<ContentBlockComponent Role="@this.resultingContentBlock.Role" Type="@this.resultingContentBlock.ContentType" Time="@this.resultingContentBlock.Time" Content="@this.resultingContentBlock.Content" Class="mr-2"/> <MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="mb-6" />
}
<div id="@ASSISTANT_RESULT_DIV_ID" class="mr-2 mt-3">
@if (this.ShowResult && this.resultingContentBlock is not null)
{
<ContentBlockComponent Role="@this.resultingContentBlock.Role" Type="@this.resultingContentBlock.ContentType" Time="@this.resultingContentBlock.Time" Content="@this.resultingContentBlock.Content"/>
}
</div>
<div id="@AFTER_RESULT_DIV_ID" class="mt-3">
</div>
} }
</ChildContent> </ChildContent>
</InnerScrolling> </InnerScrolling>

View File

@ -18,6 +18,9 @@ public abstract partial class AssistantBase : ComponentBase
[Inject] [Inject]
protected ThreadSafeRandom RNG { get; init; } = null!; protected ThreadSafeRandom RNG { get; init; } = null!;
internal const string AFTER_RESULT_DIV_ID = "afterAssistantResult";
internal const string ASSISTANT_RESULT_DIV_ID = "assistantResult";
protected abstract string Title { get; } protected abstract string Title { get; }
protected abstract string Description { get; } protected abstract string Description { get; }
@ -131,5 +134,12 @@ public abstract partial class AssistantBase : ComponentBase
// Return the AI response: // Return the AI response:
return aiText.Text; return aiText.Text;
} }
private static string? GetButtonIcon(string icon)
{
if(string.IsNullOrWhiteSpace(icon))
return null;
return icon;
} }
} }