Generated the JSON contracts of the stored data at compile time (#1148)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-02 18:23:19 +01:00
1 parent fc7399e81b
commit e954881fda
75 files changed
+5437 -298

No files matched your search

@@ -10,7 +10,7 @@ namespace AIStudio.Settings.DataModel;
/// <summary>
/// Represents a local directory as a data source.
/// </summary>
public readonly record struct DataSourceLocalDirectory : IInternalDataSource
public record struct DataSourceLocalDirectory: IInternalDataSource
{
// Selects what folder data sources indexed before they had file patterns, plus every other
// file whose content is readable text, e.g., a Terraform file or a script without an extension.
@@ -27,46 +27,46 @@ public readonly record struct DataSourceLocalDirectory : IInternalDataSource
}
/// <inheritdoc />
public uint Num { get; init; }
public uint Num { get; set; }
/// <inheritdoc />
public string Id { get; init; } = Guid.Empty.ToString();
public string Id { get; set; } = Guid.Empty.ToString();
/// <inheritdoc />
public string Name { get; init; } = string.Empty;
public string Name { get; set; } = string.Empty;
/// <summary>
/// The description of the data source. What kind of data does it contain?
/// What is the data source used for?
/// </summary>
public string Description { get; init; } = string.Empty;
public string Description { get; set; } = string.Empty;
/// <inheritdoc />
public DataSourceType Type { get; init; } = DataSourceType.NONE;
public DataSourceType Type { get; set; } = DataSourceType.NONE;
/// <inheritdoc />
public string EmbeddingId { get; init; } = Guid.Empty.ToString();
public string EmbeddingId { get; set; } = Guid.Empty.ToString();
/// <inheritdoc />
public int MaxChunkTokenLength { get; init; }
public int MaxChunkTokenLength { get; set; }
/// <inheritdoc />
public int ChunkOverlapTokenLength { get; init; } = DataSourceEmbeddingService.DEFAULT_CHUNK_OVERLAP_TOKEN_LENGTH;
public int ChunkOverlapTokenLength { get; set; } = DataSourceEmbeddingService.DEFAULT_CHUNK_OVERLAP_TOKEN_LENGTH;
/// <inheritdoc />
public ConfidenceLevel ConfidenceLevel { get; init; } = ConfidenceLevel.UNKNOWN;
public ConfidenceLevel ConfidenceLevel { get; set; } = ConfidenceLevel.UNKNOWN;
/// <inheritdoc />
public bool IsEnterpriseConfiguration { get; init; }
public bool IsEnterpriseConfiguration { get; set; }
/// <inheritdoc />
public Guid EnterpriseConfigurationPluginId { get; init; } = Guid.Empty;
public Guid EnterpriseConfigurationPluginId { get; set; } = Guid.Empty;
/// <inheritdoc />
public ushort MaxMatches { get; init; } = 10;
public ushort MaxMatches { get; set; } = 10;
/// <inheritdoc />
public OutboundDataRestriction OutboundDataRestriction { get; init; } = DataSourceOutboundDataExtensions.DEFAULT_OUTBOUND_DATA_RESTRICTION;
public OutboundDataRestriction OutboundDataRestriction { get; set; } = DataSourceOutboundDataExtensions.DEFAULT_OUTBOUND_DATA_RESTRICTION;
/// <inheritdoc />
public Task<IReadOnlyList<IRetrievalContext>> RetrieveDataAsync(IContent lastUserPrompt, ChatThread thread, CancellationToken token = default) =>
@@ -79,31 +79,31 @@ public readonly record struct DataSourceLocalDirectory : IInternalDataSource
/// <summary>
/// The path to the directory.
/// </summary>
public string Path { get; init; } = string.Empty;
public string Path { get; set; } = string.Empty;
/// <summary>
/// Semicolon-separated file-name patterns which decide which files below the path
/// are considered for indexing.
/// </summary>
public string FilePatterns { get; init; } = DEFAULT_FILE_PATTERNS;
public string FilePatterns { get; set; } = DEFAULT_FILE_PATTERNS;
/// <summary>
/// The files and folders below the path which are left out, even when a file pattern selects
/// them, cf. FileExclusions. Data sources from before this list existed get the default list,
/// so their build outputs and dependencies leave the index during the next run.
/// </summary>
public string ExcludePatterns { get; init; } = FileExclusions.DEFAULT_PATTERNS;
public string ExcludePatterns { get; set; } = FileExclusions.DEFAULT_PATTERNS;
/// <summary>
/// The largest file below the path which is indexed, in megabytes. A larger file which the
/// patterns select is not indexed, and the embedding page tells the user about it.
/// </summary>
public int MaxFileSizeMegabytes { get; init; } = FolderFileSelection.DEFAULT_MAX_FILE_SIZE_MEGABYTES;
public int MaxFileSizeMegabytes { get; set; } = FolderFileSelection.DEFAULT_MAX_FILE_SIZE_MEGABYTES;
/// <summary>
/// Whether files in folders below the path are considered for indexing.
/// </summary>
public bool IncludeSubdirectories { get; init; } = DEFAULT_INCLUDE_SUBDIRECTORIES;
public bool IncludeSubdirectories { get; set; } = DEFAULT_INCLUDE_SUBDIRECTORIES;
/// <summary>
/// Whether hidden files and the files in hidden folders below the path are considered for
@@ -114,7 +114,7 @@ public readonly record struct DataSourceLocalDirectory : IInternalDataSource
/// the hidden files it names, cf. FileNamePatterns.NamesHiddenFile. Hidden folders are entered
/// only while this is on.
/// </remarks>
public bool IncludeHiddenFilesAndFolders { get; init; } = DEFAULT_INCLUDE_HIDDEN_FILES_AND_FOLDERS;
public bool IncludeHiddenFilesAndFolders { get; set; } = DEFAULT_INCLUDE_HIDDEN_FILES_AND_FOLDERS;
/// <summary>
/// The patterns used at runtime. An invalid value can only come from malformed or hand-edited