mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 19:27:21 +00:00
Allowed moving local data sources without embedding them again (#1091)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
f6e48e95f3
commit
5d6e48ef93
49 files changed
+2280
-297
No files matched your search
@@ -47,31 +47,7 @@
|
||||
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||
@T("Select a root directory for this data source.")
|
||||
</MudJustifiedText>
|
||||
@if (!this.CanChangeSource)
|
||||
{
|
||||
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined" Class="mb-3">
|
||||
@T("The documents of this data source are already prepared, so its folder cannot be changed. Another folder holds other documents, which makes it another data source: please add one for it. The embedding provider below can be changed.")
|
||||
</MudAlert>
|
||||
}
|
||||
@if (this.CanChangeSource)
|
||||
{
|
||||
<SelectDirectory @bind-Directory="@this.dataPath" Label="@T("Selected base directory for this data source")" DirectoryDialogTitle="@T("Select the base directory")" Validation="@this.dataSourceValidation.ValidatePath" EnableDragDrop="true" CatchAllDocuments="true" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudTextField
|
||||
T="string"
|
||||
Text="@this.dataPath"
|
||||
Label="@T("Selected base directory for this data source")"
|
||||
Class="mb-3"
|
||||
ReadOnly="@true"
|
||||
Validation="@this.dataSourceValidation.ValidatePath"
|
||||
Adornment="Adornment.Start"
|
||||
AdornmentIcon="@Icons.Material.Filled.Folder"
|
||||
UserAttributes="@SPELLCHECK_ATTRIBUTES"
|
||||
Variant="Variant.Outlined"
|
||||
/>
|
||||
}
|
||||
<SelectDirectory @bind-Directory="@this.dataPath" Label="@T("Selected base directory for this data source")" DirectoryDialogTitle="@T("Select the base directory")" Validation="@this.dataSourceValidation.ValidatePath" EnableDragDrop="true" CatchAllDocuments="true" />
|
||||
|
||||
<MudTextSwitch
|
||||
Label="@T("Include subfolders?")"
|
||||
|
||||
@@ -23,16 +23,6 @@ public partial class DataSourceLocalDirectoryDialog : MSGComponentBase
|
||||
[Parameter]
|
||||
public DataSourceLocalDirectory DataSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the folder this data source reads must stay as it is.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Set once the index holds something for this data source. The embedding is not locked along
|
||||
/// with it: it can be changed, and DataSourceReindexWarning asks what that costs.
|
||||
/// </remarks>
|
||||
[Parameter]
|
||||
public bool LockSource { get; set; }
|
||||
|
||||
[Inject]
|
||||
private IDialogService DialogService { get; init; } = null!;
|
||||
|
||||
@@ -215,8 +205,6 @@ public partial class DataSourceLocalDirectoryDialog : MSGComponentBase
|
||||
? T("Audio and video files which this data source selects are skipped, because your transcription provider does not meet the confidence level this data source requires.")
|
||||
: null;
|
||||
|
||||
private bool CanChangeSource => !this.IsEditing || !this.LockSource;
|
||||
|
||||
private IEnumerable<ConfigurationSelectData<ConfidenceLevel>> ConfidenceLevels => ConfigurationSelectDataFactory.GetDataSourceConfidenceLevelsData();
|
||||
|
||||
private string SelectedEmbeddingTokenizerText => this.SelectedEmbedding is null
|
||||
@@ -244,9 +232,7 @@ public partial class DataSourceLocalDirectoryDialog : MSGComponentBase
|
||||
Type = DataSourceType.LOCAL_DIRECTORY,
|
||||
EmbeddingId = this.dataEmbeddingId,
|
||||
|
||||
// Kept out of reach of the form while the source is locked, so a stale field cannot point an
|
||||
// indexed data source somewhere else:
|
||||
Path = this.CanChangeSource ? this.dataPath : this.DataSource.Path,
|
||||
Path = this.dataPath,
|
||||
FilePatterns = this.NormalizeFilePatterns(),
|
||||
|
||||
// Kept as typed, since the line breaks group the entries for the eye:
|
||||
@@ -268,6 +254,14 @@ public partial class DataSourceLocalDirectoryDialog : MSGComponentBase
|
||||
if (!this.dataIsValid)
|
||||
return;
|
||||
|
||||
await this.StoreValidatedDataSourceAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Continues Save after form validation, asking before the draft is returned to its caller.
|
||||
/// </summary>
|
||||
internal async Task StoreValidatedDataSourceAsync()
|
||||
{
|
||||
var addedDataSource = this.CreateDataSource();
|
||||
|
||||
//
|
||||
|
||||
@@ -47,31 +47,7 @@
|
||||
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||
@T("Select a file for this data source. The content of this file will be processed for the data source. An audio or video file is transcribed by your transcription provider first.")
|
||||
</MudJustifiedText>
|
||||
@if (!this.CanChangeSource)
|
||||
{
|
||||
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined" Class="mb-3">
|
||||
@T("The documents of this data source are already prepared, so its file cannot be changed. Another file holds other content, which makes it another data source: please add one for it. The embedding provider below can be changed.")
|
||||
</MudAlert>
|
||||
}
|
||||
@if (this.CanChangeSource)
|
||||
{
|
||||
<SelectFile @bind-File="@this.dataFilePath" Label="@T("Selected file path for this data source")" FileDialogTitle="@T("Select the file")" Validation="@this.dataSourceValidation.ValidateFilePath" EnableDragDrop="true" CatchAllDocuments="true" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudTextField
|
||||
T="string"
|
||||
Text="@this.dataFilePath"
|
||||
Label="@T("Selected file path for this data source")"
|
||||
Class="mb-3"
|
||||
ReadOnly="@true"
|
||||
Validation="@this.dataSourceValidation.ValidateFilePath"
|
||||
Adornment="Adornment.Start"
|
||||
AdornmentIcon="@Icons.Material.Filled.AttachFile"
|
||||
UserAttributes="@SPELLCHECK_ATTRIBUTES"
|
||||
Variant="Variant.Outlined"
|
||||
/>
|
||||
}
|
||||
<SelectFile @bind-File="@this.dataFilePath" Label="@T("Selected file path for this data source")" FileDialogTitle="@T("Select the file")" Validation="@this.dataSourceValidation.ValidateFilePath" EnableDragDrop="true" CatchAllDocuments="true" />
|
||||
|
||||
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||
@T("In order for the AI to be able to determine the appropriate data at any time, you must choose an embedding provider.")
|
||||
|
||||
@@ -24,16 +24,6 @@ public partial class DataSourceLocalFileDialog : MSGComponentBase
|
||||
[Parameter]
|
||||
public DataSourceLocalFile DataSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the file this data source reads must stay as it is.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Set once the index holds something for this data source. The embedding is not locked along
|
||||
/// with it: it can be changed, and DataSourceReindexWarning asks what that costs.
|
||||
/// </remarks>
|
||||
[Parameter]
|
||||
public bool LockSource { get; set; }
|
||||
|
||||
[Inject]
|
||||
private IDialogService DialogService { get; init; } = null!;
|
||||
|
||||
@@ -206,8 +196,6 @@ public partial class DataSourceLocalFileDialog : MSGComponentBase
|
||||
? T("This audio or video file is skipped, because your transcription provider does not meet the confidence level this data source requires.")
|
||||
: null;
|
||||
|
||||
private bool CanChangeSource => !this.IsEditing || !this.LockSource;
|
||||
|
||||
private IEnumerable<ConfigurationSelectData<ConfidenceLevel>> ConfidenceLevels => ConfigurationSelectDataFactory.GetDataSourceConfidenceLevelsData();
|
||||
|
||||
private string SelectedEmbeddingTokenizerText => this.SelectedEmbedding is null
|
||||
@@ -235,9 +223,7 @@ public partial class DataSourceLocalFileDialog : MSGComponentBase
|
||||
Type = DataSourceType.LOCAL_FILE,
|
||||
EmbeddingId = this.dataEmbeddingId,
|
||||
|
||||
// Kept out of reach of the form while the source is locked, so a stale field cannot point an
|
||||
// indexed data source somewhere else:
|
||||
FilePath = this.CanChangeSource ? this.dataFilePath : this.DataSource.FilePath,
|
||||
FilePath = this.dataFilePath,
|
||||
MaxChunkTokenLength = this.dataMaxChunkTokenLength,
|
||||
ChunkOverlapTokenLength = this.dataChunkOverlapTokenLength,
|
||||
ConfidenceLevel = this.dataConfidenceLevel,
|
||||
@@ -252,6 +238,14 @@ public partial class DataSourceLocalFileDialog : MSGComponentBase
|
||||
if (!this.dataIsValid)
|
||||
return;
|
||||
|
||||
await this.StoreValidatedDataSourceAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Continues Save after form validation, asking before the draft is returned to its caller.
|
||||
/// </summary>
|
||||
internal async Task StoreValidatedDataSourceAsync()
|
||||
{
|
||||
var addedDataSource = this.CreateDataSource();
|
||||
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user