feat(intelligence): implement global hybrid search engine and monetization logic
- Created IUserLibraryStore and IVectorSearchStore abstractions to decouple relational DB and Qdrant gRPC logic from Application Layer - Implemented MediatR GetGlobalIntelligenceQuery with value-first teaser RAG monetization logic - Registered new request and response DTOs in AppJsonContext for Native AOT source-generated serialization - Bound RagMonetizationOptions via IOptions pattern in appsettings.json configuration - Added POST /api/intelligence endpoint on server and implemented GetGlobalIntelligenceAsync in WASM client service - Refactored Intelligence.razor to consume the backend-driven global hybrid search Q&A engine
This commit is contained in:
@@ -36,6 +36,11 @@ builder.Services.AddRazorComponents()
|
||||
.AddInteractiveServerComponents()
|
||||
.AddInteractiveWebAssemblyComponents();
|
||||
|
||||
builder.Services.ConfigureHttpJsonOptions(options =>
|
||||
{
|
||||
options.SerializerOptions.TypeInfoResolverChain.Insert(0, NexusReader.Application.Common.AppJsonContext.Default);
|
||||
});
|
||||
|
||||
// Enable detailed circuit errors for Server‑Side Blazor components
|
||||
builder.Services.AddServerSideBlazor()
|
||||
.AddCircuitOptions(options =>
|
||||
@@ -415,6 +420,23 @@ knowledgeApi.MapDelete("/", async (IKnowledgeService knowledgeService) =>
|
||||
return Results.BadRequest(errorMsg);
|
||||
});
|
||||
|
||||
app.MapPost("/api/intelligence", async (
|
||||
[FromBody] NexusReader.Application.Queries.Intelligence.GetGlobalIntelligenceRequest request,
|
||||
ClaimsPrincipal user,
|
||||
IMediator mediator) =>
|
||||
{
|
||||
var userId = user.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (string.IsNullOrEmpty(userId)) return Results.Unauthorized();
|
||||
|
||||
var tenantId = user.FindFirstValue("TenantId") ?? "global";
|
||||
|
||||
var result = await mediator.Send(new NexusReader.Application.Queries.Intelligence.GetGlobalIntelligenceQuery(request.QueryText, userId, tenantId));
|
||||
if (result.IsSuccess) return Results.Ok(result.Value);
|
||||
|
||||
var errorMsg = result.Errors.Count > 0 ? result.Errors[0].Message : "Failed to execute global intelligence query";
|
||||
return Results.BadRequest(errorMsg);
|
||||
}).RequireAuthorization();
|
||||
|
||||
app.MapPost("/api/library/ingest", async ([FromBody] IngestEbookRequest request, ClaimsPrincipal user, IMediator mediator) =>
|
||||
{
|
||||
var userId = user.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
Reference in New Issue
Block a user