Skip to content

Commit c836bd7

Browse files
Added an information view to all data sources (#273)
1 parent 9d71978 commit c836bd7

File tree

61 files changed

+1594
-1370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1594
-1370
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Things we are currently working on:
1212
- [x] ~~App: Add an option to show preview features (PR [#222](https://github.com/MindWorkAI/AI-Studio/pull/222))~~
1313
- [x] ~~App: Configure embedding providers (PR [#224](https://github.com/MindWorkAI/AI-Studio/pull/224))~~
1414
- [x] ~~App: Implement an [ERI](https://github.com/MindWorkAI/ERI) server coding assistant (PR [#231](https://github.com/MindWorkAI/AI-Studio/pull/231))~~
15-
- [x] ~~App: Management of data sources (local & external data via [ERI](https://github.com/MindWorkAI/ERI)) (PR [#259](https://github.com/MindWorkAI/AI-Studio/pull/259))~~
15+
- [x] ~~App: Management of data sources (local & external data via [ERI](https://github.com/MindWorkAI/ERI)) (PR [#259](https://github.com/MindWorkAI/AI-Studio/pull/259), [#273](https://github.com/MindWorkAI/AI-Studio/pull/273))~~
1616
- [ ] Runtime: Extract data from txt / md / pdf / docx / xlsx files
1717
- [ ] (*Optional*) Runtime: Implement internal embedding provider through [fastembed-rs](https://github.com/Anush008/fastembed-rs)
1818
- [ ] App: Implement external embedding providers

app/ERIClientV1/Client.Generated.cs

Lines changed: 0 additions & 1277 deletions
This file was deleted.

app/ERIClientV1/ERIClientV1.csproj

Lines changed: 0 additions & 10 deletions
This file was deleted.

app/MindWork AI Studio.sln

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
Microsoft Visual Studio Solution File, Format Version 12.00
33
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MindWork AI Studio", "MindWork AI Studio\MindWork AI Studio.csproj", "{059FDFCC-7D0B-474E-9F20-B9C437DF1CDD}"
44
EndProject
5-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ERIClients", "ERIClients", "{5C2AF789-287B-4FCB-B675-7273D8CD4579}"
6-
EndProject
7-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ERIClientV1", "ERIClientV1\ERIClientV1.csproj", "{9E35A273-0FA6-4BD5-8880-A1DDAC106926}"
8-
EndProject
95
Global
106
GlobalSection(SolutionConfigurationPlatforms) = preSolution
117
Debug|Any CPU = Debug|Any CPU
@@ -16,12 +12,7 @@ Global
1612
{059FDFCC-7D0B-474E-9F20-B9C437DF1CDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
1713
{059FDFCC-7D0B-474E-9F20-B9C437DF1CDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
1814
{059FDFCC-7D0B-474E-9F20-B9C437DF1CDD}.Release|Any CPU.Build.0 = Release|Any CPU
19-
{9E35A273-0FA6-4BD5-8880-A1DDAC106926}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20-
{9E35A273-0FA6-4BD5-8880-A1DDAC106926}.Debug|Any CPU.Build.0 = Debug|Any CPU
21-
{9E35A273-0FA6-4BD5-8880-A1DDAC106926}.Release|Any CPU.ActiveCfg = Release|Any CPU
22-
{9E35A273-0FA6-4BD5-8880-A1DDAC106926}.Release|Any CPU.Build.0 = Release|Any CPU
2315
EndGlobalSection
2416
GlobalSection(NestedProjects) = preSolution
25-
{9E35A273-0FA6-4BD5-8880-A1DDAC106926} = {5C2AF789-287B-4FCB-B675-7273D8CD4579}
2617
EndGlobalSection
2718
EndGlobal

app/MindWork AI Studio/Assistants/ERI/ERIVersionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public static async Task<string> ReadSpecification(this ERIVersion version, Http
77
try
88
{
99
var url = version.SpecificationURL();
10-
var response = await httpClient.GetAsync(url);
10+
using var response = await httpClient.GetAsync(url);
1111
return await response.Content.ReadAsStringAsync();
1212
}
1313
catch

app/MindWork AI Studio/Components/Changelog.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected override async Task OnInitializedAsync()
2323

2424
private async Task ReadLogAsync()
2525
{
26-
var response = await this.HttpClient.GetAsync($"changelog/{this.SelectedLog.Filename}");
26+
using var response = await this.HttpClient.GetAsync($"changelog/{this.SelectedLog.Filename}");
2727
this.LogContent = await response.Content.ReadAsStringAsync();
2828
}
2929
}

app/MindWork AI Studio/Components/Settings/SettingsPanelDataSources.razor

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@using AIStudio.Settings
21
@using AIStudio.Settings.DataModel
32
@inherits SettingsPanelBase
43

@@ -37,12 +36,7 @@
3736
<MudTd>@this.GetEmbeddingName(context)</MudTd>
3837

3938
<MudTd Style="text-align: left;">
40-
@if (context is IERIDataSource)
41-
{
42-
@* <MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Info" Class="ma-2" OnClick="() => this.ShowInformation(context)"> *@
43-
@* Show Information *@
44-
@* </MudButton> *@
45-
}
39+
<MudIconButton Variant="Variant.Filled" Color="Color.Info" Icon="@Icons.Material.Filled.Info" Class="ma-2" OnClick="() => this.ShowInformation(context)"/>
4640
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" Class="ma-2" OnClick="() => this.EditDataSource(context)">
4741
Edit
4842
</MudButton>

app/MindWork AI Studio/Components/Settings/SettingsPanelDataSources.razor.cs

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using AIStudio.Dialogs;
22
using AIStudio.Settings;
33
using AIStudio.Settings.DataModel;
4-
5-
using ERI_Client.V1;
4+
using AIStudio.Tools.ERIClient.DataModel;
65

76
using Microsoft.AspNetCore.Components;
87

@@ -216,10 +215,37 @@ private async Task DeleteDataSource(IDataSource dataSource)
216215
}
217216
}
218217

219-
private Task ShowInformation(IDataSource dataSource)
218+
private async Task ShowInformation(IDataSource dataSource)
220219
{
221-
#warning Implement the information dialog for ERI data sources.
222-
return Task.CompletedTask;
220+
switch (dataSource)
221+
{
222+
case DataSourceLocalFile localFile:
223+
var localFileDialogParameters = new DialogParameters<DataSourceLocalFileInfoDialog>
224+
{
225+
{ x => x.DataSource, localFile },
226+
};
227+
228+
await this.DialogService.ShowAsync<DataSourceLocalFileInfoDialog>("Local File Data Source Information", localFileDialogParameters, DialogOptions.FULLSCREEN);
229+
break;
230+
231+
case DataSourceLocalDirectory localDirectory:
232+
var localDirectoryDialogParameters = new DialogParameters<DataSourceLocalDirectoryInfoDialog>
233+
{
234+
{ x => x.DataSource, localDirectory },
235+
};
236+
237+
await this.DialogService.ShowAsync<DataSourceLocalDirectoryInfoDialog>("Local Directory Data Source Information", localDirectoryDialogParameters, DialogOptions.FULLSCREEN);
238+
break;
239+
240+
case DataSourceERI_V1 eriV1DataSource:
241+
var eriV1DialogParameters = new DialogParameters<DataSourceERI_V1InfoDialog>
242+
{
243+
{ x => x.DataSource, eriV1DataSource },
244+
};
245+
246+
await this.DialogService.ShowAsync<DataSourceERI_V1InfoDialog>("ERI v1 Data Source Information", eriV1DialogParameters, DialogOptions.FULLSCREEN);
247+
break;
248+
}
223249
}
224250

225251
private async Task UpdateDataSources()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<MudStack Row="@true" AlignItems="AlignItems.Center">
2+
<MudTextField
3+
T="string"
4+
ReadOnly="@true"
5+
Label="@this.Label"
6+
Text="@this.Value"
7+
Variant="Variant.Outlined"
8+
Margin="Margin.Dense"
9+
Adornment="Adornment.Start"
10+
AdornmentIcon="@this.Icon"
11+
UserAttributes="@USER_INPUT_ATTRIBUTES" />
12+
13+
@if (this.ShowingCopyButton)
14+
{
15+
<MudTooltip Text="@this.ClipboardTooltip">
16+
<MudIconButton Icon="@Icons.Material.Filled.ContentCopy" Size="Size.Medium" OnClick="@(() => this.CopyToClipboard(this.Value))"/>
17+
</MudTooltip>
18+
}
19+
</MudStack>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using AIStudio.Settings;
2+
3+
using Microsoft.AspNetCore.Components;
4+
5+
namespace AIStudio.Components;
6+
7+
public partial class TextInfoLine : ComponentBase
8+
{
9+
[Parameter]
10+
public string Label { get; set; } = string.Empty;
11+
12+
[Parameter]
13+
public string Icon { get; set; } = Icons.Material.Filled.Info;
14+
15+
[Parameter]
16+
public string Value { get; set; } = string.Empty;
17+
18+
[Parameter]
19+
public string ClipboardTooltipSubject { get; set; } = "the text";
20+
21+
[Parameter]
22+
public bool ShowingCopyButton { get; set; } = true;
23+
24+
[Inject]
25+
private RustService RustService { get; init; } = null!;
26+
27+
[Inject]
28+
private ISnackbar Snackbar { get; init; } = null!;
29+
30+
[Inject]
31+
private SettingsManager SettingsManager { get; init; } = null!;
32+
33+
#region Overrides of ComponentBase
34+
35+
protected override async Task OnInitializedAsync()
36+
{
37+
// Configure the spellchecking for the user input:
38+
this.SettingsManager.InjectSpellchecking(USER_INPUT_ATTRIBUTES);
39+
40+
await base.OnInitializedAsync();
41+
}
42+
43+
#endregion
44+
45+
private static readonly Dictionary<string, object?> USER_INPUT_ATTRIBUTES = new();
46+
47+
private string ClipboardTooltip => $"Copy {this.ClipboardTooltipSubject} to the clipboard";
48+
49+
private async Task CopyToClipboard(string content) => await this.RustService.CopyText2Clipboard(this.Snackbar, content);
50+
}

0 commit comments

Comments
 (0)