mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-06-27 16:36:27 +00:00
# Conflicts: # app/MindWork AI Studio/Assistants/AssistantBase.razor.cs # app/MindWork AI Studio/Assistants/I18N/allTexts.lua # app/MindWork AI Studio/Components/ChatComponent.razor.cs # app/MindWork AI Studio/Plugins/configuration/plugin.lua # app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua # app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua # app/MindWork AI Studio/Provider/AlibabaCloud/ProviderAlibabaCloud.cs # app/MindWork AI Studio/Provider/BaseProvider.cs # app/MindWork AI Studio/Provider/DeepSeek/ProviderDeepSeek.cs # app/MindWork AI Studio/Provider/Fireworks/ProviderFireworks.cs # app/MindWork AI Studio/Provider/GWDG/ProviderGWDG.cs # app/MindWork AI Studio/Provider/Google/ProviderGoogle.cs # app/MindWork AI Studio/Provider/Groq/ProviderGroq.cs # app/MindWork AI Studio/Provider/Helmholtz/ProviderHelmholtz.cs # app/MindWork AI Studio/Provider/HuggingFace/ProviderHuggingFace.cs # app/MindWork AI Studio/Provider/Mistral/ProviderMistral.cs # app/MindWork AI Studio/Provider/OpenAI/ProviderOpenAI.cs # app/MindWork AI Studio/Provider/OpenAI/ResponsesAPIRequest.cs # app/MindWork AI Studio/Provider/OpenRouter/ProviderOpenRouter.cs # app/MindWork AI Studio/Provider/Perplexity/ProviderPerplexity.cs # app/MindWork AI Studio/Provider/SelfHosted/ProviderSelfHosted.cs # app/MindWork AI Studio/Provider/X/ProviderX.cs # app/MindWork AI Studio/Settings/DataModel/Data.cs # app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs # app/MindWork AI Studio/Tools/PluginSystem/PluginFactory.Loading.cs # app/MindWork AI Studio/wwwroot/changelog/v26.4.1.md
158 lines
9.3 KiB
Plaintext
158 lines
9.3 KiB
Plaintext
@using AIStudio.Settings.DataModel
|
|
@using AIStudio.Chat
|
|
|
|
@inherits MSGComponentBase
|
|
|
|
<InnerScrolling FillEntireHorizontalSpace="@true" @ref="@this.scrollingArea" MinWidth="36em" Style="height: 100%">
|
|
<ChildContent>
|
|
@if (this.ChatThread is not null)
|
|
{
|
|
var blocks = this.ChatThread.Blocks.OrderBy(n => n.Time).ToList();
|
|
for (var i = 0; i < blocks.Count; i++)
|
|
{
|
|
var block = blocks[i];
|
|
var isLastBlock = i == blocks.Count - 1;
|
|
var isSecondLastBlock = i == blocks.Count - 2;
|
|
@if (block is { HideFromUser: false, Content: not null })
|
|
{
|
|
<ContentBlockComponent
|
|
@key="@block"
|
|
Role="@block.Role"
|
|
Type="@block.ContentType"
|
|
Time="@block.Time"
|
|
Content="@block.Content"
|
|
RemoveBlockFunc="@this.RemoveBlock"
|
|
IsLastContentBlock="@isLastBlock"
|
|
IsSecondToLastBlock="@isSecondLastBlock"
|
|
RegenerateFunc="@this.RegenerateBlock"
|
|
RegenerateEnabled="@(() => this.IsProviderSelected && this.ChatThread.IsLLMProviderAllowed(this.Provider))"
|
|
EditLastBlockFunc="@this.EditLastBlock"
|
|
EditLastUserBlockFunc="@this.EditLastUserBlock"/>
|
|
}
|
|
}
|
|
}
|
|
</ChildContent>
|
|
<FooterContent>
|
|
<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()"
|
|
Disabled="@this.IsInputForbidden()"
|
|
Immediate="@true"
|
|
OnKeyUp="@this.InputKeyEvent"
|
|
UserAttributes="@USER_INPUT_ATTRIBUTES"
|
|
Class="@this.UserInputClass"
|
|
Style="@this.UserInputStyle"/>
|
|
</MudElement>
|
|
<MudToolBar WrapContent="true" Gutters="@false" Class="border border-solid rounded" Style="border-color: lightgrey; gap: 2px;">
|
|
|
|
@if (
|
|
this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES
|
|
&& this.SettingsManager.ConfigurationData.Workspace.DisplayBehavior is WorkspaceDisplayBehavior.TOGGLE_OVERLAY)
|
|
{
|
|
<MudTooltip Text="@T("Show your workspaces")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
|
|
<MudIconButton Icon="@Icons.Material.Filled.SnippetFolder" OnClick="@(() => this.ToggleWorkspaceOverlay())"/>
|
|
</MudTooltip>
|
|
}
|
|
|
|
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY)
|
|
{
|
|
<MudTooltip Text="@T("Save chat")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
|
|
<MudIconButton Icon="@Icons.Material.Filled.Save" OnClick="@(() => this.SaveThread())" Disabled="@(!this.CanThreadBeSaved || this.IsCurrentChatStreaming)"/>
|
|
</MudTooltip>
|
|
}
|
|
|
|
<MudTooltip Text="@T("Start temporary chat")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
|
|
<MudIconButton Icon="@Icons.Material.Filled.AddComment" OnClick="@(() => this.StartNewChat(useSameWorkspace: false))"/>
|
|
</MudTooltip>
|
|
|
|
@if (!string.IsNullOrWhiteSpace(this.currentWorkspaceName))
|
|
{
|
|
<MudTooltip Text="@this.TooltipAddChatToWorkspace" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
|
|
<MudIconButton Icon="@Icons.Material.Filled.CommentBank" OnClick="@(() => this.StartNewChat(useSameWorkspace: true))"/>
|
|
</MudTooltip>
|
|
}
|
|
|
|
<ChatTemplateSelection MarginLeft="" CanChatThreadBeUsedForTemplate="@this.CanThreadBeSaved" CurrentChatThread="@this.ChatThread" CurrentChatTemplate="@this.currentChatTemplate" CurrentChatTemplateChanged="@this.ChatTemplateWasChanged"/>
|
|
|
|
|
|
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY)
|
|
{
|
|
<MudTooltip Text="@T("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 || this.IsCurrentChatStreaming)"/>
|
|
</MudTooltip>
|
|
}
|
|
|
|
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES)
|
|
{
|
|
<MudTooltip Text="@T("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 || this.IsCurrentChatStreaming)" OnClick="@this.MoveChatToWorkspace"/>
|
|
</MudTooltip>
|
|
}
|
|
|
|
<AttachDocuments Name="File Attachments" Layer="@DropLayers.PAGES" DocumentPaths="@this.ComposerState.FileAttachments" DocumentPathsChanged="@this.ComposerAttachmentsChanged" CatchAllDocuments="true" UseSmallForm="true" Provider="@this.Provider"/>
|
|
|
|
<MudDivider Vertical="true" Style="height: 24px; align-self: center;"/>
|
|
|
|
<MudTooltip Text="@T("Bold")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
|
|
<MudIconButton Icon="@Icons.Material.Filled.FormatBold" OnClick="@(() => this.ApplyMarkdownFormat(MARKDOWN_BOLD))" Disabled="@this.IsInputForbidden()"/>
|
|
</MudTooltip>
|
|
<MudTooltip Text="@T("Italic")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
|
|
<MudIconButton Icon="@Icons.Material.Filled.FormatItalic" OnClick="@(() => this.ApplyMarkdownFormat(MARKDOWN_ITALIC))" Disabled="@this.IsInputForbidden()"/>
|
|
</MudTooltip>
|
|
<MudTooltip Text="@T("Heading")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
|
|
<MudIconButton Icon="@Icons.Material.Filled.TextFields" OnClick="@(() => this.ApplyMarkdownFormat(MARKDOWN_HEADING))" Disabled="@this.IsInputForbidden()"/>
|
|
</MudTooltip>
|
|
<MudTooltip Text="@T("Bulleted List")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
|
|
<MudIconButton Icon="@Icons.Material.Filled.FormatListBulleted" OnClick="@(() => this.ApplyMarkdownFormat(MARKDOWN_BULLET_LIST))" Disabled="@this.IsInputForbidden()"/>
|
|
</MudTooltip>
|
|
<MudTooltip Text="@T("Code")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
|
|
<MudIconButton Icon="@Icons.Material.Filled.Code" OnClick="@(() => this.ApplyMarkdownFormat(MARKDOWN_CODE))" Disabled="@this.IsInputForbidden()"/>
|
|
</MudTooltip>
|
|
|
|
<MudDivider Vertical="true" Style="height: 24px; align-self: center;"/>
|
|
|
|
<ProfileSelection MarginLeft="" CurrentProfile="@this.currentProfile" CurrentProfileChanged="@this.ProfileWasChanged" Disabled="@(!this.currentChatTemplate.AllowProfileUsage)" DisabledText="@T("Profile usage is disabled according to your chat template settings.")"/>
|
|
|
|
<ToolSelection Component="Components.CHAT" LLMProvider="@this.Provider" SelectedToolIds="@this.selectedToolIds" SelectedToolIdsChanged="@this.SelectedToolIdsChanged" Disabled="@this.isStreaming" />
|
|
|
|
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
|
|
{
|
|
<DataSourceSelection @ref="@this.dataSourceSelectionComponent" PopoverTriggerMode="PopoverTriggerMode.BUTTON" LLMProvider="@this.Provider" DataSourceOptions="@this.GetCurrentDataSourceOptions()" DataSourceOptionsChanged="@(async options => await this.SetCurrentDataSourceOptions(options))" DataSourcesAISelected="@this.GetAgentSelectedDataSources()"/>
|
|
}
|
|
|
|
@if (this.SettingsManager.ConfigurationData.LLMProviders.ShowProviderConfidence)
|
|
{
|
|
<ConfidenceInfo Mode="PopoverTriggerMode.ICON" LLMProvider="@this.Provider.UsedLLMProvider"/>
|
|
}
|
|
|
|
@if (this.IsCurrentChatStreaming)
|
|
{
|
|
<MudTooltip Text="@T("Stop generation")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
|
|
<MudIconButton Icon="@Icons.Material.Filled.Stop" Color="Color.Error" OnClick="@this.CancelStreaming"/>
|
|
</MudTooltip>
|
|
}
|
|
|
|
@if (!this.ChatThread.IsLLMProviderAllowed(this.Provider))
|
|
{
|
|
<MudTooltip Text="@T("The selected provider is not allowed in this chat due to data security reasons.")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
|
|
<MudIconButton Icon="@Icons.Material.Filled.Error" Color="Color.Error"/>
|
|
</MudTooltip>
|
|
}
|
|
|
|
<MudSpacer />
|
|
<HalluzinationReminder ContainerClass="my-0 ml-2 me-2"/>
|
|
</MudToolBar>
|
|
</FooterContent>
|
|
</InnerScrolling>
|