mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 09:21:36 +00:00
WIP: Working out a data model and an example lua file to turn it into assistants
This commit is contained in:
parent
6116c03f7c
commit
b9a9f2d823
85
app/MindWork AI Studio/Plugins/assistants/plugin.lua
Normal file
85
app/MindWork AI Studio/Plugins/assistants/plugin.lua
Normal file
@ -0,0 +1,85 @@
|
||||
require("icon")
|
||||
|
||||
-- The ID for this plugin:
|
||||
ID = "43065dbc-78d0-45b7-92be-f14c2926e2dc"
|
||||
|
||||
-- The icon for the plugin:
|
||||
ICON_SVG = SVG
|
||||
|
||||
-- The name of the plugin:
|
||||
NAME = "MindWork AI Studio - German / Deutsch"
|
||||
|
||||
-- The description of the plugin:
|
||||
DESCRIPTION = "Dieses Plugin bietet deutsche Sprachunterstützung für MindWork AI Studio."
|
||||
|
||||
-- The version of the plugin:
|
||||
VERSION = "1.0.0"
|
||||
|
||||
-- The type of the plugin:
|
||||
TYPE = "LANGUAGE"
|
||||
|
||||
-- The authors of the plugin:
|
||||
AUTHORS = {"MindWork AI Community"}
|
||||
|
||||
-- The support contact for the plugin:
|
||||
SUPPORT_CONTACT = "MindWork AI Community"
|
||||
|
||||
-- The source URL for the plugin:
|
||||
SOURCE_URL = "https://github.com/MindWorkAI/AI-Studio"
|
||||
|
||||
-- The categories for the plugin:
|
||||
CATEGORIES = { "ASSISTANT" }
|
||||
|
||||
-- The target groups for the plugin:
|
||||
TARGET_GROUPS = { "EVERYONE" }
|
||||
|
||||
-- The flag for whether the plugin is maintained:
|
||||
IS_MAINTAINED = true
|
||||
|
||||
-- When the plugin is deprecated, this message will be shown to users:
|
||||
DEPRECATION_MESSAGE = ""
|
||||
|
||||
ASSISTANT = {
|
||||
Name = "Grammatik- und Rechtschreibprüfung",
|
||||
Description = "Grammatik und Rechtschreibung eines Textes überprüfen.",
|
||||
UI = {
|
||||
Type = "Form",
|
||||
Children = {
|
||||
{
|
||||
Type = "TextArea",
|
||||
Props = {
|
||||
Name = "input",
|
||||
Label = "Ihre Eingabe zur Überprüfung"
|
||||
}
|
||||
},
|
||||
{
|
||||
Type = "Dropdown",
|
||||
Props = {
|
||||
Name = "language",
|
||||
Label = "Sprache",
|
||||
Default = "Sprache nicht angeben",
|
||||
Items = {
|
||||
{ Value = "de-DE", Display = "Deutsch" },
|
||||
{ Value = "en-UK", Display = "Englisch (UK)" },
|
||||
{ Value = "en-US", Display = "Englisch (US)" },
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
Type = "ProviderSelection",
|
||||
Props = {
|
||||
Name = "Anbieter",
|
||||
Label = "LLM auswählen"
|
||||
}
|
||||
},
|
||||
{
|
||||
Type = "Button",
|
||||
Props = {
|
||||
Name = "submit",
|
||||
Text = "Korrekturlesen",
|
||||
Action = "OnSubmit"
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
namespace AIStudio.Tools.PluginSystem;
|
||||
|
||||
public class AssistantButton : AssistantComponentBase
|
||||
{
|
||||
public override AssistantUiCompontentType Type => AssistantUiCompontentType.BUTTON;
|
||||
public Dictionary<string, object> Props { get; set; } = new();
|
||||
public List<IAssistantComponent> Children { get; set; } = new();
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => this.Props.TryGetValue(nameof(this.Name), out var v) ? v.ToString() ?? string.Empty : string.Empty;
|
||||
set => this.Props[nameof(this.Name)] = value;
|
||||
}
|
||||
public string Text
|
||||
{
|
||||
get => this.Props.TryGetValue(nameof(this.Text), out var v) ? v.ToString() ?? string.Empty : string.Empty;
|
||||
set => this.Props[nameof(this.Text)] = value;
|
||||
}
|
||||
public string Action
|
||||
{
|
||||
get => this.Props.TryGetValue(nameof(this.Action), out var v) ? v.ToString() ?? string.Empty : string.Empty;
|
||||
set => this.Props[nameof(this.Action)] = value;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
namespace AIStudio.Tools.PluginSystem;
|
||||
|
||||
public abstract class AssistantComponentBase : IAssistantComponent
|
||||
{
|
||||
public abstract AssistantUiCompontentType Type { get; }
|
||||
public Dictionary<string, object> Props { get; }
|
||||
public List<IAssistantComponent> Children { get; }
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
namespace AIStudio.Tools.PluginSystem;
|
||||
|
||||
public class AssistantDropdown : AssistantComponentBase
|
||||
{
|
||||
public override AssistantUiCompontentType Type => AssistantUiCompontentType.DROPDOWN;
|
||||
public Dictionary<string, object> Props { get; set; } = new();
|
||||
public List<IAssistantComponent> Children { get; set; } = new();
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => this.Props.TryGetValue(nameof(this.Name), out var v) ? v.ToString() ?? string.Empty : string.Empty;
|
||||
set => this.Props[nameof(this.Name)] = value;
|
||||
}
|
||||
public string Label
|
||||
{
|
||||
get => this.Props.TryGetValue(nameof(this.Label), out var v) ? v.ToString() ?? string.Empty : string.Empty;
|
||||
set => this.Props[nameof(this.Label)] = value;
|
||||
}
|
||||
public string Default
|
||||
{
|
||||
get => this.Props.TryGetValue(nameof(this.Default), out var v) ? v.ToString() ?? string.Empty : string.Empty;
|
||||
set => this.Props[nameof(this.Default)] = value;
|
||||
}
|
||||
public List<AssistantDropdownItem> Items
|
||||
{
|
||||
get => this.Props.TryGetValue(nameof(this.Items), out var v) && v is List<AssistantDropdownItem> list ? list : [];
|
||||
set => this.Props[nameof(this.Items)] = value;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
namespace AIStudio.Tools.PluginSystem;
|
||||
|
||||
public class AssistantDropdownItem
|
||||
{
|
||||
public string Value { get; set; } = string.Empty;
|
||||
public string Display { get; set; } = string.Empty;
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
namespace AIStudio.Tools.PluginSystem;
|
||||
|
||||
public class AssistantForm : AssistantComponentBase
|
||||
{
|
||||
public override AssistantUiCompontentType Type => AssistantUiCompontentType.FORM;
|
||||
public Dictionary<string, object> Props { get; set; } = new();
|
||||
public List<IAssistantComponent> Children { get; set; } = new();
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
namespace AIStudio.Tools.PluginSystem;
|
||||
|
||||
public class AssistantProviderSelection : AssistantComponentBase
|
||||
{
|
||||
public override AssistantUiCompontentType Type => AssistantUiCompontentType.PROVIDER_SELECTION;
|
||||
public Dictionary<string, object> Props { get; set; } = new();
|
||||
public List<IAssistantComponent> Children { get; set; } = new();
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => this.Props.TryGetValue(nameof(this.Name), out var v) ? v.ToString() ?? string.Empty : string.Empty;
|
||||
set => this.Props[nameof(this.Name)] = value;
|
||||
}
|
||||
public string Label
|
||||
{
|
||||
get => this.Props.TryGetValue(nameof(this.Label), out var v) ? v.ToString() ?? string.Empty : string.Empty;
|
||||
set => this.Props[nameof(this.Label)] = value;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
namespace AIStudio.Tools.PluginSystem;
|
||||
|
||||
public class AssistantTextArea : AssistantComponentBase
|
||||
{
|
||||
public override AssistantUiCompontentType Type => AssistantUiCompontentType.TEXT_AREA;
|
||||
public Dictionary<string, object> Props { get; set; } = new();
|
||||
public List<IAssistantComponent> Children { get; set; } = new();
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => this.Props.TryGetValue(nameof(this.Name), out var val) ? val.ToString() ?? string.Empty : string.Empty;
|
||||
set => this.Props[nameof(this.Name)] = value;
|
||||
}
|
||||
|
||||
public string Label
|
||||
{
|
||||
get => this.Props.TryGetValue(nameof(this.Label), out var val) ? val.ToString() ?? string.Empty : string.Empty;
|
||||
set => this.Props[nameof(this.Label)] = value;
|
||||
}
|
||||
|
||||
public bool ReadOnly
|
||||
{
|
||||
get => this.Props.TryGetValue(nameof(this.ReadOnly), out var val) && val is true;
|
||||
set => this.Props[nameof(this.ReadOnly)] = value;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
namespace AIStudio.Tools.PluginSystem;
|
||||
|
||||
public enum AssistantUiCompontentType
|
||||
{
|
||||
FORM,
|
||||
TEXT_AREA,
|
||||
BUTTON,
|
||||
CHECKBOX,
|
||||
DROPDOWN,
|
||||
PROVIDER_SELECTION,
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
namespace AIStudio.Tools.PluginSystem;
|
||||
|
||||
public interface IAssistantComponent
|
||||
{
|
||||
AssistantUiCompontentType Type { get; }
|
||||
Dictionary<string, object> Props { get; }
|
||||
List<IAssistantComponent> Children { get; }
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
using Lua;
|
||||
|
||||
namespace AIStudio.Tools.PluginSystem;
|
||||
|
||||
public sealed class PluginAssistants : PluginBase
|
||||
{
|
||||
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(PluginAssistants).Namespace, nameof(PluginAssistants));
|
||||
private static readonly ILogger<PluginAssistants> LOGGER = Program.LOGGER_FACTORY.CreateLogger<PluginAssistants>();
|
||||
|
||||
public string AssistantTitle { get; set;} = string.Empty;
|
||||
private string AssistantDescription {get; set;} = string.Empty;
|
||||
|
||||
public PluginAssistants(bool isInternal, LuaState state, PluginType type) : base(isInternal, state, type)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -30,4 +30,5 @@ public enum PluginCategory
|
||||
FICTION,
|
||||
WRITING,
|
||||
CONTENT_CREATION,
|
||||
ASSISTANT,
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user