fix: resolve PR #76 review recommendations

- Add ILogger<GetContextualRecommendationsQueryHandler> with structured logging
- Guard empty embedding text in VectorSearchStore (return empty vector, skip search)
- Benchmark vector search and embedding latency with Stopwatch (LogDebug/LogInfo)
- Refine EnsureCollectionExistsAsync: log creation events and non-fatal errors
- Replace all Console.WriteLine with ILogger in UI components (AiAssistantBubble,
  AiResponseRenderer, IntelligenceToolbar, SelectionAiPanel, Catalog, Intelligence, MyBooks)
- Create IRecommendationService abstraction + RecommendationService WASM implementation
- Register IRecommendationService in Web.Client DI
- Add ContextualRecommendationsWidget component with loading spinner and design tokens
- Add ContextualRecommendationsWidget to Dashboard.razor
- Update test constructor with ILogger mock for GetContextualRecommendationsQueryHandler

Closes review items: 2, 3, 4, 5, 6, 7, 8, 9, 10
Item 1 (unit tests) was already completed in previous session
This commit is contained in:
2026-06-06 14:54:44 +02:00
parent 94f6fe366d
commit ce4687ee93
17 changed files with 549 additions and 21 deletions
@@ -4,10 +4,12 @@
@using NexusReader.UI.Shared.Components.Organisms
@using NexusReader.Application.DTOs.User
@using NexusReader.UI.Shared.Services
@using Microsoft.Extensions.Logging
@using System.Net.Http.Json
@inject HttpClient Http
@inject IReaderNavigationService ReaderNavigation
@inject ILibraryStateService LibraryStateService
@inject ILogger<MyBooks> Logger
<div class="my-books-page">
<header class="my-books-header">
@@ -140,7 +142,7 @@
}
catch (Exception ex)
{
Console.WriteLine($"[MyBooks] Failed to load books: {ex.Message}");
Logger.LogError(ex, "[MyBooks] Failed to load books.");
if (OperatingSystem.IsBrowser())
{
_isLoading = false;