2026-06-21 15:59:23 +02:00
using System.Linq.Expressions ;
2024-08-05 21:12:52 +02:00
namespace AIStudio.Settings.DataModel ;
2026-06-21 15:59:23 +02:00
public sealed class DataChat ( Expression < Func < Data , DataChat >>? configSelection = null )
2024-08-05 21:12:52 +02:00
{
2026-06-21 15:59:23 +02:00
/// <summary>
/// The default constructor for the JSON deserializer.
/// </summary>
public DataChat () : this ( null )
{
}
2024-08-05 21:12:52 +02:00
/// <summary>
/// Shortcuts to send the input to the AI.
/// </summary>
2024-08-23 10:49:30 +02:00
public SendBehavior ShortcutSendBehavior { get ; set ; } = SendBehavior . ENTER_IS_SENDING ;
2024-08-05 21:12:52 +02:00
2024-11-23 13:04:02 +01:00
/// <summary>
/// Defines the provider behavior for loading a chat.
/// </summary>
public LoadingChatProviderBehavior LoadingProviderBehavior { get ; set ; } = LoadingChatProviderBehavior . USE_CHAT_PROVIDER_IF_AVAILABLE ;
/// <summary>
/// Defines the provider behavior when adding a chat.
/// </summary>
public AddChatProviderBehavior AddChatProviderBehavior { get ; set ; } = AddChatProviderBehavior . ADDED_CHATS_USE_LATEST_PROVIDER ;
2025-02-15 15:41:12 +01:00
/// <summary>
/// Defines the data source behavior when sending assistant results to a chat.
/// </summary>
2026-07-05 14:46:31 +02:00
public SendToChatDataSourceBehavior SendToChatDataSourceBehavior { get ; set ; } = ManagedConfiguration . Register ( configSelection , n => n . SendToChatDataSourceBehavior , SendToChatDataSourceBehavior . NO_DATA_SOURCES );
2025-02-15 15:41:12 +01:00
2024-08-05 21:12:52 +02:00
/// <summary>
/// Preselect any chat options?
/// </summary>
2026-06-21 15:59:23 +02:00
public bool PreselectOptions { get ; set ; } = ManagedConfiguration . Register ( configSelection , n => n . PreselectOptions , false );
2024-08-05 21:12:52 +02:00
/// <summary>
/// Should we preselect a provider for the chat?
/// </summary>
2026-06-21 15:59:23 +02:00
public string PreselectedProvider { get ; set ; } = ManagedConfiguration . Register ( configSelection , n => n . PreselectedProvider , string . Empty );
2024-09-08 21:01:51 +02:00
/// <summary>
/// Preselect a profile?
/// </summary>
2026-06-21 15:59:23 +02:00
public string PreselectedProfile { get ; set ; } = ManagedConfiguration . Register ( configSelection , n => n . PreselectedProfile , string . Empty );
2025-02-15 15:41:12 +01:00
2025-05-24 12:27:00 +02:00
/// <summary>
/// Preselect a chat template?
/// </summary>
2026-06-21 15:59:23 +02:00
public string PreselectedChatTemplate { get ; set ; } = ManagedConfiguration . Register ( configSelection , n => n . PreselectedChatTemplate , string . Empty );
2025-05-24 12:27:00 +02:00
2026-07-05 14:46:31 +02:00
/// <summary>
/// Whether data sources are disabled by default for new chats.
/// </summary>
public bool PreselectedDataSourcesDisabled { get ; set ; } = ManagedConfiguration . Register ( configSelection , n => n . PreselectedDataSourcesDisabled , true );
/// <summary>
/// Whether data sources should be selected automatically by default for new chats.
/// </summary>
public bool PreselectedDataSourcesAutomaticSelection { get ; set ; } = ManagedConfiguration . Register ( configSelection , n => n . PreselectedDataSourcesAutomaticSelection , false );
/// <summary>
/// Whether retrieved data should be validated automatically by default for new chats.
/// </summary>
public bool PreselectedDataSourcesAutomaticValidation { get ; set ; } = ManagedConfiguration . Register ( configSelection , n => n . PreselectedDataSourcesAutomaticValidation , false );
/// <summary>
/// The data source IDs that should be preselected by default for new chats.
/// </summary>
public List < string > PreselectedDataSourceIds { get ; set ; } = ManagedConfiguration . Register ( configSelection , n => n . PreselectedDataSourceIds , []);
2025-02-15 15:41:12 +01:00
/// <summary>
/// Should we preselect data sources options for a created chat?
/// </summary>
2026-07-05 14:46:31 +02:00
// 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 ];
}
}
2024-08-23 10:32:27 +02:00
/// <summary>
/// Should we show the latest message after loading? When false, we show the first (aka oldest) message.
/// </summary>
public bool ShowLatestMessageAfterLoading { get ; set ; } = true ;
2024-08-05 21:12:52 +02:00
}