Disable upload form during upload; update citation template

The file upload form in Documents.razor is now wrapped in a <fieldset> that disables all controls while uploading, using a new isUploading flag to manage state and UI updates. The upload button's loading state is also handled. In Program.cs, the citation template was revised to require supporting excerpts of about 20-30 words instead of 15-20 words.
This commit is contained in:
Marco Minerva
2026-07-28 15:23:19 +02:00
parent 3390d94c81
commit 7d413aa0b3
2 changed files with 37 additions and 28 deletions
@@ -17,6 +17,7 @@
<EditForm Model="Model" Enhance OnValidSubmit="UploadFile"> <EditForm Model="Model" Enhance OnValidSubmit="UploadFile">
<DataAnnotationsValidator /> <DataAnnotationsValidator />
<fieldset disabled="@isUploading">
<div class="row"> <div class="row">
<div class="col-md-5 col-sm-4 col-5"> <div class="col-md-5 col-sm-4 col-5">
<div class="input-group"> <div class="input-group">
@@ -46,6 +47,7 @@
</div> </div>
</div> </div>
</div> </div>
</fieldset>
</EditForm> </EditForm>
@if (isLoading && documents.Count == 0) @if (isLoading && documents.Count == 0)
@@ -125,6 +127,7 @@ else
private Button deleteButton = default!; private Button deleteButton = default!;
private bool isLoading = true; private bool isLoading = true;
private bool isUploading;
private IList<SelectableDocument> documents = []; private IList<SelectableDocument> documents = [];
private UploadDocument Model { get; set; } = new(); private UploadDocument Model { get; set; } = new();
@@ -178,6 +181,9 @@ else
uploadButton.ShowLoading(); uploadButton.ShowLoading();
isUploading = true;
await InvokeAsync(StateHasChanged);
var fileName = Model.File.Name; var fileName = Model.File.Name;
try try
@@ -205,6 +211,9 @@ else
finally finally
{ {
uploadButton.HideLoading(); uploadButton.HideLoading();
isUploading = false;
await InvokeAsync(StateHasChanged);
} }
} }
+1 -1
View File
@@ -174,7 +174,7 @@ var textSearchOptions = new TextSearchProviderOptions()
sb.AppendLine("- Do NOT add inline citations."); sb.AppendLine("- Do NOT add inline citations.");
sb.AppendLine("- At the END of your answer, add a sources section that follows this template exactly, where the sources label and the page label are localized in the same language as the user's question:"); sb.AppendLine("- At the END of your answer, add a sources section that follows this template exactly, where the sources label and the page label are localized in the same language as the user's question:");
sb.AppendLine(" *localized-sources-label*"); sb.AppendLine(" *localized-sources-label*");
sb.AppendLine(" 1. **SourceName**, localized-page-label PageNumber: *supporting excerpt of about 15-20 words*"); sb.AppendLine(" 1. **SourceName**, localized-page-label PageNumber: *supporting excerpt of about 20-30 words*");
sb.AppendLine("- Omit the page label and the page number when the page number is not available."); sb.AppendLine("- Omit the page label and the page number when the page number is not available.");
sb.AppendLine("- Do NOT use headings or links in the sources section."); sb.AppendLine("- Do NOT use headings or links in the sources section.");
sb.AppendLine("- Include ONLY sources you actually used. No duplicates."); sb.AppendLine("- Include ONLY sources you actually used. No duplicates.");