AI-Studio/app/MindWork AI Studio/Components/Pages/Chat.razor

52 lines
2.6 KiB
Plaintext
Raw Normal View History

@page "/chat"
@using AIStudio.Chat
2024-05-04 09:11:09 +00:00
@using AIStudio.Settings
2024-07-10 11:20:15 +00:00
<MudText Typo="Typo.h3" Class="mb-2 mr-3">
Chats
</MudText>
2024-07-04 09:00:13 +00:00
2024-05-04 09:11:09 +00:00
<MudSelect T="Provider" @bind-Value="@this.selectedProvider" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Apps" Margin="Margin.Dense" Label="Provider" Class="mb-2 rounded-lg" Variant="Variant.Outlined">
@foreach (var provider in this.SettingsManager.ConfigurationData.Providers)
{
<MudSelectItem Value="@provider"/>
}
</MudSelect>
<InnerScrolling HeaderHeight="12.3em">
<ChildContent>
2024-05-04 09:11:09 +00:00
@if (this.chatThread is not null)
{
foreach (var block in this.chatThread.Blocks.OrderBy(n => n.Time))
{
<ContentBlockComponent Role="@block.Role" Type="@block.ContentType" Time="@block.Time" Content="@block.Content"/>
}
}
</ChildContent>
<FooterContent>
<MudPaper Style="flex: 0 0 auto;">
<MudTextField T="string" @ref="@this.inputField" @bind-Text="@this.userInput" Variant="Variant.Outlined" AutoGrow="@true" Lines="3" MaxLines="12" Label="@this.InputLabel" Placeholder="@this.ProviderPlaceholder" Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.Send" OnAdornmentClick="() => this.SendMessage()" ReadOnly="!this.IsProviderSelected || this.isStreaming" Immediate="@true" OnKeyUp="this.InputKeyEvent" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
</MudPaper>
2024-07-10 11:20:15 +00:00
<MudPaper Class="mt-1" Outlined="@true">
<MudToolBar WrapContent="true">
<MudTooltip Text="Your workspaces" Placement="Placement.Bottom">
<MudIconButton Icon="@Icons.Material.Filled.SnippetFolder" OnClick="() => this.ToggleWorkspaces()" Disabled="@(this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is WorkspaceStorageBehavior.DISABLE_WORKSPACES)"/>
</MudTooltip>
</MudToolBar>
</MudPaper>
</FooterContent>
2024-07-04 09:00:13 +00:00
</InnerScrolling>
<MudDrawer @bind-Open="@this.workspacesVisible" Width="40em" Height="100%" Anchor="Anchor.Start" Variant="DrawerVariant.Temporary" Elevation="1">
<MudDrawerHeader>
<MudStack Row="@true" AlignItems="AlignItems.Center">
<MudText Typo="Typo.h6" Class="mr-3">
Your workspaces
</MudText>
<MudIconButton Icon="@Icons.Material.Filled.Close" Variant="Variant.Filled" Color="Color.Default" Size="Size.Small" OnClick="() => this.ToggleWorkspaces()"/>
</MudStack>
</MudDrawerHeader>
<MudDrawerContainer Class="ml-6">
<Workspaces/>
</MudDrawerContainer>
</MudDrawer>