mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-11 06:27:40 +00:00
Added the BeyondFacts Lab as a prototype (#1175)
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user