mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-05 07:27:21 +00:00
Fixed assistants undoing your changes while a run you left continues (#1111)
This commit is contained in:
1 parent
31c271eb7b
commit
7f72da628e
8 files changed
+322
-6
No files matched your search
+14
-1
@@ -217,7 +217,20 @@ public partial class SlideAssistant
|
||||
return;
|
||||
}
|
||||
|
||||
// A variant of another template means nothing for this one, nor do choices for its slides:
|
||||
this.FitChoicesToTemplate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fits the color variant and the choices for the slides to the loaded template.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A variant of another template means nothing for this one, nor do choices for its slides.
|
||||
/// </remarks>
|
||||
private void FitChoicesToTemplate()
|
||||
{
|
||||
if (this.template is null)
|
||||
return;
|
||||
|
||||
if (this.variantLabel is null || !this.template.VariantLabels.Contains(this.variantLabel))
|
||||
this.variantLabel = this.template.VariantLabels.FirstOrDefault();
|
||||
|
||||
|
||||
@@ -346,6 +346,10 @@ public partial class SlideAssistant : AssistantBaseCore<SettingsDialogSlideBuild
|
||||
/// <inheritdoc />
|
||||
protected override void RestoreCustomAssistantSessionState(AssistantSessionStateReader state)
|
||||
{
|
||||
var previousTemplatePath = this.templatePath;
|
||||
var previousSlideDeckAnswer = this.slideDeckAnswer;
|
||||
var previousPictureLibraryPath = this.pictureLibraryPath;
|
||||
|
||||
state.Restore(INPUT_TITLE_STATE_KEY, value => this.inputTitle = value);
|
||||
state.Restore(INPUT_CONTENT_STATE_KEY, value => this.inputContent = value);
|
||||
state.Restore(CUSTOM_TARGET_LANGUAGE_STATE_KEY, value => this.customTargetLanguage = value);
|
||||
@@ -377,10 +381,22 @@ public partial class SlideAssistant : AssistantBaseCore<SettingsDialogSlideBuild
|
||||
state.RestoreDictionary(SLIDE_DECK_BASIS_STATE_KEY, this.slideDeckBasis);
|
||||
state.Restore(PLANNING_STEP_STATE_KEY, value => this.planningStep = value);
|
||||
|
||||
// Neither the template nor the slides are kept themselves, only what they were read from:
|
||||
this.LoadTemplate();
|
||||
this.RestoreSlideDeck();
|
||||
this.StartCountingPictureLibrary();
|
||||
//
|
||||
// Neither the template nor the slides nor the count of the library are kept themselves, only
|
||||
// what they were read from. A running session stores its state every few seconds, and the
|
||||
// template is read on the thread of the renderer, maybe from a network drive. So each one is
|
||||
// read again only when what it was read from has changed:
|
||||
//
|
||||
if (string.Equals(previousTemplatePath, this.templatePath, StringComparison.Ordinal))
|
||||
this.FitChoicesToTemplate();
|
||||
else
|
||||
this.LoadTemplate();
|
||||
|
||||
if (!string.Equals(previousSlideDeckAnswer, this.slideDeckAnswer, StringComparison.Ordinal))
|
||||
this.RestoreSlideDeck();
|
||||
|
||||
if (!string.Equals(previousPictureLibraryPath, this.pictureLibraryPath, StringComparison.Ordinal))
|
||||
this.StartCountingPictureLibrary();
|
||||
}
|
||||
|
||||
#region Overrides of ComponentBase
|
||||
|
||||
Reference in new issue
Block a user