Improved assistant footer handling (#91)

This commit is contained in:
Thorsten Sommer 2024-08-23 13:44:27 +02:00 committed by GitHub
parent a6c5b3de23
commit 537a608e7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 57 additions and 50 deletions

View File

@ -4,7 +4,7 @@
@(this.Title) @(this.Title)
</MudText> </MudText>
<InnerScrolling HeaderHeight="12.3em"> <InnerScrolling HeaderHeight="6em">
<ChildContent> <ChildContent>
<MudForm @ref="@(this.form)" @bind-IsValid="@(this.inputIsValid)" @bind-Errors="@(this.inputIssues)" Class="pr-2"> <MudForm @ref="@(this.form)" @bind-IsValid="@(this.inputIsValid)" @bind-Errors="@(this.inputIssues)" Class="pr-2">
<MudText Typo="Typo.body1" Align="Align.Justify" Class="mb-6"> <MudText Typo="Typo.body1" Align="Align.Justify" Class="mb-6">
@ -33,10 +33,11 @@
<div id="@AFTER_RESULT_DIV_ID" class="mt-3"> <div id="@AFTER_RESULT_DIV_ID" class="mt-3">
</div> </div>
</ChildContent>
<FooterContent>
@if (this.FooterButtons.Count > 0) @if (this.FooterButtons.Count > 0)
{ {
<MudStack Row="@true" Wrap="Wrap.Wrap" Class="mt-3 mr-2"> <MudStack Row="@true" Wrap="Wrap.Wrap" Class="ma-1">
@foreach (var button in this.FooterButtons) @foreach (var button in this.FooterButtons)
{ {
switch (button) switch (button)
@ -54,14 +55,14 @@
@buttonData.Text @buttonData.Text
</MudButton> </MudButton>
break; break;
case SendToButton sendToButton: case SendToButton sendToButton:
<MudMenu StartIcon="@Icons.Material.Filled.Apps" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="Send to ..." Variant="Variant.Filled" Color="Color.Info"> <MudMenu StartIcon="@Icons.Material.Filled.Apps" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="Send to ..." Variant="Variant.Filled" Color="Color.Info">
@foreach (var assistant in Enum.GetValues<SendTo>().OrderBy(n => n.Name().Length)) @foreach (var assistant in Enum.GetValues<SendTo>().OrderBy(n => n.Name().Length))
{ {
if(assistant is SendTo.NONE || sendToButton.Self == assistant) if(assistant is SendTo.NONE || sendToButton.Self == assistant)
continue; continue;
<MudMenuItem OnClick="() => this.SendToAssistant(assistant, sendToButton)"> <MudMenuItem OnClick="() => this.SendToAssistant(assistant, sendToButton)">
@assistant.Name() @assistant.Name()
</MudMenuItem> </MudMenuItem>
@ -78,5 +79,5 @@
</MudButton> </MudButton>
</MudStack> </MudStack>
} }
</ChildContent> </FooterContent>
</InnerScrolling> </InnerScrolling>

View File

@ -8,6 +8,11 @@
&nbsp; &nbsp;
</div> </div>
</div> </div>
@this.FooterContent @if (this.FooterContent is not null)
{
<MudPaper Class="pa-3 border-solid border rounded-lg">
@this.FooterContent
</MudPaper>
}
</div> </div>

View File

@ -27,51 +27,49 @@
} }
</ChildContent> </ChildContent>
<FooterContent> <FooterContent>
<MudPaper Style="flex: 0 0 auto;"> <MudElement 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"/> <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> </MudElement>
<MudPaper Class="mt-1" Outlined="@true"> <MudToolBar WrapContent="true" Gutters="@false" Class="border border-solid rounded" Style="border-color: lightgrey;">
<MudToolBar WrapContent="true"> @if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES)
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES) {
{ <MudTooltip Text="Your workspaces" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
<MudTooltip Text="Your workspaces" Placement="@TOOLBAR_TOOLTIP_PLACEMENT"> <MudIconButton Icon="@Icons.Material.Filled.SnippetFolder" OnClick="() => this.ToggleWorkspaces()"/>
<MudIconButton Icon="@Icons.Material.Filled.SnippetFolder" OnClick="() => this.ToggleWorkspaces()"/>
</MudTooltip>
}
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY)
{
<MudTooltip Text="Save chat" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
<MudIconButton Icon="@Icons.Material.Filled.Save" OnClick="() => this.SaveThread()" Disabled="@(!this.CanThreadBeSaved)"/>
</MudTooltip>
}
<MudTooltip Text="Start temporary chat" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
<MudIconButton Icon="@Icons.Material.Filled.AddComment" OnClick="() => this.StartNewChat(useSameWorkspace: false)"/>
</MudTooltip> </MudTooltip>
}
@if (!string.IsNullOrWhiteSpace(this.currentWorkspaceName)) @if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY)
{ {
<MudTooltip Text="@this.TooltipAddChatToWorkspace" Placement="@TOOLBAR_TOOLTIP_PLACEMENT"> <MudTooltip Text="Save chat" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
<MudIconButton Icon="@Icons.Material.Filled.CommentBank" OnClick="() => this.StartNewChat(useSameWorkspace: true)"/> <MudIconButton Icon="@Icons.Material.Filled.Save" OnClick="() => this.SaveThread()" Disabled="@(!this.CanThreadBeSaved)"/>
</MudTooltip> </MudTooltip>
} }
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY)
{
<MudTooltip Text="Delete this chat & start a new one" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
<MudIconButton Icon="@Icons.Material.Filled.Refresh" OnClick="() => this.StartNewChat(useSameWorkspace: true, deletePreviousChat: true)" Disabled="@(!this.CanThreadBeSaved)"/>
</MudTooltip>
}
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES) <MudTooltip Text="Start temporary chat" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
{ <MudIconButton Icon="@Icons.Material.Filled.AddComment" OnClick="() => this.StartNewChat(useSameWorkspace: false)"/>
<MudTooltip Text="Move the chat to a workspace, or to another if it is already in one." Placement="@TOOLBAR_TOOLTIP_PLACEMENT"> </MudTooltip>
<MudIconButton Icon="@Icons.Material.Filled.MoveToInbox" Disabled="@(!this.CanThreadBeSaved)" OnClick="() => this.MoveChatToWorkspace()"/>
</MudTooltip> @if (!string.IsNullOrWhiteSpace(this.currentWorkspaceName))
} {
</MudToolBar> <MudTooltip Text="@this.TooltipAddChatToWorkspace" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
</MudPaper> <MudIconButton Icon="@Icons.Material.Filled.CommentBank" OnClick="() => this.StartNewChat(useSameWorkspace: true)"/>
</MudTooltip>
}
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY)
{
<MudTooltip Text="Delete this chat & start a new one" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
<MudIconButton Icon="@Icons.Material.Filled.Refresh" OnClick="() => this.StartNewChat(useSameWorkspace: true, deletePreviousChat: true)" Disabled="@(!this.CanThreadBeSaved)"/>
</MudTooltip>
}
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES)
{
<MudTooltip Text="Move the chat to a workspace, or to another if it is already in one." Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
<MudIconButton Icon="@Icons.Material.Filled.MoveToInbox" Disabled="@(!this.CanThreadBeSaved)" OnClick="() => this.MoveChatToWorkspace()"/>
</MudTooltip>
}
</MudToolBar>
</FooterContent> </FooterContent>
</InnerScrolling> </InnerScrolling>

