Share the conversation reset across assistants

This commit is contained in:
Thorsten Sommer 2026-09-22 19:48:32 +02:00
parent 594bce813d
commit f94af9c07d
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
3 changed files with 16 additions and 6 deletions

View File

@ -753,9 +753,7 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
await this.AssistantSessionService.ClearAsync(this.assistantSessionKey);
this.MediaTranscriptionService.ClearOwnerState(this.CurrentMediaImportOwner);
this.assistantSessionId = null;
this.ChatThread = null;
this.LastUserPrompt = null;
this.ResultingContentBlock = null;
this.ClearConversationState();
this.ProviderSettings = Settings.Provider.NONE;
await this.JsRuntime.ClearDiv(BEFORE_RESULT_DIV_ID);

View File

@ -34,4 +34,18 @@ public abstract class AssistantLowerBase : MSGComponentBase
protected ContentBlock? ResultingContentBlock;
protected string[] InputIssues = [];
protected bool IsProcessing;
/// <summary>
/// Clears everything one assistant run has produced.
/// </summary>
/// <remarks>
/// Assistants call this whenever the previous run must not carry over: a follow-up run would
/// otherwise append to the old chat thread, and the old result would stay on screen.
/// </remarks>
protected void ClearConversationState()
{
this.ChatThread = null;
this.LastUserPrompt = null;
this.ResultingContentBlock = null;
}
}

View File

@ -479,9 +479,7 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
this.inputPrompt = this.optimizedPrompt;
this.ResetOutput();
this.ChatThread = null;
this.LastUserPrompt = null;
this.ResultingContentBlock = null;
this.ClearConversationState();
this.ClearInputIssues();
return Task.CompletedTask;
}