Optimized thread name generation

This commit is contained in:
Thorsten Sommer 2025-01-03 18:21:53 +01:00
parent 5e445f09fa
commit 199693dfbd
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -252,8 +252,6 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
await this.inputField.BlurAsync(); await this.inputField.BlurAsync();
// Create a new chat thread if necessary: // Create a new chat thread if necessary:
var threadName = this.ExtractThreadName(this.userInput);
if (this.ChatThread is null) if (this.ChatThread is null)
{ {
this.ChatThread = new() this.ChatThread = new()
@ -263,7 +261,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
SystemPrompt = SystemPrompts.DEFAULT, SystemPrompt = SystemPrompts.DEFAULT,
WorkspaceId = this.currentWorkspaceId, WorkspaceId = this.currentWorkspaceId,
ChatId = Guid.NewGuid(), ChatId = Guid.NewGuid(),
Name = threadName, Name = this.ExtractThreadName(this.userInput),
Seed = this.RNG.Next(), Seed = this.RNG.Next(),
Blocks = [], Blocks = [],
}; };
@ -274,7 +272,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
{ {
// Set the thread name if it is empty: // Set the thread name if it is empty:
if (string.IsNullOrWhiteSpace(this.ChatThread.Name)) if (string.IsNullOrWhiteSpace(this.ChatThread.Name))
this.ChatThread.Name = threadName; this.ChatThread.Name = this.ExtractThreadName(this.userInput);
// Update provider and profile: // Update provider and profile:
this.ChatThread.SelectedProvider = this.Provider.Id; this.ChatThread.SelectedProvider = this.Provider.Id;