Fixed bugs in & related to the web content reader (#549)
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üttandtsommer authored and GitHub committed 2025-09-01 19:13:02 +02:00
1 parent f61fe87181
commit 4e167d58ea
9 files changed
+63 -20

No files matched your search

@@ -31,14 +31,18 @@ public partial class ReadWebContent : MSGComponentBase
[Parameter]
public bool Preselect { get; set; }
[Parameter]
public EventCallback<bool> PreselectChanged { get; set; }
[Parameter]
public bool PreselectContentCleanerAgent { get; set; }
[Parameter]
public EventCallback<bool> PreselectContentCleanerAgentChanged { get; set; }
private readonly Process<ReadWebContentSteps> process = Process<ReadWebContentSteps>.INSTANCE;
private ProcessStepValue processStep;
private bool showWebContentReader;
private bool useContentCleanerAgent;
private string providedURL = string.Empty;
private bool urlIsValid;
private bool isProviderValid;
@@ -49,13 +53,10 @@ public partial class ReadWebContent : MSGComponentBase
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.ProviderSettings;
this.ValidateProvider(this.PreselectContentCleanerAgent);
await base.OnInitializedAsync();
}
@@ -64,6 +65,7 @@ public partial class ReadWebContent : MSGComponentBase
if (!this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions)
this.providerSettings = this.ProviderSettings;
this.ValidateProvider(this.PreselectContentCleanerAgent);
await base.OnParametersSetAsync();
}
@@ -86,7 +88,7 @@ public partial class ReadWebContent : MSGComponentBase
this.StateHasChanged();
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;
var additionalData = new Dictionary<string, string>
@@ -140,13 +142,23 @@ public partial class ReadWebContent : MSGComponentBase
if(!this.urlIsValid)
return false;
if(this.useContentCleanerAgent && !this.isProviderValid)
if(this.PreselectContentCleanerAgent && !this.isProviderValid)
return false;
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)
{
if(shouldUseAgent && this.providerSettings == AIStudio.Settings.Provider.NONE)