diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua
index de185236..68813a98 100644
--- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua
+++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua
@@ -5302,6 +5302,9 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCELOCALFILEINFODIALOG::T3688254408"]
-- Your security policy
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCELOCALFILEINFODIALOG::T4081226330"] = "Your security policy"
+-- Please wait while we load the content of your file. Depending on the file type and size, this may take a moment.
+UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DOCUMENTCHECKDIALOG::T1205126512"] = "Please wait while we load the content of your file. Depending on the file type and size, this may take a moment."
+
-- Markdown View
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DOCUMENTCHECKDIALOG::T1373123357"] = "Markdown View"
diff --git a/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor b/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor
index f844abb9..62fea886 100644
--- a/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor
+++ b/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor
@@ -33,6 +33,16 @@
@T("The specified file could not be found. The file have been moved, deleted, renamed, or is otherwise inaccessible.")
}
+ else if (this.isLoadingContent)
+ {
+
+ @T("Please wait while we load the content of your file. Depending on the file type and size, this may take a moment.")
+
+
+
+
+
+ }
else if (this.loadFailureMessage is not null)
{
diff --git a/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor.cs b/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor.cs
index d652660d..2406b5a3 100644
--- a/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor.cs
+++ b/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor.cs
@@ -25,7 +25,13 @@ public partial class DocumentCheckDialog : MSGComponentBase
/// Set when reading the file failed, so the dialog shows the reason instead of empty content.
///
private string? loadFailureMessage;
-
+
+ ///
+ /// True while we extract the file content. Reading happens after the first render, so the
+ /// dialog can tell the user that it is working instead of showing an empty document.
+ ///
+ private bool isLoadingContent;
+
[Inject]
private RustService RustService { get; init; } = null!;
@@ -35,24 +41,40 @@ public partial class DocumentCheckDialog : MSGComponentBase
[Inject]
private ILogger Logger { get; init; } = null!;
+ protected override async Task OnInitializedAsync()
+ {
+ //
+ // Decide before the first render whether we have to read the file at all. Images are shown
+ // as they are, a missing file shows its own message, and content a caller already handed
+ // us is reused instead of being extracted a second time:
+ //
+ this.isLoadingContent =
+ this.Document is not null &&
+ !this.Document.IsImage &&
+ this.Document.Exists &&
+ string.IsNullOrWhiteSpace(this.FileContent);
+
+ await base.OnInitializedAsync();
+ }
+
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender && this.Document is not null)
{
+ if (!this.isLoadingContent)
+ return;
+
try
{
- if (!this.Document.IsImage)
- {
- var extraction = await UserFile.LoadFileData(this.Document.FilePath, this.RustService, this.DialogService);
- this.FileContent = extraction.Content;
+ var extraction = await UserFile.LoadFileData(this.Document.FilePath, this.RustService, this.DialogService);
+ this.FileContent = extraction.Content;
- //
- // This dialog exists so the user can check what we hand to the AI. Showing an
- // empty document when reading the file failed would answer that question wrong.
- //
- if (!extraction.HasUsableContent)
- this.loadFailureMessage = extraction.ToUserMessage(this.Document.FileName);
- }
+ //
+ // This dialog exists so the user can check what we hand to the AI. Showing an
+ // empty document when reading the file failed would answer that question wrong.
+ //
+ if (!extraction.HasUsableContent)
+ this.loadFailureMessage = extraction.ToUserMessage(this.Document.FileName);
}
catch (Exception ex)
{
@@ -60,8 +82,11 @@ public partial class DocumentCheckDialog : MSGComponentBase
this.FileContent = string.Empty;
this.loadFailureMessage = FileExtractionErrorCode.INTERNAL.ToUserMessage(this.Document.FileName);
}
-
- this.StateHasChanged();
+ finally
+ {
+ this.isLoadingContent = false;
+ this.StateHasChanged();
+ }
}
else if (firstRender)
this.Logger.LogWarning("Document check dialog opened without a valid file path.");
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 0f3c7329..28fb5a33 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
@@ -5304,6 +5304,9 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCELOCALFILEINFODIALOG::T3688254408"]
-- Your security policy
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCELOCALFILEINFODIALOG::T4081226330"] = "Ihre Sicherheitsrichtlinie"
+-- Please wait while we load the content of your file. Depending on the file type and size, this may take a moment.
+UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DOCUMENTCHECKDIALOG::T1205126512"] = "Bitte warten Sie, während wir den Inhalt Ihrer Datei laden. Je nach Dateityp und -größe kann dies einen Moment dauern."
+
-- Markdown View
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DOCUMENTCHECKDIALOG::T1373123357"] = "Markdown-Ansicht"
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 0b861aa5..aa294bf6 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
@@ -5304,6 +5304,9 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCELOCALFILEINFODIALOG::T3688254408"]
-- Your security policy
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DATASOURCELOCALFILEINFODIALOG::T4081226330"] = "Your security policy"
+-- Please wait while we load the content of your file. Depending on the file type and size, this may take a moment.
+UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DOCUMENTCHECKDIALOG::T1205126512"] = "Please wait while we load the content of your file. Depending on the file type and size, this may take a moment."
+
-- Markdown View
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::DOCUMENTCHECKDIALOG::T1373123357"] = "Markdown View"