mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 10:39:47 +00:00
Dialogs work now. Now I need to do the cleanup of unused code
This commit is contained in:
parent
7cfe53b06f
commit
111d2619f6
@ -1,3 +1,5 @@
|
|||||||
|
@typeparam TSettings
|
||||||
|
|
||||||
<MudCard Outlined="@true" Style="@this.BlockStyle">
|
<MudCard Outlined="@true" Style="@this.BlockStyle">
|
||||||
<MudCardHeader>
|
<MudCardHeader>
|
||||||
<CardHeaderContent>
|
<CardHeaderContent>
|
||||||
@ -24,7 +26,7 @@
|
|||||||
</MudButton>
|
</MudButton>
|
||||||
</MudItem>
|
</MudItem>
|
||||||
<MudItem xs="3">
|
<MudItem xs="3">
|
||||||
<MudIconButton Size="Size.Large" Variant="Variant.Filled" Icon="@Icons.Material.Filled.Settings" Color="Color.Default" Href="@this.Link"/>
|
<MudIconButton Size="Size.Medium" Variant="Variant.Text" Icon="@Icons.Material.Filled.Settings" Color="Color.Default" OnClick="@this.OpenSettingsDialog"/>
|
||||||
</MudItem>
|
</MudItem>
|
||||||
</MudGrid>
|
</MudGrid>
|
||||||
</MudCardActions>
|
</MudCardActions>
|
||||||
|
@ -2,9 +2,11 @@ using AIStudio.Settings;
|
|||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
using DialogOptions = AIStudio.Dialogs.DialogOptions;
|
||||||
|
|
||||||
namespace AIStudio.Components;
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
public partial class AssistantBlock : ComponentBase, IMessageBusReceiver, IDisposable
|
public partial class AssistantBlock<TSettings> : ComponentBase, IMessageBusReceiver, IDisposable where TSettings : IComponent
|
||||||
{
|
{
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
@ -30,6 +32,16 @@ public partial class AssistantBlock : ComponentBase, IMessageBusReceiver, IDispo
|
|||||||
[Inject]
|
[Inject]
|
||||||
private MessageBus MessageBus { get; init; } = null!;
|
private MessageBus MessageBus { get; init; } = null!;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private IDialogService DialogService { get; init; } = null!;
|
||||||
|
|
||||||
|
private async Task OpenSettingsDialog()
|
||||||
|
{
|
||||||
|
var dialogParameters = new DialogParameters();
|
||||||
|
|
||||||
|
await this.DialogService.ShowAsync<TSettings>("Open Settings", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
}
|
||||||
|
|
||||||
#region Overrides of ComponentBase
|
#region Overrides of ComponentBase
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
@ -44,7 +56,7 @@ public partial class AssistantBlock : ComponentBase, IMessageBusReceiver, IDispo
|
|||||||
|
|
||||||
#region Implementation of IMessageBusReceiver
|
#region Implementation of IMessageBusReceiver
|
||||||
|
|
||||||
public string ComponentName => nameof(AssistantBlock);
|
public string ComponentName => nameof(AssistantBlock<TSettings>);
|
||||||
|
|
||||||
public Task ProcessMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data)
|
public Task ProcessMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data)
|
||||||
{
|
{
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
@using AIStudio.Settings
|
|
||||||
@inherits SettingsPanelBase
|
|
||||||
|
|
||||||
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Translate" HeaderText="Assistant: Translator Options" IsExpanded="@this.IsExtended()">
|
|
||||||
<ConfigurationSlider T="int" OptionDescription="How fast should the live translation react?" Min="500" Max="3_000" Step="100" Unit="milliseconds" Value="@(() => this.SettingsManager.ConfigurationData.Translation.DebounceIntervalMilliseconds)" ValueUpdate="@(updatedValue => this.SettingsManager.ConfigurationData.Translation.DebounceIntervalMilliseconds = updatedValue)"/>
|
|
||||||
<ConfigurationOption OptionDescription="Hide the web content reader?" LabelOn="Web content reader is hidden" LabelOff="Web content reader is shown" State="@(() => this.SettingsManager.ConfigurationData.Translation.HideWebContentReader)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Translation.HideWebContentReader = updatedState)" OptionHelp="When activated, the web content reader is hidden and cannot be used. As a result, the user interface becomes a bit easier to use."/>
|
|
||||||
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
|
||||||
<ConfigurationOption OptionDescription="Preselect translator options?" LabelOn="Translator options are preselected" LabelOff="No translator options are preselected" State="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Translation.PreselectOptions = updatedState)" OptionHelp="When enabled, you can preselect the translator options. This is might be useful when you prefer a specific target language or LLM model."/>
|
|
||||||
<ConfigurationOption OptionDescription="Preselect the web content reader?" Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions || this.SettingsManager.ConfigurationData.Translation.HideWebContentReader)" LabelOn="Web content reader is preselected" LabelOff="Web content reader is not preselected" State="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectWebContentReader)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Translation.PreselectWebContentReader = updatedState)" OptionHelp="When enabled, the web content reader is preselected. This is might be useful when you prefer to load content from the web very often."/>
|
|
||||||
<ConfigurationOption OptionDescription="Preselect the content cleaner agent?" Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions || this.SettingsManager.ConfigurationData.Translation.HideWebContentReader)" LabelOn="Content cleaner agent is preselected" LabelOff="Content cleaner agent is not preselected" State="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectContentCleanerAgent)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Translation.PreselectContentCleanerAgent = updatedState)" OptionHelp="When enabled, the content cleaner agent is preselected. This is might be useful when you prefer to clean up the content before translating it."/>
|
|
||||||
<ConfigurationOption OptionDescription="Preselect live translation?" Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions)" LabelOn="Live translation is preselected" LabelOff="Live translation is not preselected" State="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectLiveTranslation)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Translation.PreselectLiveTranslation = updatedState)" />
|
|
||||||
<ConfigurationSelect OptionDescription="Preselect the target language" Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectedTargetLanguage)" Data="@ConfigurationSelectDataFactory.GetCommonLanguagesData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Translation.PreselectedTargetLanguage = selectedValue)" OptionHelp="Which target language should be preselected?"/>
|
|
||||||
@if (this.SettingsManager.ConfigurationData.Translation.PreselectedTargetLanguage is CommonLanguages.OTHER)
|
|
||||||
{
|
|
||||||
<ConfigurationText OptionDescription="Preselect another target language" Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions)" Icon="@Icons.Material.Filled.Translate" Text="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectOtherLanguage)" TextUpdate="@(updatedText => this.SettingsManager.ConfigurationData.Translation.PreselectOtherLanguage = updatedText)"/>
|
|
||||||
}
|
|
||||||
<ConfigurationMinConfidenceSelection Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions)" RestrictToGlobalMinimumConfidence="@true" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Translation.MinimumProviderConfidence)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Translation.MinimumProviderConfidence = selectedValue)"/>
|
|
||||||
<ConfigurationProviderSelection Component="Components.TRANSLATION_ASSISTANT" Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectedProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Translation.PreselectedProvider = selectedValue)"/>
|
|
||||||
</MudPaper>
|
|
||||||
</ExpansionPanel>
|
|
@ -1,6 +0,0 @@
|
|||||||
namespace AIStudio.Components.Settings;
|
|
||||||
|
|
||||||
public partial class SettingsPanelTranslation : SettingsPanelBase
|
|
||||||
{
|
|
||||||
protected override SettingsPanel Type => SettingsPanel.ASSISTANT_TRANSLATION_PANEL;
|
|
||||||
}
|
|
@ -0,0 +1,20 @@
|
|||||||
|
@inherits SettingsDialogBase
|
||||||
|
|
||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6"><MudIcon Icon="@Icons.Material.Filled.TextFields" Class="mr-2" />Agent: Text Content Cleaner Options</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
||||||
|
<MudText Typo="Typo.body1" Class="mb-3">
|
||||||
|
Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things,
|
||||||
|
and attempts to convert relative links into absolute links so that they can be used.
|
||||||
|
</MudText>
|
||||||
|
<ConfigurationOption OptionDescription="Preselect text content cleaner options?" LabelOn="Options are preselected" LabelOff="No options are preselected" State="@(() => this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions = updatedState)" OptionHelp="When enabled, you can preselect some agent options. This is might be useful when you prefer a LLM."/>
|
||||||
|
<ConfigurationProviderSelection Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectedAgentProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectedAgentProvider = selectedValue)"/>
|
||||||
|
</MudPaper>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
@ -0,0 +1,5 @@
|
|||||||
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
public partial class SettingsDialogAgentContentCleaner : SettingsDialogBase
|
||||||
|
{
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
@inherits SettingsDialogBase
|
||||||
|
|
||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6"><MudIcon Icon="@Icons.Material.Filled.SelectAll" Class="mr-2" />Assistant: Agent: Data Source Selection Options</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
||||||
|
<MudText Typo="Typo.body1" Class="mb-3">
|
||||||
|
Use Case: this agent is used to select the appropriate data sources for the current prompt.
|
||||||
|
</MudText>
|
||||||
|
<ConfigurationOption OptionDescription="Preselect data source selection options?" LabelOn="Options are preselected" LabelOff="No options are preselected" State="@(() => this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectAgentOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectAgentOptions = updatedState)" OptionHelp="When enabled, you can preselect some agent options. This is might be useful when you prefer a LLM."/>
|
||||||
|
<ConfigurationProviderSelection Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectAgentOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectedAgentProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectedAgentProvider = selectedValue)"/>
|
||||||
|
</MudPaper>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
@ -0,0 +1,5 @@
|
|||||||
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
public partial class SettingsDialogAgentDataSourceSelection : SettingsDialogBase
|
||||||
|
{
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
@inherits SettingsDialogBase
|
||||||
|
|
||||||
|
|
||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6"><MudIcon Icon="@Icons.Material.Filled.Assessment" Class="mr-2" />Agent: Retrieval Context Validation Options</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
|
||||||
|
<MudText Typo="Typo.body1" Class="mb-3">
|
||||||
|
Use Case: this agent is used to validate any retrieval context of any retrieval process. Perhaps there are many of these
|
||||||
|
retrieval contexts and you want to validate them all. Therefore, you might want to use a cheap and fast LLM for this
|
||||||
|
job. When using a local or self-hosted LLM, look for a small (e.g. 3B) and fast model.
|
||||||
|
</MudText>
|
||||||
|
<ConfigurationOption OptionDescription="Enable the retrieval context validation agent?" LabelOn="The validation agent is enabled" LabelOff="No validation is performed" State="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation = updatedState)" OptionHelp="When enabled, the retrieval context validation agent will check each retrieval context of any retrieval process, whether a context makes sense for the given prompt."/>
|
||||||
|
@if (this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation)
|
||||||
|
{
|
||||||
|
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
||||||
|
<ConfigurationOption OptionDescription="Preselect retrieval context validation options?" LabelOn="Options are preselected" LabelOff="No options are preselected" State="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions = updatedState)" OptionHelp="When enabled, you can preselect some agent options. This is might be useful when you prefer a LLM."/>
|
||||||
|
<ConfigurationSlider T="int" OptionDescription="How many validation agents should work simultaneously?" Min="1" Max="100" Step="1" Unit="agents" Value="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.NumParallelValidations)" ValueUpdate="@(updatedValue => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.NumParallelValidations = updatedValue)" OptionHelp="More active agents also mean that a corresponding number of requests are made simultaneously. Some providers limit the number of requests per minute. When you are unsure, choose a low setting between 1 to 6 agents."/>
|
||||||
|
<ConfigurationProviderSelection Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectedAgentProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectedAgentProvider = selectedValue)"/>
|
||||||
|
</MudPaper>
|
||||||
|
}
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
@ -0,0 +1,5 @@
|
|||||||
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
public partial class SettingsDialogAgentRetrievalContextValidation : SettingsDialogBase
|
||||||
|
{
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
@using AIStudio.Settings
|
||||||
|
@using AIStudio.Settings.DataModel
|
||||||
|
@inherits SettingsDialogBase
|
||||||
|
|
||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6"><MudIcon Icon="@Icons.Material.Filled.Apps" Class="mr-2" />App Options</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<ConfigurationSelect OptionDescription="Color theme" SelectedValue="@(() => this.SettingsManager.ConfigurationData.App.PreferredTheme)" Data="@ConfigurationSelectDataFactory.GetThemesData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.App.PreferredTheme = selectedValue)" OptionHelp="Choose the color theme that best suits for you."/>
|
||||||
|
<ConfigurationOption OptionDescription="Save energy?" LabelOn="Energy saving is enabled" LabelOff="Energy saving is disabled" State="@(() => this.SettingsManager.ConfigurationData.App.IsSavingEnergy)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.App.IsSavingEnergy = updatedState)" OptionHelp="When enabled, streamed content from the AI is updated once every third second. When disabled, streamed content will be updated as soon as it is available."/>
|
||||||
|
<ConfigurationOption OptionDescription="Enable spellchecking?" LabelOn="Spellchecking is enabled" LabelOff="Spellchecking is disabled" State="@(() => this.SettingsManager.ConfigurationData.App.EnableSpellchecking)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.App.EnableSpellchecking = updatedState)" OptionHelp="When enabled, spellchecking will be active in all input fields. Depending on your operating system, errors may not be visually highlighted, but right-clicking may still offer possible corrections."/>
|
||||||
|
<ConfigurationSelect OptionDescription="Check for updates" SelectedValue="@(() => this.SettingsManager.ConfigurationData.App.UpdateBehavior)" Data="@ConfigurationSelectDataFactory.GetUpdateBehaviorData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.App.UpdateBehavior = selectedValue)" OptionHelp="How often should we check for app updates?"/>
|
||||||
|
<ConfigurationSelect OptionDescription="Navigation bar behavior" SelectedValue="@(() => this.SettingsManager.ConfigurationData.App.NavigationBehavior)" Data="@ConfigurationSelectDataFactory.GetNavBehaviorData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.App.NavigationBehavior = selectedValue)" OptionHelp="Select the desired behavior for the navigation bar."/>
|
||||||
|
<ConfigurationSelect OptionDescription="Preview feature visibility" SelectedValue="@(() => this.SettingsManager.ConfigurationData.App.PreviewVisibility)" Data="@ConfigurationSelectDataFactory.GetPreviewVisibility()" SelectionUpdate="@this.UpdatePreviewFeatures" OptionHelp="Do you want to show preview features in the app?"/>
|
||||||
|
|
||||||
|
@if (this.SettingsManager.ConfigurationData.App.PreviewVisibility > PreviewVisibility.NONE)
|
||||||
|
{
|
||||||
|
var availablePreviewFeatures = ConfigurationSelectDataFactory.GetPreviewFeaturesData(this.SettingsManager).ToList();
|
||||||
|
if (availablePreviewFeatures.Count > 0)
|
||||||
|
{
|
||||||
|
<ConfigurationMultiSelect OptionDescription="Select preview features" SelectedValues="@(() => this.SettingsManager.ConfigurationData.App.EnabledPreviewFeatures)" Data="@availablePreviewFeatures" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.App.EnabledPreviewFeatures = selectedValue)" OptionHelp="Which preview features would you like to enable?"/>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<ConfigurationProviderSelection Component="Components.APP_SETTINGS" Data="@this.AvailableLLMProvidersFunc()" SelectedValue="@(() => this.SettingsManager.ConfigurationData.App.PreselectedProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.App.PreselectedProvider = selectedValue)" HelpText="@(() => "Would you like to set one provider as the default for the entire app? When you configure a different provider for an assistant, it will always take precedence.")"/>
|
||||||
|
<ConfigurationSelect OptionDescription="Preselect one of your profiles?" SelectedValue="@(() => this.SettingsManager.ConfigurationData.App.PreselectedProfile)" Data="@ConfigurationSelectDataFactory.GetProfilesData(this.SettingsManager.ConfigurationData.Profiles)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.App.PreselectedProfile = selectedValue)" OptionHelp="Would you like to set one of your profiles as the default for the entire app? When you configure a different profile for an assistant, it will always take precedence."/>
|
||||||
|
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
@ -0,0 +1,13 @@
|
|||||||
|
using AIStudio.Settings.DataModel;
|
||||||
|
|
||||||
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
public partial class SettingsDialogApp : SettingsDialogBase
|
||||||
|
{
|
||||||
|
private void UpdatePreviewFeatures(PreviewVisibility previewVisibility)
|
||||||
|
{
|
||||||
|
this.SettingsManager.ConfigurationData.App.PreviewVisibility = previewVisibility;
|
||||||
|
this.SettingsManager.ConfigurationData.App.EnabledPreviewFeatures = previewVisibility.FilterPreviewFeatures(this.SettingsManager.ConfigurationData.App.EnabledPreviewFeatures);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using AIStudio.Settings;
|
||||||
|
using AIStudio.Tools.Services;
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
public abstract class SettingsDialogBase : ComponentBase
|
||||||
|
{
|
||||||
|
[CascadingParameter]
|
||||||
|
protected MudDialogInstance MudDialog { get; set; } = null!;
|
||||||
|
|
||||||
|
[CascadingParameter]
|
||||||
|
public Pages.Settings Settings { get; set; } = null!;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Func<IReadOnlyList<ConfigurationSelectData<string>>> AvailableLLMProvidersFunc { get; set; } = () => [];
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected SettingsManager SettingsManager { get; init; } = null!;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected IDialogService DialogService { get; init; } = null!;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected MessageBus MessageBus { get; init; } = null!;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected RustService RustService { get; init; } = null!;
|
||||||
|
|
||||||
|
protected void Close() => this.MudDialog.Cancel();
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
@using AIStudio.Settings
|
||||||
|
@using AIStudio.Settings.DataModel
|
||||||
|
@inherits SettingsDialogBase
|
||||||
|
|
||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6"><MudIcon Icon="@Icons.Material.Filled.Chat" Class="mr-2" />Chat Options</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<ConfigurationSelect OptionDescription="Shortcut to send input" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Chat.ShortcutSendBehavior)" Data="@ConfigurationSelectDataFactory.GetSendBehaviorData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Chat.ShortcutSendBehavior = selectedValue)" OptionHelp="Do you want to use any shortcut to send your input?"/>
|
||||||
|
<ConfigurationOption OptionDescription="Show the latest message after loading?" LabelOn="Latest message is shown, after loading a chat" LabelOff="First (oldest) message is shown, after loading a chat" State="@(() => this.SettingsManager.ConfigurationData.Chat.ShowLatestMessageAfterLoading)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Chat.ShowLatestMessageAfterLoading = updatedState)" OptionHelp="When enabled, the latest message is shown after loading a chat. When disabled, the first (oldest) message is shown."/>
|
||||||
|
<ConfigurationSelect OptionDescription="Provider selection when creating new chats" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Chat.AddChatProviderBehavior)" Data="@ConfigurationSelectDataFactory.GetAddChatProviderBehavior()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Chat.AddChatProviderBehavior = selectedValue)" OptionHelp="Control how the LLM provider for added chats is selected."/>
|
||||||
|
<ConfigurationSelect OptionDescription="Provider selection when loading a chat and sending assistant results to chat" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Chat.LoadingProviderBehavior)" Data="@ConfigurationSelectDataFactory.GetLoadingChatProviderBehavior()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Chat.LoadingProviderBehavior = selectedValue)" OptionHelp="Control how the LLM provider for loaded chats is selected and when assistant results are sent to chat."/>
|
||||||
|
|
||||||
|
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
||||||
|
<ConfigurationOption OptionDescription="Preselect chat options?" LabelOn="Chat options are preselected" LabelOff="No chat options are preselected" State="@(() => this.SettingsManager.ConfigurationData.Chat.PreselectOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Chat.PreselectOptions = updatedState)" OptionHelp="When enabled, you can preselect chat options. This is might be useful when you prefer a specific provider."/>
|
||||||
|
<ConfigurationProviderSelection Component="Components.CHAT" Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.Chat.PreselectOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Chat.PreselectedProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Chat.PreselectedProvider = selectedValue)"/>
|
||||||
|
<ConfigurationSelect OptionDescription="Preselect one of your profiles?" Disabled="@(() => !this.SettingsManager.ConfigurationData.Chat.PreselectOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Chat.PreselectedProfile)" Data="@ConfigurationSelectDataFactory.GetProfilesData(this.SettingsManager.ConfigurationData.Profiles)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Chat.PreselectedProfile = selectedValue)" OptionHelp="Would you like to set one of your profiles as the default for chats?"/>
|
||||||
|
</MudPaper>
|
||||||
|
|
||||||
|
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
|
||||||
|
{
|
||||||
|
<DataSourceSelection SelectionMode="DataSourceSelectionMode.CONFIGURATION_MODE" AutoSaveAppSettings="@true" @bind-DataSourceOptions="@this.SettingsManager.ConfigurationData.Chat.PreselectedDataSourceOptions" ConfigurationHeaderMessage="You can set default data sources and options for new chats. You can change these settings later for each individual chat."/>
|
||||||
|
<ConfigurationSelect OptionDescription="Apply default data source option when sending assistant results to chat" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Chat.SendToChatDataSourceBehavior)" Data="@ConfigurationSelectDataFactory.GetSendToChatDataSourceBehaviorData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Chat.SendToChatDataSourceBehavior = selectedValue)" OptionHelp="Do you want to apply the default data source options when sending assistant results to chat?"/>
|
||||||
|
}
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
@ -0,0 +1,5 @@
|
|||||||
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
public partial class SettingsDialogChat : SettingsDialogBase
|
||||||
|
{
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
@using AIStudio.Settings.DataModel
|
||||||
|
@inherits SettingsDialogBase
|
||||||
|
|
||||||
|
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
|
||||||
|
{
|
||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6"><MudIcon Icon="@Icons.Material.Filled.IntegrationInstructions" Class="mr-2" />Configure Data Sources</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<PreviewPrototype/>
|
||||||
|
<MudText Typo="Typo.h4" Class="mb-3">
|
||||||
|
Configured Data Sources
|
||||||
|
</MudText>
|
||||||
|
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||||
|
You might configure different data sources. A data source can include one file, all files
|
||||||
|
in a directory, or data from your company. Later, you can incorporate these data sources
|
||||||
|
as needed when the AI requires this data to complete a certain task.
|
||||||
|
</MudJustifiedText>
|
||||||
|
|
||||||
|
<MudTable Items="@this.SettingsManager.ConfigurationData.DataSources" Hover="@true" Class="border-dashed border rounded-lg">
|
||||||
|
<ColGroup>
|
||||||
|
<col style="width: 3em;"/>
|
||||||
|
<col/>
|
||||||
|
<col style="width: 12em;"/>
|
||||||
|
<col style="width: 12em;"/>
|
||||||
|
<col style="width: 40em;"/>
|
||||||
|
</ColGroup>
|
||||||
|
<HeaderContent>
|
||||||
|
<MudTh>#</MudTh>
|
||||||
|
<MudTh>Name</MudTh>
|
||||||
|
<MudTh>Type</MudTh>
|
||||||
|
<MudTh>Embedding</MudTh>
|
||||||
|
<MudTh Style="text-align: left;">Actions</MudTh>
|
||||||
|
</HeaderContent>
|
||||||
|
<RowTemplate>
|
||||||
|
<MudTd>@context.Num</MudTd>
|
||||||
|
<MudTd>@context.Name</MudTd>
|
||||||
|
<MudTd>@context.Type.GetDisplayName()</MudTd>
|
||||||
|
<MudTd>@this.GetEmbeddingName(context)</MudTd>
|
||||||
|
|
||||||
|
<MudTd Style="text-align: left;">
|
||||||
|
<MudIconButton Variant="Variant.Filled" Color="Color.Info" Icon="@Icons.Material.Filled.Info" Class="ma-2" OnClick="() => this.ShowInformation(context)"/>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" Class="ma-2" OnClick="() => this.EditDataSource(context)">
|
||||||
|
Edit
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" Class="ma-2" OnClick="() => this.DeleteDataSource(context)">
|
||||||
|
Delete
|
||||||
|
</MudButton>
|
||||||
|
</MudTd>
|
||||||
|
</RowTemplate>
|
||||||
|
</MudTable>
|
||||||
|
|
||||||
|
@if (this.SettingsManager.ConfigurationData.DataSources.Count == 0)
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.h6" Class="mt-3">No data sources configured yet.</MudText>
|
||||||
|
}
|
||||||
|
|
||||||
|
<MudMenu EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="Add Data Source" Color="Color.Primary" Variant="Variant.Filled" AnchorOrigin="Origin.CenterCenter" TransformOrigin="Origin.TopLeft" Class="mt-3 mb-6">
|
||||||
|
<MudMenuItem OnClick="() => this.AddDataSource(DataSourceType.ERI_V1)">External Data (ERI-Server v1)</MudMenuItem>
|
||||||
|
<MudMenuItem OnClick="() => this.AddDataSource(DataSourceType.LOCAL_DIRECTORY)">Local Directory</MudMenuItem>
|
||||||
|
<MudMenuItem OnClick="() => this.AddDataSource(DataSourceType.LOCAL_FILE)">Local File</MudMenuItem>
|
||||||
|
</MudMenu>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
||||||
|
}
|
@ -0,0 +1,260 @@
|
|||||||
|
using AIStudio.Dialogs;
|
||||||
|
using AIStudio.Settings;
|
||||||
|
using AIStudio.Settings.DataModel;
|
||||||
|
using AIStudio.Tools.ERIClient.DataModel;
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
using DialogOptions = AIStudio.Dialogs.DialogOptions;
|
||||||
|
|
||||||
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
public partial class SettingsDialogDataSources : SettingsDialogBase
|
||||||
|
{
|
||||||
|
[Parameter]
|
||||||
|
public List<ConfigurationSelectData<string>> AvailableDataSources { get; set; } = new();
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<List<ConfigurationSelectData<string>>> AvailableDataSourcesChanged { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Func<IReadOnlyList<ConfigurationSelectData<string>>> AvailableEmbeddingsFunc { get; set; } = () => [];
|
||||||
|
|
||||||
|
#region Overrides of ComponentBase
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await this.UpdateDataSources();
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string GetEmbeddingName(IDataSource dataSource)
|
||||||
|
{
|
||||||
|
if(dataSource is IInternalDataSource internalDataSource)
|
||||||
|
{
|
||||||
|
var matchedEmbedding = this.SettingsManager.ConfigurationData.EmbeddingProviders.FirstOrDefault(x => x.Id == internalDataSource.EmbeddingId);
|
||||||
|
if(matchedEmbedding == default)
|
||||||
|
return "No valid embedding";
|
||||||
|
|
||||||
|
return matchedEmbedding.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dataSource is IExternalDataSource)
|
||||||
|
return "External (ERI)";
|
||||||
|
|
||||||
|
return "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task AddDataSource(DataSourceType type)
|
||||||
|
{
|
||||||
|
IDataSource? addedDataSource = null;
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case DataSourceType.LOCAL_FILE:
|
||||||
|
var localFileDialogParameters = new DialogParameters<DataSourceLocalFileDialog>
|
||||||
|
{
|
||||||
|
{ x => x.IsEditing, false },
|
||||||
|
{ x => x.AvailableEmbeddings, this.AvailableEmbeddingsFunc() }
|
||||||
|
};
|
||||||
|
|
||||||
|
var localFileDialogReference = await this.DialogService.ShowAsync<DataSourceLocalFileDialog>("Add Local File as Data Source", localFileDialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var localFileDialogResult = await localFileDialogReference.Result;
|
||||||
|
if (localFileDialogResult is null || localFileDialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var localFile = (DataSourceLocalFile)localFileDialogResult.Data!;
|
||||||
|
localFile = localFile with { Num = this.SettingsManager.ConfigurationData.NextDataSourceNum++ };
|
||||||
|
addedDataSource = localFile;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DataSourceType.LOCAL_DIRECTORY:
|
||||||
|
var localDirectoryDialogParameters = new DialogParameters<DataSourceLocalDirectoryDialog>
|
||||||
|
{
|
||||||
|
{ x => x.IsEditing, false },
|
||||||
|
{ x => x.AvailableEmbeddings, this.AvailableEmbeddingsFunc() }
|
||||||
|
};
|
||||||
|
|
||||||
|
var localDirectoryDialogReference = await this.DialogService.ShowAsync<DataSourceLocalDirectoryDialog>("Add Local Directory as Data Source", localDirectoryDialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var localDirectoryDialogResult = await localDirectoryDialogReference.Result;
|
||||||
|
if (localDirectoryDialogResult is null || localDirectoryDialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var localDirectory = (DataSourceLocalDirectory)localDirectoryDialogResult.Data!;
|
||||||
|
localDirectory = localDirectory with { Num = this.SettingsManager.ConfigurationData.NextDataSourceNum++ };
|
||||||
|
addedDataSource = localDirectory;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DataSourceType.ERI_V1:
|
||||||
|
var eriDialogParameters = new DialogParameters<DataSourceERI_V1Dialog>
|
||||||
|
{
|
||||||
|
{ x => x.IsEditing, false },
|
||||||
|
};
|
||||||
|
|
||||||
|
var eriDialogReference = await this.DialogService.ShowAsync<DataSourceERI_V1Dialog>("Add ERI v1 Data Source", eriDialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var eriDialogResult = await eriDialogReference.Result;
|
||||||
|
if (eriDialogResult is null || eriDialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var eriDataSource = (DataSourceERI_V1)eriDialogResult.Data!;
|
||||||
|
eriDataSource = eriDataSource with { Num = this.SettingsManager.ConfigurationData.NextDataSourceNum++ };
|
||||||
|
addedDataSource = eriDataSource;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(addedDataSource is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.SettingsManager.ConfigurationData.DataSources.Add(addedDataSource);
|
||||||
|
await this.UpdateDataSources();
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task EditDataSource(IDataSource dataSource)
|
||||||
|
{
|
||||||
|
IDataSource? editedDataSource = null;
|
||||||
|
switch (dataSource)
|
||||||
|
{
|
||||||
|
case DataSourceLocalFile localFile:
|
||||||
|
var localFileDialogParameters = new DialogParameters<DataSourceLocalFileDialog>
|
||||||
|
{
|
||||||
|
{ x => x.IsEditing, true },
|
||||||
|
{ x => x.DataSource, localFile },
|
||||||
|
{ x => x.AvailableEmbeddings, this.AvailableEmbeddingsFunc() }
|
||||||
|
};
|
||||||
|
|
||||||
|
var localFileDialogReference = await this.DialogService.ShowAsync<DataSourceLocalFileDialog>("Edit Local File Data Source", localFileDialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var localFileDialogResult = await localFileDialogReference.Result;
|
||||||
|
if (localFileDialogResult is null || localFileDialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
editedDataSource = (DataSourceLocalFile)localFileDialogResult.Data!;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DataSourceLocalDirectory localDirectory:
|
||||||
|
var localDirectoryDialogParameters = new DialogParameters<DataSourceLocalDirectoryDialog>
|
||||||
|
{
|
||||||
|
{ x => x.IsEditing, true },
|
||||||
|
{ x => x.DataSource, localDirectory },
|
||||||
|
{ x => x.AvailableEmbeddings, this.AvailableEmbeddingsFunc() }
|
||||||
|
};
|
||||||
|
|
||||||
|
var localDirectoryDialogReference = await this.DialogService.ShowAsync<DataSourceLocalDirectoryDialog>("Edit Local Directory Data Source", localDirectoryDialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var localDirectoryDialogResult = await localDirectoryDialogReference.Result;
|
||||||
|
if (localDirectoryDialogResult is null || localDirectoryDialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
editedDataSource = (DataSourceLocalDirectory)localDirectoryDialogResult.Data!;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DataSourceERI_V1 eriDataSource:
|
||||||
|
var eriDialogParameters = new DialogParameters<DataSourceERI_V1Dialog>
|
||||||
|
{
|
||||||
|
{ x => x.IsEditing, true },
|
||||||
|
{ x => x.DataSource, eriDataSource },
|
||||||
|
};
|
||||||
|
|
||||||
|
var eriDialogReference = await this.DialogService.ShowAsync<DataSourceERI_V1Dialog>("Edit ERI v1 Data Source", eriDialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var eriDialogResult = await eriDialogReference.Result;
|
||||||
|
if (eriDialogResult is null || eriDialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
editedDataSource = (DataSourceERI_V1)eriDialogResult.Data!;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(editedDataSource is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.SettingsManager.ConfigurationData.DataSources[this.SettingsManager.ConfigurationData.DataSources.IndexOf(dataSource)] = editedDataSource;
|
||||||
|
|
||||||
|
await this.UpdateDataSources();
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DeleteDataSource(IDataSource dataSource)
|
||||||
|
{
|
||||||
|
var dialogParameters = new DialogParameters
|
||||||
|
{
|
||||||
|
{ "Message", $"Are you sure you want to delete the data source '{dataSource.Name}' of type {dataSource.Type.GetDisplayName()}?" },
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Data Source", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var dialogResult = await dialogReference.Result;
|
||||||
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var applyChanges = dataSource is IInternalDataSource;
|
||||||
|
|
||||||
|
// External data sources may need a secret for authentication:
|
||||||
|
if (dataSource is IExternalDataSource externalDataSource)
|
||||||
|
{
|
||||||
|
// When the auth method is NONE or KERBEROS, we don't need to delete a secret.
|
||||||
|
// In the case of KERBEROS, we don't store the Kerberos ticket in the secret store.
|
||||||
|
if(dataSource is IERIDataSource { AuthMethod: AuthMethod.NONE or AuthMethod.KERBEROS })
|
||||||
|
applyChanges = true;
|
||||||
|
|
||||||
|
// All other auth methods require a secret, which we need to delete now:
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var deleteSecretResponse = await this.RustService.DeleteSecret(externalDataSource);
|
||||||
|
if (deleteSecretResponse.Success)
|
||||||
|
applyChanges = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(applyChanges)
|
||||||
|
{
|
||||||
|
this.SettingsManager.ConfigurationData.DataSources.Remove(dataSource);
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
await this.UpdateDataSources();
|
||||||
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ShowInformation(IDataSource dataSource)
|
||||||
|
{
|
||||||
|
switch (dataSource)
|
||||||
|
{
|
||||||
|
case DataSourceLocalFile localFile:
|
||||||
|
var localFileDialogParameters = new DialogParameters<DataSourceLocalFileInfoDialog>
|
||||||
|
{
|
||||||
|
{ x => x.DataSource, localFile },
|
||||||
|
};
|
||||||
|
|
||||||
|
await this.DialogService.ShowAsync<DataSourceLocalFileInfoDialog>("Local File Data Source Information", localFileDialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DataSourceLocalDirectory localDirectory:
|
||||||
|
var localDirectoryDialogParameters = new DialogParameters<DataSourceLocalDirectoryInfoDialog>
|
||||||
|
{
|
||||||
|
{ x => x.DataSource, localDirectory },
|
||||||
|
};
|
||||||
|
|
||||||
|
await this.DialogService.ShowAsync<DataSourceLocalDirectoryInfoDialog>("Local Directory Data Source Information", localDirectoryDialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DataSourceERI_V1 eriV1DataSource:
|
||||||
|
var eriV1DialogParameters = new DialogParameters<DataSourceERI_V1InfoDialog>
|
||||||
|
{
|
||||||
|
{ x => x.DataSource, eriV1DataSource },
|
||||||
|
};
|
||||||
|
|
||||||
|
await this.DialogService.ShowAsync<DataSourceERI_V1InfoDialog>("ERI v1 Data Source Information", eriV1DialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task UpdateDataSources()
|
||||||
|
{
|
||||||
|
this.AvailableDataSources.Clear();
|
||||||
|
foreach (var dataSource in this.SettingsManager.ConfigurationData.DataSources)
|
||||||
|
this.AvailableDataSources.Add(new (dataSource.Name, dataSource.Id));
|
||||||
|
|
||||||
|
await this.AvailableDataSourcesChanged.InvokeAsync(this.AvailableDataSources);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
@using AIStudio.Settings
|
||||||
|
@inherits SettingsDialogBase
|
||||||
|
|
||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6"><MudIcon Icon="@Icons.Material.Filled.PrivateConnectivity" Class="mr-2" />Assistant: ERI Server</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
||||||
|
<ConfigurationOption OptionDescription="Preselect ERI server options?" LabelOn="ERI server options are preselected" LabelOff="No ERI server options are preselected" State="@(() => this.SettingsManager.ConfigurationData.ERI.PreselectOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.ERI.PreselectOptions = updatedState)" OptionHelp="When enabled, you can preselect some ERI server options."/>
|
||||||
|
<ConfigurationMinConfidenceSelection Disabled="@(() => !this.SettingsManager.ConfigurationData.ERI.PreselectOptions)" RestrictToGlobalMinimumConfidence="@true" SelectedValue="@(() => this.SettingsManager.ConfigurationData.ERI.MinimumProviderConfidence)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.ERI.MinimumProviderConfidence = selectedValue)"/>
|
||||||
|
<ConfigurationSelect OptionDescription="Preselect one of your profiles?" Disabled="@(() => !this.SettingsManager.ConfigurationData.ERI.PreselectOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.ERI.PreselectedProfile)" Data="@ConfigurationSelectDataFactory.GetProfilesData(this.SettingsManager.ConfigurationData.Profiles)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.ERI.PreselectedProfile = selectedValue)" OptionHelp="Would you like to preselect one of your profiles?"/>
|
||||||
|
|
||||||
|
<MudText Typo="Typo.body1" Class="mb-3">
|
||||||
|
Most ERI server options can be customized and saved directly in the ERI server assistant.
|
||||||
|
For this, the ERI server assistant has an auto-save function.
|
||||||
|
</MudText>
|
||||||
|
|
||||||
|
<MudButton Size="Size.Large" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.PrivateConnectivity" Color="Color.Default" Href="@Routes.ASSISTANT_ERI">
|
||||||
|
Switch to ERI server assistant
|
||||||
|
</MudButton>
|
||||||
|
</MudPaper>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
@ -0,0 +1,5 @@
|
|||||||
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
public partial class SettingsDialogERIServer : SettingsDialogBase
|
||||||
|
{
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
@using AIStudio.Provider
|
||||||
|
@using AIStudio.Settings.DataModel
|
||||||
|
@inherits SettingsDialogBase
|
||||||
|
|
||||||
|
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
|
||||||
|
{
|
||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6"><MudIcon Icon="@Icons.Material.Filled.IntegrationInstructions" Class="mr-2" />Configure Embeddings</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<PreviewPrototype/>
|
||||||
|
<MudText Typo="Typo.h4" Class="mb-3">
|
||||||
|
Configured Embeddings
|
||||||
|
</MudText>
|
||||||
|
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||||
|
Embeddings are a way to represent words, sentences, entire documents, or even images and videos as digital
|
||||||
|
fingerprints. Just like each person has a unique fingerprint, embedding models create unique digital patterns
|
||||||
|
that capture the meaning and characteristics of the content they analyze. When two things are similar in meaning
|
||||||
|
or content, their digital fingerprints will look very similar. For example, the fingerprints for 'happy' and
|
||||||
|
'joyful' would be more alike than those for 'happy' and 'sad'.
|
||||||
|
</MudJustifiedText>
|
||||||
|
|
||||||
|
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||||
|
This helps AI Studio understand and compare things in a way that's similar to how humans do. When you're working on
|
||||||
|
something, AI Studio can automatically identify related documents and data by comparing their digital fingerprints.
|
||||||
|
For instance, if you're writing about customer service, AI Studio can instantly find other documents in your data that
|
||||||
|
discuss similar topics or experiences, even if they use different words.
|
||||||
|
</MudJustifiedText>
|
||||||
|
<MudTable Items="@this.SettingsManager.ConfigurationData.EmbeddingProviders" Hover="@true" Class="border-dashed border rounded-lg">
|
||||||
|
<ColGroup>
|
||||||
|
<col style="width: 3em;"/>
|
||||||
|
<col style="width: 12em;"/>
|
||||||
|
<col style="width: 12em;"/>
|
||||||
|
<col/>
|
||||||
|
<col style="width: 40em;"/>
|
||||||
|
</ColGroup>
|
||||||
|
<HeaderContent>
|
||||||
|
<MudTh>#</MudTh>
|
||||||
|
<MudTh>Name</MudTh>
|
||||||
|
<MudTh>Provider</MudTh>
|
||||||
|
<MudTh>Model</MudTh>
|
||||||
|
<MudTh Style="text-align: left;">Actions</MudTh>
|
||||||
|
</HeaderContent>
|
||||||
|
<RowTemplate>
|
||||||
|
<MudTd>@context.Num</MudTd>
|
||||||
|
<MudTd>@context.Name</MudTd>
|
||||||
|
<MudTd>@context.UsedLLMProvider</MudTd>
|
||||||
|
<MudTd>@this.GetEmbeddingProviderModelName(context)</MudTd>
|
||||||
|
|
||||||
|
<MudTd Style="text-align: left;">
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.OpenInBrowser" Class="ma-2" Href="@context.UsedLLMProvider.GetDashboardURL()" Target="_blank" Disabled="@(!context.UsedLLMProvider.HasDashboard())">
|
||||||
|
Open Dashboard
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" Class="ma-2" OnClick="() => this.EditEmbeddingProvider(context)">
|
||||||
|
Edit
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" Class="ma-2" OnClick="() => this.DeleteEmbeddingProvider(context)">
|
||||||
|
Delete
|
||||||
|
</MudButton>
|
||||||
|
</MudTd>
|
||||||
|
</RowTemplate>
|
||||||
|
</MudTable>
|
||||||
|
|
||||||
|
@if (this.SettingsManager.ConfigurationData.EmbeddingProviders.Count == 0)
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.h6" Class="mt-3">No embeddings configured yet.</MudText>
|
||||||
|
}
|
||||||
|
|
||||||
|
<MudButton Variant="Variant.Filled" Color="@Color.Primary" StartIcon="@Icons.Material.Filled.AddRoad" Class="mt-3 mb-6" OnClick="@this.AddEmbeddingProvider">
|
||||||
|
Add Embedding
|
||||||
|
</MudButton>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
using AIStudio.Dialogs;
|
||||||
|
using AIStudio.Settings;
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
using DialogOptions = AIStudio.Dialogs.DialogOptions;
|
||||||
|
|
||||||
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
public partial class SettingsDialogEmbeddings : SettingsDialogBase
|
||||||
|
{
|
||||||
|
[Parameter]
|
||||||
|
public List<ConfigurationSelectData<string>> AvailableEmbeddingProviders { get; set; } = new();
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<List<ConfigurationSelectData<string>>> AvailableEmbeddingProvidersChanged { get; set; }
|
||||||
|
|
||||||
|
private string GetEmbeddingProviderModelName(EmbeddingProvider provider)
|
||||||
|
{
|
||||||
|
const int MAX_LENGTH = 36;
|
||||||
|
var modelName = provider.Model.ToString();
|
||||||
|
return modelName.Length > MAX_LENGTH ? "[...] " + modelName[^Math.Min(MAX_LENGTH, modelName.Length)..] : modelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Overrides of ComponentBase
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await this.UpdateEmbeddingProviders();
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private async Task AddEmbeddingProvider()
|
||||||
|
{
|
||||||
|
var dialogParameters = new DialogParameters<EmbeddingProviderDialog>
|
||||||
|
{
|
||||||
|
{ x => x.IsEditing, false },
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialogReference = await this.DialogService.ShowAsync<EmbeddingProviderDialog>("Add Embedding Provider", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var dialogResult = await dialogReference.Result;
|
||||||
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var addedEmbedding = (EmbeddingProvider)dialogResult.Data!;
|
||||||
|
addedEmbedding = addedEmbedding with { Num = this.SettingsManager.ConfigurationData.NextEmbeddingNum++ };
|
||||||
|
|
||||||
|
this.SettingsManager.ConfigurationData.EmbeddingProviders.Add(addedEmbedding);
|
||||||
|
await this.UpdateEmbeddingProviders();
|
||||||
|
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task EditEmbeddingProvider(EmbeddingProvider embeddingProvider)
|
||||||
|
{
|
||||||
|
var dialogParameters = new DialogParameters<EmbeddingProviderDialog>
|
||||||
|
{
|
||||||
|
{ x => x.DataNum, embeddingProvider.Num },
|
||||||
|
{ x => x.DataId, embeddingProvider.Id },
|
||||||
|
{ x => x.DataName, embeddingProvider.Name },
|
||||||
|
{ x => x.DataLLMProvider, embeddingProvider.UsedLLMProvider },
|
||||||
|
{ x => x.DataModel, embeddingProvider.Model },
|
||||||
|
{ x => x.DataHostname, embeddingProvider.Hostname },
|
||||||
|
{ x => x.IsSelfHosted, embeddingProvider.IsSelfHosted },
|
||||||
|
{ x => x.IsEditing, true },
|
||||||
|
{ x => x.DataHost, embeddingProvider.Host },
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialogReference = await this.DialogService.ShowAsync<EmbeddingProviderDialog>("Edit Embedding Provider", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var dialogResult = await dialogReference.Result;
|
||||||
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var editedEmbeddingProvider = (EmbeddingProvider)dialogResult.Data!;
|
||||||
|
|
||||||
|
// Set the provider number if it's not set. This is important for providers
|
||||||
|
// added before we started saving the provider number.
|
||||||
|
if(editedEmbeddingProvider.Num == 0)
|
||||||
|
editedEmbeddingProvider = editedEmbeddingProvider with { Num = this.SettingsManager.ConfigurationData.NextEmbeddingNum++ };
|
||||||
|
|
||||||
|
this.SettingsManager.ConfigurationData.EmbeddingProviders[this.SettingsManager.ConfigurationData.EmbeddingProviders.IndexOf(embeddingProvider)] = editedEmbeddingProvider;
|
||||||
|
await this.UpdateEmbeddingProviders();
|
||||||
|
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DeleteEmbeddingProvider(EmbeddingProvider provider)
|
||||||
|
{
|
||||||
|
var dialogParameters = new DialogParameters
|
||||||
|
{
|
||||||
|
{ "Message", $"Are you sure you want to delete the embedding provider '{provider.Name}'?" },
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Embedding Provider", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var dialogResult = await dialogReference.Result;
|
||||||
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var deleteSecretResponse = await this.RustService.DeleteAPIKey(provider);
|
||||||
|
if(deleteSecretResponse.Success)
|
||||||
|
{
|
||||||
|
this.SettingsManager.ConfigurationData.EmbeddingProviders.Remove(provider);
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.UpdateEmbeddingProviders();
|
||||||
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task UpdateEmbeddingProviders()
|
||||||
|
{
|
||||||
|
this.AvailableEmbeddingProviders.Clear();
|
||||||
|
foreach (var provider in this.SettingsManager.ConfigurationData.EmbeddingProviders)
|
||||||
|
this.AvailableEmbeddingProviders.Add(new (provider.Name, provider.Id));
|
||||||
|
|
||||||
|
await this.AvailableEmbeddingProvidersChanged.InvokeAsync(this.AvailableEmbeddingProviders);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
@inherits SettingsDialogBase
|
||||||
|
|
||||||
|
|
||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6"><MudIcon Icon="@Icons.Material.Filled.Person4" Class="mr-2" />Configure Profiles</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<MudText Typo="Typo.h4" Class="mb-3">Your Profiles</MudText>
|
||||||
|
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||||
|
Store personal data about yourself in various profiles so that the AIs know your personal context.
|
||||||
|
This saves you from having to explain your context each time, for example, in every chat. When you
|
||||||
|
have different roles, you can create a profile for each role.
|
||||||
|
</MudJustifiedText>
|
||||||
|
|
||||||
|
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||||
|
Are you a project manager in a research facility? You might want to create a profile for your project
|
||||||
|
management activities, one for your scientific work, and a profile for when you need to write program
|
||||||
|
code. In these profiles, you can record how much experience you have or which methods you like or
|
||||||
|
dislike using. Later, you can choose when and where you want to use each profile.
|
||||||
|
</MudJustifiedText>
|
||||||
|
<MudTable Items="@this.SettingsManager.ConfigurationData.Profiles" Hover="@true" Class="border-dashed border rounded-lg">
|
||||||
|
<ColGroup>
|
||||||
|
<col style="width: 3em;"/>
|
||||||
|
<col/>
|
||||||
|
<col style="width: 40em;"/>
|
||||||
|
</ColGroup>
|
||||||
|
<HeaderContent>
|
||||||
|
<MudTh>#</MudTh>
|
||||||
|
<MudTh>Profile Name</MudTh>
|
||||||
|
<MudTh Style="text-align: left;">Actions</MudTh>
|
||||||
|
</HeaderContent>
|
||||||
|
<RowTemplate>
|
||||||
|
<MudTd>@context.Num</MudTd>
|
||||||
|
<MudTd>@context.Name</MudTd>
|
||||||
|
<MudTd Style="text-align: left;">
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" Class="ma-2" OnClick="() => this.EditProfile(context)">
|
||||||
|
Edit
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" Class="ma-2" OnClick="() => this.DeleteProfile(context)">
|
||||||
|
Delete
|
||||||
|
</MudButton>
|
||||||
|
</MudTd>
|
||||||
|
</RowTemplate>
|
||||||
|
</MudTable>
|
||||||
|
|
||||||
|
@if(this.SettingsManager.ConfigurationData.Profiles.Count == 0)
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.h6" Class="mt-3">No profiles configured yet.</MudText>
|
||||||
|
}
|
||||||
|
|
||||||
|
<MudButton Variant="Variant.Filled" Color="@Color.Primary" StartIcon="@Icons.Material.Filled.AddRoad" Class="mt-3 mb-6" OnClick="@this.AddProfile">
|
||||||
|
Add Profile
|
||||||
|
</MudButton>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
@ -0,0 +1,73 @@
|
|||||||
|
using AIStudio.Dialogs;
|
||||||
|
using AIStudio.Settings;
|
||||||
|
|
||||||
|
using DialogOptions = AIStudio.Dialogs.DialogOptions;
|
||||||
|
|
||||||
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
public partial class SettingsDialogProfiles : SettingsDialogBase
|
||||||
|
{
|
||||||
|
private async Task AddProfile()
|
||||||
|
{
|
||||||
|
var dialogParameters = new DialogParameters<ProfileDialog>
|
||||||
|
{
|
||||||
|
{ x => x.IsEditing, false },
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialogReference = await this.DialogService.ShowAsync<ProfileDialog>("Add Profile", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var dialogResult = await dialogReference.Result;
|
||||||
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var addedProfile = (Profile)dialogResult.Data!;
|
||||||
|
addedProfile = addedProfile with { Num = this.SettingsManager.ConfigurationData.NextProfileNum++ };
|
||||||
|
|
||||||
|
this.SettingsManager.ConfigurationData.Profiles.Add(addedProfile);
|
||||||
|
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task EditProfile(Profile profile)
|
||||||
|
{
|
||||||
|
var dialogParameters = new DialogParameters<ProfileDialog>
|
||||||
|
{
|
||||||
|
{ x => x.DataNum, profile.Num },
|
||||||
|
{ x => x.DataId, profile.Id },
|
||||||
|
{ x => x.DataName, profile.Name },
|
||||||
|
{ x => x.DataNeedToKnow, profile.NeedToKnow },
|
||||||
|
{ x => x.DataActions, profile.Actions },
|
||||||
|
{ x => x.IsEditing, true },
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialogReference = await this.DialogService.ShowAsync<ProfileDialog>("Edit Profile", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var dialogResult = await dialogReference.Result;
|
||||||
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var editedProfile = (Profile)dialogResult.Data!;
|
||||||
|
this.SettingsManager.ConfigurationData.Profiles[this.SettingsManager.ConfigurationData.Profiles.IndexOf(profile)] = editedProfile;
|
||||||
|
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DeleteProfile(Profile profile)
|
||||||
|
{
|
||||||
|
var dialogParameters = new DialogParameters
|
||||||
|
{
|
||||||
|
{ "Message", $"Are you sure you want to delete the profile '{profile.Name}'?" },
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Profile", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var dialogResult = await dialogReference.Result;
|
||||||
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.SettingsManager.ConfigurationData.Profiles.Remove(profile);
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
|
||||||
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,132 @@
|
|||||||
|
@using AIStudio.Provider
|
||||||
|
@using AIStudio.Settings
|
||||||
|
@using AIStudio.Provider.SelfHosted
|
||||||
|
@inherits SettingsDialogBase
|
||||||
|
|
||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6"><MudIcon Icon="@Icons.Material.Filled.Layers" Class="mr-2" />Configure Providers</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<MudText Typo="Typo.h4" Class="mb-3">Configured Providers</MudText>
|
||||||
|
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||||
|
What we call a provider is the combination of an LLM provider such as OpenAI and a model like GPT-4o.
|
||||||
|
You can configure as many providers as you want. This way, you can use the appropriate model for each
|
||||||
|
task. As an LLM provider, you can also choose local providers. However, to use this app, you must
|
||||||
|
configure at least one provider.
|
||||||
|
</MudJustifiedText>
|
||||||
|
<MudTable Items="@this.SettingsManager.ConfigurationData.Providers" Hover="@true" Class="border-dashed border rounded-lg">
|
||||||
|
<ColGroup>
|
||||||
|
<col style="width: 3em;"/>
|
||||||
|
<col style="width: 12em;"/>
|
||||||
|
<col style="width: 12em;"/>
|
||||||
|
<col/>
|
||||||
|
<col style="width: 34em;"/>
|
||||||
|
</ColGroup>
|
||||||
|
<HeaderContent>
|
||||||
|
<MudTh>#</MudTh>
|
||||||
|
<MudTh>Instance Name</MudTh>
|
||||||
|
<MudTh>Provider</MudTh>
|
||||||
|
<MudTh>Model</MudTh>
|
||||||
|
<MudTh Style="text-align: left;">Actions</MudTh>
|
||||||
|
</HeaderContent>
|
||||||
|
<RowTemplate>
|
||||||
|
<MudTd>@context.Num</MudTd>
|
||||||
|
<MudTd>@context.InstanceName</MudTd>
|
||||||
|
<MudTd>@context.UsedLLMProvider</MudTd>
|
||||||
|
<MudTd>
|
||||||
|
@if (context.UsedLLMProvider is not LLMProviders.SELF_HOSTED)
|
||||||
|
{
|
||||||
|
@this.GetLLMProviderModelName(context)
|
||||||
|
}
|
||||||
|
else if (context.UsedLLMProvider is LLMProviders.SELF_HOSTED && context.Host is not Host.LLAMACPP)
|
||||||
|
{
|
||||||
|
@this.GetLLMProviderModelName(context)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@("as selected by provider")
|
||||||
|
}
|
||||||
|
</MudTd>
|
||||||
|
<MudTd Style="text-align: left;">
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.OpenInBrowser" Class="ma-2" Href="@context.UsedLLMProvider.GetDashboardURL()" Target="_blank" Disabled="@(!context.UsedLLMProvider.HasDashboard())">
|
||||||
|
Open Dashboard
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" Class="ma-2" OnClick="() => this.EditLLMProvider(context)">
|
||||||
|
Edit
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" Class="ma-2" OnClick="() => this.DeleteLLMProvider(context)">
|
||||||
|
Delete
|
||||||
|
</MudButton>
|
||||||
|
</MudTd>
|
||||||
|
</RowTemplate>
|
||||||
|
</MudTable>
|
||||||
|
|
||||||
|
@if(this.SettingsManager.ConfigurationData.Providers.Count == 0)
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.h6" Class="mt-3">No providers configured yet.</MudText>
|
||||||
|
}
|
||||||
|
|
||||||
|
<MudButton Variant="Variant.Filled" Color="@Color.Primary" StartIcon="@Icons.Material.Filled.AddRoad" Class="mt-3 mb-6" OnClick="@this.AddLLMProvider">
|
||||||
|
Add Provider
|
||||||
|
</MudButton>
|
||||||
|
|
||||||
|
<MudText Typo="Typo.h4" Class="mb-3">LLM Provider Confidence</MudText>
|
||||||
|
<MudJustifiedText Class="mb-3">
|
||||||
|
Do you want to always be able to recognize how trustworthy your LLM providers are? This way,
|
||||||
|
you keep control over which provider you send your data to. You have two options for this:
|
||||||
|
Either you choose a common schema, or you configure the trust levels for each LLM provider yourself.
|
||||||
|
</MudJustifiedText>
|
||||||
|
|
||||||
|
<ConfigurationOption OptionDescription="Do you want to enforce an app-wide minimum confidence level?" LabelOn="Yes, enforce a minimum confidence level" LabelOff="No, do not enforce a minimum confidence level" State="@(() => this.SettingsManager.ConfigurationData.LLMProviders.EnforceGlobalMinimumConfidence)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.LLMProviders.EnforceGlobalMinimumConfidence = updatedState)" OptionHelp="When enabled, you can enforce a minimum confidence level for all LLM providers. This way, you can ensure that only trustworthy providers are used."/>
|
||||||
|
@if(this.SettingsManager.ConfigurationData.LLMProviders.EnforceGlobalMinimumConfidence)
|
||||||
|
{
|
||||||
|
<ConfigurationMinConfidenceSelection RestrictToGlobalMinimumConfidence="@false" SelectedValue="@(() => this.SettingsManager.ConfigurationData.LLMProviders.GlobalMinimumConfidence)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.LLMProviders.GlobalMinimumConfidence = selectedValue)"/>
|
||||||
|
}
|
||||||
|
|
||||||
|
<ConfigurationOption OptionDescription="Show provider's confidence level?" LabelOn="Yes, show me the confidence level" LabelOff="No, please hide the confidence level" State="@(() => this.SettingsManager.ConfigurationData.LLMProviders.ShowProviderConfidence)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.LLMProviders.ShowProviderConfidence = updatedState)" OptionHelp="When enabled, we show you the confidence level for the selected provider in the app. This helps you assess where you are sending your data at any time. Example: are you currently working with sensitive data? Then choose a particularly trustworthy provider, etc."/>
|
||||||
|
@if (this.SettingsManager.ConfigurationData.LLMProviders.ShowProviderConfidence)
|
||||||
|
{
|
||||||
|
<ConfigurationSelect OptionDescription="Select a confidence scheme" SelectedValue="@(() => this.SettingsManager.ConfigurationData.LLMProviders.ConfidenceScheme)" Data="@ConfigurationSelectDataFactory.GetConfidenceSchemesData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.LLMProviders.ConfidenceScheme = selectedValue)" OptionHelp="Choose the scheme that best suits you and your life. Do you trust any western provider? Or only providers from the USA or exclusively European providers? Then choose the appropriate scheme. Alternatively, you can assign the confidence levels to each provider yourself."/>
|
||||||
|
@if (this.SettingsManager.ConfigurationData.LLMProviders.ConfidenceScheme is ConfidenceSchemes.CUSTOM)
|
||||||
|
{
|
||||||
|
<MudTable Items="@(Enum.GetValues<LLMProviders>().Where(x => x is not LLMProviders.NONE))" Hover="@true" Class="border-dashed border rounded-lg">
|
||||||
|
<ColGroup>
|
||||||
|
<col style="width: 12em;"/>
|
||||||
|
<col/>
|
||||||
|
<col style="width: 22em;"/>
|
||||||
|
</ColGroup>
|
||||||
|
<HeaderContent>
|
||||||
|
<MudTh>LLM Provider</MudTh>
|
||||||
|
<MudTh>Description</MudTh>
|
||||||
|
<MudTh>Confidence Level</MudTh>
|
||||||
|
</HeaderContent>
|
||||||
|
<RowTemplate>
|
||||||
|
<MudTd Style="vertical-align: top;">
|
||||||
|
@context.ToName()
|
||||||
|
</MudTd>
|
||||||
|
<MudTd>
|
||||||
|
<MudMarkdown Value="@context.GetConfidence(this.SettingsManager).Description"/>
|
||||||
|
</MudTd>
|
||||||
|
<MudTd Style="vertical-align: top;">
|
||||||
|
<MudMenu StartIcon="@Icons.Material.Filled.Security" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="@this.GetCurrentConfidenceLevelName(context)" Variant="Variant.Filled" Style="@this.SetCurrentConfidenceLevelColorStyle(context)">
|
||||||
|
@foreach (var confidenceLevel in Enum.GetValues<ConfidenceLevel>().OrderBy(n => n))
|
||||||
|
{
|
||||||
|
if(confidenceLevel is ConfidenceLevel.NONE or ConfidenceLevel.UNKNOWN)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
<MudMenuItem OnClick="@(async () => await this.ChangeCustomConfidenceLevel(context, confidenceLevel))">
|
||||||
|
@confidenceLevel.GetName()
|
||||||
|
</MudMenuItem>
|
||||||
|
}
|
||||||
|
</MudMenu>
|
||||||
|
</MudTd>
|
||||||
|
</RowTemplate>
|
||||||
|
</MudTable>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
@ -0,0 +1,152 @@
|
|||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
using AIStudio.Dialogs;
|
||||||
|
using AIStudio.Provider;
|
||||||
|
using AIStudio.Settings;
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
using DialogOptions = AIStudio.Dialogs.DialogOptions;
|
||||||
|
|
||||||
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
public partial class SettingsDialogProviders : SettingsDialogBase
|
||||||
|
{
|
||||||
|
[Parameter]
|
||||||
|
public List<ConfigurationSelectData<string>> AvailableLLMProviders { get; set; } = new();
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<List<ConfigurationSelectData<string>>> AvailableLLMProvidersChanged { get; set; }
|
||||||
|
|
||||||
|
#region Overrides of ComponentBase
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await this.UpdateProviders();
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
[SuppressMessage("Usage", "MWAIS0001:Direct access to `Providers` is not allowed")]
|
||||||
|
private async Task AddLLMProvider()
|
||||||
|
{
|
||||||
|
var dialogParameters = new DialogParameters<ProviderDialog>
|
||||||
|
{
|
||||||
|
{ x => x.IsEditing, false },
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialogReference = await this.DialogService.ShowAsync<ProviderDialog>("Add LLM Provider", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var dialogResult = await dialogReference.Result;
|
||||||
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var addedProvider = (AIStudio.Settings.Provider)dialogResult.Data!;
|
||||||
|
addedProvider = addedProvider with { Num = this.SettingsManager.ConfigurationData.NextProviderNum++ };
|
||||||
|
|
||||||
|
this.SettingsManager.ConfigurationData.Providers.Add(addedProvider);
|
||||||
|
await this.UpdateProviders();
|
||||||
|
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
[SuppressMessage("Usage", "MWAIS0001:Direct access to `Providers` is not allowed")]
|
||||||
|
private async Task EditLLMProvider(AIStudio.Settings.Provider provider)
|
||||||
|
{
|
||||||
|
var dialogParameters = new DialogParameters<ProviderDialog>
|
||||||
|
{
|
||||||
|
{ x => x.DataNum, provider.Num },
|
||||||
|
{ x => x.DataId, provider.Id },
|
||||||
|
{ x => x.DataInstanceName, provider.InstanceName },
|
||||||
|
{ x => x.DataLLMProvider, provider.UsedLLMProvider },
|
||||||
|
{ x => x.DataModel, provider.Model },
|
||||||
|
{ x => x.DataHostname, provider.Hostname },
|
||||||
|
{ x => x.IsSelfHosted, provider.IsSelfHosted },
|
||||||
|
{ x => x.IsEditing, true },
|
||||||
|
{ x => x.DataHost, provider.Host },
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialogReference = await this.DialogService.ShowAsync<ProviderDialog>("Edit LLM Provider", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var dialogResult = await dialogReference.Result;
|
||||||
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var editedProvider = (AIStudio.Settings.Provider)dialogResult.Data!;
|
||||||
|
|
||||||
|
// Set the provider number if it's not set. This is important for providers
|
||||||
|
// added before we started saving the provider number.
|
||||||
|
if(editedProvider.Num == 0)
|
||||||
|
editedProvider = editedProvider with { Num = this.SettingsManager.ConfigurationData.NextProviderNum++ };
|
||||||
|
|
||||||
|
this.SettingsManager.ConfigurationData.Providers[this.SettingsManager.ConfigurationData.Providers.IndexOf(provider)] = editedProvider;
|
||||||
|
await this.UpdateProviders();
|
||||||
|
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
[SuppressMessage("Usage", "MWAIS0001:Direct access to `Providers` is not allowed")]
|
||||||
|
private async Task DeleteLLMProvider(AIStudio.Settings.Provider provider)
|
||||||
|
{
|
||||||
|
var dialogParameters = new DialogParameters
|
||||||
|
{
|
||||||
|
{ "Message", $"Are you sure you want to delete the provider '{provider.InstanceName}'?" },
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete LLM Provider", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
var dialogResult = await dialogReference.Result;
|
||||||
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var deleteSecretResponse = await this.RustService.DeleteAPIKey(provider);
|
||||||
|
if(deleteSecretResponse.Success)
|
||||||
|
{
|
||||||
|
this.SettingsManager.ConfigurationData.Providers.Remove(provider);
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.UpdateProviders();
|
||||||
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetLLMProviderModelName(AIStudio.Settings.Provider provider)
|
||||||
|
{
|
||||||
|
const int MAX_LENGTH = 36;
|
||||||
|
var modelName = provider.Model.ToString();
|
||||||
|
return modelName.Length > MAX_LENGTH ? "[...] " + modelName[^Math.Min(MAX_LENGTH, modelName.Length)..] : modelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
[SuppressMessage("Usage", "MWAIS0001:Direct access to `Providers` is not allowed")]
|
||||||
|
private async Task UpdateProviders()
|
||||||
|
{
|
||||||
|
this.AvailableLLMProviders.Clear();
|
||||||
|
foreach (var provider in this.SettingsManager.ConfigurationData.Providers)
|
||||||
|
this.AvailableLLMProviders.Add(new (provider.InstanceName, provider.Id));
|
||||||
|
|
||||||
|
await this.AvailableLLMProvidersChanged.InvokeAsync(this.AvailableLLMProviders);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetCurrentConfidenceLevelName(LLMProviders llmProvider)
|
||||||
|
{
|
||||||
|
if (this.SettingsManager.ConfigurationData.LLMProviders.CustomConfidenceScheme.TryGetValue(llmProvider, out var level))
|
||||||
|
return level.GetName();
|
||||||
|
|
||||||
|
return "Not yet configured";
|
||||||
|
}
|
||||||
|
|
||||||
|
private string SetCurrentConfidenceLevelColorStyle(LLMProviders llmProvider)
|
||||||
|
{
|
||||||
|
if (this.SettingsManager.ConfigurationData.LLMProviders.CustomConfidenceScheme.TryGetValue(llmProvider, out var level))
|
||||||
|
return $"background-color: {level.GetColor(this.SettingsManager)};";
|
||||||
|
|
||||||
|
return $"background-color: {ConfidenceLevel.UNKNOWN.GetColor(this.SettingsManager)};";
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ChangeCustomConfidenceLevel(LLMProviders llmProvider, ConfidenceLevel level)
|
||||||
|
{
|
||||||
|
this.SettingsManager.ConfigurationData.LLMProviders.CustomConfidenceScheme[llmProvider] = level;
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
@using AIStudio.Settings
|
||||||
|
@inherits SettingsDialogBase
|
||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6"><MudIcon Icon="@Icons.Material.Filled.Translate" Class="mr-2" />Assistant: Translator Options</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<ConfigurationSlider T="int" OptionDescription="How fast should the live translation react?" Min="500" Max="3_000" Step="100" Unit="milliseconds" Value="@(() => this.SettingsManager.ConfigurationData.Translation.DebounceIntervalMilliseconds)" ValueUpdate="@(updatedValue => this.SettingsManager.ConfigurationData.Translation.DebounceIntervalMilliseconds = updatedValue)"/>
|
||||||
|
<ConfigurationOption OptionDescription="Hide the web content reader?" LabelOn="Web content reader is hidden" LabelOff="Web content reader is shown" State="@(() => this.SettingsManager.ConfigurationData.Translation.HideWebContentReader)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Translation.HideWebContentReader = updatedState)" OptionHelp="When activated, the web content reader is hidden and cannot be used. As a result, the user interface becomes a bit easier to use."/>
|
||||||
|
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
||||||
|
<ConfigurationOption OptionDescription="Preselect translator options?" LabelOn="Translator options are preselected" LabelOff="No translator options are preselected" State="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Translation.PreselectOptions = updatedState)" OptionHelp="When enabled, you can preselect the translator options. This is might be useful when you prefer a specific target language or LLM model."/>
|
||||||
|
<ConfigurationOption OptionDescription="Preselect the web content reader?" Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions || this.SettingsManager.ConfigurationData.Translation.HideWebContentReader)" LabelOn="Web content reader is preselected" LabelOff="Web content reader is not preselected" State="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectWebContentReader)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Translation.PreselectWebContentReader = updatedState)" OptionHelp="When enabled, the web content reader is preselected. This is might be useful when you prefer to load content from the web very often."/>
|
||||||
|
<ConfigurationOption OptionDescription="Preselect the content cleaner agent?" Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions || this.SettingsManager.ConfigurationData.Translation.HideWebContentReader)" LabelOn="Content cleaner agent is preselected" LabelOff="Content cleaner agent is not preselected" State="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectContentCleanerAgent)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Translation.PreselectContentCleanerAgent = updatedState)" OptionHelp="When enabled, the content cleaner agent is preselected. This is might be useful when you prefer to clean up the content before translating it."/>
|
||||||
|
<ConfigurationOption OptionDescription="Preselect live translation?" Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions)" LabelOn="Live translation is preselected" LabelOff="Live translation is not preselected" State="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectLiveTranslation)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Translation.PreselectLiveTranslation = updatedState)" />
|
||||||
|
<ConfigurationSelect OptionDescription="Preselect the target language" Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectedTargetLanguage)" Data="@ConfigurationSelectDataFactory.GetCommonLanguagesData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Translation.PreselectedTargetLanguage = selectedValue)" OptionHelp="Which target language should be preselected?"/>
|
||||||
|
@if (this.SettingsManager.ConfigurationData.Translation.PreselectedTargetLanguage is CommonLanguages.OTHER)
|
||||||
|
{
|
||||||
|
<ConfigurationText OptionDescription="Preselect another target language" Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions)" Icon="@Icons.Material.Filled.Translate" Text="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectOtherLanguage)" TextUpdate="@(updatedText => this.SettingsManager.ConfigurationData.Translation.PreselectOtherLanguage = updatedText)"/>
|
||||||
|
}
|
||||||
|
<ConfigurationMinConfidenceSelection Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions)" RestrictToGlobalMinimumConfidence="@true" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Translation.MinimumProviderConfidence)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Translation.MinimumProviderConfidence = selectedValue)"/>
|
||||||
|
<ConfigurationProviderSelection Component="Components.TRANSLATION_ASSISTANT" Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.Translation.PreselectOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Translation.PreselectedProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Translation.PreselectedProvider = selectedValue)"/>
|
||||||
|
</MudPaper>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
@ -0,0 +1,7 @@
|
|||||||
|
using AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
public partial class SettingsDialogTranslation : SettingsDialogBase
|
||||||
|
{
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
@using AIStudio.Settings
|
||||||
|
@using AIStudio.Settings.DataModel
|
||||||
|
@inherits SettingsDialogBase
|
||||||
|
|
||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6"><MudIcon Icon="@Icons.Material.Filled.Work" Class="mr-2" />Workspace Options</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<ConfigurationSelect OptionDescription="Workspace behavior" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Workspace.StorageBehavior)" Data="@ConfigurationSelectDataFactory.GetWorkspaceStorageBehaviorData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Workspace.StorageBehavior = selectedValue)" OptionHelp="Should we store your chats?"/>
|
||||||
|
|
||||||
|
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES)
|
||||||
|
{
|
||||||
|
<ConfigurationSelect OptionDescription="Workspace maintenance" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Workspace.StorageTemporaryMaintenancePolicy)" Data="@ConfigurationSelectDataFactory.GetWorkspaceStorageTemporaryMaintenancePolicyData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Workspace.StorageTemporaryMaintenancePolicy = selectedValue)" OptionHelp="If and when should we delete your temporary chats?"/>
|
||||||
|
<ConfigurationSelect OptionDescription="Workspace display behavior" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Workspace.DisplayBehavior)" Data="@ConfigurationSelectDataFactory.GetWorkspaceDisplayBehaviorData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Workspace.DisplayBehavior = selectedValue)" OptionHelp="How should we display your workspaces?"/>
|
||||||
|
}
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
@ -0,0 +1,5 @@
|
|||||||
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
|
public partial class SettingsDialogWorkspaces : SettingsDialogBase
|
||||||
|
{
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
@using AIStudio.Dialogs.Settings
|
||||||
@using AIStudio.Settings.DataModel
|
@using AIStudio.Settings.DataModel
|
||||||
@attribute [Route(Routes.ASSISTANTS)]
|
@attribute [Route(Routes.ASSISTANTS)]
|
||||||
|
|
||||||
@ -12,40 +13,40 @@
|
|||||||
General
|
General
|
||||||
</MudText>
|
</MudText>
|
||||||
<MudStack Row="@true" Wrap="@Wrap.Wrap" Class="mb-3">
|
<MudStack Row="@true" Wrap="@Wrap.Wrap" Class="mb-3">
|
||||||
<AssistantBlock Name="Text Summarizer" Description="Using a LLM to summarize a given text." Icon="@Icons.Material.Filled.TextSnippet" Link="@Routes.ASSISTANT_SUMMARIZER"/>
|
<AssistantBlock TSettings="SettingsDialogTextSummarizer" Name="Text Summarizer" Description="Using a LLM to summarize a given text." Icon="@Icons.Material.Filled.TextSnippet" Link="@Routes.ASSISTANT_SUMMARIZER"/>
|
||||||
<AssistantBlock Name="Translation" Description="Translate text into another language." Icon="@Icons.Material.Filled.Translate" Link="@Routes.ASSISTANT_TRANSLATION"/>
|
<AssistantBlock TSettings="SettingsDialogTranslation" Name="Translation" Description="Translate text into another language." Icon="@Icons.Material.Filled.Translate" Link="@Routes.ASSISTANT_TRANSLATION"/>
|
||||||
<AssistantBlock Name="Grammar & Spelling" Description="Check grammar and spelling of a given text." Icon="@Icons.Material.Filled.Edit" Link="@Routes.ASSISTANT_GRAMMAR_SPELLING"/>
|
<AssistantBlock TSettings="SettingsDialogGrammarSpelling" Name="Grammar & Spelling" Description="Check grammar and spelling of a given text." Icon="@Icons.Material.Filled.Edit" Link="@Routes.ASSISTANT_GRAMMAR_SPELLING"/>
|
||||||
<AssistantBlock Name="Rewrite & Improve" Description="Rewrite and improve a given text for a chosen style." Icon="@Icons.Material.Filled.Edit" Link="@Routes.ASSISTANT_REWRITE"/>
|
<AssistantBlock TSettings="SettingsDialogRewrite" Name="Rewrite & Improve" Description="Rewrite and improve a given text for a chosen style." Icon="@Icons.Material.Filled.Edit" Link="@Routes.ASSISTANT_REWRITE"/>
|
||||||
<AssistantBlock Name="Synonyms" Description="Find synonyms for a given word or phrase." Icon="@Icons.Material.Filled.Spellcheck" Link="@Routes.ASSISTANT_SYNONYMS"/>
|
<AssistantBlock TSettings="SettingsDialogSynonyms" Name="Synonyms" Description="Find synonyms for a given word or phrase." Icon="@Icons.Material.Filled.Spellcheck" Link="@Routes.ASSISTANT_SYNONYMS"/>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|
||||||
<MudText Typo="Typo.h4" Class="mb-2 mr-3 mt-6">
|
<MudText Typo="Typo.h4" Class="mb-2 mr-3 mt-6">
|
||||||
Business
|
Business
|
||||||
</MudText>
|
</MudText>
|
||||||
<MudStack Row="@true" Wrap="@Wrap.Wrap" Class="mb-3">
|
<MudStack Row="@true" Wrap="@Wrap.Wrap" Class="mb-3">
|
||||||
<AssistantBlock Name="E-Mail" Description="Generate an e-mail for a given context." Icon="@Icons.Material.Filled.Email" Link="@Routes.ASSISTANT_EMAIL"/>
|
<AssistantBlock TSettings="SettingsDialogWritingEMails" Name="E-Mail" Description="Generate an e-mail for a given context." Icon="@Icons.Material.Filled.Email" Link="@Routes.ASSISTANT_EMAIL"/>
|
||||||
<AssistantBlock Name="My Tasks" Description="Analyze a text or an email for tasks you need to complete." Icon="@Icons.Material.Filled.Task" Link="@Routes.ASSISTANT_MY_TASKS"/>
|
<AssistantBlock TSettings="SettingsDialogMyTasks" Name="My Tasks" Description="Analyze a text or an email for tasks you need to complete." Icon="@Icons.Material.Filled.Task" Link="@Routes.ASSISTANT_MY_TASKS"/>
|
||||||
<AssistantBlock Name="Agenda Planner" Description="Generate an agenda for a given meeting, seminar, etc." Icon="@Icons.Material.Filled.CalendarToday" Link="@Routes.ASSISTANT_AGENDA"/>
|
<AssistantBlock TSettings="SettingsDialogAgenda" Name="Agenda Planner" Description="Generate an agenda for a given meeting, seminar, etc." Icon="@Icons.Material.Filled.CalendarToday" Link="@Routes.ASSISTANT_AGENDA"/>
|
||||||
<AssistantBlock Name="Job Posting" Description="Generate a job posting for a given job description." Icon="@Icons.Material.Filled.Work" Link="@Routes.ASSISTANT_JOB_POSTING"/>
|
<AssistantBlock TSettings="SettingsDialogJobPostings" Name="Job Posting" Description="Generate a job posting for a given job description." Icon="@Icons.Material.Filled.Work" Link="@Routes.ASSISTANT_JOB_POSTING"/>
|
||||||
<AssistantBlock Name="Legal Check" Description="Ask a question about a legal document." Icon="@Icons.Material.Filled.Gavel" Link="@Routes.ASSISTANT_LEGAL_CHECK"/>
|
<AssistantBlock TSettings="SettingsDialogLegalCheck" Name="Legal Check" Description="Ask a question about a legal document." Icon="@Icons.Material.Filled.Gavel" Link="@Routes.ASSISTANT_LEGAL_CHECK"/>
|
||||||
<AssistantBlock Name="Icon Finder" Description="Using a LLM to find an icon for a given context." Icon="@Icons.Material.Filled.FindInPage" Link="@Routes.ASSISTANT_ICON_FINDER"/>
|
<AssistantBlock TSettings="SettingsDialogIconFinder" Name="Icon Finder" Description="Using a LLM to find an icon for a given context." Icon="@Icons.Material.Filled.FindInPage" Link="@Routes.ASSISTANT_ICON_FINDER"/>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|
||||||
<MudText Typo="Typo.h4" Class="mb-2 mr-3 mt-6">
|
<MudText Typo="Typo.h4" Class="mb-2 mr-3 mt-6">
|
||||||
Learning
|
Learning
|
||||||
</MudText>
|
</MudText>
|
||||||
<MudStack Row="@true" Wrap="@Wrap.Wrap" Class="mb-3">
|
<MudStack Row="@true" Wrap="@Wrap.Wrap" Class="mb-3">
|
||||||
<AssistantBlock Name="Bias of the Day" Description="Learn about one cognitive bias every day." Icon="@Icons.Material.Filled.Psychology" Link="@Routes.ASSISTANT_BIAS"/>
|
<AssistantBlock TSettings="SettingsDialogAssistantBias" Name="Bias of the Day" Description="Learn about one cognitive bias every day." Icon="@Icons.Material.Filled.Psychology" Link="@Routes.ASSISTANT_BIAS"/>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|
||||||
<MudText Typo="Typo.h4" Class="mb-2 mr-3 mt-6">
|
<MudText Typo="Typo.h4" Class="mb-2 mr-3 mt-6">
|
||||||
Software Engineering
|
Software Engineering
|
||||||
</MudText>
|
</MudText>
|
||||||
<MudStack Row="@true" Wrap="@Wrap.Wrap" Class="mb-3">
|
<MudStack Row="@true" Wrap="@Wrap.Wrap" Class="mb-3">
|
||||||
<AssistantBlock Name="Coding" Description="Get coding and debugging support from a LLM." Icon="@Icons.Material.Filled.Code" Link="@Routes.ASSISTANT_CODING"/>
|
<AssistantBlock TSettings="SettingsDialogCoding" Name="Coding" Description="Get coding and debugging support from a LLM." Icon="@Icons.Material.Filled.Code" Link="@Routes.ASSISTANT_CODING"/>
|
||||||
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
|
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
|
||||||
{
|
{
|
||||||
<AssistantBlock Name="ERI Server" Description="Generate an ERI server to integrate business systems." Icon="@Icons.Material.Filled.PrivateConnectivity" Link="@Routes.ASSISTANT_ERI"/>
|
<AssistantBlock TSettings="SettingsDialogERIServer" Name="ERI Server" Description="Generate an ERI server to integrate business systems." Icon="@Icons.Material.Filled.PrivateConnectivity" Link="@Routes.ASSISTANT_ERI"/>
|
||||||
}
|
}
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|
||||||
|
@ -8,6 +8,4 @@ public partial class Assistants : ComponentBase
|
|||||||
{
|
{
|
||||||
[Inject]
|
[Inject]
|
||||||
public SettingsManager SettingsManager { get; set; } = null!;
|
public SettingsManager SettingsManager { get; set; } = null!;
|
||||||
|
|
||||||
//TODO: On click aus AssistantBase.razor.cs -> private method mit hardcoded T
|
|
||||||
}
|
}
|
@ -8,36 +8,17 @@
|
|||||||
<InnerScrolling>
|
<InnerScrolling>
|
||||||
<CascadingValue Value="@this">
|
<CascadingValue Value="@this">
|
||||||
<MudExpansionPanels Class="mb-3" MultiExpansion="@false">
|
<MudExpansionPanels Class="mb-3" MultiExpansion="@false">
|
||||||
<SettingsDialogProviders @bind-AvailableLLMProviders="@this.availableLLMProviders"/>
|
<SettingsPanelProviders @bind-AvailableLLMProviders="@this.availableLLMProviders"/>
|
||||||
|
|
||||||
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
|
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
|
||||||
{
|
{
|
||||||
<SettingsPanelEmbeddings AvailableLLMProvidersFunc="() => this.availableLLMProviders" @bind-AvailableEmbeddingProviders="@this.availableEmbeddingProviders"/>
|
<SettingsPanelEmbeddings AvailableLLMProvidersFunc="() => this.availableLLMProviders" @bind-AvailableEmbeddingProviders="@this.availableEmbeddingProviders"/>
|
||||||
<SettingsPanelDataSources AvailableLLMProvidersFunc="() => this.availableLLMProviders" AvailableEmbeddingsFunc="() => this.availableEmbeddingProviders" @bind-AvailableDataSources="@this.availableDataSources"/>
|
<SettingsPanelDataSources AvailableLLMProvidersFunc="() => this.availableLLMProviders" AvailableEmbeddingsFunc="() => this.availableEmbeddingProviders" @bind-AvailableDataSources="@this.availableDataSources"/>
|
||||||
}
|
}
|
||||||
<SettingsDialogProfiles AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
<SettingsPanelProfiles AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
||||||
<SettingsPanelApp AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
<SettingsPanelApp AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
||||||
<SettingsPanelChat AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
<SettingsPanelChat AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
||||||
<SettingsDialogWorkspaces AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
<SettingsPanelWorkspaces AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
||||||
<SettingsDialogIconFinder AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
<SettingsPanelTranslation AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
<SettingsDialogCoding AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
|
|
||||||
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
|
|
||||||
{
|
|
||||||
<SettingsDialogERIServer AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
}
|
|
||||||
|
|
||||||
<SettingsDialogTextSummarizer AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
<SettingsDialogAgenda AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
<SettingsDialogGrammarSpelling AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
<SettingsDialogRewrite AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
<SettingsDialogWritingEMails AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
<SettingsDialogJobPostings AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
<SettingsDialogLegalCheck AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
<SettingsDialogSynonyms AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
<SettingsDialogMyTasks AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
<SettingsDialogAssistantBias AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
|
|
||||||
|
|
||||||
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
|
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
|
||||||
{
|
{
|
||||||
|
@ -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.RESULT_DIV_ID, AssistantBase.BEFORE_RESULT_DIV_ID);
|
await jsRuntime.InvokeVoidAsync("generateDiff", text1, text2, AssistantBase<NoComponent>.RESULT_DIV_ID, AssistantBase<NoComponent>.BEFORE_RESULT_DIV_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task ClearDiv(this IJSRuntime jsRuntime, string divId)
|
public static async Task ClearDiv(this IJSRuntime jsRuntime, string divId)
|
||||||
|
16
app/MindWork AI Studio/Tools/NoComponent.cs
Normal file
16
app/MindWork AI Studio/Tools/NoComponent.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace AIStudio.Tools;
|
||||||
|
|
||||||
|
public sealed class NoComponent: IComponent
|
||||||
|
{
|
||||||
|
public void Attach(RenderHandle renderHandle)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task SetParametersAsync(ParameterView parameters)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user