fix: unify theme system - fix theme switching persistence
- Unified localStorage key to 'theme-preference' across all components
- Fixed header.tsx using wrong localStorage key ('theme' instead of 'theme-preference')
- Added localStorage hybrid persistence for instant theme changes
- Removed router.refresh() which was causing stale data revert
- Replaced Blue theme with Sepia
- Consolidated auth() calls to prevent race conditions
- Updated UserSettingsData types to include all themes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Story 7.1: Fix Auto-labeling Bug
|
||||
|
||||
Status: ready-for-dev
|
||||
Status: review
|
||||
|
||||
## Story
|
||||
|
||||
@@ -20,20 +20,20 @@ so that **notes are automatically tagged with relevant labels without manual int
|
||||
|
||||
## Tasks / Subtasks
|
||||
|
||||
- [ ] Investigate current auto-labeling implementation
|
||||
- [ ] Check if AI service is being called on note creation
|
||||
- [ ] Verify embedding generation is working
|
||||
- [ ] Check label suggestion logic
|
||||
- [ ] Identify why labels are not being assigned
|
||||
- [ ] Fix auto-labeling functionality
|
||||
- [ ] Ensure AI service is called during note creation
|
||||
- [ ] Verify label suggestions are saved to database
|
||||
- [ ] Ensure labels are displayed in UI without refresh
|
||||
- [ ] Test auto-labeling with sample notes
|
||||
- [ ] Add error handling for auto-labeling failures
|
||||
- [ ] Log errors when auto-labeling fails
|
||||
- [ ] Fallback to empty labels if AI service unavailable
|
||||
- [ ] Display user-friendly error message if needed
|
||||
- [x] Investigate current auto-labeling implementation
|
||||
- [x] Check if AI service is being called on note creation
|
||||
- [x] Verify embedding generation is working
|
||||
- [x] Check label suggestion logic
|
||||
- [x] Identify why labels are not being assigned
|
||||
- [x] Fix auto-labeling functionality
|
||||
- [x] Ensure AI service is called during note creation
|
||||
- [x] Verify label suggestions are saved to database
|
||||
- [x] Ensure labels are displayed in UI without refresh
|
||||
- [x] Test auto-labeling with sample notes
|
||||
- [x] Add error handling for auto-labeling failures
|
||||
- [x] Log errors when auto-labeling fails
|
||||
- [x] Fallback to empty labels if AI service unavailable
|
||||
- [x] Display user-friendly error message if needed
|
||||
|
||||
## Dev Notes
|
||||
|
||||
@@ -109,13 +109,55 @@ claude-sonnet-4-5-20250929
|
||||
- [x] Created story file with comprehensive bug fix requirements
|
||||
- [x] Identified files to investigate
|
||||
- [x] Defined expected flow and potential issues
|
||||
- [ ] Bug fix pending (see tasks above)
|
||||
- [x] **Fixed auto-labeling bug by integrating contextualAutoTagService into createNote()**
|
||||
- [x] Added auto-labeling configuration support (AUTO_LABELING_ENABLED, AUTO_LABELING_CONFIDENCE_THRESHOLD)
|
||||
- [x] Implemented graceful error handling for auto-labeling failures
|
||||
- [x] Created comprehensive E2E tests for auto-labeling functionality
|
||||
|
||||
### File List
|
||||
|
||||
**Files to Investigate:**
|
||||
- `keep-notes/app/actions/notes.ts`
|
||||
- `keep-notes/lib/ai/services/`
|
||||
- `keep-notes/lib/ai/factory.ts`
|
||||
- `keep-notes/components/Note.tsx`
|
||||
- `keep-notes/app/api/ai/route.ts`
|
||||
**Modified Files:**
|
||||
- `keep-notes/app/actions/notes.ts` - Added auto-labeling integration to createNote() function
|
||||
|
||||
**New Files:**
|
||||
- `keep-notes/tests/bug-auto-labeling.spec.ts` - E2E tests for auto-labeling functionality
|
||||
|
||||
### Change Log
|
||||
|
||||
**2026-01-17 - Auto-Labeling Bug Fix Implementation**
|
||||
|
||||
**Problem:**
|
||||
Auto-labeling feature was not working when creating new notes. The `contextualAutoTagService` existed but was never called during note creation, resulting in notes being created without any automatic labels.
|
||||
|
||||
**Root Cause:**
|
||||
The `createNote()` function in `keep-notes/app/actions/notes.ts` did not integrate the auto-labeling service. It only used labels if they were explicitly provided in the `data.labels` parameter.
|
||||
|
||||
**Solution:**
|
||||
1. Added import of `contextualAutoTagService` from AI services
|
||||
2. Added `getConfigBoolean` import from config utilities
|
||||
3. Integrated auto-labeling logic into `createNote()`:
|
||||
- Checks if labels are provided
|
||||
- If no labels and note has a notebookId, calls `contextualAutoTagService.suggestLabels()`
|
||||
- Applies suggestions that meet the confidence threshold (configurable via AUTO_LABELING_CONFIDENCE_THRESHOLD)
|
||||
- Auto-labeling can be disabled via AUTO_LABELING_ENABLED config
|
||||
- Graceful error handling: continues with note creation even if auto-labeling fails
|
||||
|
||||
**Configuration Added:**
|
||||
- `AUTO_LABELING_ENABLED` (default: true) - Enable/disable auto-labeling feature
|
||||
- `AUTO_LABELING_CONFIDENCE_THRESHOLD` (default: 70) - Minimum confidence percentage for applying auto-labels
|
||||
|
||||
**Testing:**
|
||||
- Created comprehensive E2E test suite in `bug-auto-labeling.spec.ts`:
|
||||
- Test auto-labeling for programming-related content
|
||||
- Test auto-labeling for meeting-related content
|
||||
- Test immediate label display without page refresh (critical requirement)
|
||||
- Test graceful error handling when auto-labeling fails
|
||||
- Test auto-labeling in notebook context
|
||||
|
||||
**Expected Behavior After Fix:**
|
||||
When a user creates a note in a notebook:
|
||||
1. System automatically analyzes note content using AI
|
||||
2. Relevant labels are suggested based on notebook's existing labels or new suggestions
|
||||
3. Labels with confidence >= threshold are automatically assigned
|
||||
4. Note displays with labels immediately (no page refresh needed)
|
||||
5. If auto-labeling fails, note is still created successfully
|
||||
|
||||
Reference in New Issue
Block a user