feat(recommendations): implement contextual recommendation engine #76

Merged
mjasin merged 5 commits from feature/global-intelligence-qa into develop 2026-06-06 13:38:49 +00:00

5 Commits

Author SHA1 Message Date
Antigravity f7dc3b3137 fix: resolve all 10 review items from PR #76 (#77)
## Summary

Resolves all 10 review recommendations from the review on PR #76.

## Review Items Addressed

| # | Item | Status |
|---|------|--------|
| 1 | Unit tests for query handler |  Already done (30 tests) |
| 2 | Log exceptions in handler |  `ILogger<GetContextualRecommendationsQueryHandler>` added |
| 3 | Guard empty embedding text |  Early return + empty vector guard in `VectorSearchStore` |
| 4 | Refine collection creation error handling |  Logs creation events and non-fatal errors |
| 5 | Replace `Console.WriteLine` with `ILogger` |  Fixed in 7 components/pages |
| 6 | Abstract HTTP calls behind a service |  `IRecommendationService` + `RecommendationService` |
| 7 | Verify CSS uses design tokens |  `ContextualRecommendationsWidget.razor.css` uses `var(--nexus-*)` |
| 8 | Add loading spinner |  Animated spinner in `ContextualRecommendationsWidget` |
| 9 | Document XML comments |  `<summary>` docs on handler, interface, service |
| 10 | Benchmark vector search latency |  `Stopwatch` around embedding and Qdrant search |

## New Files
- `IRecommendationService.cs` — Application-layer abstraction
- `RecommendationService.cs` — WASM HTTP implementation (AOT-safe)
- `ContextualRecommendationsWidget.razor` — Dashboard UI widget with spinner
- `ContextualRecommendationsWidget.razor.css` — Design-token CSS

## Build
 `dotnet build NexusReader.slnx --no-restore` — 0 errors, 5 pre-existing warnings

Closes review: #76 (comment)

---------

Co-authored-by: Marek Jasiński <jasins.marek@gmail.com>
Reviewed-on: #77
Co-authored-by: Antigravity <antigravity@google.com>
Co-committed-by: Antigravity <antigravity@google.com>
2026-06-06 13:38:34 +00:00
mjasin 94f6fe366d feat(recommendations): refactor handler to use clean IVectorSearchStore abstraction and fix unit tests 2026-06-06 11:28:14 +02:00
mjasin e9bb51af77 feat(ui): implement client-side [PAYWALL_TRIGGER] token parser, styling and tests 2026-06-06 11:07:21 +02:00
mjasin 93133a49b6 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
2026-06-06 10:55:58 +02:00
mjasin faf6ec826e feat(intelligence): implement Global AI Q&A screen and paywall blocker
- Implemented standard empty and active chat conversation states for the `/intelligence` page
- Created interactive `AiResponseRenderer` with AOT-compliant sentence splitting and payment gateway simulation
- Added scoped `LibraryStateService` to synchronize book ownership and updates across the application
- Obfuscated paywalled content in DOM to prevent inspection bypass
- Fixed local port connection mismatch by updating API configurations to use port 5104
2026-06-06 10:41:48 +02:00