Files
AI-Studio/app/MindWork AI Studio/Assistants/BeyondFactsLab/BflPersonResearchPanel.razor
T

163 lines
9.8 KiB
Plaintext
Raw Normal View History

@inherits MSGComponentBase
<MudText Typo="Typo.h6" Class="mt-2 mb-1">@T("Research on individual participants")</MudText>
<MudJustifiedText Typo="Typo.body2" Class="mb-2">@TA("Choose whom of the participants the lab should research in depth. For each person, three research agents work one after the other: profile, positions on the topic, and public appearances. They receive only the name and the list entry of the person, the public details about the event, and what the earlier stages found.")</MudJustifiedText>
<MudJustifiedText Typo="Typo.body2" Class="mb-3">@T("The agents look only for public, professional information and public statements on the topic. They keep summaries with sources, no full texts, create no personality profiles, and judge nobody.")</MudJustifiedText>
@if (this.List is null)
{
<MudJustifiedText Typo="Typo.body2" Class="mb-3">@TA("Once the research on the participants found a list of people, you can choose here whom the lab researches in depth.")</MudJustifiedText>
}
else if (this.List.Participants.Count is 0)
{
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined" Dense="true" Class="mb-3">
<MudJustifiedText Typo="Typo.body2">@string.Format(Culture, TA("The research on the participants found no list of people. Research the topic '{0}' again, or first enter the names you know in the step '{1}'."), BflResearchTopic.PARTICIPANTS.Title, BflStep.FRAMEWORK.Title)</MudJustifiedText>
</MudAlert>
}
else
{
@if (this.IsSuggesting)
{
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2" Class="mb-2">
<MudProgressCircular Size="Size.Small" Indeterminate="true" Color="Color.Primary"/>
<MudText Typo="Typo.body2">@T("The lab suggests whom to research in depth")</MudText>
</MudStack>
}
else if (this.IsSuggestion)
{
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined" Dense="true" Icon="@AppIcons.SELECTION_SUGGESTION" Class="mb-2">
<MudJustifiedText Typo="Typo.body2">@TA("The lab suggested this selection because the list is long. Check it and change it as you like.")</MudJustifiedText>
</MudAlert>
}
else if (BflParticipantSelection.NeedsSuggestion(this.List, this.selection))
{
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined" Dense="true" Class="mb-2">
<MudJustifiedText Typo="Typo.body2">@TA("The list is long, so nobody is chosen yet. Choose the people yourself, or let the lab suggest whom to research.")</MudJustifiedText>
</MudAlert>
}
<MudJustifiedText Typo="Typo.body2" Class="mb-1">@TA("If your own name is on the list, leave it unchosen.")</MudJustifiedText>
<div class="border-dashed border rounded-lg pa-2 mb-1">
<MudChipSet T="string"
SelectionMode="SelectionMode.MultiSelection"
SelectedValues="@this.SelectedNames"
SelectedValuesChanged="@this.ChooseAsync"
CheckMark="true"
Color="Color.Primary"
Variant="Variant.Outlined"
Disabled="@this.IsSuggesting">
@foreach (var participant in this.List.Participants)
{
<MudChip @key="participant.Name" T="string" Value="@participant.Name" Text="@participant.Name"/>
}
</MudChipSet>
</div>
<MudText Typo="Typo.caption" Class="d-block mb-1">@string.Format(Culture, T("{0} of {1} people chosen."), this.Selected.Count, this.List.Participants.Count)</MudText>
<MudText Typo="Typo.caption" Class="d-block mb-3">@string.Format(Culture, T("Each person takes up to {0} research agents, one after the other. At most {1} agents work at once; the others wait."), BflPersonResearchStage.All.Count, BflResearchRunner.MAX_PERSON_AGENTS_AT_ONCE)</MudText>
<MudStack Row="true" Wrap="Wrap.Wrap" Spacing="2" Class="mb-3">
<MudButton Variant="Variant.Filled"
Color="Color.Primary"
StartIcon="@AppIcons.PERSON_RESEARCH"
OnClick="@this.StartChosenAsync"
Disabled="@(!this.CanStart || this.ToStart.Count is 0)">
@T("Research the chosen people")
</MudButton>
@if (this.List.Participants.Count > BflParticipantSelection.MAX_SUGGESTED_PEOPLE)
{
<MudButton Variant="Variant.Outlined"
Color="Color.Primary"
StartIcon="@AppIcons.SELECTION_SUGGESTION"
OnClick="@this.SuggestAsync"
Disabled="@(this.ProviderIssue is not null || this.IsSuggesting)">
@T("Suggest a selection")
</MudButton>
}
</MudStack>
@* Only one person is open at a time, so that the step stays clear: *@
<MudExpansionPanels MultiExpansion="@false" Class="mb-3">
@foreach (var participant in this.Shown)
{
var location = this.LocationOf(participant);
var found = this.dossiers.GetValueOrDefault(location.PersonId);
var isRunning = this.Runner.IsRunning(location);
<MudExpansionPanel @key="location.PersonId" Class="border-solid border rounded-lg" Expanded="@(this.expandedPerson == location.PersonId)" ExpandedChanged="@(expanded => this.SetExpanded(location.PersonId, expanded))">
<TitleContent>
<div class="d-flex align-center">
@if (isRunning)
{
<MudProgressCircular Size="Size.Small" Indeterminate="true" Color="Color.Primary" Class="mr-3"/>
}
else
{
<MudIcon Icon="@this.StatusIcon(found)" Color="@this.StatusColor(found)" Class="mr-3"/>
}
<MudText Typo="Typo.h6">@participant.Name</MudText>
<MudSpacer/>
<MudText Typo="Typo.caption" Class="mr-2">@this.StatusText(location, found)</MudText>
</div>
</TitleContent>
<ChildContent>
@if (isRunning)
{
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="mb-1"/>
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2" Class="mb-3">
<MudText Typo="Typo.caption">@this.StatusText(location, found)</MudText>
<MudButton Size="Size.Small" StartIcon="@AppIcons.STOP" OnClick="@(() => this.CancelAsync(location))">@T("Stop")</MudButton>
</MudStack>
}
@if (participant.Entry.Length > 0)
{
<MudText Typo="Typo.subtitle2">@T("Entry in the list of participants")</MudText>
<div class="mb-3">
<MudMarkdown Value="@participant.Entry" Props="Markdown.DefaultConfig" MarkdownPipeline="Markdown.SAFE_MARKDOWN_PIPELINE"/>
</div>
}
@if (found is not null)
{
@* While the agents research anew, the notes about the earlier research no longer apply: *@
@if (!isRunning && found.IsOutdated(this.PublicDetails))
{
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined" Dense="true" Class="mb-2">
<MudJustifiedText Typo="Typo.body2">@TA("The public details changed since this research. You can research this person again.")</MudJustifiedText>
</MudAlert>
}
else if (!isRunning && !found.IsComplete)
{
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined" Dense="true" Class="mb-2">
<MudJustifiedText Typo="Typo.body2">@T("This research stopped before all of its stages were done.")</MudJustifiedText>
</MudAlert>
}
@foreach (var stage in this.StagesShown(location, found))
{
<div @key="stage.Stage" class="mb-3">
<div class="d-flex align-center mb-1">
<MudText Typo="Typo.subtitle1"><strong>@stage.Stage.Title</strong></MudText>
<MudTooltip Text="@stage.Stage.Description" Placement="Placement.Top">
<MudIcon Icon="@AppIcons.INFO" Size="Size.Small" Color="Color.Info" Class="ml-2"/>
</MudTooltip>
</div>
<div class="border rounded pa-2 mb-2" style="max-height: 400px; overflow-y: auto;">
<MudMarkdown Value="@stage.Research.Text" Props="Markdown.DefaultConfig" MarkdownPipeline="Markdown.SAFE_MARKDOWN_PIPELINE"/>
</div>
<BflResearchTrace Research="@stage.Research"/>
</div>
}
}
<MudButton Size="Size.Small"
Variant="Variant.Outlined"
StartIcon="@AppIcons.PERSON_RESEARCH"
OnClick="@(() => this.StartPersonAsync(participant))"
Disabled="@(!this.CanStart || isRunning)">
@(found is null ? T("Research this person") : T("Research this person again"))
</MudButton>
</ChildContent>
</MudExpansionPanel>
}
</MudExpansionPanels>
}