mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 05:21:36 +00:00
Optimized code
This commit is contained in:
parent
4eb58eb56d
commit
34317fc219
@ -24,7 +24,7 @@
|
||||
<MudText Typo="Typo.body1">
|
||||
@this.VersionDatabase
|
||||
</MudText>
|
||||
<MudCollapse Expanded="@showDatabaseDetails">
|
||||
<MudCollapse Expanded="@this.showDatabaseDetails">
|
||||
<MudText Typo="Typo.body1" Class="mt-2 mb-2">
|
||||
@foreach (var item in this.databaseDisplayInfo)
|
||||
{
|
||||
|
||||
@ -6,11 +6,11 @@ public abstract class DatabaseClient(string name, string path)
|
||||
|
||||
private string Path => path;
|
||||
|
||||
protected ILogger<DatabaseClient>? logger;
|
||||
private ILogger<DatabaseClient>? logger;
|
||||
|
||||
public abstract IAsyncEnumerable<(string Label, string Value)> GetDisplayInfo();
|
||||
|
||||
public string GetStorageSize()
|
||||
protected string GetStorageSize()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(this.Path))
|
||||
{
|
||||
@ -29,7 +29,7 @@ public abstract class DatabaseClient(string name, string path)
|
||||
return FormatBytes(size);
|
||||
}
|
||||
|
||||
public static string FormatBytes(long size)
|
||||
private static string FormatBytes(long size)
|
||||
{
|
||||
string[] suffixes = { "B", "KB", "MB", "GB", "TB", "PB" };
|
||||
int suffixIndex = 0;
|
||||
|
||||
@ -26,7 +26,7 @@ public class QdrantClientImplementation : DatabaseClient
|
||||
|
||||
private const string IP_ADDRESS = "localhost";
|
||||
|
||||
public QdrantClient CreateQdrantClient()
|
||||
private QdrantClient CreateQdrantClient()
|
||||
{
|
||||
var address = "https://" + IP_ADDRESS + ":" + this.GrpcPort;
|
||||
var channel = QdrantChannel.ForAddress(address, new ClientConfiguration
|
||||
@ -38,13 +38,13 @@ public class QdrantClientImplementation : DatabaseClient
|
||||
return new QdrantClient(grpcClient);
|
||||
}
|
||||
|
||||
public async Task<string> GetVersion()
|
||||
private async Task<string> GetVersion()
|
||||
{
|
||||
var operation = await this.GrpcClient.HealthAsync();
|
||||
return "v"+operation.Version;
|
||||
}
|
||||
|
||||
public async Task<string> GetCollectionsAmount()
|
||||
private async Task<string> GetCollectionsAmount()
|
||||
{
|
||||
var operation = await this.GrpcClient.ListCollectionsAsync();
|
||||
return operation.Count.ToString();
|
||||
@ -59,8 +59,5 @@ public class QdrantClientImplementation : DatabaseClient
|
||||
yield return ("Amount of collections", await this.GetCollectionsAmount());
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
this.GrpcClient.Dispose();
|
||||
}
|
||||
public override void Dispose() => this.GrpcClient.Dispose();
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user