diff --git a/app/MindWork AI Studio/Assistants/ERI/AssistantERI.razor.cs b/app/MindWork AI Studio/Assistants/ERI/AssistantERI.razor.cs index 32e45306..6268b137 100644 --- a/app/MindWork AI Studio/Assistants/ERI/AssistantERI.razor.cs +++ b/app/MindWork AI Studio/Assistants/ERI/AssistantERI.razor.cs @@ -473,9 +473,9 @@ public partial class AssistantERI : AssistantBaseCore if(this.selectedERIServer is null) return; - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", string.Format(T("Are you sure you want to delete the ERI server preset '{0}'?"), this.selectedERIServer.ServerName) }, + { x => x.Message, string.Format(T("Are you sure you want to delete the ERI server preset '{0}'?"), this.selectedERIServer.ServerName) }, }; var dialogReference = await this.DialogService.ShowAsync(T("Delete ERI server preset"), dialogParameters, DialogOptions.FULLSCREEN); @@ -827,9 +827,9 @@ public partial class AssistantERI : AssistantBaseCore ? string.Format(T("The embedding '{0}' is used in one or more retrieval processes. Are you sure you want to delete it?"), embeddingInfo.EmbeddingName) : string.Format(T("Are you sure you want to delete the embedding '{0}'?"), embeddingInfo.EmbeddingName); - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", message }, + { x => x.Message, message }, }; var dialogReference = await this.DialogService.ShowAsync(T("Delete Embedding"), dialogParameters, DialogOptions.FULLSCREEN); @@ -890,9 +890,9 @@ public partial class AssistantERI : AssistantBaseCore private async Task DeleteRetrievalProcess(RetrievalInfo retrievalInfo) { - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", string.Format(T("Are you sure you want to delete the retrieval process '{0}'?"), retrievalInfo.Name) }, + { x => x.Message, string.Format(T("Are you sure you want to delete the retrieval process '{0}'?"), retrievalInfo.Name) }, }; var dialogReference = await this.DialogService.ShowAsync(T("Delete Retrieval Process"), dialogParameters, DialogOptions.FULLSCREEN); diff --git a/app/MindWork AI Studio/Components/ChatComponent.razor.cs b/app/MindWork AI Studio/Components/ChatComponent.razor.cs index 6af2a5b7..96481bc5 100644 --- a/app/MindWork AI Studio/Components/ChatComponent.razor.cs +++ b/app/MindWork AI Studio/Components/ChatComponent.razor.cs @@ -587,9 +587,9 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable // if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges) { - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", "Are you sure you want to start a new chat? All unsaved changes will be lost." }, + { x => x.Message, "Are you sure you want to start a new chat? All unsaved changes will be lost." }, }; var dialogReference = await this.DialogService.ShowAsync("Delete Chat", dialogParameters, DialogOptions.FULLSCREEN); @@ -695,9 +695,9 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges) { - var confirmationDialogParameters = new DialogParameters + var confirmationDialogParameters = new DialogParameters { - { "Message", T("Are you sure you want to move this chat? All unsaved changes will be lost.") }, + { x => x.Message, T("Are you sure you want to move this chat? All unsaved changes will be lost.") }, }; var confirmationDialogReference = await this.DialogService.ShowAsync("Unsaved Changes", confirmationDialogParameters, DialogOptions.FULLSCREEN); @@ -706,11 +706,11 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable return; } - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", T("Please select the workspace where you want to move the chat to.") }, - { "SelectedWorkspace", this.ChatThread?.WorkspaceId }, - { "ConfirmText", T("Move chat") }, + { x => x.Message, T("Please select the workspace where you want to move the chat to.") }, + { x => x.SelectedWorkspace, this.ChatThread?.WorkspaceId }, + { x => x.ConfirmText, T("Move chat") }, }; var dialogReference = await this.DialogService.ShowAsync(T("Move Chat to Workspace"), dialogParameters, DialogOptions.FULLSCREEN); diff --git a/app/MindWork AI Studio/Components/Settings/SettingsPanelEmbeddings.razor.cs b/app/MindWork AI Studio/Components/Settings/SettingsPanelEmbeddings.razor.cs index 5d80211c..ec8a2316 100644 --- a/app/MindWork AI Studio/Components/Settings/SettingsPanelEmbeddings.razor.cs +++ b/app/MindWork AI Studio/Components/Settings/SettingsPanelEmbeddings.razor.cs @@ -90,9 +90,9 @@ public partial class SettingsPanelEmbeddings : SettingsPanelBase private async Task DeleteEmbeddingProvider(EmbeddingProvider provider) { - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", string.Format(T("Are you sure you want to delete the embedding provider '{0}'?"), provider.Name) }, + { x => x.Message, string.Format(T("Are you sure you want to delete the embedding provider '{0}'?"), provider.Name) }, }; var dialogReference = await this.DialogService.ShowAsync(T("Delete Embedding Provider"), dialogParameters, DialogOptions.FULLSCREEN); diff --git a/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor.cs b/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor.cs index a2e650da..1af88e3e 100644 --- a/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor.cs +++ b/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor.cs @@ -96,9 +96,9 @@ public partial class SettingsPanelProviders : SettingsPanelBase [SuppressMessage("Usage", "MWAIS0001:Direct access to `Providers` is not allowed")] private async Task DeleteLLMProvider(AIStudio.Settings.Provider provider) { - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", string.Format(T("Are you sure you want to delete the provider '{0}'?"), provider.InstanceName) }, + { x => x.Message, string.Format(T("Are you sure you want to delete the provider '{0}'?"), provider.InstanceName) }, }; var dialogReference = await this.DialogService.ShowAsync(T("Delete LLM Provider"), dialogParameters, DialogOptions.FULLSCREEN); @@ -114,9 +114,9 @@ public partial class SettingsPanelProviders : SettingsPanelBase } else { - var issueDialogParameters = new DialogParameters + var issueDialogParameters = new DialogParameters { - { "Message", string.Format(T("Couldn't delete the provider '{0}'. The issue: {1}. We can ignore this issue and delete the provider anyway. Do you want to ignore it and delete this provider?"), provider.InstanceName, deleteSecretResponse.Issue) }, + { x => x.Message, string.Format(T("Couldn't delete the provider '{0}'. The issue: {1}. We can ignore this issue and delete the provider anyway. Do you want to ignore it and delete this provider?"), provider.InstanceName, deleteSecretResponse.Issue) }, }; var issueDialogReference = await this.DialogService.ShowAsync(T("Delete LLM Provider"), issueDialogParameters, DialogOptions.FULLSCREEN); diff --git a/app/MindWork AI Studio/Components/Workspaces.razor.cs b/app/MindWork AI Studio/Components/Workspaces.razor.cs index 8970762e..7fc51877 100644 --- a/app/MindWork AI Studio/Components/Workspaces.razor.cs +++ b/app/MindWork AI Studio/Components/Workspaces.razor.cs @@ -315,9 +315,9 @@ public partial class Workspaces : MSGComponentBase // Check if the chat has unsaved changes: if (switchToChat && await MessageBus.INSTANCE.SendMessageUseFirstResult(this, Event.HAS_CHAT_UNSAVED_CHANGES)) { - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", T("Are you sure you want to load another chat? All unsaved changes will be lost.") }, + { x => x.Message, T("Are you sure you want to load another chat? All unsaved changes will be lost.") }, }; var dialogReference = await this.DialogService.ShowAsync(T("Load Chat"), dialogParameters, DialogOptions.FULLSCREEN); @@ -356,10 +356,10 @@ public partial class Workspaces : MSGComponentBase if (askForConfirmation) { var workspaceName = await WorkspaceBehaviour.LoadWorkspaceName(chat.WorkspaceId); - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { { - "Message", (chat.WorkspaceId == Guid.Empty) switch + x => x.Message, (chat.WorkspaceId == Guid.Empty) switch { true => string.Format(T("Are you sure you want to delete the temporary chat '{0}'?"), chat.Name), false => string.Format(T("Are you sure you want to delete the chat '{0}' in the workspace '{1}'?"), chat.Name, workspaceName), @@ -492,9 +492,9 @@ public partial class Workspaces : MSGComponentBase // Determine how many chats are in the workspace: var chatCount = Directory.EnumerateDirectories(workspacePath).Count(); - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", string.Format(T("Are you sure you want to delete the workspace '{0}'? This will also delete {1} chat(s) in this workspace."), workspaceName, chatCount) }, + { x => x.Message, string.Format(T("Are you sure you want to delete the workspace '{0}'? This will also delete {1} chat(s) in this workspace."), workspaceName, chatCount) }, }; var dialogReference = await this.DialogService.ShowAsync(T("Delete Workspace"), dialogParameters, DialogOptions.FULLSCREEN); @@ -512,11 +512,11 @@ public partial class Workspaces : MSGComponentBase if (chat is null) return; - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", T("Please select the workspace where you want to move the chat to.") }, - { "SelectedWorkspace", chat.WorkspaceId }, - { "ConfirmText", T("Move chat") }, + { x => x.Message, T("Please select the workspace where you want to move the chat to.") }, + { x => x.SelectedWorkspace, chat.WorkspaceId }, + { x => x.ConfirmText, T("Move chat") }, }; var dialogReference = await this.DialogService.ShowAsync(T("Move Chat to Workspace"), dialogParameters, DialogOptions.FULLSCREEN); @@ -559,9 +559,9 @@ public partial class Workspaces : MSGComponentBase // Check if the chat has unsaved changes: if (await MessageBus.INSTANCE.SendMessageUseFirstResult(this, Event.HAS_CHAT_UNSAVED_CHANGES)) { - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", T("Are you sure you want to create a another chat? All unsaved changes will be lost.") }, + { x => x.Message, T("Are you sure you want to create a another chat? All unsaved changes will be lost.") }, }; var dialogReference = await this.DialogService.ShowAsync(T("Create Chat"), dialogParameters, DialogOptions.FULLSCREEN); diff --git a/app/MindWork AI Studio/Dialogs/PandocDialog.razor.cs b/app/MindWork AI Studio/Dialogs/PandocDialog.razor.cs index ae048016..98716f14 100644 --- a/app/MindWork AI Studio/Dialogs/PandocDialog.razor.cs +++ b/app/MindWork AI Studio/Dialogs/PandocDialog.razor.cs @@ -83,9 +83,9 @@ public partial class PandocDialog : MSGComponentBase private async Task RejectLicense() { var message = T("Pandoc is open-source and free, but if you reject its license, you can't install it and some MindWork AI Studio features will be limited (like the integration of Office files) or unavailable (like the generation of Office files). You can change your decision anytime. Are you sure you want to reject the license?"); - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", message }, + { x => x.Message, message }, }; var dialogReference = await this.DialogService.ShowAsync(T("Reject Pandoc's Licence"), dialogParameters, DialogOptions.FULLSCREEN); diff --git a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogAssistantBias.razor.cs b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogAssistantBias.razor.cs index 27686673..aeabdea6 100644 --- a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogAssistantBias.razor.cs +++ b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogAssistantBias.razor.cs @@ -8,9 +8,9 @@ public partial class SettingsDialogAssistantBias : SettingsDialogBase private async Task ResetBiasOfTheDayHistory() { - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", T("Are you sure you want to reset your bias-of-the-day statistics? The system will no longer remember which biases you already know. As a result, biases you are already familiar with may be addressed again.") }, + { x => x.Message, T("Are you sure you want to reset your bias-of-the-day statistics? The system will no longer remember which biases you already know. As a result, biases you are already familiar with may be addressed again.") }, }; var dialogReference = await this.DialogService.ShowAsync(T("Reset your bias-of-the-day statistics"), dialogParameters, DialogOptions.FULLSCREEN); diff --git a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogChatTemplate.razor.cs b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogChatTemplate.razor.cs index 73ed5fa5..93084866 100644 --- a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogChatTemplate.razor.cs +++ b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogChatTemplate.razor.cs @@ -82,9 +82,9 @@ public partial class SettingsDialogChatTemplate : SettingsDialogBase private async Task DeleteChatTemplate(ChatTemplate chatTemplate) { - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", string.Format(T("Are you sure you want to delete the chat template '{0}'?"), chatTemplate.Name) }, + { x => x.Message, string.Format(T("Are you sure you want to delete the chat template '{0}'?"), chatTemplate.Name) }, }; var dialogReference = await this.DialogService.ShowAsync(T("Delete Chat Template"), dialogParameters, DialogOptions.FULLSCREEN); diff --git a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogDataSources.razor.cs b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogDataSources.razor.cs index 2c2eff67..1170de67 100644 --- a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogDataSources.razor.cs +++ b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogDataSources.razor.cs @@ -151,9 +151,9 @@ public partial class SettingsDialogDataSources : SettingsDialogBase private async Task DeleteDataSource(IDataSource dataSource) { - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", string.Format(T("Are you sure you want to delete the data source '{0}' of type {1}?"), dataSource.Name, dataSource.Type.GetDisplayName()) }, + { x => x.Message, string.Format(T("Are you sure you want to delete the data source '{0}' of type {1}?"), dataSource.Name, dataSource.Type.GetDisplayName()) }, }; var dialogReference = await this.DialogService.ShowAsync(T("Delete Data Source"), dialogParameters, DialogOptions.FULLSCREEN); diff --git a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogProfiles.razor.cs b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogProfiles.razor.cs index acb5e5a6..6547257c 100644 --- a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogProfiles.razor.cs +++ b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogProfiles.razor.cs @@ -51,9 +51,9 @@ public partial class SettingsDialogProfiles : SettingsDialogBase private async Task DeleteProfile(Profile profile) { - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", string.Format(T("Are you sure you want to delete the profile '{0}'?"), profile.Name) }, + { x => x.Message, string.Format(T("Are you sure you want to delete the profile '{0}'?"), profile.Name) }, }; var dialogReference = await this.DialogService.ShowAsync(T("Delete Profile"), dialogParameters, DialogOptions.FULLSCREEN); diff --git a/app/MindWork AI Studio/Layout/MainLayout.razor.cs b/app/MindWork AI Studio/Layout/MainLayout.razor.cs index 079b4161..840e8608 100644 --- a/app/MindWork AI Studio/Layout/MainLayout.razor.cs +++ b/app/MindWork AI Studio/Layout/MainLayout.razor.cs @@ -306,9 +306,9 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, ILan { if (await MessageBus.INSTANCE.SendMessageUseFirstResult(this, Event.HAS_CHAT_UNSAVED_CHANGES)) { - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { - { "Message", T("Are you sure you want to leave the chat page? All unsaved changes will be lost.") }, + { x => x.Message, T("Are you sure you want to leave the chat page? All unsaved changes will be lost.") }, }; var dialogReference = await this.DialogService.ShowAsync(T("Leave Chat Page"), dialogParameters, DialogOptions.FULLSCREEN); diff --git a/app/MindWork AI Studio/Tools/WorkspaceBehaviour.cs b/app/MindWork AI Studio/Tools/WorkspaceBehaviour.cs index 66d665ca..1eab21bc 100644 --- a/app/MindWork AI Studio/Tools/WorkspaceBehaviour.cs +++ b/app/MindWork AI Studio/Tools/WorkspaceBehaviour.cs @@ -121,10 +121,10 @@ public static class WorkspaceBehaviour if (askForConfirmation) { var workspaceName = await LoadWorkspaceName(chat.WorkspaceId); - var dialogParameters = new DialogParameters + var dialogParameters = new DialogParameters { { - "Message", (chat.WorkspaceId == Guid.Empty) switch + x => x.Message, (chat.WorkspaceId == Guid.Empty) switch { true => TB($"Are you sure you want to delete the temporary chat '{chat.Name}'?"), false => TB($"Are you sure you want to delete the chat '{chat.Name}' in the workspace '{workspaceName}'?"), diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.9.51.md b/app/MindWork AI Studio/wwwroot/changelog/v0.9.51.md index eb80ba14..2cc6172f 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v0.9.51.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.9.51.md @@ -5,6 +5,7 @@ - Improved memory usage in several areas of the app. - Improved plugin management for configuration plugins so that hot reload detects when a provider or chat template has been removed. - Improved the dialog for naming chats and workspaces to ensure valid inputs are entered. +- Improved the dialog invocation by making parameter provision more robust. - Changed the configuration plugin setting name for how often to check for updates from `UpdateBehavior` to `UpdateInterval`. - Fixed a bug in various assistants where some text fields were not reset when resetting. - Fixed the input field header in the dialog for naming chats and workspaces.