Skip to content

Configure data sources #259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8d2b451
Defined initial data source types
SommerEngineering Jan 5, 2025
6d3f1f8
Renamed data source type extensions
SommerEngineering Jan 5, 2025
c62bcb1
Added documentation to data source types
SommerEngineering Jan 5, 2025
f00fd51
Formatting
SommerEngineering Jan 5, 2025
425c888
Spelling
SommerEngineering Jan 5, 2025
b5fbbfa
Defined data structures for configuring the initial dats sources
SommerEngineering Jan 5, 2025
c1e0bae
Ensure that we can use ERI servers of different versions
SommerEngineering Jan 5, 2025
6dce52f
Added ERI server v1 client
SommerEngineering Jan 5, 2025
3ad6275
Resolved warning
SommerEngineering Jan 5, 2025
bcbb7d2
Defined interfaces for internal & external data sources
SommerEngineering Jan 6, 2025
120b388
Added data sources to config data
SommerEngineering Jan 6, 2025
7463e7b
Refactored the rust service into partial files
SommerEngineering Jan 6, 2025
12ce4b5
Added common secret data handling
SommerEngineering Jan 6, 2025
b473010
Made external data sources also secret IDs
SommerEngineering Jan 6, 2025
ef9e9eb
Added a common ERI data source interface
SommerEngineering Jan 6, 2025
321befa
Added the data sources number
SommerEngineering Jan 6, 2025
e707e46
Added the data sources configuration panel
SommerEngineering Jan 6, 2025
ae1af63
Removed unused import
SommerEngineering Jan 6, 2025
bd768de
Provided configured embeddings to the data sources panel
SommerEngineering Jan 7, 2025
7aba4e8
Ensure that available data sources and embeddings are loaded when init
SommerEngineering Jan 7, 2025
daacb5f
Propagate available embeddings to the dialogs
SommerEngineering Jan 7, 2025
a75020f
Fixed wrong type
SommerEngineering Jan 7, 2025
6a31b1b
Added validation to the directory selection component
SommerEngineering Jan 7, 2025
8bf1189
Changed delete button color
SommerEngineering Jan 7, 2025
ceb806d
Updated changelog
SommerEngineering Jan 7, 2025
dd08a7e
Spelling
SommerEngineering Jan 8, 2025
5d37d42
Fixed serialization & deserialization of data sources
SommerEngineering Jan 8, 2025
2326247
Fixed call of editing dialogs
SommerEngineering Jan 8, 2025
474847d
Fixed margin
SommerEngineering Jan 8, 2025
03c9257
Added explanation to the config panel
SommerEngineering Jan 8, 2025
0c5417a
Implemented local directory dialog
SommerEngineering Jan 8, 2025
cb74406
Added possibility that the user selects a file
SommerEngineering Jan 8, 2025
31db3f0
Implemented local file dialog
SommerEngineering Jan 8, 2025
59c08fe
Refactored data source validation
SommerEngineering Jan 9, 2025
06471ef
Simplified statement
SommerEngineering Jan 13, 2025
ee55cd1
Implemented ERI v1 server dialog
SommerEngineering Jan 13, 2025
8af362f
Disabled the information button for now
SommerEngineering Jan 13, 2025
acdac9f
Updated changelog
SommerEngineering Jan 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,277 changes: 1,277 additions & 0 deletions app/ERIClientV1/Client.Generated.cs

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions app/ERIClientV1/ERIClientV1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
11 changes: 11 additions & 0 deletions app/MindWork AI Studio.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MindWork AI Studio", "MindWork AI Studio\MindWork AI Studio.csproj", "{059FDFCC-7D0B-474E-9F20-B9C437DF1CDD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ERIClients", "ERIClients", "{5C2AF789-287B-4FCB-B675-7273D8CD4579}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ERIClientV1", "ERIClientV1\ERIClientV1.csproj", "{9E35A273-0FA6-4BD5-8880-A1DDAC106926}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -12,5 +16,12 @@ Global
{059FDFCC-7D0B-474E-9F20-B9C437DF1CDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{059FDFCC-7D0B-474E-9F20-B9C437DF1CDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{059FDFCC-7D0B-474E-9F20-B9C437DF1CDD}.Release|Any CPU.Build.0 = Release|Any CPU
{9E35A273-0FA6-4BD5-8880-A1DDAC106926}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9E35A273-0FA6-4BD5-8880-A1DDAC106926}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E35A273-0FA6-4BD5-8880-A1DDAC106926}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E35A273-0FA6-4BD5-8880-A1DDAC106926}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{9E35A273-0FA6-4BD5-8880-A1DDAC106926} = {5C2AF789-287B-4FCB-B675-7273D8CD4579}
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions app/MindWork AI Studio/Assistants/ERI/AssistantERI.razor
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ else
<MudButton Disabled="@this.AreServerPresetsBlocked" OnClick="@this.AddERIServer" Variant="Variant.Filled" Color="Color.Primary">
Add ERI server preset
</MudButton>
<MudButton OnClick="@this.RemoveERIServer" Disabled="@(this.AreServerPresetsBlocked || this.IsNoneERIServerSelected)" Variant="Variant.Filled" Color="Color.Primary">
<MudButton OnClick="@this.RemoveERIServer" Disabled="@(this.AreServerPresetsBlocked || this.IsNoneERIServerSelected)" Variant="Variant.Filled" Color="Color.Error">
Delete this server preset
</MudButton>
</MudStack>
Expand Down Expand Up @@ -346,4 +346,4 @@ else
</MudText>

