mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-15 12:08:27 +00:00
Moved the chats of the BeyondFacts Lab to the embedded chat of assistants (#1203)
This commit is contained in:
1 parent
dc97db256e
commit
cb54ad297d
27 files changed
+1023
-743
No files matched your search
@@ -1,79 +1,19 @@
|
||||
@using AIStudio.Chat
|
||||
@inherits MSGComponentBase
|
||||
|
||||
@if (this.ShowHeading)
|
||||
{
|
||||
<MudText Typo="Typo.h6" Class="mt-6 mb-2">@T("Conversation")</MudText>
|
||||
}
|
||||
@if (this.conversation is null)
|
||||
{
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="mb-3"/>
|
||||
}
|
||||
else if (this.conversation.Thread is not { } thread)
|
||||
{
|
||||
<MudAlert Severity="Severity.Error" Variant="Variant.Outlined" Class="mb-3">
|
||||
@TA("AI Studio cannot open this conversation. Its file may be damaged, or a newer version of AI Studio stored it. You can start the conversation over, which deletes it.")
|
||||
</MudAlert>
|
||||
<MudButton StartIcon="@AppIcons.RESET" Color="Color.Error" OnClick="@this.ResetAsync">@T("Start over")</MudButton>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (!this.conversation.HasVisibleMessages && !this.IsRunning)
|
||||
{
|
||||
<MudText Typo="Typo.body2" Class="mb-3">@this.Introduction</MudText>
|
||||
<div class="mb-4">
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" StartIcon="@AppIcons.CHAT" OnClick="@this.StartAsync" Disabled="@(!this.CanSend)">
|
||||
@T("Start the conversation")
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var block in thread.Blocks)
|
||||
{
|
||||
@if (block is { HideFromUser: false, Content: not null })
|
||||
{
|
||||
<ContentBlockComponent Role="@block.Role" Type="@block.ContentType" Time="@block.Time" Content="@block.Content" ExportTitle="@T("Export message")" ExportFileName="@this.ExportFileName"/>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@if (this.ProviderIssue is { } issue)
|
||||
{
|
||||
<MudText Typo="Typo.body2" Color="Color.Warning" Class="mb-2">@issue</MudText>
|
||||
}
|
||||
|
||||
@* Laid out like the input of the chat page: sending through the icon in the field, and the tokens as its helper text. *@
|
||||
<MudTextField T="string"
|
||||
@bind-Value="@this.userInput"
|
||||
Immediate="true"
|
||||
Lines="3"
|
||||
Sizing="InputSizing.Auto"
|
||||
MaxLines="12"
|
||||
Variant="Variant.Outlined"
|
||||
Label="@TA("Your message")"
|
||||
Adornment="Adornment.End"
|
||||
AdornmentIcon="@AppIcons.SEND"
|
||||
AdornmentColor="@(this.CanSendMessage ? Color.Primary : Color.Default)"
|
||||
AdornmentAriaLabel="@T("Send")"
|
||||
OnAdornmentClick="@this.SendAsync"
|
||||
OnKeyUp="@this.InputKeyEventAsync"
|
||||
UserAttributes="@this.inputAttributes"
|
||||
HelperText="@this.TokenBudgetText"
|
||||
Class="@this.InputClass"
|
||||
Disabled="@(!this.conversation.IsAvailable || this.IsRunning)"/>
|
||||
|
||||
@if (this.IsRunning || this.conversation.HasVisibleMessages)
|
||||
{
|
||||
<MudStack Row="true" Spacing="1" Class="mt-2">
|
||||
@if (this.IsRunning)
|
||||
{
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@AppIcons.STOP" OnClick="@this.CancelAsync">@T("Stop")</MudButton>
|
||||
}
|
||||
@if (this.conversation.HasVisibleMessages)
|
||||
{
|
||||
<MudButton StartIcon="@AppIcons.RESET" OnClick="@this.ResetAsync" Disabled="@this.IsRunning">@T("Start over")</MudButton>
|
||||
}
|
||||
</MudStack>
|
||||
}
|
||||
}
|
||||
<EmbeddedChat Store="@this.ConversationService.StoreOf(this.Location)"
|
||||
Component="@Components.BEYOND_FACTS_LAB_ASSISTANT"
|
||||
ChatId="@this.Location.ChatId"
|
||||
CreateThread="@this.CreateThread"
|
||||
Provider="@this.Provider"
|
||||
PrepareAsync="@this.prepareAsync"
|
||||
ProviderIssue="@this.ProviderIssue"
|
||||
Heading="@(this.ShowHeading ? T("Conversation") : null)"
|
||||
StartRequest="@BflConversationService.OpeningRequestFor(this.Location)"
|
||||
Introduction="@this.Introduction"
|
||||
ExportFileName="@this.ExportFileName"
|
||||
AllowsReset="true"
|
||||
ResetQuestion="@this.ResetQuestion"
|
||||
AllowsAttachments="false"
|
||||
ShowsContextWindow="true"
|
||||
SystemPromptForCountAsync="@this.systemPromptForCountAsync"
|
||||
ContextVersion="@this.materialsVersion"/>
|
||||
Reference in new issue
Block a user