mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 21:27:21 +00:00
Added a way to read what the AI received from your sources (#1100)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
e0d8e18f34
commit
cbc4ce5413
229 files changed
+12739
-1269
No files matched your search
@@ -20,44 +20,28 @@
|
||||
<MudListItem T="string" Icon="@Icons.Material.Outlined.Build" Text="@this.VersionDotnetSdk"/>
|
||||
<MudListItem T="string" Icon="@Icons.Material.Outlined.Memory" Text="@this.VersionDotnetRuntime"/>
|
||||
<MudListItem T="string" Icon="@Icons.Material.Outlined.Build" Text="@this.VersionRust"/>
|
||||
<MudListItem T="string" Icon="@Icons.Material.Outlined.Storage">
|
||||
<MudText Typo="Typo.body1">
|
||||
@this.DatabaseHeaderText(this.vectorStoreSection)
|
||||
</MudText>
|
||||
<MudCollapse Expanded="@this.vectorStoreSection.ShowDetails">
|
||||
<MudText Typo="Typo.body1" Class="mt-2 mb-2">
|
||||
@foreach (var item in this.BuildDatabaseInfoItems(this.vectorStoreSection))
|
||||
{
|
||||
<ConfigInfoRow Item="@item"/>
|
||||
}
|
||||
@foreach (var database in this.databaseSections)
|
||||
{
|
||||
<MudListItem T="string" Icon="@database.Icon">
|
||||
<MudText Typo="Typo.body1">
|
||||
@this.DatabaseHeaderText(database)
|
||||
</MudText>
|
||||
</MudCollapse>
|
||||
<MudButton StartIcon="@(this.vectorStoreSection.ShowDetails ? Icons.Material.Filled.ExpandLess : Icons.Material.Filled.ExpandMore)"
|
||||
Size="Size.Small"
|
||||
Variant="Variant.Text"
|
||||
OnClick="@(() => this.ToggleDatabaseDetails(this.vectorStoreSection))">
|
||||
@(this.vectorStoreSection.ShowDetails ? T("Hide Details") : T("Show Details"))
|
||||
</MudButton>
|
||||
</MudListItem>
|
||||
<MudListItem T="string" Icon="@Icons.Material.Outlined.ManageSearch">
|
||||
<MudText Typo="Typo.body1">
|
||||
@this.DatabaseHeaderText(this.indexStoreSection)
|
||||
</MudText>
|
||||
<MudCollapse Expanded="@this.indexStoreSection.ShowDetails">
|
||||
<MudText Typo="Typo.body1" Class="mt-2 mb-2">
|
||||
@foreach (var item in this.BuildDatabaseInfoItems(this.indexStoreSection))
|
||||
{
|
||||
<ConfigInfoRow Item="@item"/>
|
||||
}
|
||||
</MudText>
|
||||
</MudCollapse>
|
||||
<MudButton StartIcon="@(this.indexStoreSection.ShowDetails ? Icons.Material.Filled.ExpandLess : Icons.Material.Filled.ExpandMore)"
|
||||
Size="Size.Small"
|
||||
Variant="Variant.Text"
|
||||
OnClick="@(() => this.ToggleDatabaseDetails(this.indexStoreSection))">
|
||||
@(this.indexStoreSection.ShowDetails ? T("Hide Details") : T("Show Details"))
|
||||
</MudButton>
|
||||
</MudListItem>
|
||||
<MudCollapse Expanded="@database.ShowDetails">
|
||||
<MudText Typo="Typo.body1" Class="mt-2 mb-2">
|
||||
@foreach (var item in this.BuildDatabaseInfoItems(database))
|
||||
{
|
||||
<ConfigInfoRow Item="@item"/>
|
||||
}
|
||||
</MudText>
|
||||
</MudCollapse>
|
||||
<MudButton StartIcon="@(database.ShowDetails ? Icons.Material.Filled.ExpandLess : Icons.Material.Filled.ExpandMore)"
|
||||
Size="Size.Small"
|
||||
Variant="Variant.Text"
|
||||
OnClick="@(() => this.ToggleDatabaseDetails(database))">
|
||||
@(database.ShowDetails ? T("Hide Details") : T("Show Details"))
|
||||
</MudButton>
|
||||
</MudListItem>
|
||||
}
|
||||
<MudListItem T="string" Icon="@Icons.Material.Outlined.DocumentScanner" Text="@this.VersionPdfium"/>
|
||||
<MudListItem T="string" Icon="@Icons.Material.Outlined.Article" Text="@this.versionPandoc"/>
|
||||
<MudListItem T="string" Icon="@Icons.Material.Outlined.Widgets" Text="@MudBlazorVersion"/>
|
||||
|
||||
@@ -102,7 +102,7 @@ public partial class Information : MSGComponentBase
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The vector store names the version from the build metadata, which is what this page always
|
||||
/// showed. The index store names the one its client read from the running database instead:
|
||||
/// showed. The SQLite stores name the one their client read from the running database instead:
|
||||
/// there, which SQLite build actually got loaded is the whole point of showing it.
|
||||
/// </remarks>
|
||||
private string DatabaseHeaderText(DatabaseSection section)
|
||||
@@ -110,6 +110,7 @@ public partial class Information : MSGComponentBase
|
||||
var nameLabel = section.Role switch
|
||||
{
|
||||
DatabaseRole.VECTOR_STORE => T("Vector database"),
|
||||
DatabaseRole.PROVENANCE_STORE => T("Provenance database"),
|
||||
_ => T("Index database"),
|
||||
};
|
||||
|
||||
@@ -163,13 +164,16 @@ public partial class Information : MSGComponentBase
|
||||
/// Everything one database block on this page needs to show itself.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Both blocks work the same way, so they share their state and their methods and differ only
|
||||
/// in their role. Whoever adds a third database adds one field here, not another set of methods.
|
||||
/// The blocks work the same way, so they share their state, their methods, and their markup, and
|
||||
/// differ only in their role and icon. Whoever adds another database adds one entry to
|
||||
/// databaseSections, not another set of methods.
|
||||
/// </remarks>
|
||||
private sealed class DatabaseSection(DatabaseRole role)
|
||||
private sealed class DatabaseSection(DatabaseRole role, string icon)
|
||||
{
|
||||
public DatabaseRole Role => role;
|
||||
|
||||
public string Icon => icon;
|
||||
|
||||
public DatabaseClient? Client { get; set; }
|
||||
|
||||
public bool ShowDetails { get; set; }
|
||||
@@ -179,8 +183,15 @@ public partial class Information : MSGComponentBase
|
||||
public CancellationTokenSource? RefreshCancellationTokenSource { get; set; }
|
||||
}
|
||||
|
||||
private readonly DatabaseSection vectorStoreSection = new(DatabaseRole.VECTOR_STORE);
|
||||
private readonly DatabaseSection indexStoreSection = new(DatabaseRole.INDEX_STORE);
|
||||
/// <summary>
|
||||
/// The database blocks, in the order this page shows them.
|
||||
/// </summary>
|
||||
private readonly IReadOnlyList<DatabaseSection> databaseSections =
|
||||
[
|
||||
new(DatabaseRole.VECTOR_STORE, Icons.Material.Outlined.Storage),
|
||||
new(DatabaseRole.INDEX_STORE, Icons.Material.Outlined.ManageSearch),
|
||||
new(DatabaseRole.PROVENANCE_STORE, Icons.Material.Outlined.Source),
|
||||
];
|
||||
|
||||
private bool HasAnyActiveEnvironment => this.enterpriseEnvironments.Any(e => e.IsActive);
|
||||
|
||||
@@ -229,14 +240,11 @@ public partial class Information : MSGComponentBase
|
||||
|
||||
// The index store goes first: the vector store asks it for the number of stored vectors,
|
||||
// and this way that client is already cached when it does.
|
||||
await this.RefreshDatabaseInfo(this.indexStoreSection, CancellationToken.None);
|
||||
await this.RefreshDatabaseInfo(this.vectorStoreSection, CancellationToken.None);
|
||||
foreach (var section in this.databaseSections.OrderByDescending(section => section.Role is DatabaseRole.INDEX_STORE))
|
||||
await this.RefreshDatabaseInfo(section, CancellationToken.None);
|
||||
|
||||
if (this.indexStoreSection.Client?.Status is DatabaseClientStatus.STARTING)
|
||||
this.StartShortDatabaseRefreshLoop(this.indexStoreSection);
|
||||
|
||||
if (this.vectorStoreSection.Client?.Status is DatabaseClientStatus.STARTING)
|
||||
this.StartShortDatabaseRefreshLoop(this.vectorStoreSection);
|
||||
foreach (var section in this.databaseSections.Where(section => section.Client?.Status is DatabaseClientStatus.STARTING))
|
||||
this.StartShortDatabaseRefreshLoop(section);
|
||||
|
||||
// Determine the Pandoc version may take some time, so we start it here
|
||||
// without waiting for the result:
|
||||
@@ -588,8 +596,8 @@ public partial class Information : MSGComponentBase
|
||||
|
||||
protected override void DisposeResources()
|
||||
{
|
||||
this.CancelDatabaseRefreshLoop(this.vectorStoreSection);
|
||||
this.CancelDatabaseRefreshLoop(this.indexStoreSection);
|
||||
foreach (var section in this.databaseSections)
|
||||
this.CancelDatabaseRefreshLoop(section);
|
||||
base.DisposeResources();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user