mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-15 07:21:38 +00:00
Formatting
This commit is contained in:
parent
1dcfd19f72
commit
3f7b230e6b
@ -44,7 +44,8 @@ public static class Qdrant
|
|||||||
{
|
{
|
||||||
using var archive = new ZipArchive(zStream, ZipArchiveMode.Read);
|
using var archive = new ZipArchive(zStream, ZipArchiveMode.Read);
|
||||||
archive.ExtractToDirectory(qdrantTmpExtractPath.FullName, overwriteFiles: true);
|
archive.ExtractToDirectory(qdrantTmpExtractPath.FullName, overwriteFiles: true);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
await using var uncompressedStream = new GZipStream(zStream, CompressionMode.Decompress);
|
await using var uncompressedStream = new GZipStream(zStream, CompressionMode.Decompress);
|
||||||
await TarFile.ExtractToDirectoryAsync(uncompressedStream, qdrantTmpExtractPath.FullName, true);
|
await TarFile.ExtractToDirectoryAsync(uncompressedStream, qdrantTmpExtractPath.FullName, true);
|
||||||
@ -63,7 +64,7 @@ public static class Qdrant
|
|||||||
}
|
}
|
||||||
|
|
||||||
var qdrantDBSourcePath = Path.Join(qdrantTmpExtractPath.FullName, database.Path);
|
var qdrantDBSourcePath = Path.Join(qdrantTmpExtractPath.FullName, database.Path);
|
||||||
var qdrantDBTargetPath = Path.Join(cwd, "resources", "databases", "qdrant",database.Filename);
|
var qdrantDBTargetPath = Path.Join(cwd, "resources", "databases", "qdrant", database.Filename);
|
||||||
if (!File.Exists(qdrantDBSourcePath))
|
if (!File.Exists(qdrantDBSourcePath))
|
||||||
{
|
{
|
||||||
Console.WriteLine($" failed to find the database file '{qdrantDBSourcePath}'");
|
Console.WriteLine($" failed to find the database file '{qdrantDBSourcePath}'");
|
||||||
|
|||||||
@ -3,7 +3,9 @@
|
|||||||
public abstract class DatabaseClient(string name, string path)
|
public abstract class DatabaseClient(string name, string path)
|
||||||
{
|
{
|
||||||
public string Name => name;
|
public string Name => name;
|
||||||
|
|
||||||
private string Path => path;
|
private string Path => path;
|
||||||
|
|
||||||
protected ILogger<DatabaseClient>? logger;
|
protected ILogger<DatabaseClient>? logger;
|
||||||
|
|
||||||
public abstract IAsyncEnumerable<(string Label, string Value)> GetDisplayInfo();
|
public abstract IAsyncEnumerable<(string Label, string Value)> GetDisplayInfo();
|
||||||
|
|||||||
@ -6,10 +6,13 @@ namespace AIStudio.Tools.Databases.Qdrant;
|
|||||||
public class QdrantClientImplementation : DatabaseClient
|
public class QdrantClientImplementation : DatabaseClient
|
||||||
{
|
{
|
||||||
private int HttpPort { get; }
|
private int HttpPort { get; }
|
||||||
|
|
||||||
private int GrpcPort { get; }
|
private int GrpcPort { get; }
|
||||||
private string IpAddress => "localhost";
|
private string IpAddress => "localhost";
|
||||||
private QdrantClient GrpcClient { get; }
|
private QdrantClient GrpcClient { get; }
|
||||||
|
|
||||||
private string Fingerprint { get; }
|
private string Fingerprint { get; }
|
||||||
|
|
||||||
private string ApiToken { get; }
|
private string ApiToken { get; }
|
||||||
|
|
||||||
public QdrantClientImplementation(string name, string path, int httpPort, int grpcPort, string fingerprint, string apiToken): base(name, path)
|
public QdrantClientImplementation(string name, string path, int httpPort, int grpcPort, string fingerprint, string apiToken): base(name, path)
|
||||||
|
|||||||
@ -8,8 +8,12 @@
|
|||||||
public record struct QdrantInfo
|
public record struct QdrantInfo
|
||||||
{
|
{
|
||||||
public string Path { get; init; }
|
public string Path { get; init; }
|
||||||
|
|
||||||
public int PortHttp { get; init; }
|
public int PortHttp { get; init; }
|
||||||
|
|
||||||
public int PortGrpc { get; init; }
|
public int PortGrpc { get; init; }
|
||||||
|
|
||||||
public string Fingerprint { get; init; }
|
public string Fingerprint { get; init; }
|
||||||
|
|
||||||
public string ApiToken { get; init; }
|
public string ApiToken { get; init; }
|
||||||
}
|
}
|
||||||
@ -106,10 +106,12 @@ pub fn start_qdrant_server() {
|
|||||||
} else {
|
} else {
|
||||||
debug!(Source = "Qdrant Server"; "{line}");
|
debug!(Source = "Qdrant Server"; "{line}");
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
CommandEvent::Stderr(line) => {
|
CommandEvent::Stderr(line) => {
|
||||||
error!(Source = "Qdrant Server (stderr)"; "{line}");
|
error!(Source = "Qdrant Server (stderr)"; "{line}");
|
||||||
}
|
},
|
||||||
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,9 +134,7 @@ pub fn stop_qdrant_server() {
|
|||||||
|
|
||||||
pub fn create_temp_tls_files(path: PathBuf) -> Result<(PathBuf, PathBuf), Box<dyn std::error::Error>> {
|
pub fn create_temp_tls_files(path: PathBuf) -> Result<(PathBuf, PathBuf), Box<dyn std::error::Error>> {
|
||||||
let (certificate, cert_private_key, cert_fingerprint) = generate_certificate();
|
let (certificate, cert_private_key, cert_fingerprint) = generate_certificate();
|
||||||
|
|
||||||
let temp_dir = init_tmpdir_in(path);
|
let temp_dir = init_tmpdir_in(path);
|
||||||
|
|
||||||
let cert_path = temp_dir.join("cert.pem");
|
let cert_path = temp_dir.join("cert.pem");
|
||||||
let key_path = temp_dir.join("key.pem");
|
let key_path = temp_dir.join("key.pem");
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user