mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-11 10:49:07 +00:00
Added local file information view
This commit is contained in:
parent
094daedee1
commit
e9b6bd8e67
@ -1,4 +1,3 @@
|
||||
@using AIStudio.Settings
|
||||
@using AIStudio.Settings.DataModel
|
||||
@inherits SettingsPanelBase
|
||||
|
||||
@ -37,12 +36,7 @@
|
||||
<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> *@
|
||||
}
|
||||
<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>
|
||||
|
@ -216,10 +216,19 @@ public partial class SettingsPanelDataSources : SettingsPanelBase
|
||||
}
|
||||
}
|
||||
|
||||
private Task ShowInformation(IDataSource dataSource)
|
||||
private async Task ShowInformation(IDataSource dataSource)
|
||||
{
|
||||
#warning Implement the information dialog for ERI data sources.
|
||||
return Task.CompletedTask;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task UpdateDataSources()
|
||||
|
@ -0,0 +1,97 @@
|
||||
<MudDialog>
|
||||
<DialogContent>
|
||||
<MudStack Row="@true">
|
||||
<MudTextField
|
||||
T="string"
|
||||
ReadOnly="@true"
|
||||
Label="Data source name"
|
||||
Text="@this.DataSource.Name"
|
||||
Variant="Variant.Outlined"
|
||||
Margin="Margin.Dense"
|
||||
Adornment="Adornment.Start"
|
||||
AdornmentIcon="@Icons.Material.Filled.Tag"/>
|
||||
|
||||
<MudTooltip Text="Copy the data source name to the clipboard">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.ContentCopy" OnClick="@(() => this.CopyToClipboard(this.DataSource.Name))"/>
|
||||
</MudTooltip>
|
||||
</MudStack>
|
||||
|
||||
<MudStack Row="@true">
|
||||
<MudTextField
|
||||
T="string"
|
||||
ReadOnly="@true"
|
||||
Label="File path"
|
||||
Text="@this.DataSource.FilePath"
|
||||
Variant="Variant.Outlined"
|
||||
Margin="Margin.Dense"
|
||||
Adornment="Adornment.Start"
|
||||
AdornmentIcon="@Icons.Material.Filled.FolderOpen"/>
|
||||
|
||||
<MudTooltip Text="Copy this path to the clipboard">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.ContentCopy" OnClick="@(() => this.CopyToClipboard(this.DataSource.FilePath))"/>
|
||||
</MudTooltip>
|
||||
</MudStack>
|
||||
|
||||
@if (!this.IsFileAvailable)
|
||||
{
|
||||
<MudJustifiedText Typo="Typo.body1" Color="Color.Error" Class="mb-3">
|
||||
The file chosen for the data source does not exist anymore. Please edit the data source and choose another file or correct the path.
|
||||
</MudJustifiedText>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudJustifiedText Typo="Typo.body1" Color="Color.Tertiary" Class="mb-3">
|
||||
The file chosen for the data source exists.
|
||||
</MudJustifiedText>
|
||||
}
|
||||
|
||||
<MudStack Row="@true">
|
||||
<MudTextField
|
||||
T="string"
|
||||
ReadOnly="@true"
|
||||
Label="Embedding name"
|
||||
Text="@this.embeddingProvider.Name"
|
||||
Variant="Variant.Outlined"
|
||||
Margin="Margin.Dense"
|
||||
Adornment="Adornment.Start"
|
||||
AdornmentIcon="@Icons.Material.Filled.Layers"/>
|
||||
|
||||
<MudTooltip Text="Copy the embedding name to the clipboard">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.ContentCopy" OnClick="@(() => this.CopyToClipboard(this.embeddingProvider.Name))"/>
|
||||
</MudTooltip>
|
||||
</MudStack>
|
||||
|
||||
@if (this.IsCloudEmbedding)
|
||||
{
|
||||
<MudJustifiedText Typo="Typo.body1" Color="Color.Error" Class="mb-3">
|
||||
The embedding runs in the cloud. All your data within the
|
||||
file '@this.DataSource.FilePath' will be sent to the cloud.
|
||||
</MudJustifiedText>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudJustifiedText Typo="Typo.body1" Color="Color.Tertiary" Class="mb-3">
|
||||
The embedding runs locally or in your organization. Your data is not sent to the cloud.
|
||||
</MudJustifiedText>
|
||||
}
|
||||
|
||||
<MudStack Row="@true">
|
||||
<MudTextField
|
||||
T="string"
|
||||
ReadOnly="@true"
|
||||
Label="File size"
|
||||
Text="@this.FileSize"
|
||||
Variant="Variant.Outlined"
|
||||
Margin="Margin.Dense"
|
||||
Adornment="Adornment.Start"
|
||||
AdornmentIcon="@Icons.Material.Filled.SquareFoot"/>
|
||||
|
||||
<MudTooltip Text="Copy the file size to the clipboard">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.ContentCopy" OnClick="@(() => this.CopyToClipboard(this.FileSize))"/>
|
||||
</MudTooltip>
|
||||
</MudStack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
@ -0,0 +1,48 @@
|
||||
using AIStudio.Settings;
|
||||
using AIStudio.Settings.DataModel;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace AIStudio.Dialogs;
|
||||
|
||||
public partial class DataSourceLocalFileInfoDialog : ComponentBase
|
||||
{
|
||||
[CascadingParameter]
|
||||
private MudDialogInstance MudDialog { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public DataSourceLocalFile DataSource { get; set; }
|
||||
|
||||
[Inject]
|
||||
private RustService RustService { get; init; } = null!;
|
||||
|
||||
[Inject]
|
||||
private ISnackbar Snackbar { get; init; } = null!;
|
||||
|
||||
[Inject]
|
||||
private SettingsManager SettingsManager { get; init; } = null!;
|
||||
|
||||
#region Overrides of ComponentBase
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
this.embeddingProvider = this.SettingsManager.ConfigurationData.EmbeddingProviders.FirstOrDefault(x => x.Id == this.DataSource.EmbeddingId);
|
||||
this.fileInfo = new FileInfo(this.DataSource.FilePath);
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private EmbeddingProvider embeddingProvider;
|
||||
private FileInfo fileInfo = null!;
|
||||
|
||||
private bool IsCloudEmbedding => !this.embeddingProvider.IsSelfHosted;
|
||||
|
||||
private bool IsFileAvailable => this.fileInfo.Exists;
|
||||
|
||||
private string FileSize => this.fileInfo.FileSize();
|
||||
|
||||
private async Task CopyToClipboard(string content) => await this.RustService.CopyText2Clipboard(this.Snackbar, content);
|
||||
|
||||
private void Close() => this.MudDialog.Close();
|
||||
}
|
@ -210,6 +210,6 @@
|
||||
"type": "Project"
|
||||
}
|
||||
},
|
||||
"net8.0/osx-x64": {}
|
||||
"net8.0/osx-arm64": {}
|
||||
}
|
||||
}
|
2
app/MindWork AI Studio/wwwroot/changelog/v0.9.28.md
Normal file
2
app/MindWork AI Studio/wwwroot/changelog/v0.9.28.md
Normal file
@ -0,0 +1,2 @@
|
||||
# v0.9.28, build 203 (2025-0x-xx xx:xx UTC)
|
||||
- Added an information view to all data sources to the data source configuration page. The data source configuration is a preview feature behind the RAG feature flag.
|
Loading…
Reference in New Issue
Block a user