mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-10 17:47:21 +00:00
79 lines
3.3 KiB
Plaintext
79 lines
3.3 KiB
Plaintext
@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="@Icons.Material.Filled.RestartAlt" 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="@Icons.Material.Filled.Forum" 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="@Icons.Material.Filled.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="@Icons.Material.Filled.Stop" OnClick="@this.CancelAsync">@T("Stop")</MudButton>
|
|
}
|
|
@if (this.conversation.HasVisibleMessages)
|
|
{
|
|
<MudButton StartIcon="@Icons.Material.Filled.RestartAlt" OnClick="@this.ResetAsync" Disabled="@this.IsRunning">@T("Start over")</MudButton>
|
|
}
|
|
</MudStack>
|
|
}
|
|
} |