Added a SWOT analysis assistant (#1122)

Co-authored-by: hart_s3 <sabrina.hartmann@dlr.de>
This commit is contained in:
Thorsten Sommerandhart_s3 authored and GitHub committed 2026-10-28 08:51:30 +01:00
1 parent 6cb20fd75a
commit 060a2a5734
87 files changed
+4601 -45

No files matched your search

@@ -0,0 +1,36 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;
namespace AIStudio.Assistants.SWOTAnalysis;
/// <summary>
/// The part of the SWOT analysis assistant which shows what is going on while the analysis runs.
/// </summary>
/// <remarks>
/// None of the answers is shown while it streams: they are JSON, and they come from private threads.
/// The progress text below the progress bar names the stage, and the categories show their findings
/// as soon as each one is ready.
/// </remarks>
public partial class AssistantSWOTAnalysis
{
protected override bool ShowDedicatedProgress => true;
protected override string ProgressText =>
this.isGatheringSharedResearch ? T("Researching with the selected tools...") :
this.isRepairingModeration ? T("The overall assessment did not have the expected form. Asking the model once more...") :
this.isModeratingAnalysis ? T("Reconciling the four SWOT categories and writing the overall assessment...") :
this.categoryAnalysisProgress.Values.Any(progress => progress.Status is SwotCategoryAnalysisStatus.RUNNING or SwotCategoryAnalysisStatus.REPAIRING) ? T("Analyzing the four SWOT categories...") :
string.Empty;
private protected override RenderFragment? BelowSubmitContent =>
this.categoryAnalysisProgress.Count > 0 && this.analysisResult is null
? new RenderFragment(this.RenderProgress)
: null;
private void RenderProgress(RenderTreeBuilder builder)
{
builder.OpenComponent<SwotAnalysisProgressView>(0);
builder.AddComponentParameter(1, nameof(SwotAnalysisProgressView.Progress), this.categoryAnalysisProgress);
builder.CloseComponent();
}
}