using System.Collections.Concurrent; namespace AIStudio.Assistants; /// /// Keeps what the user last chose to work on in each assistant which works on documents as well as on texts. /// /// /// It keeps the choices only until AI Studio quits, for the start option "Start with the last choice": an assistant /// continues with what the user worked on before and asks again after a restart. A text which another assistant or /// a chat sent to an assistant is no choice of the user. /// public sealed class LastContentModeService { private readonly ConcurrentDictionary lastModes = new(); /// /// Notes what the user chose to work on in an assistant. /// /// The assistant. /// What the user chose to work on. public void Remember(Tools.Components assistant, AssistantContentMode mode) => this.lastModes[assistant] = mode; /// /// Gets what the user last chose to work on in an assistant; undecided while the user chose nothing there since /// AI Studio started. /// /// The assistant. public AssistantContentMode LastOf(Tools.Components assistant) => this.lastModes.GetValueOrDefault(assistant, AssistantContentMode.UNDECIDED); }