diff --git a/app/MindWork AI Studio/Dialogs/DataSourceERI_V1Dialog.razor b/app/MindWork AI Studio/Dialogs/DataSourceERI_V1Dialog.razor index a16077af..7893ac54 100644 --- a/app/MindWork AI Studio/Dialogs/DataSourceERI_V1Dialog.razor +++ b/app/MindWork AI Studio/Dialogs/DataSourceERI_V1Dialog.razor @@ -113,7 +113,7 @@ @if (this.availableRetrievalProcesses.Count > 0) { - + @foreach (var retrievalProcess in this.availableRetrievalProcesses) { diff --git a/app/MindWork AI Studio/Dialogs/DataSourceERI_V1Dialog.razor.cs b/app/MindWork AI Studio/Dialogs/DataSourceERI_V1Dialog.razor.cs index 5827274f..2ad1b370 100644 --- a/app/MindWork AI Studio/Dialogs/DataSourceERI_V1Dialog.razor.cs +++ b/app/MindWork AI Studio/Dialogs/DataSourceERI_V1Dialog.razor.cs @@ -51,6 +51,7 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId private string dataSecretStorageIssue = string.Empty; private string importCredentialIssue = string.Empty; private string importRetrievalIssue = string.Empty; + private string importedRetrievalId = string.Empty; private string dataEditingPreviousInstanceName = string.Empty; private List availableAuthMethods = []; private DataSourceSecurity dataSecurityPolicy; @@ -227,12 +228,15 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId this.dataSecret = secret; this.importCredentialIssue = credentialIssue; this.importRetrievalIssue = string.Empty; + this.importedRetrievalId = retrievalId; this.connectionTested = false; this.connectionSuccessfulTested = false; this.form.ResetValidation(); return Task.CompletedTask; } + private void ClearImportRetrievalIssue() => this.importRetrievalIssue = string.Empty; + private bool IsConnectionEncrypted() => this.dataHostname.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase); private bool IsConnectionPossible() @@ -307,16 +311,23 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId } this.availableRetrievalProcesses = retrievalInfoRequest.Data ?? []; - if (!string.IsNullOrWhiteSpace(this.dataSelectedRetrievalProcess.Id)) + // Only the first successful test after an import resolves the imported retrieval ID; + // afterward, the selection belongs to the user: + if (!string.IsNullOrWhiteSpace(this.importedRetrievalId)) { - var importedRetrieval = this.availableRetrievalProcesses.FirstOrDefault(item => item.Id == this.dataSelectedRetrievalProcess.Id); + var importedRetrieval = this.availableRetrievalProcesses.FirstOrDefault(item => item.Id == this.importedRetrievalId); if (importedRetrieval != default) + { this.dataSelectedRetrievalProcess = importedRetrieval; + this.importRetrievalIssue = string.Empty; + } else { - this.importRetrievalIssue = string.Format(T("The imported retrieval process '{0}' is unavailable. Select another process before saving."), this.dataSelectedRetrievalProcess.Id); + this.importRetrievalIssue = string.Format(T("The imported retrieval process '{0}' is unavailable. Select another process before saving."), this.importedRetrievalId); this.dataSelectedRetrievalProcess = default; } + + this.importedRetrievalId = string.Empty; } this.connectionTested = true; diff --git a/app/MindWork AI Studio/Settings/EmbeddingProvider.cs b/app/MindWork AI Studio/Settings/EmbeddingProvider.cs index 8aa411b1..7180c1d9 100644 --- a/app/MindWork AI Studio/Settings/EmbeddingProvider.cs +++ b/app/MindWork AI Studio/Settings/EmbeddingProvider.cs @@ -256,7 +256,7 @@ public sealed record EmbeddingProvider( ["Name"] = "{{LuaTools.EscapeLuaString(this.Name)}}", ["UsedLLMProvider"] = "{{this.UsedLLMProvider}}", - ["TokenizerPath"] = "{{this.TokenizerPath}}", + ["TokenizerPath"] = "{{LuaTools.EscapeLuaString(this.TokenizerPath)}}", ["TokenLimit"] = {{this.EffectiveTokenLimit}}, ["EmbeddingBatchSize"] = {{this.EffectiveEmbeddingBatchSize}}, diff --git a/app/MindWork AI Studio/Settings/Provider.cs b/app/MindWork AI Studio/Settings/Provider.cs index cc153d21..f42ea61e 100644 --- a/app/MindWork AI Studio/Settings/Provider.cs +++ b/app/MindWork AI Studio/Settings/Provider.cs @@ -279,7 +279,7 @@ public sealed record Provider( ["InstanceName"] = "{{LuaTools.EscapeLuaString(this.InstanceName)}}", ["UsedLLMProvider"] = "{{this.UsedLLMProvider}}", - ["TokenizerPath"] = "{{this.TokenizerPath}}", + ["TokenizerPath"] = "{{LuaTools.EscapeLuaString(this.TokenizerPath)}}", ["Host"] = "{{this.Host}}", ["Hostname"] = "{{LuaTools.EscapeLuaString(this.Hostname)}}",