<MudTextSwitch Label="Should we write the generated code to the file system?" Disabled="@this.IsNoneERIServerSelected" @bind-Value="@this.writeToFilesystem" LabelOn="Yes, please write or update all generated code to the file system" LabelOff="No, just show me the code" />
<SelectDirectory Label="Base directory where to write the code" @bind-Directory="@this.baseDirectory" Disabled="@(this.IsNoneERIServerSelected || !this.writeToFilesystem)" DirectoryDialogTitle="Select the target directory for the ERI server"/>
<SelectDirectory Label="Base directory where to write the code" @bind-Directory="@this.baseDirectory" Disabled="@(this.IsNoneERIServerSelected || !this.writeToFilesystem)" DirectoryDialogTitle="Select the target directory for the ERI server" Validation="@this.ValidateDirectory" />
11 changes: 11 additions & 0 deletions app/MindWork AI Studio/Assistants/ERI/AssistantERI.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,17 @@ private bool IsAuthDescriptionOptional()

return null;
}

private string? ValidateDirectory(string path)
{
if(!this.writeToFilesystem)
return null;

if(string.IsNullOrWhiteSpace(path))
return "Please provide a base directory for the ERI server to write files to.";

return null;
}

private string GetMultiSelectionAuthText(List<Auth> selectedValues)
{
Expand Down
1 change: 1 addition & 0 deletions app/MindWork AI Studio/Components/SelectDirectory.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Text="@this.Directory"
Label="@this.Label"
ReadOnly="@true"
Validation="@this.Validation"
Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.Folder"
UserAttributes="@SPELLCHECK_ATTRIBUTES"
Expand Down
3 changes: 3 additions & 0 deletions app/MindWork AI Studio/Components/SelectDirectory.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public partial class SelectDirectory : ComponentBase
[Parameter]
public string DirectoryDialogTitle { get; set; } = "Select Directory";

[Parameter]
public Func<string, string?> Validation { get; set; } = _ => null;

[Inject]
private SettingsManager SettingsManager { get; init; } = null!;

Expand Down
17 changes: 17 additions & 0 deletions app/MindWork AI Studio/Components/SelectFile.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<MudStack Row="@true" Spacing="3" Class="mb-3" StretchItems="StretchItems.None" AlignItems="AlignItems.Center">
<MudTextField
T="string"
Text="@this.File"
Label="@this.Label"
ReadOnly="@true"
Validation="@this.Validation"
Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.AttachFile"
UserAttributes="@SPELLCHECK_ATTRIBUTES"
Variant="Variant.Outlined"
/>

<MudButton StartIcon="@Icons.Material.Filled.FolderOpen" Variant="Variant.Outlined" Color="Color.Primary" Disabled="this.Disabled" OnClick="@this.OpenFileDialog">
Choose File
</MudButton>
</MudStack>
63 changes: 63 additions & 0 deletions app/MindWork AI Studio/Components/SelectFile.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using AIStudio.Settings;

using Microsoft.AspNetCore.Components;

namespace AIStudio.Components;

public partial class SelectFile : ComponentBase
{
[Parameter]
public string File { get; set; } = string.Empty;

[Parameter]
public EventCallback<string> FileChanged { get; set; }

[Parameter]
public bool Disabled { get; set; }

[Parameter]
public string Label { get; set; } = string.Empty;

[Parameter]
public string FileDialogTitle { get; set; } = "Select File";

[Parameter]
public Func<string, string?> Validation { get; set; } = _ => null;

[Inject]
private SettingsManager SettingsManager { get; init; } = null!;

[Inject]
public RustService RustService { get; set; } = null!;

[Inject]
protected ILogger<SelectDirectory> Logger { get; init; } = null!;

private static readonly Dictionary<string, object?> SPELLCHECK_ATTRIBUTES = new();

#region Overrides of ComponentBase

protected override async Task OnInitializedAsync()
{
// Configure the spellchecking for the instance name input:
this.SettingsManager.InjectSpellchecking(SPELLCHECK_ATTRIBUTES);
await base.OnInitializedAsync();
}

#endregion

private void InternalFileChanged(string file)
{
this.File = file;
this.FileChanged.InvokeAsync(file);
}

private async Task OpenFileDialog()
{
var response = await this.RustService.SelectFile(this.FileDialogTitle, string.IsNullOrWhiteSpace(this.File) ? null : this.File);
this.Logger.LogInformation($"The user selected the file '{response.SelectedFilePath}'.");

if (!response.UserCancelled)
this.InternalFileChanged(response.SelectedFilePath);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
@using AIStudio.Settings
@using AIStudio.Settings.DataModel
@inherits SettingsPanelBase

@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
{
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.IntegrationInstructions" HeaderText="Configure Data Sources">
<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;">
@if (context is IERIDataSource)
{
@* <MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Info" Class="ma-2" OnClick="() => this.ShowInformation(context)"> *@
@* Show Information *@
@* </MudButton> *@
}
<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>
</ExpansionPanel>
}
Loading