9fddafa4234eaf2b585d78d148ee5336e4e46d1a
5 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a0bf6c15f4 |
feat(search/rag): implement NexusSearchBox, dynamic Qdrant collection auto-provisioning, batch vector ingestion, mobile Serilog logging, and resolve 401 auth handler error (#51)
Resolves #52 This Pull Request introduces the **NexusSearchBox** search feature with premium unified styling, implements a robust **dynamic Qdrant collection auto-provisioning and batch-vector ingestion pipeline**, integrates a unified **Serilog logging infrastructure** for the Blazor Hybrid environment (MAUI), and resolves the **401 Unauthorized API header propagation error** inside mobile builds. ### 🚀 Key Implementations #### 1. Premium `NexusSearchBox` & Semantic Search UI * **NexusSearchBox Component:** Created an elegant search-as-you-type search box with smooth key navigation, quick-clearing, and seamless dynamic styling. * **Unified Aesthetics:** Refactored the search box isolated styling to align perfectly with the dashboard's design system using glassmorphism, `--nexus-neon` token gradients, and smooth pulse/fade animations. * **Semantic Search Integration:** Integrated semantic search query dispatching (`SearchLibrarySemanticallyQuery`) and wired up navigation seamlessly through the updated `ReaderNavigationService`. * **Tests Hardening:** Added/adapted query assertions in `QueryTests.cs` to guarantee safe parameterization and error boundary mapping. #### 2. Qdrant Collection Provisioning & Vector Ingestion * **Dynamic Auto-Provisioning:** Implemented dynamic checking and lazy-creation of the `knowledge_units` collection using 768 dimensions and Cosine distance. * **High-Performance Ingestion:** Optimized `ProcessKnowledgeUnitsAsync` with high-performance batch embedding generation using `_embeddingGenerator` and deterministic MD5 GUIDs for stable, duplicate-free upsertion. * **Database Cache Clear Sync:** Integrated Qdrant collection deletion in `ClearCacheAsync` to ensure absolute consistency between the PostgreSQL database cache and vector database indices. #### 3. Cross-Platform MAUI Logging (Serilog Infrastructure) * **Serilog Integration:** Configured cross-platform Serilog routing in `SerilogConfiguration.cs`, streaming diagnostic logs safely across native platforms and the Blazor Webview container. * **Interop Bridge:** Built `BlazorLoggingBridge.cs` to capture web console messages and pipe them directly to the native host logger. * **Demo Interface:** Added an interactive `SerilogDemo.razor` sandbox under Pages. #### 4. Resolving 401 Load Errors (Authentication Handler Flow) * **Authentication Header Handler:** Implemented the `MobileAuthenticationHeaderHandler` to correctly extract, validate, and inject bearer JWT tokens into outbound API requests. * **Configuration-based API Host:** Structured standard API URI routing to use clean configuration bindings in `appsettings.json`. --- ### 🧪 Verification & Build Status * Run `dotnet build` from the solution root: Successfully compiled the full multi-targeted solution (`Liczba błędów: 0`). * All unit and integration tests successfully executed and verified (`dotnet test`). --------- Co-authored-by: Marek Jasiński <jasins.marek@gmail.com> Co-authored-by: Marek Jaisński <jasins.marek@gmail.com> Reviewed-on: #51 Co-authored-by: Antigravity <antigravity@google.com> Co-committed-by: Antigravity <antigravity@google.com> |
||
|
|
37bec89484 |
feat: implement central package management and stabilize mobile build (#50)
This pull request implements **Central Package Management (CPM)** across the NexusReader solution to centralize package version definitions, improve package maintainability, and ensure security patch consistency. It also resolves compile issues in the mobile infrastructure and client projects. ### Key Changes #### 1. NuGet Central Package Management (CPM) - Created `Directory.Packages.props` in the solution root containing all solution-wide dependency versions (consolidating 48 packages). - Pinned and secured `Microsoft.Bcl.Memory` to `v9.0.14` to resolve a known high-severity vulnerability (CVE-2026-26127). - Stripped explicit `Version` attributes from `.csproj` files for the core library, web client, web host, UI shared, data access, and testing projects to inherit central version definitions. #### 2. Mobile / MAUI Projects Stabilization - **Workload Support & Locally Disabled CPM**: Disabled Central Package Management locally (`<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>`) in both `NexusReader.Infrastructure.Mobile.csproj` and `NexusReader.Maui.csproj` to preserve native MAUI workload package integration while cleanly referencing package versions manually. - **Ambiguity Resolving**: Added using aliases for `FluentResults.Result` to eliminate compiler ambiguity conflicts between `Android.App.Result` and `FluentResults.Result` inside Android platform service implementations. - **Missing Namespaces Fix**: Added explicit hosting imports (`using Microsoft.Maui; using Microsoft.Maui.Hosting;`) and ensured `Microsoft.Maui.Essentials` references resolve properly in the mobile context. --- ### Verification - **Build**: Successfully built the entire solution with zero compilation errors (`dotnet build NexusReader.slnx --no-restore` -> `Liczba błędów: 0`). - **Tests**: All 7 integration and unit tests run and pass successfully (`dotnet test NexusReader.slnx --no-restore`). --------- Co-authored-by: Marek Jasiński <jasins.marek@gmail.com> Reviewed-on: #50 Reviewed-by: Marek Jaisński <jasins.marek@gmail.com> Co-authored-by: Antigravity <antigravity@google.com> Co-committed-by: Antigravity <antigravity@google.com> |
||
|
|
cb4b7d0052 |
feat(rag): implement KM-RAG retrieval read-path, API endpoints, global Q&A UI, and unit tests (#49)
This Pull Request implements the complete **Retrieval module (Read Path)** for the Knowledge-Map RAG (KM-RAG) architecture within the NexusReader platform. It resolves all requirements for vector-based semantic search, Neo4j graph context expansion, structured grounding with Google Gemini, API/Wasm integration, and an interactive front-end global Q&A panel. Resolves #48 ### 🚀 Key Implementations 1. **Grounded DTOs & Schema Definition** - Added `GroundedResponseDto` and `CitationDto` for strict JSON Schema matching with Gemini. 2. **Core Service & Read Path Logic** - Implemented the robust **5-step pipeline** in `KnowledgeService.AskQuestionAsync`: 1. *Embedding*: Query vectorization using `IEmbeddingGenerator`. 2. *Semantic Search*: Multi-tenant vector search with Qdrant, supporting scoping to a specific book or global search. 3. *Graph Expansion*: Fetching connected concepts and parent relationships using Neo4j Cypher. 4. *Citation Hydration*: Cross-referencing results with PostgreSQL to fetch book titles and accurate chapter citations. 5. *Grounded Generation*: Strict structured generation via `IChatClient` (Gemini) preventing hallucinations and using citations. 3. **CQRS & Endpoints** - Added `AskLibraryQuestionQuery` and its handler. - Mapped `/api/knowledge/ask` and `/api/knowledge/search` endpoints inside `Program.cs`. - Updated `WasmKnowledgeService` to support proxying retrieval requests. 4. **Premium Blazor UI Panel** - Implemented `/intelligence` (Global AI Q&A) with a curated HSL palette, dark theme, smooth micro-animations, loading shimmers, and side-by-side citation cards. - Registered the panel within the `MainHubLayout` sidebar. 5. **Test Coverage** - Wrote comprehensive xUnit tests in `QueryTests.cs` using Moq and FluentAssertions to assert that handlers correctly validate input and interact with services. ### 🧪 Verification - Verified compilation and build gate successfully (`dotnet build`: 0 errors). - All 7 tests passed perfectly (`dotnet test`). --------- Co-authored-by: Marek Jasiński <jasins.marek@gmail.com> Reviewed-on: #49 Reviewed-by: Marek Jaisński <jasins.marek@gmail.com> Co-authored-by: Antigravity <antigravity@google.com> Co-committed-by: Antigravity <antigravity@google.com> |
||
|
|
23acaeb705 |
feat: KM-RAG Polyglot Ingestion Pipeline Migration (#46)
Resolves the KM-RAG Polyglot Persistence and Background Ingestion Pipeline Migration task. ### Key Changes 1. **Infrastructure Migration**: Integrated Qdrant (for vector embeddings) and Neo4j (for concept graphs), reducing reliance on PostgreSQL pgvector storage. 2. **Concurrent Background Job**: Implemented a robust Hangfire `EbookIngestionJob` utilizing Polly exponential retries for transient 429 rate limits, executing three core ingestion tasks concurrently via `Task.WhenAll`. 3. **Data Layer**: Standardized database schemas and entities; retained `Pgvector.EntityFrameworkCore` for migration compilation compatibility. 4. **Wasm Client & Tests**: Implemented client support for semantic search and refactored related tests in `QueryTests.cs` to mock `IKnowledgeService`. ### Verification Status - **Build**: Successfully compiles with `dotnet build NexusReader.slnx --no-restore` (0 errors). - **Tests**: All 5 unit tests pass cleanly with `dotnet test NexusReader.slnx --no-restore`. **Resolve** #47 --------- Co-authored-by: Marek Jasiński <jasins.marek@gmail.com> Reviewed-on: #46 Reviewed-by: Marek Jaisński <jasins.marek@gmail.com> Co-authored-by: Antigravity <antigravity@google.com> Co-committed-by: Antigravity <antigravity@google.com> |
||
|
|
541e9e1fb5 |
feat(ai-ux): deduplicate AI queries, handle ServiceUnavailable retries, and optimize reader canvas graph prerendering (#44)
This Pull Request encapsulates all outstanding AI, Blazor InteractiveAuto lifecycle, pgvector, and Firefox authorization/session compatibility fixes. ### Key Accomplishments: 1. **Concurrent Request Deduplication (Option B):** Implemented a thread-safe active task registry in `KnowledgeService` that groups concurrent graph extraction queries for the same content, preventing duplicate AI calls completely. 2. **Resilience Strategy for Downstream Demands:** Extended the `ai-retry` resilience pipeline to automatically intercept and retry on temporary Google API `503 ServiceUnavailable` / `high demand` spikes. 3. **Interactive Graph Generation Guard (Option A):** Prevented server-side prerender-phase graph requests in the reader canvas component. 4. **Firefox Compatibility & Cookie Handler:** Implemented an authentication endpoint and hybrid hidden-form submission flow to solve login, registration, and logout redirections and cookies securely. 5. **Autoscrolling & Graph Exclusions:** Added concept-to-block smooth scrolling, active block badging, and filtered out markdown code blocks from being extracted as nodes. All unit tests compiled and passed 100% cleanly. --------- Co-authored-by: Marek Jasiński <jasins.marek@gmail.com> Reviewed-on: #44 Co-authored-by: Antigravity <antigravity@google.com> Co-committed-by: Antigravity <antigravity@google.com> |