using System.Linq.Expressions; namespace AIStudio.Settings.DataModel; public sealed class DataChat(Expression>? configSelection = null) { /// /// The default constructor for the JSON deserializer. /// public DataChat() : this(null) { } /// /// Shortcuts to send the input to the AI. /// public SendBehavior ShortcutSendBehavior { get; set; } = SendBehavior.ENTER_IS_SENDING; /// /// Defines the provider behavior for loading a chat. /// public LoadingChatProviderBehavior LoadingProviderBehavior { get; set; } = LoadingChatProviderBehavior.USE_CHAT_PROVIDER_IF_AVAILABLE; /// /// Defines the provider behavior when adding a chat. /// public AddChatProviderBehavior AddChatProviderBehavior { get; set; } = AddChatProviderBehavior.ADDED_CHATS_USE_LATEST_PROVIDER; /// /// Defines the data source behavior when sending assistant results to a chat. /// public SendToChatDataSourceBehavior SendToChatDataSourceBehavior { get; set; } = ManagedConfiguration.Register(configSelection, n => n.SendToChatDataSourceBehavior, SendToChatDataSourceBehavior.NO_DATA_SOURCES); /// /// Preselect any chat options? /// public bool PreselectOptions { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectOptions, false); /// /// Should we preselect a provider for the chat? /// public string PreselectedProvider { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedProvider, string.Empty); /// /// Preselect a profile? /// public string PreselectedProfile { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedProfile, string.Empty); /// /// Preselect a chat template? /// public string PreselectedChatTemplate { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedChatTemplate, string.Empty); /// /// Whether data sources are disabled by default for new chats. /// public bool PreselectedDataSourcesDisabled { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedDataSourcesDisabled, true); /// /// Whether data sources should be selected automatically by default for new chats. /// public bool PreselectedDataSourcesAutomaticSelection { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedDataSourcesAutomaticSelection, false); /// /// Whether retrieved data should be validated automatically by default for new chats. /// public bool PreselectedDataSourcesAutomaticValidation { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedDataSourcesAutomaticValidation, false); /// /// The data source IDs that should be preselected by default for new chats. /// public List PreselectedDataSourceIds { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedDataSourceIds, []); /// /// Should we preselect data sources options for a created chat? /// // Compatibility shim: legacy settings used this nested object. See documentation/compatibility-shims/2026-07-chat-data-source-options.md; remove after 2027-01-05. public DataSourceOptions PreselectedDataSourceOptions { get => new() { DisableDataSources = this.PreselectedDataSourcesDisabled, AutomaticDataSourceSelection = this.PreselectedDataSourcesAutomaticSelection, AutomaticValidation = this.PreselectedDataSourcesAutomaticValidation, PreselectedDataSourceIds = [..this.PreselectedDataSourceIds], }; set { this.PreselectedDataSourcesDisabled = value.DisableDataSources; this.PreselectedDataSourcesAutomaticSelection = value.AutomaticDataSourceSelection; this.PreselectedDataSourcesAutomaticValidation = value.AutomaticValidation; this.PreselectedDataSourceIds = [..value.PreselectedDataSourceIds]; } } /// /// Should we show the latest message after loading? When false, we show the first (aka oldest) message. /// public bool ShowLatestMessageAfterLoading { get; set; } = true; }