mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 21:27:21 +00:00
43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
using AIStudio.Components;
|
|
using AIStudio.Settings;
|
|
using AIStudio.Settings.DataModel;
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace AIStudio.Dialogs;
|
|
|
|
public partial class DataSourceLocalFileInfoDialog : MSGComponentBase
|
|
{
|
|
[CascadingParameter]
|
|
private IMudDialogInstance MudDialog { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public DataSourceLocalFile DataSource { get; set; }
|
|
|
|
#region Overrides of ComponentBase
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
this.embeddingProvider = this.SettingsManager.ConfigurationData.EmbeddingProviders.FirstOrDefault(x => x.Id == this.DataSource.EmbeddingId) ?? EmbeddingProvider.NONE;
|
|
this.fileInfo = new FileInfo(this.DataSource.FilePath);
|
|
await base.OnInitializedAsync();
|
|
}
|
|
|
|
#endregion
|
|
|
|
private EmbeddingProvider embeddingProvider = EmbeddingProvider.NONE;
|
|
private FileInfo fileInfo = null!;
|
|
|
|
private bool IsCloudEmbedding => !this.embeddingProvider.IsTrustedForDataSourceSecurityChecks(this.SettingsManager);
|
|
|
|
private bool IsFileAvailable => this.fileInfo.Exists;
|
|
|
|
private string FileSize => this.fileInfo.FileSize();
|
|
|
|
/// <summary>
|
|
/// The level which applies, including what the organization demands.
|
|
/// </summary>
|
|
private string OutboundDataRestrictionName => this.DataSource.GetEffectiveOutboundDataRestriction(this.SettingsManager.ConfigurationData.DataSourceSecurity.MinimumOutboundDataRestriction).GetName();
|
|
|
|
private void Close() => this.MudDialog.Close();
|
|
} |