mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 16:37:59 +00:00
Add assistants (#33)
This commit is contained in:
1 parent
88aefe1c4e
commit
58c9d8ac33
33 files changed
+778
-12
No files matched your search
@@ -0,0 +1,22 @@
|
||||
namespace AIStudio.Tools;
|
||||
|
||||
public static class CommonLanguageExtensions
|
||||
{
|
||||
public static string Name(this CommonLanguages language) => language switch
|
||||
{
|
||||
CommonLanguages.AS_IS => "Do not change the language",
|
||||
|
||||
CommonLanguages.EN_US => "English (US)",
|
||||
CommonLanguages.EN_GB => "English (UK)",
|
||||
CommonLanguages.ZH_CN => "Chinese (Simplified)",
|
||||
CommonLanguages.HI_IN => "Hindi (India)",
|
||||
CommonLanguages.ES_ES => "Spanish (Spain)",
|
||||
CommonLanguages.FR_FR => "French (France)",
|
||||
CommonLanguages.DE_DE => "German (Germany)",
|
||||
CommonLanguages.DE_AT => "German (Austria)",
|
||||
CommonLanguages.DE_CH => "German (Switzerland)",
|
||||
CommonLanguages.JA_JP => "Japanese (Japan)",
|
||||
|
||||
_ => "Other",
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace AIStudio.Tools;
|
||||
|
||||
public enum CommonLanguages
|
||||
{
|
||||
AS_IS,
|
||||
|
||||
EN_US,
|
||||
EN_GB,
|
||||
ZH_CN,
|
||||
HI_IN,
|
||||
ES_ES,
|
||||
FR_FR,
|
||||
DE_DE,
|
||||
DE_CH,
|
||||
DE_AT,
|
||||
JA_JP,
|
||||
|
||||
OTHER,
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace AIStudio.Tools;
|
||||
|
||||
public abstract class MSGComponentBase : ComponentBase, IDisposable, IMessageBusReceiver
|
||||
{
|
||||
[Inject]
|
||||
protected MessageBus MessageBus { get; init; } = null!;
|
||||
|
||||
#region Overrides of ComponentBase
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
this.MessageBus.RegisterComponent(this);
|
||||
base.OnInitialized();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IMessageBusReceiver
|
||||
|
||||
public abstract Task ProcessMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data);
|
||||
|
||||
public abstract Task<TResult?> ProcessMessageWithResult<TPayload, TResult>(ComponentBase? sendingComponent, Event triggeredEvent, TPayload? data);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IDisposable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.MessageBus.Unregister(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected async Task SendMessage<T>(Event triggeredEvent, T? data = default)
|
||||
{
|
||||
await this.MessageBus.SendMessage(this, triggeredEvent, data);
|
||||
}
|
||||
|
||||
protected async Task<TResult?> SendMessageWithResult<TPayload, TResult>(Event triggeredEvent, TPayload? data)
|
||||
{
|
||||
return await this.MessageBus.SendMessageUseFirstResult<TPayload, TResult>(this, triggeredEvent, data);
|
||||
}
|
||||
|
||||
protected void ApplyFilters(ComponentBase[] components, Event[] events)
|
||||
{
|
||||
this.MessageBus.ApplyFilters(this, components, events);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user