diff --git a/app/MindWork AI Studio/Components/Pages/Chat.razor b/app/MindWork AI Studio/Components/Pages/Chat.razor
index dabe31cc..0017303b 100644
--- a/app/MindWork AI Studio/Components/Pages/Chat.razor
+++ b/app/MindWork AI Studio/Components/Pages/Chat.razor
@@ -62,6 +62,13 @@
}
+
+ @if (this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY)
+ {
+
+
+
+ }
@if (this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES)
{
diff --git a/app/MindWork AI Studio/Components/Pages/Chat.razor.cs b/app/MindWork AI Studio/Components/Pages/Chat.razor.cs
index 49cde7d2..0820b8de 100644
--- a/app/MindWork AI Studio/Components/Pages/Chat.razor.cs
+++ b/app/MindWork AI Studio/Components/Pages/Chat.razor.cs
@@ -224,9 +224,9 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
return threadName;
}
- private async Task StartNewChat(bool useSameWorkspace = false)
+ private async Task StartNewChat(bool useSameWorkspace = false, bool deletePreviousChat = false)
{
- if (this.hasUnsavedChanges)
+ if (this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges)
{
var dialogParameters = new DialogParameters
{
@@ -238,7 +238,22 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
if (dialogResult.Canceled)
return;
}
-
+
+ if (this.chatThread is not null && this.workspaces is not null && deletePreviousChat)
+ {
+ string chatPath;
+ if (this.chatThread.WorkspaceId == Guid.Empty)
+ {
+ chatPath = Path.Join(SettingsManager.DataDirectory, "tempChats", this.chatThread.ChatId.ToString());
+ }
+ else
+ {
+ chatPath = Path.Join(SettingsManager.DataDirectory, "workspaces", this.chatThread.WorkspaceId.ToString(), this.chatThread.ChatId.ToString());
+ }
+
+ await this.workspaces.DeleteChat(chatPath, askForConfirmation: false, unloadChat: true);
+ }
+
this.isStreaming = false;
this.hasUnsavedChanges = false;
this.userInput = string.Empty;
@@ -273,7 +288,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
if(this.workspaces is null)
return;
- if (this.hasUnsavedChanges)
+ if (this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges)
{
var confirmationDialogParameters = new DialogParameters
{