Allow checking if a chat exists

This commit is contained in:
Thorsten Sommer 2024-10-28 15:32:59 +01:00
parent c22a8db15d
commit 2cbf9d5dc3
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -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<ChatThread?> LoadChat(string? chatPath, bool switchToChat)
{