Add NextGen library: index DB, thumbnails, AI culling, and CLIP search

Builds the "indexed library" foundation and first intelligent features on
top of the organizer (sql.js index, non-destructive in-place indexing).

Phase 0 — Library index:
- sql.js (WASM SQLite) index DB; contentHash-keyed assets, resumable indexing
  (skip by path+mtime), batch persistence (chosen over native better-sqlite3
  which fails to build on Node 24 / Python 3.12)
- Library folders (in place, non-destructive) + background indexer w/ progress
- Thumbnails generated in the AI worker (canvas->webp), cached in userData;
  served via photoai-media://thumb by hash; thumbnail grid w/ pagination

Phase 1 — AI quality assessment & culling:
- Focus (Laplacian variance), exposure (histogram), eyes-open (face-api EAR)
  computed in one analyze pass alongside the thumbnail
- Culling filters (candidate/rejected) + quality badges
- Adjustable thresholds (live SQL re-classification from stored raw scores,
  no re-analysis) + manual star rating (0-5) and color labels (usermeta)

Phase 2 — CLIP natural-language / similarity search:
- @huggingface/transformers (WASM/WebGPU, no native build)
- CLIP image/text embeddings (lazy-loaded); Korean queries auto-translated
  via opus-mt-ko-en into the English CLIP
- Embeddings stored as SQLite BLOBs; "build search index" batch w/ progress;
  brute-force cosine search; new Search tab
- Note: models download from HF Hub on first use; fully-offline ORT-wasm
  packaging and KO search-accuracy tuning are follow-ups

Tabs added (Organize / Library / Search). All typecheck/tests(12)/build green;
boot smoke verified across phases.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 17:32:51 +09:00
parent 6dce580846
commit 72c41ae834
33 changed files with 3136 additions and 358 deletions
+34
View File
@@ -50,6 +50,22 @@ export const DEFAULT_JOB_OPTIONS = {
/** 추론 시 이미지 장변 최대 픽셀 (다운스케일 기준) */
export const MAX_IMAGE_DIMENSION = 1024
/** 썸네일 장변 픽셀 */
export const THUMBNAIL_SIZE = 256
/** 품질 분석 시 이미지 장변 픽셀 (초점/노출/얼굴 계산용) */
export const ANALYZE_SIZE = 512
/** 품질 판정 기본 임계값 (Phase 1) */
export const QUALITY_THRESHOLDS = {
/** 라플라시안 분산이 이 값 미만이면 흐림 (512px 기준) */
focus: 60,
/** 노출 점수(0~1)가 이 값 미만이면 노출 불량 */
exposure: 0.35,
/** EAR(눈 종횡비)이 이 값 미만이면 눈 감음 */
eyes: 0.18
}
/** IPC 채널명 */
export const IPC = {
// UI → Main (invoke)
@@ -73,6 +89,24 @@ export const IPC = {
SETTINGS_GET: 'settings:get',
SETTINGS_SET: 'settings:set',
SETTINGS_CHANGED: 'settings:changed',
// 라이브러리 / 색인 (Phase 0)
LIBRARY_LIST: 'library:list',
LIBRARY_ADD: 'library:add',
LIBRARY_REMOVE: 'library:remove',
INDEX_RUN: 'index:run',
INDEX_CANCEL: 'index:cancel',
INDEX_PROGRESS: 'index:progress',
INDEX_DONE: 'index:done',
INDEX_ASSETS: 'index:assets',
INDEX_SET_RATING: 'index:setRating',
INDEX_SET_LABEL: 'index:setLabel',
// 검색 (Phase 2)
SEARCH_BUILD: 'search:build',
SEARCH_CANCEL: 'search:cancel',
SEARCH_STATUS: 'search:status',
SEARCH_QUERY: 'search:query',
SEARCH_PROGRESS: 'search:progress',
SEARCH_DONE: 'search:done',
// Main → UI (send)
JOB_PROGRESS: 'job:progress',
JOB_FILE_PROCESSED: 'job:fileProcessed',