Skip to content

Commit f1c2a65

Browse files
Made dialog parameter usage explicit with generic types (#543)
1 parent e03289b commit f1c2a65

13 files changed

+47
-46
lines changed

app/MindWork AI Studio/Assistants/ERI/AssistantERI.razor.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,9 @@ private async Task RemoveERIServer()
473473
if(this.selectedERIServer is null)
474474
return;
475475

476-
var dialogParameters = new DialogParameters
476+
var dialogParameters = new DialogParameters<ConfirmDialog>
477477
{
478-
{ "Message", string.Format(T("Are you sure you want to delete the ERI server preset '{0}'?"), this.selectedERIServer.ServerName) },
478+
{ x => x.Message, string.Format(T("Are you sure you want to delete the ERI server preset '{0}'?"), this.selectedERIServer.ServerName) },
479479
};
480480

481481
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete ERI server preset"), dialogParameters, DialogOptions.FULLSCREEN);
@@ -827,9 +827,9 @@ private async Task DeleteEmbedding(EmbeddingInfo embeddingInfo)
827827
? string.Format(T("The embedding '{0}' is used in one or more retrieval processes. Are you sure you want to delete it?"), embeddingInfo.EmbeddingName)
828828
: string.Format(T("Are you sure you want to delete the embedding '{0}'?"), embeddingInfo.EmbeddingName);
829829

830-
var dialogParameters = new DialogParameters
830+
var dialogParameters = new DialogParameters<ConfirmDialog>
831831
{
832-
{ "Message", message },
832+
{ x => x.Message, message },
833833
};
834834

835835
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete Embedding"), dialogParameters, DialogOptions.FULLSCREEN);
@@ -890,9 +890,9 @@ private async Task EditRetrievalProcess(RetrievalInfo retrievalInfo)
890890

891891
private async Task DeleteRetrievalProcess(RetrievalInfo retrievalInfo)
892892
{
893-
var dialogParameters = new DialogParameters
893+
var dialogParameters = new DialogParameters<ConfirmDialog>
894894
{
895-
{ "Message", string.Format(T("Are you sure you want to delete the retrieval process '{0}'?"), retrievalInfo.Name) },
895+
{ x => x.Message, string.Format(T("Are you sure you want to delete the retrieval process '{0}'?"), retrievalInfo.Name) },
896896
};
897897

898898
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete Retrieval Process"), dialogParameters, DialogOptions.FULLSCREEN);

app/MindWork AI Studio/Components/ChatComponent.razor.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,9 @@ private async Task StartNewChat(bool useSameWorkspace = false, bool deletePrevio
587587
//
588588
if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges)
589589
{
590-
var dialogParameters = new DialogParameters
590+
var dialogParameters = new DialogParameters<ConfirmDialog>
591591
{
592-
{ "Message", "Are you sure you want to start a new chat? All unsaved changes will be lost." },
592+
{ x => x.Message, "Are you sure you want to start a new chat? All unsaved changes will be lost." },
593593
};
594594

595595
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Chat", dialogParameters, DialogOptions.FULLSCREEN);
@@ -695,9 +695,9 @@ private async Task MoveChatToWorkspace()
695695

696696
if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges)
697697
{
698-
var confirmationDialogParameters = new DialogParameters
698+
var confirmationDialogParameters = new DialogParameters<ConfirmDialog>
699699
{
700-
{ "Message", T("Are you sure you want to move this chat? All unsaved changes will be lost.") },
700+
{ x => x.Message, T("Are you sure you want to move this chat? All unsaved changes will be lost.") },
701701
};
702702

703703
var confirmationDialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Unsaved Changes", confirmationDialogParameters, DialogOptions.FULLSCREEN);
@@ -706,11 +706,11 @@ private async Task MoveChatToWorkspace()
706706
return;
707707
}
708708

709-
var dialogParameters = new DialogParameters
709+
var dialogParameters = new DialogParameters<WorkspaceSelectionDialog>
710710
{
711-
{ "Message", T("Please select the workspace where you want to move the chat to.") },
712-
{ "SelectedWorkspace", this.ChatThread?.WorkspaceId },
713-
{ "ConfirmText", T("Move chat") },
711+
{ x => x.Message, T("Please select the workspace where you want to move the chat to.") },
712+
{ x => x.SelectedWorkspace, this.ChatThread?.WorkspaceId },
713+
{ x => x.ConfirmText, T("Move chat") },
714714
};
715715

716716
var dialogReference = await this.DialogService.ShowAsync<WorkspaceSelectionDialog>(T("Move Chat to Workspace"), dialogParameters, DialogOptions.FULLSCREEN);

app/MindWork AI Studio/Components/Settings/SettingsPanelEmbeddings.razor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ private async Task EditEmbeddingProvider(EmbeddingProvider embeddingProvider)
9090

9191
private async Task DeleteEmbeddingProvider(EmbeddingProvider provider)
9292
{
93-
var dialogParameters = new DialogParameters
93+
var dialogParameters = new DialogParameters<ConfirmDialog>
9494
{
95-
{ "Message", string.Format(T("Are you sure you want to delete the embedding provider '{0}'?"), provider.Name) },
95+
{ x => x.Message, string.Format(T("Are you sure you want to delete the embedding provider '{0}'?"), provider.Name) },
9696
};
9797

9898
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete Embedding Provider"), dialogParameters, DialogOptions.FULLSCREEN);

app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ private async Task EditLLMProvider(AIStudio.Settings.Provider provider)
9696
[SuppressMessage("Usage", "MWAIS0001:Direct access to `Providers` is not allowed")]
9797
private async Task DeleteLLMProvider(AIStudio.Settings.Provider provider)
9898
{
99-
var dialogParameters = new DialogParameters
99+
var dialogParameters = new DialogParameters<ConfirmDialog>
100100
{
101-
{ "Message", string.Format(T("Are you sure you want to delete the provider '{0}'?"), provider.InstanceName) },
101+
{ x => x.Message, string.Format(T("Are you sure you want to delete the provider '{0}'?"), provider.InstanceName) },
102102
};
103103

104104
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete LLM Provider"), dialogParameters, DialogOptions.FULLSCREEN);
@@ -114,9 +114,9 @@ private async Task DeleteLLMProvider(AIStudio.Settings.Provider provider)
114114
}
115115
else
116116
{
117-
var issueDialogParameters = new DialogParameters
117+
var issueDialogParameters = new DialogParameters<ConfirmDialog>
118118
{
119-
{ "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) },
119+
{ 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) },
120120
};
121121

122122
var issueDialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete LLM Provider"), issueDialogParameters, DialogOptions.FULLSCREEN);

app/MindWork AI Studio/Components/Workspaces.razor.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ public async Task StoreChat(ChatThread chat, bool reloadTreeItems = true)
315315
// Check if the chat has unsaved changes:
316316
if (switchToChat && await MessageBus.INSTANCE.SendMessageUseFirstResult<bool, bool>(this, Event.HAS_CHAT_UNSAVED_CHANGES))
317317
{
318-
var dialogParameters = new DialogParameters
318+
var dialogParameters = new DialogParameters<ConfirmDialog>
319319
{
320-
{ "Message", T("Are you sure you want to load another chat? All unsaved changes will be lost.") },
320+
{ x => x.Message, T("Are you sure you want to load another chat? All unsaved changes will be lost.") },
321321
};
322322

323323
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Load Chat"), dialogParameters, DialogOptions.FULLSCREEN);
@@ -356,10 +356,10 @@ public async Task DeleteChat(string? chatPath, bool askForConfirmation = true, b
356356
if (askForConfirmation)
357357
{
358358
var workspaceName = await WorkspaceBehaviour.LoadWorkspaceName(chat.WorkspaceId);
359-
var dialogParameters = new DialogParameters
359+
var dialogParameters = new DialogParameters<ConfirmDialog>
360360
{
361361
{
362-
"Message", (chat.WorkspaceId == Guid.Empty) switch
362+
x => x.Message, (chat.WorkspaceId == Guid.Empty) switch
363363
{
364364
true => string.Format(T("Are you sure you want to delete the temporary chat '{0}'?"), chat.Name),
365365
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 @@ private async Task DeleteWorkspace(string? workspacePath)
492492
// Determine how many chats are in the workspace:
493493
var chatCount = Directory.EnumerateDirectories(workspacePath).Count();
494494

495-
var dialogParameters = new DialogParameters
495+
var dialogParameters = new DialogParameters<ConfirmDialog>
496496
{
497-
{ "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) },
497+
{ 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) },
498498
};
499499

500500
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete Workspace"), dialogParameters, DialogOptions.FULLSCREEN);
@@ -512,11 +512,11 @@ private async Task MoveChat(string? chatPath)
512512
if (chat is null)
513513
return;
514514

515-
var dialogParameters = new DialogParameters
515+
var dialogParameters = new DialogParameters<WorkspaceSelectionDialog>
516516
{
517-
{ "Message", T("Please select the workspace where you want to move the chat to.") },
518-
{ "SelectedWorkspace", chat.WorkspaceId },
519-
{ "ConfirmText", T("Move chat") },
517+
{ x => x.Message, T("Please select the workspace where you want to move the chat to.") },
518+
{ x => x.SelectedWorkspace, chat.WorkspaceId },
519+
{ x => x.ConfirmText, T("Move chat") },
520520
};
521521

522522
var dialogReference = await this.DialogService.ShowAsync<WorkspaceSelectionDialog>(T("Move Chat to Workspace"), dialogParameters, DialogOptions.FULLSCREEN);
@@ -559,9 +559,9 @@ private async Task AddChat(string workspacePath)
559559
// Check if the chat has unsaved changes:
560560
if (await MessageBus.INSTANCE.SendMessageUseFirstResult<bool, bool>(this, Event.HAS_CHAT_UNSAVED_CHANGES))
561561
{
562-
var dialogParameters = new DialogParameters
562+
var dialogParameters = new DialogParameters<ConfirmDialog>
563563
{
564-
{ "Message", T("Are you sure you want to create a another chat? All unsaved changes will be lost.") },
564+
{ x => x.Message, T("Are you sure you want to create a another chat? All unsaved changes will be lost.") },
565565
};
566566

567567
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Create Chat"), dialogParameters, DialogOptions.FULLSCREEN);

app/MindWork AI Studio/Dialogs/PandocDialog.razor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ private async Task InstallPandocAsync()
8383
private async Task RejectLicense()
8484
{
8585
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?");
86-
var dialogParameters = new DialogParameters
86+
var dialogParameters = new DialogParameters<ConfirmDialog>
8787
{
88-
{ "Message", message },
88+
{ x => x.Message, message },
8989
};
9090

9191
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Reject Pandoc's Licence"), dialogParameters, DialogOptions.FULLSCREEN);

app/MindWork AI Studio/Dialogs/Settings/SettingsDialogAssistantBias.razor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ public partial class SettingsDialogAssistantBias : SettingsDialogBase
88

99
private async Task ResetBiasOfTheDayHistory()
1010
{
11-
var dialogParameters = new DialogParameters
11+
var dialogParameters = new DialogParameters<ConfirmDialog>
1212
{
13-
{ "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.") },
13+
{ 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.") },
1414
};
1515

1616
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Reset your bias-of-the-day statistics"), dialogParameters, DialogOptions.FULLSCREEN);

app/MindWork AI Studio/Dialogs/Settings/SettingsDialogChatTemplate.razor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ private async Task EditChatTemplate(ChatTemplate chatTemplate)
8282

8383
private async Task DeleteChatTemplate(ChatTemplate chatTemplate)
8484
{
85-
var dialogParameters = new DialogParameters
85+
var dialogParameters = new DialogParameters<ConfirmDialog>
8686
{
87-
{ "Message", string.Format(T("Are you sure you want to delete the chat template '{0}'?"), chatTemplate.Name) },
87+
{ x => x.Message, string.Format(T("Are you sure you want to delete the chat template '{0}'?"), chatTemplate.Name) },
8888
};
8989

9090
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete Chat Template"), dialogParameters, DialogOptions.FULLSCREEN);

app/MindWork AI Studio/Dialogs/Settings/SettingsDialogDataSources.razor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ private async Task EditDataSource(IDataSource dataSource)
151151

152152
private async Task DeleteDataSource(IDataSource dataSource)
153153
{
154-
var dialogParameters = new DialogParameters
154+
var dialogParameters = new DialogParameters<ConfirmDialog>
155155
{
156-
{ "Message", string.Format(T("Are you sure you want to delete the data source '{0}' of type {1}?"), dataSource.Name, dataSource.Type.GetDisplayName()) },
156+
{ 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()) },
157157
};
158158

159159
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete Data Source"), dialogParameters, DialogOptions.FULLSCREEN);

app/MindWork AI Studio/Dialogs/Settings/SettingsDialogProfiles.razor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ private async Task EditProfile(Profile profile)
5151

5252
private async Task DeleteProfile(Profile profile)
5353
{
54-
var dialogParameters = new DialogParameters
54+
var dialogParameters = new DialogParameters<ConfirmDialog>
5555
{
56-
{ "Message", string.Format(T("Are you sure you want to delete the profile '{0}'?"), profile.Name) },
56+
{ x => x.Message, string.Format(T("Are you sure you want to delete the profile '{0}'?"), profile.Name) },
5757
};
5858

5959
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete Profile"), dialogParameters, DialogOptions.FULLSCREEN);

0 commit comments

Comments
 (0)