Added draft for workspaces

This commit is contained in:
Thorsten Sommer 2024-07-04 11:00:13 +02:00
parent aa1beb4340
commit 839c398209
No known key found for this signature in database
GPG Key ID: B0B7E2FC074BF1F5
4 changed files with 38 additions and 2 deletions

View File

@ -0,0 +1 @@
<MudText Typo="Typo.body1">TODO</MudText>

View File

@ -0,0 +1,7 @@
using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.Blocks;
public partial class Workspaces : ComponentBase
{
}

View File

@ -2,7 +2,15 @@
@using AIStudio.Chat
@using AIStudio.Settings
<MudText Typo="Typo.h3" Class="mb-2">Chats</MudText>
<MudStack Row="@true" AlignItems="AlignItems.Center">
<MudText Typo="Typo.h3" Class="mb-2 mr-3">
Chats
</MudText>
<MudTooltip Text="Your workspaces" Placement="Placement.Bottom">
<MudIconButton Icon="@Icons.Material.Filled.SnippetFolder" Variant="Variant.Filled" Color="Color.Default" Size="Size.Large" OnClick="() => this.ToggleWorkspaces()"/>
</MudTooltip>
</MudStack>
<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)
{
@ -25,4 +33,18 @@
<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>
</FooterContent>
</InnerScrolling>
</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>

View File

@ -27,6 +27,7 @@ public partial class Chat : ComponentBase
private ChatThread? chatThread;
private bool isStreaming;
private string userInput = string.Empty;
private bool workspacesVisible;
// Unfortunately, we need the input field reference to clear it after sending a message.
// This is necessary because we have to handle the key events ourselves. Otherwise,
@ -132,4 +133,9 @@ public partial class Chat : ComponentBase
break;
}
}
private void ToggleWorkspaces()
{
this.workspacesVisible = !this.workspacesVisible;
}
}