diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua
index df597c2c..a4205982 100644
--- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua
+++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua
@@ -3631,6 +3631,9 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCEERI_V1INFODIALOG::T2879113658"] =
-- Maximum matches per query
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCEERI_V1INFODIALOG::T2889706179"] = "Maximum matches per query"
+-- Failed to read the user's username from the operating system.
+UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCEERI_V1INFODIALOG::T2909734556"] = "Failed to read the user's username from the operating system."
+
-- Open web link, show more information
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCEERI_V1INFODIALOG::T2968752071"] = "Open web link, show more information"
diff --git a/app/MindWork AI Studio/Dialogs/DataSourceERI_V1InfoDialog.razor b/app/MindWork AI Studio/Dialogs/DataSourceERI_V1InfoDialog.razor
index aa6b7b7d..fa9766fe 100644
--- a/app/MindWork AI Studio/Dialogs/DataSourceERI_V1InfoDialog.razor
+++ b/app/MindWork AI Studio/Dialogs/DataSourceERI_V1InfoDialog.razor
@@ -21,7 +21,7 @@
@if (this.DataSource.AuthMethod is AuthMethod.USERNAME_PASSWORD)
{
-
+
}
diff --git a/app/MindWork AI Studio/Dialogs/DataSourceERI_V1InfoDialog.razor.cs b/app/MindWork AI Studio/Dialogs/DataSourceERI_V1InfoDialog.razor.cs
index 38ed220a..02d522b6 100644
--- a/app/MindWork AI Studio/Dialogs/DataSourceERI_V1InfoDialog.razor.cs
+++ b/app/MindWork AI Studio/Dialogs/DataSourceERI_V1InfoDialog.razor.cs
@@ -41,6 +41,7 @@ public partial class DataSourceERI_V1InfoDialog : MSGComponentBase, IAsyncDispos
private readonly List dataIssues = [];
private string serverDescription = string.Empty;
+ private string effectiveUsername = string.Empty;
private ProviderType securityRequirements = ProviderType.NONE;
private IReadOnlyList retrievalInfoformation = [];
private RetrievalInfo selectedRetrievalInfo;
@@ -51,6 +52,27 @@ public partial class DataSourceERI_V1InfoDialog : MSGComponentBase, IAsyncDispos
private string Port => this.DataSource.Port == 0 ? string.Empty : $"{this.DataSource.Port}";
+ private async Task<(bool Success, DataSourceERI_V1 EffectiveDataSource)> CreateEffectiveDataSource()
+ {
+ this.effectiveUsername = this.DataSource.Username;
+ if (this.DataSource is not { AuthMethod: AuthMethod.USERNAME_PASSWORD, UsernamePasswordMode: DataSourceERIUsernamePasswordMode.OS_USERNAME_SHARED_PASSWORD })
+ return (true, this.DataSource);
+
+ var osUsername = await this.RustService.ReadUserName();
+ if (string.IsNullOrWhiteSpace(osUsername))
+ {
+ this.dataIssues.Add(T("Failed to read the user's username from the operating system."));
+ return (false, this.DataSource);
+ }
+
+ this.effectiveUsername = osUsername;
+ return (true, this.DataSource with
+ {
+ Username = osUsername,
+ UsernamePasswordMode = DataSourceERIUsernamePasswordMode.SHARED_USERNAME_AND_PASSWORD,
+ });
+ }
+
private string RetrievalName(RetrievalInfo retrievalInfo)
{
var hasId = !string.IsNullOrWhiteSpace(retrievalInfo.Id);
@@ -91,15 +113,19 @@ public partial class DataSourceERI_V1InfoDialog : MSGComponentBase, IAsyncDispos
{
this.IsOperationInProgress = true;
this.StateHasChanged();
+
+ var effectiveDataSourceResult = await this.CreateEffectiveDataSource();
+ if (!effectiveDataSourceResult.Success)
+ return;
- using var client = ERIClientFactory.Get(ERIVersion.V1, this.DataSource);
+ using var client = ERIClientFactory.Get(ERIVersion.V1, effectiveDataSourceResult.EffectiveDataSource);
if(client is null)
{
this.dataIssues.Add(T("Failed to connect to the ERI v1 server. The server is not supported."));
return;
}
- var loginResult = await client.AuthenticateAsync(this.RustService);
+ var loginResult = await client.AuthenticateAsync(this.RustService, cancellationToken: this.cts.Token);
if (!loginResult.Successful)
{
this.dataIssues.Add(loginResult.Message);
diff --git a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua
index e3f24448..adcba747 100644
--- a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua
+++ b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua
@@ -3633,6 +3633,9 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCEERI_V1INFODIALOG::T2879113658"] =
-- Maximum matches per query
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCEERI_V1INFODIALOG::T2889706179"] = "Maximale Treffer pro Abfrage"
+-- Failed to read the user's username from the operating system.
+UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCEERI_V1INFODIALOG::T2909734556"] = "Der Benutzername des Nutzers konnte nicht aus dem Betriebssystem gelesen werden."
+
-- Open web link, show more information
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCEERI_V1INFODIALOG::T2968752071"] = "Weblink öffnen & mehr Informationen anzeigen"
diff --git a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua
index 4402128e..0f5389cf 100644
--- a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua
+++ b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua
@@ -3633,6 +3633,9 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCEERI_V1INFODIALOG::T2879113658"] =
-- Maximum matches per query
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCEERI_V1INFODIALOG::T2889706179"] = "Maximum matches per query"
+-- Failed to read the user's username from the operating system.
+UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCEERI_V1INFODIALOG::T2909734556"] = "Failed to read the user's username from the operating system."
+
-- Open web link, show more information
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCEERI_V1INFODIALOG::T2968752071"] = "Open web link, show more information"