Give the profile and template dialogs their own drop zones

This commit is contained in:
Thorsten Sommer 2026-09-10 13:08:22 +02:00
parent d1b471359b
commit bd14d3aabb
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
6 changed files with 45 additions and 8 deletions

View File

@ -266,9 +266,21 @@ public partial class AttachDocuments : MSGComponentBase
/// </summary>
private void ClaimDefaultZoneRole()
{
if (!this.CatchAllDocuments || this.Scope is null)
if (!this.CatchAllDocuments)
return;
if (this.Scope is null)
{
//
// There is nothing to claim: the surrounding page, assistant, or dialog is not a drop
// area at all. The flag would then do nothing, and silently -- which is how a zone ends
// up promising a behaviour it cannot deliver. So say it out loud: either the area needs
// a DropZoneScope, or the flag does not belong here.
//
this.Logger.LogWarning("The attachment zone '{Name}' wants to be the default target of its area, but it does not live in a drop zone scope. Dropping next to this zone will do nothing.", this.Name);
return;
}
this.isDefaultZone = this.Scope.TryBecomeDefaultZone(this);
if (!this.isDefaultZone)
this.Logger.LogDebug("The attachment zone '{Name}' asked to be the default target of its area, which another zone already is. It now takes only the drops aimed at itself.", this.Name);

View File

@ -120,9 +120,21 @@ public partial class PathDropZone : MSGComponentBase
/// </summary>
private void ClaimDefaultZoneRole()
{
if (!this.CatchAllDocuments || this.Scope is null)
if (!this.CatchAllDocuments)
return;
if (this.Scope is null)
{
//
// There is nothing to claim: the surrounding page, assistant, or dialog is not a drop
// area at all. The flag would then do nothing, and silently -- which is how a zone ends
// up promising a behaviour it cannot deliver. So say it out loud: either the area needs
// a DropZoneScope, or the flag does not belong here.
//
this.Logger.LogWarning("The path drop zone '{ZoneId}' wants to be the default target of its area, but it does not live in a drop zone scope. Dropping next to this zone will do nothing.", this.dropZoneId);
return;
}
this.isDefaultZone = this.Scope.TryBecomeDefaultZone(this);
if (!this.isDefaultZone)
this.Logger.LogDebug("The path drop zone '{ZoneId}' asked to be the default target of its area, which another zone already is. It now takes only the drops aimed at itself.", this.dropZoneId);

View File

@ -244,9 +244,21 @@ public partial class ReadFileContent : MSGComponentBase
/// </summary>
private void ClaimDefaultZoneRole()
{
if (!this.CatchAllDocuments || this.Scope is null)
if (!this.CatchAllDocuments)
return;
if (this.Scope is null)
{
//
// There is nothing to claim: the surrounding page, assistant, or dialog is not a drop
// area at all. The flag would then do nothing, and silently -- which is how a zone ends
// up promising a behaviour it cannot deliver. So say it out loud: either the area needs
// a DropZoneScope, or the flag does not belong here.
//
this.Logger.LogWarning("The file zone '{ZoneId}' wants to be the default target of its area, but it does not live in a drop zone scope. Dropping next to this zone will do nothing.", this.dropZoneId);
return;
}
this.isDefaultZone = this.Scope.TryBecomeDefaultZone(this);
if (!this.isDefaultZone)
this.Logger.LogDebug("The file zone '{ZoneId}' asked to be the default target of its area, which another zone already is. It now takes only the drops aimed at itself.", this.dropZoneId);

View File

@ -59,7 +59,7 @@
<MudButton Class="mb-3" Color="Color.Default" OnClick="@this.UseDefaultSystemPrompt" StartIcon="@Icons.Material.Filled.ListAlt" Variant="Variant.Filled" Disabled="@this.IsReadOnly">
@T("Use the default system prompt")
</MudButton>
<ReadFileContent Text="@T("Load system prompt from file")" @bind-FileContent="@this.DataSystemPrompt" Disabled="@this.IsReadOnly"/>
<ReadFileContent Text="@T("Load system prompt from file")" @bind-FileContent="@this.DataSystemPrompt" EnableDragDrop="true" Disabled="@this.IsReadOnly"/>
<MudText Typo="Typo.h6" Class="mb-3 mt-6">
@T("Predefined User Input")
@ -83,6 +83,7 @@
HelperText="@T("Tell the AI your predefined user input.")"
ReadOnly="@this.IsReadOnly"
/>
<ReadFileContent Text="@T("Load predefined user input from file")" @bind-FileContent="@this.PredefinedUserPrompt" EnableDragDrop="true" Disabled="@this.IsReadOnly"/>
<MudText Typo="Typo.h6" Class="mb-3 mt-6">
@T("File Attachments")

View File

@ -47,7 +47,7 @@
HelperText="@T("Tell the AI something about yourself. What is your profession? How experienced are you in this profession? Which technologies do you like?")"
ReadOnly="@this.IsReadOnly"
/>
<ReadFileContent @bind-FileContent="@this.DataNeedToKnow" Disabled="@this.IsReadOnly"/>
<ReadFileContent Text="@T("Load what the AI should know from file")" @bind-FileContent="@this.DataNeedToKnow" EnableDragDrop="true" Disabled="@this.IsReadOnly"/>
<MudTextField
T="string"
@ -66,7 +66,7 @@
HelperText="@T("Tell the AI what you want it to do for you. What are your goals or are you trying to achieve? Like having the AI address you informally.")"
ReadOnly="@this.IsReadOnly"
/>
<ReadFileContent @bind-FileContent="@this.DataActions" Disabled="@this.IsReadOnly"/>
<ReadFileContent Text="@T("Load what the AI should do from file")" @bind-FileContent="@this.DataActions" EnableDragDrop="true" Disabled="@this.IsReadOnly"/>
<MudJustifiedText Typo="Typo.body2" Class="mb-3 mt-3">
@T("Please be aware that your profile info becomes part of the system prompt. This means it uses up context space — the “memory” the LLM uses to understand and respond to your request. If your profile is extremely long, the LLM may struggle to focus on your actual task.")

View File

@ -26,12 +26,12 @@
<ConfigurationSelect OptionDescription="@T("Default source of the instructions")" Disabled="@this.DefaultsDisabled" SelectedValue="@(() => this.SettingsManager.ConfigurationData.BatchProcessing.PromptSource)" Data="@this.PromptSourceData" SelectionUpdate="@(value => this.SettingsManager.ConfigurationData.BatchProcessing.PromptSource = value)" IsLocked="() => ManagedConfiguration.TryGet(x => x.BatchProcessing, x => x.PromptSource, out var meta) && meta.IsLocked"/>
@if (this.SettingsManager.ConfigurationData.BatchProcessing.PromptSource is BatchProcessingPromptSource.FREE_PROMPT)
{
<ReadFileContent Text="@T("Load default prompt from file")" FileContent="@this.SettingsManager.ConfigurationData.BatchProcessing.FreePrompt" FileContentChanged="@this.UpdateFreePromptFromFileAsync" EnableDragDrop="true" CatchAllDocuments="true" Disabled="@this.FreePromptImportDisabled()"/>
<ReadFileContent Text="@T("Load default prompt from file")" FileContent="@this.SettingsManager.ConfigurationData.BatchProcessing.FreePrompt" FileContentChanged="@this.UpdateFreePromptFromFileAsync" EnableDragDrop="true" Disabled="@this.FreePromptImportDisabled()"/>
<ConfigurationText OptionDescription="@T("Default prompt")" Disabled="@this.DefaultsDisabled" Icon="@Icons.Material.Filled.EditNote" NumLines="5" MaxLines="26" Text="@(() => this.SettingsManager.ConfigurationData.BatchProcessing.FreePrompt)" TextUpdate="@(value => this.SettingsManager.ConfigurationData.BatchProcessing.FreePrompt = value)" OptionHelp="@T("These instructions are applied to every document of a new batch run.")" IsLocked="() => ManagedConfiguration.TryGet(x => x.BatchProcessing, x => x.FreePrompt, out var meta) && meta.IsLocked"/>
}
else if (this.SettingsManager.ConfigurationData.BatchProcessing.PromptSource is BatchProcessingPromptSource.FILE_IMPORT)
{
<ReadFileContent Text="@T("Load default Markdown instructions file")" Filter="@([FileTypes.MARKDOWN])" FilePathLoaded="@this.UpdatePromptFilePathAsync" EnableDragDrop="true" CatchAllDocuments="true" Disabled="@this.PromptFileImportDisabled()"/>
<ReadFileContent Text="@T("Load default Markdown instructions file")" Filter="@([FileTypes.MARKDOWN])" FilePathLoaded="@this.UpdatePromptFilePathAsync" EnableDragDrop="true" Disabled="@this.PromptFileImportDisabled()"/>
<ConfigurationFile OptionDescription="@T("Default Markdown instructions file")" Disabled="@this.DefaultsDisabled" Icon="@Icons.Material.Filled.Description" Text="@(() => this.SettingsManager.ConfigurationData.BatchProcessing.PromptFilePath)" TextUpdate="@(value => this.SettingsManager.ConfigurationData.BatchProcessing.PromptFilePath = value)" FileDialogTitle="@T("Select the default Markdown instructions file")" Filter="@([FileTypes.MARKDOWN])" OptionHelp="@T("The current content of this Markdown file is loaded whenever the defaults are applied.")" IsLocked="() => ManagedConfiguration.TryGet(x => x.BatchProcessing, x => x.PromptFilePath, out var meta) && meta.IsLocked"/>
}
else