Fixed bugs in & related to the web content reader (#549)
Some checks failed
Build and Release / Read metadata (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Prepare & create release (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Publish release (push) Has been cancelled

Co-authored-by: Thorsten Sommer <mail@tsommer.org>
This commit is contained in:
Peer Schütt 2025-09-01 19:13:02 +02:00 committed by GitHub
parent f61fe87181
commit 4e167d58ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 63 additions and 20 deletions

View File

@ -3,7 +3,7 @@
@if (!this.SettingsManager.ConfigurationData.LegalCheck.HideWebContentReader) @if (!this.SettingsManager.ConfigurationData.LegalCheck.HideWebContentReader)
{ {
<ReadWebContent @bind-Content="@this.inputLegalDocument" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" Preselect="@(this.SettingsManager.ConfigurationData.LegalCheck.PreselectOptions && this.SettingsManager.ConfigurationData.LegalCheck.PreselectWebContentReader)" PreselectContentCleanerAgent="@(this.SettingsManager.ConfigurationData.LegalCheck.PreselectOptions && this.SettingsManager.ConfigurationData.LegalCheck.PreselectContentCleanerAgent)"/> <ReadWebContent @bind-Content="@this.inputLegalDocument" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" @bind-Preselect="@this.showWebContentReader" @bind-PreselectContentCleanerAgent="@this.useContentCleanerAgent"/>
} }
<ReadFileContent @bind-FileContent="@this.inputLegalDocument"/> <ReadFileContent @bind-FileContent="@this.inputLegalDocument"/>

View File

@ -37,11 +37,27 @@ public partial class AssistantLegalCheck : AssistantBaseCore<SettingsDialogLegal
{ {
this.inputLegalDocument = string.Empty; this.inputLegalDocument = string.Empty;
this.inputQuestions = string.Empty; this.inputQuestions = string.Empty;
this.MightPreselectValues(); if (!this.MightPreselectValues())
{
this.showWebContentReader = false;
this.useContentCleanerAgent = false;
}
} }
protected override bool MightPreselectValues() => false; protected override bool MightPreselectValues()
{
if (this.SettingsManager.ConfigurationData.LegalCheck.PreselectOptions)
{
this.showWebContentReader = this.SettingsManager.ConfigurationData.LegalCheck.PreselectWebContentReader;
this.useContentCleanerAgent = this.SettingsManager.ConfigurationData.LegalCheck.PreselectContentCleanerAgent;
return true;
}
return false;
}
private bool showWebContentReader;
private bool useContentCleanerAgent;
private bool isAgentRunning; private bool isAgentRunning;
private string inputLegalDocument = string.Empty; private string inputLegalDocument = string.Empty;
private string inputQuestions = string.Empty; private string inputQuestions = string.Empty;

View File

@ -3,7 +3,7 @@
@if (!this.SettingsManager.ConfigurationData.TextSummarizer.HideWebContentReader) @if (!this.SettingsManager.ConfigurationData.TextSummarizer.HideWebContentReader)
{ {
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" Preselect="@(this.SettingsManager.ConfigurationData.TextSummarizer.PreselectOptions && this.SettingsManager.ConfigurationData.TextSummarizer.PreselectWebContentReader)" PreselectContentCleanerAgent="@(this.SettingsManager.ConfigurationData.TextSummarizer.PreselectOptions && this.SettingsManager.ConfigurationData.TextSummarizer.PreselectContentCleanerAgent)"/> <ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" @bind-Preselect="@this.showWebContentReader" @bind-PreselectContentCleanerAgent="@this.useContentCleanerAgent"/>
} }
<ReadFileContent @bind-FileContent="@this.inputText"/> <ReadFileContent @bind-FileContent="@this.inputText"/>

View File

@ -40,6 +40,8 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
this.inputText = string.Empty; this.inputText = string.Empty;
if(!this.MightPreselectValues()) if(!this.MightPreselectValues())
{ {
this.showWebContentReader = false;
this.useContentCleanerAgent = false;
this.selectedTargetLanguage = CommonLanguages.AS_IS; this.selectedTargetLanguage = CommonLanguages.AS_IS;
this.customTargetLanguage = string.Empty; this.customTargetLanguage = string.Empty;
this.selectedComplexity = Complexity.NO_CHANGE; this.selectedComplexity = Complexity.NO_CHANGE;
@ -52,6 +54,8 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
{ {
if (this.SettingsManager.ConfigurationData.TextSummarizer.PreselectOptions) if (this.SettingsManager.ConfigurationData.TextSummarizer.PreselectOptions)
{ {
this.showWebContentReader = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectWebContentReader;
this.useContentCleanerAgent = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectContentCleanerAgent;
this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedTargetLanguage; this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedTargetLanguage;
this.customTargetLanguage = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedOtherLanguage; this.customTargetLanguage = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedOtherLanguage;
this.selectedComplexity = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedComplexity; this.selectedComplexity = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedComplexity;
@ -63,6 +67,8 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
return false; return false;
} }
private bool showWebContentReader;
private bool useContentCleanerAgent;
private string inputText = string.Empty; private string inputText = string.Empty;
private bool isAgentRunning; private bool isAgentRunning;
private CommonLanguages selectedTargetLanguage; private CommonLanguages selectedTargetLanguage;

View File

@ -3,7 +3,7 @@
@if (!this.SettingsManager.ConfigurationData.Translation.HideWebContentReader) @if (!this.SettingsManager.ConfigurationData.Translation.HideWebContentReader)
{ {
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" Preselect="@(this.SettingsManager.ConfigurationData.Translation.PreselectOptions && this.SettingsManager.ConfigurationData.Translation.PreselectWebContentReader)" PreselectContentCleanerAgent="@(this.SettingsManager.ConfigurationData.Translation.PreselectOptions && this.SettingsManager.ConfigurationData.Translation.PreselectContentCleanerAgent)"/> <ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" @bind-Preselect="@this.showWebContentReader" @bind-PreselectContentCleanerAgent="@this.useContentCleanerAgent"/>
} }
<ReadFileContent @bind-FileContent="@this.inputText"/> <ReadFileContent @bind-FileContent="@this.inputText"/>

View File

@ -40,6 +40,8 @@ public partial class AssistantTranslation : AssistantBaseCore<SettingsDialogTran
this.inputTextLastTranslation = string.Empty; this.inputTextLastTranslation = string.Empty;
if (!this.MightPreselectValues()) if (!this.MightPreselectValues())
{ {
this.showWebContentReader = false;
this.useContentCleanerAgent = false;
this.liveTranslation = false; this.liveTranslation = false;
this.selectedTargetLanguage = CommonLanguages.AS_IS; this.selectedTargetLanguage = CommonLanguages.AS_IS;
this.customTargetLanguage = string.Empty; this.customTargetLanguage = string.Empty;
@ -50,6 +52,8 @@ public partial class AssistantTranslation : AssistantBaseCore<SettingsDialogTran
{ {
if (this.SettingsManager.ConfigurationData.Translation.PreselectOptions) if (this.SettingsManager.ConfigurationData.Translation.PreselectOptions)
{ {
this.showWebContentReader = this.SettingsManager.ConfigurationData.Translation.PreselectWebContentReader;
this.useContentCleanerAgent = this.SettingsManager.ConfigurationData.Translation.PreselectContentCleanerAgent;
this.liveTranslation = this.SettingsManager.ConfigurationData.Translation.PreselectLiveTranslation; this.liveTranslation = this.SettingsManager.ConfigurationData.Translation.PreselectLiveTranslation;
this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.Translation.PreselectedTargetLanguage; this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.Translation.PreselectedTargetLanguage;
this.customTargetLanguage = this.SettingsManager.ConfigurationData.Translation.PreselectOtherLanguage; this.customTargetLanguage = this.SettingsManager.ConfigurationData.Translation.PreselectOtherLanguage;
@ -59,6 +63,8 @@ public partial class AssistantTranslation : AssistantBaseCore<SettingsDialogTran
return false; return false;
} }
private bool showWebContentReader;
private bool useContentCleanerAgent;
private bool liveTranslation; private bool liveTranslation;
private bool isAgentRunning; private bool isAgentRunning;
private string inputText = string.Empty; private string inputText = string.Empty;

View File

@ -1,9 +1,9 @@
@inherits MSGComponentBase @inherits MSGComponentBase
<MudPaper Class="pa-3 mb-3 border-dashed border rounded-lg"> <MudPaper Class="pa-3 mb-3 border-dashed border rounded-lg">
<MudTextSwitch Label="@T("Read content from web?")" Disabled="@this.AgentIsRunning" @bind-Value="@this.showWebContentReader" LabelOn="@T("Show web content options")" LabelOff="@T("Hide web content options")" /> <MudTextSwitch Label="@T("Read content from web?")" Disabled="@this.AgentIsRunning" Value="@this.Preselect" ValueChanged="@this.ShowWebContentReaderChanged" LabelOn="@T("Show web content options")" LabelOff="@T("Hide web content options")" />
@if (this.showWebContentReader) @if (this.Preselect)
{ {
<MudTextSwitch Label="@T("Cleanup content by using an LLM agent?")" @bind-Value="@this.useContentCleanerAgent" Validation="@this.ValidateProvider" Disabled="@this.AgentIsRunning" LabelOn="@T("The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used.")" LabelOff="@T("No content cleaning")" /> <MudTextSwitch Label="@T("Cleanup content by using an LLM agent?")" Value="@this.PreselectContentCleanerAgent" ValueChanged="@this.UseContentCleanerAgentChanged" Validation="@this.ValidateProvider" Disabled="@this.AgentIsRunning" LabelOn="@T("The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used.")" LabelOff="@T("No content cleaning")" />
<MudStack Row="@true" AlignItems="@AlignItems.Baseline" Class="mb-3"> <MudStack Row="@true" AlignItems="@AlignItems.Baseline" Class="mb-3">
<MudTextField T="string" Label="@T("URL from which to load the content")" @bind-Value="@this.providedURL" Validation="@this.ValidateURL" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Link" Placeholder="https://..." HelperText="@T("Loads the content from your URL. Does not work when the content is hidden behind a paywall.")" Variant="Variant.Outlined" Immediate="@true" Disabled="@this.AgentIsRunning"/> <MudTextField T="string" Label="@T("URL from which to load the content")" @bind-Value="@this.providedURL" Validation="@this.ValidateURL" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Link" Placeholder="https://..." HelperText="@T("Loads the content from your URL. Does not work when the content is hidden behind a paywall.")" Variant="Variant.Outlined" Immediate="@true" Disabled="@this.AgentIsRunning"/>
<MudButton Disabled="@(!this.IsReady || this.AgentIsRunning)" Variant="Variant.Filled" Size="Size.Large" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Download" OnClick="() => this.LoadFromWeb()"> <MudButton Disabled="@(!this.IsReady || this.AgentIsRunning)" Variant="Variant.Filled" Size="Size.Large" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Download" OnClick="() => this.LoadFromWeb()">

View File

@ -31,14 +31,18 @@ public partial class ReadWebContent : MSGComponentBase
[Parameter] [Parameter]
public bool Preselect { get; set; } public bool Preselect { get; set; }
[Parameter]
public EventCallback<bool> PreselectChanged { get; set; }
[Parameter] [Parameter]
public bool PreselectContentCleanerAgent { get; set; } public bool PreselectContentCleanerAgent { get; set; }
[Parameter]
public EventCallback<bool> PreselectContentCleanerAgentChanged { get; set; }
private readonly Process<ReadWebContentSteps> process = Process<ReadWebContentSteps>.INSTANCE; private readonly Process<ReadWebContentSteps> process = Process<ReadWebContentSteps>.INSTANCE;
private ProcessStepValue processStep; private ProcessStepValue processStep;
private bool showWebContentReader;
private bool useContentCleanerAgent;
private string providedURL = string.Empty; private string providedURL = string.Empty;
private bool urlIsValid; private bool urlIsValid;
private bool isProviderValid; private bool isProviderValid;
@ -49,13 +53,10 @@ public partial class ReadWebContent : MSGComponentBase
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
if(this.Preselect)
this.showWebContentReader = true;
if(this.PreselectContentCleanerAgent)
this.useContentCleanerAgent = true;
this.ProviderSettings = this.SettingsManager.GetPreselectedProvider(Tools.Components.AGENT_TEXT_CONTENT_CLEANER, this.ProviderSettings.Id, true); this.ProviderSettings = this.SettingsManager.GetPreselectedProvider(Tools.Components.AGENT_TEXT_CONTENT_CLEANER, this.ProviderSettings.Id, true);
this.providerSettings = this.ProviderSettings;
this.ValidateProvider(this.PreselectContentCleanerAgent);
await base.OnInitializedAsync(); await base.OnInitializedAsync();
} }
@ -64,6 +65,7 @@ public partial class ReadWebContent : MSGComponentBase
if (!this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions) if (!this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions)
this.providerSettings = this.ProviderSettings; this.providerSettings = this.ProviderSettings;
this.ValidateProvider(this.PreselectContentCleanerAgent);
await base.OnParametersSetAsync(); await base.OnParametersSetAsync();
} }
@ -86,7 +88,7 @@ public partial class ReadWebContent : MSGComponentBase
this.StateHasChanged(); this.StateHasChanged();
markdown = this.HTMLParser.ParseToMarkdown(html); markdown = this.HTMLParser.ParseToMarkdown(html);
if (this.useContentCleanerAgent && this.providerSettings != AIStudio.Settings.Provider.NONE) if (this.PreselectContentCleanerAgent && this.providerSettings != AIStudio.Settings.Provider.NONE)
{ {
this.AgentTextContentCleaner.ProviderSettings = this.providerSettings; this.AgentTextContentCleaner.ProviderSettings = this.providerSettings;
var additionalData = new Dictionary<string, string> var additionalData = new Dictionary<string, string>
@ -140,13 +142,23 @@ public partial class ReadWebContent : MSGComponentBase
if(!this.urlIsValid) if(!this.urlIsValid)
return false; return false;
if(this.useContentCleanerAgent && !this.isProviderValid) if(this.PreselectContentCleanerAgent && !this.isProviderValid)
return false; return false;
return true; return true;
} }
} }
private async Task ShowWebContentReaderChanged(bool state)
{
await this.PreselectChanged.InvokeAsync(state);
}
private async Task UseContentCleanerAgentChanged(bool state)
{
await this.PreselectContentCleanerAgentChanged.InvokeAsync(state);
}
private string? ValidateProvider(bool shouldUseAgent) private string? ValidateProvider(bool shouldUseAgent)
{ {
if(shouldUseAgent && this.providerSettings == AIStudio.Settings.Provider.NONE) if(shouldUseAgent && this.providerSettings == AIStudio.Settings.Provider.NONE)

View File

@ -13,3 +13,6 @@
- Fixed a bug in various assistants where some text fields were not reset when resetting. - Fixed a bug in various assistants where some text fields were not reset when resetting.
- Fixed the input field header in the dialog for naming chats and workspaces. - Fixed the input field header in the dialog for naming chats and workspaces.
- Fixed a rare chat-related bug that could occur when a workspace was not created correctly. Thank you, Naomi, for reporting this issue. - Fixed a rare chat-related bug that could occur when a workspace was not created correctly. Thank you, Naomi, for reporting this issue.
- Fixed a bug in the web content reader where a preconfigured LLM provider was not recognized, resulting in an error message.
- Fixed another bug in the web content reader: the system incorrectly evaluated whether the content cleaning agent was preselected. Users had to first deactivate the agent and then reactivate it to make it work correctly.
- Fixed a bug in the assistants for text summarization, translations, and legal check: the web content reader preferences were not being applied when resetting the assistant.