mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 22:47:21 +00:00
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
117 lines
5.5 KiB
C#
117 lines
5.5 KiB
C#
using System.Linq.Expressions;
|
|
|
|
namespace AIStudio.Settings.DataModel;
|
|
|
|
public sealed class DataChat(Expression<Func<Data, DataChat>>? configSelection = null)
|
|
{
|
|
/// <summary>
|
|
/// The default constructor for the JSON deserializer.
|
|
/// </summary>
|
|
public DataChat() : this(null)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Shortcuts to send the input to the AI.
|
|
/// </summary>
|
|
public SendBehavior ShortcutSendBehavior { get; set; } = SendBehavior.ENTER_IS_SENDING;
|
|
|
|
/// <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;
|
|
|
|
/// <summary>
|
|
/// Defines the data source behavior when sending assistant results to a chat.
|
|
/// </summary>
|
|
public SendToChatDataSourceBehavior SendToChatDataSourceBehavior { get; set; } = ManagedConfiguration.Register(configSelection, n => n.SendToChatDataSourceBehavior, SendToChatDataSourceBehavior.NO_DATA_SOURCES);
|
|
|
|
/// <summary>
|
|
/// Preselect any chat options?
|
|
/// </summary>
|
|
public bool PreselectOptions { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectOptions, false);
|
|
|
|
/// <summary>
|
|
/// Should we preselect a provider for the chat?
|
|
/// </summary>
|
|
public string PreselectedProvider { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedProvider, string.Empty);
|
|
|
|
/// <summary>
|
|
/// Preselect a profile?
|
|
/// </summary>
|
|
public string PreselectedProfile { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedProfile, string.Empty);
|
|
|
|
/// <summary>
|
|
/// Preselect a chat template?
|
|
/// </summary>
|
|
public string PreselectedChatTemplate { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedChatTemplate, string.Empty);
|
|
|
|
/// <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, []);
|
|
|
|
/// <summary>
|
|
/// How the data sources of new chats should be searched by default.
|
|
/// </summary>
|
|
public DataSourceRetrievalMode PreselectedDataSourcesRetrievalMode { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedDataSourcesRetrievalMode, DataSourceRetrievalMode.SEMANTIC_SEARCH);
|
|
|
|
/// <summary>
|
|
/// Should we preselect data sources options for a created chat?
|
|
/// </summary>
|
|
// 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,
|
|
RetrievalMode = this.PreselectedDataSourcesRetrievalMode,
|
|
PreselectedDataSourceIds = [..this.PreselectedDataSourceIds],
|
|
};
|
|
set
|
|
{
|
|
this.PreselectedDataSourcesDisabled = value.DisableDataSources;
|
|
this.PreselectedDataSourcesAutomaticSelection = value.AutomaticDataSourceSelection;
|
|
this.PreselectedDataSourcesAutomaticValidation = value.AutomaticValidation;
|
|
this.PreselectedDataSourcesRetrievalMode = value.RetrievalMode;
|
|
this.PreselectedDataSourceIds = [..value.PreselectedDataSourceIds];
|
|
}
|
|
}
|
|
|
|
/// <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;
|
|
|
|
/// <summary>
|
|
/// Whether a chat reads an attached file again when the file changed since it was sent.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Off by default: every later message of a chat sends the text a file had when it was first
|
|
/// sent, so that what the AI received stays the same and can be shown as it was, see
|
|
/// FileAttachment.ProvenanceId. A file which is gone keeps its text either way.
|
|
/// </remarks>
|
|
public bool ReadChangedAttachmentsAgain { get; set; } = ManagedConfiguration.Register(configSelection, n => n.ReadChangedAttachmentsAgain, false);
|
|
} |