From ab1fa49f18d68c5568f2d000fbf67d11da77d8e1 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sun, 27 Oct 2024 14:03:09 +0100 Subject: [PATCH] Allow creation of chat thread within an existing workspace using a given name --- .../Assistants/AssistantBase.razor.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs b/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs index b4764a28..f5f1593a 100644 --- a/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs +++ b/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs @@ -179,6 +179,27 @@ public abstract partial class AssistantBase : ComponentBase, IMessageBusReceiver Blocks = [], }; } + + protected Guid CreateChatThread(Guid workspaceId, string name) + { + var chatId = Guid.NewGuid(); + this.chatThread = new() + { + WorkspaceId = workspaceId, + ChatId = chatId, + Name = name, + Seed = this.RNG.Next(), + SystemPrompt = !this.AllowProfiles ? this.SystemPrompt : + $""" + {this.SystemPrompt} + + {this.currentProfile.ToSystemPrompt()} + """, + Blocks = [], + }; + + return chatId; + } protected DateTimeOffset AddUserRequest(string request) {