Implement Contextual Recommendation Engine for Desktop Dashboard #75

Closed
opened 2026-06-06 12:18:49 +00:00 by Antigravity · 0 comments
Collaborator

Goal

Implement a contextual recommendation engine for the desktop dashboard to drive user retention and cross-book monetization, strictly complying with Clean Architecture, Layer Isolation, and Native AOT compilation.

Requirements

  1. Context Discovery (Graph & Relational):
    • Abstraction interface IUserReadingStateStore in Application to fetch user active reading state (book, chapter, tenant) and chapter content.
    • UserReadingStateStore implementation in Infrastructure using EF Core.
  2. MediatR Query:
    • GetContextualRecommendationsQuery and handler.
    • Separate query DTOs in Application.
    • Place query handler in Infrastructure to isolate Qdrant gRPC client dependencies, using a decoupled IVectorSearchStore interface.
  3. Similarity Search with Exclusions:
    • Vector similarity search (top 2 chunks) strictly excluding current BookId via Qdrant's MustNot filter.
    • Retrieve bookTitle and chapterTitle directly from the point payload without DB joins.
  4. Upsell Mapping:
    • Cross-reference owned publications to flag recommended items with IsPremiumUpsell = true if not owned.
  5. Web API:
    • Register types in AppJsonContext.cs for Native AOT.
    • Map GET /api/recommendations endpoint.
  6. Tests:
    • Create unit tests verifying the correctness of fallback/empty and recommendation/upsell mappings.
### Goal Implement a contextual recommendation engine for the desktop dashboard to drive user retention and cross-book monetization, strictly complying with Clean Architecture, Layer Isolation, and Native AOT compilation. ### Requirements 1. **Context Discovery (Graph & Relational)**: - Abstraction interface `IUserReadingStateStore` in Application to fetch user active reading state (book, chapter, tenant) and chapter content. - `UserReadingStateStore` implementation in Infrastructure using EF Core. 2. **MediatR Query**: - `GetContextualRecommendationsQuery` and handler. - Separate query DTOs in Application. - Place query handler in Infrastructure to isolate Qdrant gRPC client dependencies, using a decoupled `IVectorSearchStore` interface. 3. **Similarity Search with Exclusions**: - Vector similarity search (top 2 chunks) strictly excluding current `BookId` via Qdrant's `MustNot` filter. - Retrieve `bookTitle` and `chapterTitle` directly from the point payload without DB joins. 4. **Upsell Mapping**: - Cross-reference owned publications to flag recommended items with `IsPremiumUpsell = true` if not owned. 5. **Web API**: - Register types in `AppJsonContext.cs` for Native AOT. - Map `GET /api/recommendations` endpoint. 6. **Tests**: - Create unit tests verifying the correctness of fallback/empty and recommendation/upsell mappings.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mjasin/Nexus.Reader#75