openpencil/apps/web
Fini 6047e743b2 fix(ai): query mining + enqueue path for heuristic image-area frames
Why: b9b4126b's collectImageSearchTargets returns heuristic-matched
frames (named "Image" / "Photo" / "Cover" without the canonical
role) but two downstream code paths quietly dropped them:

1. enqueueImageForSearch only accepted type==='image' or
   isUnfilledImagePlaceholderFrame, so the heuristic frames got past
   collect but never reached the queue.

2. extractQueryForNode would have returned the literal name "Image" or
   "Photo" — useless to the photo search API. The user's "Bella Italia"
   restaurant card never gets a relevant photo because the placeholder
   frame's name says nothing about the restaurant.

What:
- enqueueImageForSearch grows a third branch: isImageAreaFrameByHeuristic
  → kind: 'placeholder-frame'. Same kind so the rest of the pipeline
  treats it identically to a canonical placeholder.
- extractQueryForNode learns to skip "generic" placeholder names
  (Image / Photo / Cover / Hero / Thumbnail / Banner / Poster + a few
  variants) and walk up to the nearest semantic parent frame name
  ("Bella Italia" / "Margherita Pizza" / "Sushi House" — whatever the
  enclosing card was named). Bounded to 3 hops. Filters layout words
  (Card / Wrapper / Container / Section / Frame / Root / Page / Stack /
  Row / Column / Content) so we don't end up searching for "Card".
- A new helper findParentSemanticName builds a parent map from the
  live document on demand. Cheap for typical designs (< few hundred
  nodes); avoids threading parent through every collect / enqueue call
  site.

Net effect: a model-emitted plain "Image" frame inside a "Bella Italia"
card now searches for "Bella Italia" instead of literally "Image". The
existing isImageAreaFrameByHeuristic test coverage protects the entry
condition; 1098 / 1098 AI service tests still pass.
2026-05-09 20:59:50 +08:00
..
public V0.5.0 (#67) 2026-03-22 09:44:04 +08:00
server fix(ai): explicit skipped reason for builtin providers in vision validate 2026-05-09 20:59:34 +08:00
src fix(ai): query mining + enqueue path for heuristic image-area frames 2026-05-09 20:59:50 +08:00
CLAUDE.md V0.7.0 (#95) 2026-04-11 23:25:13 +08:00
components.json V0.7.0 (#95) 2026-04-11 23:25:13 +08:00
dev.ts V0.7.2-bugfix (#109) 2026-04-14 21:42:56 +08:00
package.json fix(ai): proxy dispatcher uses ESM import, actually installs in dev path 2026-05-05 12:22:40 +08:00
tsconfig.json V0.7.2-bugfix (#109) 2026-04-14 21:42:56 +08:00
vite.config.ts feat(ab-corpus): retry transient errors on ark + deepseek 2026-04-29 07:15:00 +08:00