From 2cbf9d5dc3b37c502c6eadac970e0dedd64d2802 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Mon, 28 Oct 2024 15:32:59 +0100 Subject: [PATCH] Allow checking if a chat exists --- app/MindWork AI Studio/Components/Workspaces.razor.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/MindWork AI Studio/Components/Workspaces.razor.cs b/app/MindWork AI Studio/Components/Workspaces.razor.cs index 3b6531f8..fcb845e2 100644 --- a/app/MindWork AI Studio/Components/Workspaces.razor.cs +++ b/app/MindWork AI Studio/Components/Workspaces.razor.cs @@ -286,6 +286,15 @@ public partial class Workspaces : ComponentBase await this.LoadChat(chatPath, switchToChat: true); } + + public static bool IsChatExisting(LoadChat loadChat) + { + var chatPath = loadChat.WorkspaceId == Guid.Empty + ? Path.Join(SettingsManager.DataDirectory, "tempChats", loadChat.ChatId.ToString()) + : Path.Join(SettingsManager.DataDirectory, "workspaces", loadChat.WorkspaceId.ToString(), loadChat.ChatId.ToString()); + + return Directory.Exists(chatPath); + } private async Task LoadChat(string? chatPath, bool switchToChat) {