mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 10:39:47 +00:00
Refactor AssistantBase to inherit from AssistantLowerBase and update related references
This commit is contained in:
parent
5cc6e141c2
commit
8518fadd1a
@ -1,4 +1,5 @@
|
|||||||
@using AIStudio.Chat
|
@using AIStudio.Chat
|
||||||
|
@inherits AssistantLowerBase
|
||||||
@typeparam TSettings
|
@typeparam TSettings
|
||||||
|
|
||||||
<div class="inner-scrolling-context">
|
<div class="inner-scrolling-context">
|
||||||
|
@ -15,7 +15,7 @@ using DialogOptions = AIStudio.Dialogs.DialogOptions;
|
|||||||
|
|
||||||
namespace AIStudio.Assistants;
|
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]
|
[Inject]
|
||||||
protected SettingsManager SettingsManager { get; init; } = null!;
|
protected SettingsManager SettingsManager { get; init; } = null!;
|
||||||
@ -50,10 +50,6 @@ public abstract partial class AssistantBase<TSettings> : ComponentBase, IMessage
|
|||||||
[Inject]
|
[Inject]
|
||||||
private MessageBus MessageBus { get; init; } = null!;
|
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 Title { get; }
|
||||||
|
|
||||||
protected abstract string Description { get; }
|
protected abstract string Description { get; }
|
||||||
@ -100,8 +96,6 @@ public abstract partial class AssistantBase<TSettings> : ComponentBase, IMessage
|
|||||||
|
|
||||||
protected virtual IReadOnlyList<IButtonData> FooterButtons => [];
|
protected virtual IReadOnlyList<IButtonData> FooterButtons => [];
|
||||||
|
|
||||||
protected static readonly Dictionary<string, object?> USER_INPUT_ATTRIBUTES = new();
|
|
||||||
|
|
||||||
protected AIStudio.Settings.Provider providerSettings;
|
protected AIStudio.Settings.Provider providerSettings;
|
||||||
protected MudForm? form;
|
protected MudForm? form;
|
||||||
protected bool inputIsValid;
|
protected bool inputIsValid;
|
||||||
|
12
app/MindWork AI Studio/Assistants/AssistantLowerBase.cs
Normal file
12
app/MindWork AI Studio/Assistants/AssistantLowerBase.cs
Normal 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";
|
||||||
|
}
|
@ -7,7 +7,7 @@ public static class JsRuntimeExtensions
|
|||||||
{
|
{
|
||||||
public static async Task GenerateAndShowDiff(this IJSRuntime jsRuntime, string text1, string text2)
|
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)
|
public static async Task ClearDiv(this IJSRuntime jsRuntime, string divId)
|
||||||
|
Loading…
Reference in New Issue
Block a user