Refactor AssistantBase to inherit from AssistantLowerBase and update related references

This commit is contained in:
Thorsten Sommer 2025-03-12 18:03:54 +01:00
parent 5cc6e141c2
commit 8518fadd1a
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
4 changed files with 15 additions and 8 deletions

View File

@ -1,4 +1,5 @@
@using AIStudio.Chat
@inherits AssistantLowerBase
@typeparam TSettings
<div class="inner-scrolling-context">

View File

@ -15,7 +15,7 @@ using DialogOptions = AIStudio.Dialogs.DialogOptions;
namespace AIStudio.Assistants;
public abstract partial class AssistantBase<TSettings> : ComponentBase, IMessageBusReceiver, IDisposable where TSettings : IComponent
public abstract partial class AssistantBase<TSettings> : AssistantLowerBase, IMessageBusReceiver, IDisposable where TSettings : IComponent
{
[Inject]
protected SettingsManager SettingsManager { get; init; } = null!;
@ -50,10 +50,6 @@ public abstract partial class AssistantBase<TSettings> : ComponentBase, IMessage
[Inject]
private MessageBus MessageBus { get; init; } = null!;
internal const string RESULT_DIV_ID = "assistantResult";
internal const string BEFORE_RESULT_DIV_ID = "beforeAssistantResult";
internal const string AFTER_RESULT_DIV_ID = "afterAssistantResult";
protected abstract string Title { get; }
protected abstract string Description { get; }
@ -100,8 +96,6 @@ public abstract partial class AssistantBase<TSettings> : ComponentBase, IMessage
protected virtual IReadOnlyList<IButtonData> FooterButtons => [];
protected static readonly Dictionary<string, object?> USER_INPUT_ATTRIBUTES = new();
protected AIStudio.Settings.Provider providerSettings;
protected MudForm? form;
protected bool inputIsValid;

View File

@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Components;
namespace AIStudio.Assistants;
public abstract class AssistantLowerBase : ComponentBase
{
protected static readonly Dictionary<string, object?> USER_INPUT_ATTRIBUTES = new();
internal const string RESULT_DIV_ID = "assistantResult";
internal const string BEFORE_RESULT_DIV_ID = "beforeAssistantResult";
internal const string AFTER_RESULT_DIV_ID = "afterAssistantResult";
}

View File

@ -7,7 +7,7 @@ public static class JsRuntimeExtensions
{
public static async Task GenerateAndShowDiff(this IJSRuntime jsRuntime, string text1, string text2)
{
await jsRuntime.InvokeVoidAsync("generateDiff", text1, text2, AssistantBase<NoComponent>.RESULT_DIV_ID, AssistantBase<NoComponent>.BEFORE_RESULT_DIV_ID);
await jsRuntime.InvokeVoidAsync("generateDiff", text1, text2, AssistantLowerBase.RESULT_DIV_ID, AssistantLowerBase.BEFORE_RESULT_DIV_ID);
}
public static async Task ClearDiv(this IJSRuntime jsRuntime, string divId)