From 3548b1d44dcfc873a0abb9eb7934d939b599c574 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Mon, 14 Sep 2026 09:17:22 +0200 Subject: [PATCH] Open a disappearing chat when a launcher names no workspace --- .../Tools/Services/DirectChatService.cs | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/app/MindWork AI Studio/Tools/Services/DirectChatService.cs b/app/MindWork AI Studio/Tools/Services/DirectChatService.cs index c677e56f..b89f3cea 100644 --- a/app/MindWork AI Studio/Tools/Services/DirectChatService.cs +++ b/app/MindWork AI Studio/Tools/Services/DirectChatService.cs @@ -50,21 +50,29 @@ public sealed class DirectChatService(SettingsManager settingsManager, DataSourc if (dataSourceOptions is null) return new(null, dataSourceOptionsResult.ErrorMessage); - Guid workspaceId; - try + // + // A launcher that names no workspace wants the same chat the chat page starts on its own: + // one that belongs nowhere, is kept among the temporary chats, and disappears with them. The + // empty workspace ID is what says so, here as everywhere else in the app. + // + var workspaceId = Guid.Empty; + if (!launchConfiguration.OpensTemporaryChat) { - workspaceId = await WorkspaceBehaviour.ResolveOrCreateWorkspaceIdByNameAsync(launchConfiguration.WorkspaceName); - } - catch (Exception exception) - { - logger.LogError(exception, "Assistant plugin '{PluginName}' could not resolve or create workspace '{WorkspaceName}'.", assistantPlugin.Name, launchConfiguration.WorkspaceName); - return new(null, string.Format(TB("The workspace '{0}' could not be opened or created."), launchConfiguration.WorkspaceName)); - } + try + { + workspaceId = await WorkspaceBehaviour.ResolveOrCreateWorkspaceIdByNameAsync(launchConfiguration.WorkspaceName); + } + catch (Exception exception) + { + logger.LogError(exception, "Assistant plugin '{PluginName}' could not resolve or create workspace '{WorkspaceName}'.", assistantPlugin.Name, launchConfiguration.WorkspaceName); + return new(null, string.Format(TB("The workspace '{0}' could not be opened or created."), launchConfiguration.WorkspaceName)); + } - if (workspaceId == Guid.Empty) - { - logger.LogWarning("Assistant plugin '{PluginName}' could not resolve or create workspace '{WorkspaceName}'.", assistantPlugin.Name, launchConfiguration.WorkspaceName); - return new(null, string.Format(TB("The workspace '{0}' could not be opened or created."), launchConfiguration.WorkspaceName)); + if (workspaceId == Guid.Empty) + { + logger.LogWarning("Assistant plugin '{PluginName}' could not resolve or create workspace '{WorkspaceName}'.", assistantPlugin.Name, launchConfiguration.WorkspaceName); + return new(null, string.Format(TB("The workspace '{0}' could not be opened or created."), launchConfiguration.WorkspaceName)); + } } //