View File

@ -1,6 +1,8 @@
# v0.8.12, build 174 # v0.8.12, build 174
- Added an e-mail writing assistant. - Added an e-mail writing assistant.
- Added the possibility to preselect some e-mail writing assistant options. - Added the possibility to preselect some e-mail writing assistant options.
- Fixed the header height of assistant pages.
- Improved assistant footer handling; the footer is now fixed at the bottom of the page.
- Improved the coding assistant by adding a button to delete a context. - Improved the coding assistant by adding a button to delete a context.
- Improved chat page by scrolling to the bottom after loading (configurable; default is on). - Improved chat page by scrolling to the bottom after loading (configurable; default is on).
- Improved all assistants to provide a button to copy their respective result to the clipboard. - Improved all assistants to provide a button to copy their respective result to the clipboard.
@ -8,4 +10,5 @@
- Improved the language handling of the agenda assistant. - Improved the language handling of the agenda assistant.
- Improved the chat options readability by separating the preselection of values. - Improved the chat options readability by separating the preselection of values.
- Improved some default settings. Default key for sending input is now `Enter`. The default update check is now set to hourly. The navigation menu behavior is now set to use tooltips. - Improved some default settings. Default key for sending input is now `Enter`. The default update check is now set to hourly. The navigation menu behavior is now set to use tooltips.
- Refactored the "send to" implementation of assistants. - Refactored the "send to" implementation of assistants.
- Refactored & unified footer border style handling.