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:
@@ -1,10 +1,13 @@
|
||||
@using NexusReader.UI.Shared.Services
|
||||
@using NexusReader.Application.Abstractions.Services
|
||||
@using Microsoft.Extensions.Logging
|
||||
@using System.Linq
|
||||
@inject IFocusModeService FocusMode
|
||||
@inject IIdentityService IdentityService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IThemeService ThemeService
|
||||
@inject IKnowledgeService KnowledgeService
|
||||
@inject ILogger<IntelligenceToolbar> Logger
|
||||
@implements IDisposable
|
||||
|
||||
<aside class="intelligence-toolbar">
|
||||
@@ -51,11 +54,15 @@
|
||||
|
||||
private async Task HandleClearCache()
|
||||
{
|
||||
Console.WriteLine("[IntelligenceToolbar] Requesting cache clear...");
|
||||
Logger.LogInformation("[IntelligenceToolbar] Requesting cache clear...");
|
||||
var result = await KnowledgeService.ClearCacheAsync();
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
Console.WriteLine("[IntelligenceToolbar] Cache cleared successfully!");
|
||||
Logger.LogInformation("[IntelligenceToolbar] Cache cleared successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning("[IntelligenceToolbar] Cache clear failed: {Errors}", string.Join("; ", result.Errors.Select(e => e.Message)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user