mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-07 02:49:40 +00:00
Upgrade Qdrant Edge to 0.8.0 and make unreadable vector stores repairable (#982)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
This commit is contained in:
1 parent
557d0b1409
commit
e9aaff5774
26 files changed
+750
-571
No files matched your search
@@ -1,7 +1,18 @@
|
||||
using AIStudio.Tools.Databases.VectorStore;
|
||||
|
||||
namespace AIStudio.Tools.Services;
|
||||
|
||||
public sealed partial class RustService
|
||||
{
|
||||
/// <summary>
|
||||
/// The issue code the Rust runtime sends when a vector store is there, but cannot be opened.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Mirrors ISSUE_CODE_STORE_UNREADABLE in runtime/src/qdrant_edge_database.rs. Reading the code
|
||||
/// rather than the message is what keeps a reworded message on the Rust side harmless here.
|
||||
/// </remarks>
|
||||
private const string ISSUE_CODE_STORE_UNREADABLE = "store-unreadable";
|
||||
|
||||
public async Task<TDatabaseInfo> GetDatabaseInfo<TDatabaseInfo>(
|
||||
string databaseName,
|
||||
string infoPath,
|
||||
@@ -46,7 +57,7 @@ public sealed partial class RustService
|
||||
|
||||
var operation = await response.Content.ReadFromJsonAsync<DatabaseOperationResponse>(this.jsonRustSerializerOptions, cts.Token);
|
||||
if (operation is not { Success: true })
|
||||
throw new InvalidOperationException(operation?.Issue ?? $"The {databaseName} operation failed.");
|
||||
throw CreateDatabaseException(operation?.Issue, operation?.IssueCode, $"The {databaseName} operation failed.");
|
||||
}
|
||||
|
||||
public async Task<TResult?> ExecuteDatabaseQuery<TRequest, TResult>(string databaseName, string path, TRequest request, CancellationToken cancellationToken = default)
|
||||
@@ -59,12 +70,31 @@ public sealed partial class RustService
|
||||
|
||||
var operation = await response.Content.ReadFromJsonAsync<DatabaseQueryResponse<TResult>>(this.jsonRustSerializerOptions, cts.Token);
|
||||
if (operation is not { Success: true })
|
||||
throw new InvalidOperationException(operation?.Issue ?? $"The {databaseName} query failed.");
|
||||
throw CreateDatabaseException(operation?.Issue, operation?.IssueCode, $"The {databaseName} query failed.");
|
||||
|
||||
return operation.Data;
|
||||
}
|
||||
|
||||
private sealed record DatabaseOperationResponse(bool Success, string Issue);
|
||||
/// <summary>
|
||||
/// Turns a failed database response into the exception which fits its issue code.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Almost every failure says all it has to say in its message. A store which cannot be opened is
|
||||
/// the exception: the only way out of it is a rebuild which costs the user money and time, so it
|
||||
/// gets a type of its own and reaches the places which can offer that rebuild instead of
|
||||
/// starting it unasked.
|
||||
/// </remarks>
|
||||
private static Exception CreateDatabaseException(string? issue, string? issueCode, string fallbackMessage)
|
||||
{
|
||||
var message = string.IsNullOrWhiteSpace(issue) ? fallbackMessage : issue;
|
||||
return issueCode switch
|
||||
{
|
||||
ISSUE_CODE_STORE_UNREADABLE => new VectorStoreUnreadableException(message),
|
||||
_ => new InvalidOperationException(message),
|
||||
};
|
||||
}
|
||||
|
||||
private sealed record DatabaseQueryResponse<TResult>(bool Success, string Issue, TResult? Data);
|
||||
private sealed record DatabaseOperationResponse(bool Success, string Issue, string IssueCode);
|
||||
|
||||
private sealed record DatabaseQueryResponse<TResult>(bool Success, string Issue, string IssueCode, TResult? Data);
|
||||
}
|
||||
Reference in new issue
Block a user