Added the BeyondFacts Lab as a prototype (#1175)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-08 19:49:46 +01:00
1 parent db8dae1cf6
commit b6c3fbb5db
90 files changed
+5936 -209

No files matched your search

@@ -0,0 +1,29 @@
namespace AIStudio.Assistants.BeyondFactsLab;
/// <summary>
/// Decides which preparation the BeyondFacts Lab shows after its list changed.
/// </summary>
public static class BflProjectSelection
{
/// <summary>
/// Chooses the preparation to show: the one asked for, else the one selected last, else the one changed last.
/// </summary>
/// <param name="projects">The preparations, the one changed last first.</param>
/// <param name="preferredId">The preparation asked for, e.g., one just created or the one shown so far.</param>
/// <param name="lastSelectedId">The preparation the person selected last, from an earlier session.</param>
/// <returns>The preparation to show, or null when there is none.</returns>
public static BflProjectEntry? Choose(IReadOnlyList<BflProjectEntry> projects, Guid? preferredId, Guid? lastSelectedId)
{
foreach (var candidateId in new[] { preferredId, lastSelectedId })
{
if (candidateId is null)
continue;
var candidate = projects.FirstOrDefault(project => project.ProjectId == candidateId);
if (candidate is not null)
return candidate;
}
return projects.Count > 0 ? projects[0] : null;
}
}