Added a description field to local data sources

This commit is contained in:
Thorsten Sommer 2025-12-05 22:12:57 +01:00
parent ab9b27f1f4
commit 134c018117
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
9 changed files with 70 additions and 5 deletions

View File

@ -188,11 +188,17 @@ public sealed class AgentDataSourceSelection (ILogger<AgentDataSourceSelection>
switch (ds)
{
case DataSourceLocalDirectory localDirectory:
sb.AppendLine($"- Id={ds.Id}, name='{localDirectory.Name}', type=local directory, path='{localDirectory.Path}'");
if (string.IsNullOrWhiteSpace(localDirectory.Description))
sb.AppendLine($"- Id={ds.Id}, name='{localDirectory.Name}', type=local directory, path='{localDirectory.Path}'");
else
sb.AppendLine($"- Id={ds.Id}, name='{localDirectory.Name}', type=local directory, path='{localDirectory.Path}', description='{localDirectory.Description}'");
break;
case DataSourceLocalFile localFile:
sb.AppendLine($"- Id={ds.Id}, name='{localFile.Name}', type=local file, path='{localFile.FilePath}'");
if (string.IsNullOrWhiteSpace(localFile.Description))
sb.AppendLine($"- Id={ds.Id}, name='{localFile.Name}', type=local file, path='{localFile.FilePath}'");
else
sb.AppendLine($"- Id={ds.Id}, name='{localFile.Name}', type=local file, path='{localFile.FilePath}', description='{localFile.Description}'");
break;
case IERIDataSource eriDataSource:

View File

@ -20,6 +20,22 @@
UserAttributes="@SPELLCHECK_ATTRIBUTES"
/>
<MudTextField
T="string"
@bind-Text="@this.dataDescription"
Label="@T("Description")"
Class="mb-6"
MaxLength="200"
Counter="200"
Immediate="@true"
Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.Description"
AdornmentColor="Color.Info"
HelperText="@T("Describe what kind of data this source contains to help the AI select it appropriately.")"
UserAttributes="@SPELLCHECK_ATTRIBUTES"
Lines="3"
/>
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
@T("Select a root directory for this data source. All data in this directory and all its subdirectories will be processed for this data source.")
</MudJustifiedText>

View File

@ -37,6 +37,7 @@ public partial class DataSourceLocalDirectoryDialog : MSGComponentBase
private uint dataNum;
private string dataId = Guid.NewGuid().ToString();
private string dataName = string.Empty;
private string dataDescription = string.Empty;
private bool dataUserAcknowledgedCloudEmbedding;
private string dataEmbeddingId = string.Empty;
private string dataPath = string.Empty;
@ -73,6 +74,7 @@ public partial class DataSourceLocalDirectoryDialog : MSGComponentBase
this.dataNum = this.DataSource.Num;
this.dataId = this.DataSource.Id;
this.dataName = this.DataSource.Name;
this.dataDescription = this.DataSource.Description;
this.dataEmbeddingId = this.DataSource.EmbeddingId;
this.dataPath = this.DataSource.Path;
this.dataSecurityPolicy = this.DataSource.SecurityPolicy;
@ -101,6 +103,7 @@ public partial class DataSourceLocalDirectoryDialog : MSGComponentBase
Id = this.dataId,
Num = this.dataNum,
Name = this.dataName,
Description = this.dataDescription,
Type = DataSourceType.LOCAL_DIRECTORY,
EmbeddingId = this.dataEmbeddingId,
Path = this.dataPath,

View File

@ -4,7 +4,11 @@
<MudDialog>
<DialogContent>
<TextInfoLine Icon="@Icons.Material.Filled.Tag" Label="@T("Data source name")" Value="@this.DataSource.Name" ClipboardTooltipSubject="@T("the data source name")"/>
@if (!string.IsNullOrWhiteSpace(this.DataSource.Description))
{
<TextInfoLine Icon="@Icons.Material.Filled.Description" Label="@T("Description")" Value="@this.DataSource.Description" ClipboardTooltipSubject="@T("the description")"/>
}
<TextInfoLine Icon="@Icons.Material.Filled.FolderOpen" Label="@T("Path")" Value="@this.DataSource.Path" ClipboardTooltipSubject="@T("this path")"/>
@if (!this.IsDirectoryAvailable)
{

View File

@ -20,6 +20,22 @@
UserAttributes="@SPELLCHECK_ATTRIBUTES"
/>
<MudTextField
T="string"
@bind-Text="@this.dataDescription"
Label="@T("Description")"
Class="mb-6"
MaxLength="200"
Counter="200"
Immediate="@true"
Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.Description"
AdornmentColor="Color.Info"
HelperText="@T("Describe what kind of data this source contains to help the AI select it appropriately.")"
UserAttributes="@SPELLCHECK_ATTRIBUTES"
Lines="3"
/>
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
@T("Select a file for this data source. The content of this file will be processed for the data source.")
</MudJustifiedText>

View File

@ -37,6 +37,7 @@ public partial class DataSourceLocalFileDialog : MSGComponentBase
private uint dataNum;
private string dataId = Guid.NewGuid().ToString();
private string dataName = string.Empty;
private string dataDescription = string.Empty;
private bool dataUserAcknowledgedCloudEmbedding;
private string dataEmbeddingId = string.Empty;
private string dataFilePath = string.Empty;
@ -73,6 +74,7 @@ public partial class DataSourceLocalFileDialog : MSGComponentBase
this.dataNum = this.DataSource.Num;
this.dataId = this.DataSource.Id;
this.dataName = this.DataSource.Name;
this.dataDescription = this.DataSource.Description;
this.dataEmbeddingId = this.DataSource.EmbeddingId;
this.dataFilePath = this.DataSource.FilePath;
this.dataSecurityPolicy = this.DataSource.SecurityPolicy;
@ -101,6 +103,7 @@ public partial class DataSourceLocalFileDialog : MSGComponentBase
Id = this.dataId,
Num = this.dataNum,
Name = this.dataName,
Description = this.dataDescription,
Type = DataSourceType.LOCAL_FILE,
EmbeddingId = this.dataEmbeddingId,
FilePath = this.dataFilePath,

View File

@ -4,6 +4,11 @@
<MudDialog>
<DialogContent>
<TextInfoLine Icon="@Icons.Material.Filled.Tag" Label="@T("Data source name")" Value="@this.DataSource.Name" ClipboardTooltipSubject="@T("the data source name")"/>
@if (!string.IsNullOrWhiteSpace(this.DataSource.Description))
{
<TextInfoLine Icon="@Icons.Material.Filled.Description" Label="@T("Description")" Value="@this.DataSource.Description" ClipboardTooltipSubject="@T("the description")"/>
}
<TextInfoLine Icon="@Icons.Material.Filled.FolderOpen" Label="@T("File path")" Value="@this.DataSource.FilePath" ClipboardTooltipSubject="@T("this path")"/>
@if (!this.IsFileAvailable)
{

View File

@ -20,7 +20,13 @@ public readonly record struct DataSourceLocalDirectory : IInternalDataSource
/// <inheritdoc />
public string Name { get; init; } = 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;
/// <inheritdoc />
public DataSourceType Type { get; init; } = DataSourceType.NONE;

View File

@ -20,7 +20,13 @@ public readonly record struct DataSourceLocalFile : IInternalDataSource
/// <inheritdoc />
public string Name { get; init; } = 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;
/// <inheritdoc />
public DataSourceType Type { get; init; } = DataSourceType.NONE;