docs: lock inference review — prompts, Call 1/2, feat tags
Restore CONTENT-WOO, add PROMPTS.md, and align PRD/architecture/API with inference decisions: prompt files on disk, 0.7 confidence gate, species constrained to Woo leaves, Call 2 prose-only + templates, feat-* tags, and inference_enabled gating.
This commit is contained in:
+35
-15
@@ -20,16 +20,20 @@ publish pipeline.
|
||||
1. No calibration photos — user manually enters SKU, length, thickness.
|
||||
2. First photo is the measurement photo (must be top-down, lens parallel to broad side).
|
||||
3. All photos go through background removal + 80% frame-fill crop.
|
||||
4. Output: transparent PNGs, minimum 1600 px on the smaller dimension, aspect ratio preserved.
|
||||
4. Output: transparent PNGs, minimum 1600 px on the smaller dimension,
|
||||
cropped to 3:4 portrait (W:H 3:4 = 4:3 portrait) to match the WooCommerce
|
||||
template; configurable in settings.
|
||||
5. Green or black sheet — algorithm auto-detects background color from image borders.
|
||||
6. WooCommerce categories synced from store: Species (1 required, leaf-only), Wood Category (1+ required, leaf-only).
|
||||
7. WooCommerce attributes: Edge Type (1 required), Figure (1+ required), Grade (1+ required), Thickness (1 required, rounded up to nearest Woo attribute range).
|
||||
8. WooCommerce tags: fig-* only (1+ required, e.g., fig-chat = Chatoyant).
|
||||
8. WooCommerce tags: fig-* and feat-* only (1+ required, e.g., fig-chat, feat-makcr).
|
||||
WooCommerce is the authoritative source; the design does not duplicate tag lists.
|
||||
9. Two-call inference: Call 1 (vision, wood expert) → Call 2 (text, content gen). Both configurable.
|
||||
10. Call 1 runs automatically after calibration. User reviews/corrects before triggering Call 2.
|
||||
10. Call 1 runs automatically after calibration **only if** inference is enabled.
|
||||
User reviews/corrects before triggering Call 2.
|
||||
11. Inference timeout >45s or non-200 → error with retry. User can fill fields manually.
|
||||
12. Woo product status set to "published" by default (configurable in settings).
|
||||
13. All inference prompts stored server-side, editable in settings with reset-to-default.
|
||||
13. Inference prompts are server-side text files, read fresh on each invocation.
|
||||
14. Brand voice + GEO context injected into Call 2 prompt.
|
||||
15. WooCommerce credentials (username + App Password) stored client-side in settings.
|
||||
16. Inference endpoint: configurable OpenAI-compatible API (user provides base URL, key, model).
|
||||
@@ -94,8 +98,8 @@ publish pipeline.
|
||||
- **FR3:** App detects background color from image borders (green or black sheet).
|
||||
- **FR4:** First photo: BG removal - find longest dimension - compute scale
|
||||
(longest_px / user-length) - compute area (sqft) - bdft = sqft * thickness / 12.
|
||||
- **FR5:** All photos: BG removal - crop to 80% frame fill - save as transparent PNG,
|
||||
minimum 1600 px on smaller dimension, aspect ratio preserved.
|
||||
- **FR5:** All photos: BG removal - crop to 80% frame fill - save as transparent
|
||||
PNG, minimum 1600 px on smaller dimension, 3:4 portrait crop (configurable).
|
||||
- **FR6:** User can retake the first photo or abort and start fresh.
|
||||
|
||||
### Dimensions and calculations
|
||||
@@ -124,22 +128,38 @@ publish pipeline.
|
||||
### Inference (two-call architecture)
|
||||
- **FR22:** Call 1 (vision): auto-run after calibration. Input: all inventory photos
|
||||
(downscaled to 1024px max, using original pre-crop photos), user metadata, synced
|
||||
Woo taxonomy. Output: species, wood categories, edge type, figure, grade,
|
||||
character/inclusions/voids/checks with severity, top 3 wood categories with
|
||||
confidence. If no species match above threshold, omit and require manual selection.
|
||||
- **FR23:** Call 2 (text): user-triggered after Call 1 curation. Input: deterministic
|
||||
data + Call 1 results + brand voice + GEO context. Output: title, description,
|
||||
short description.
|
||||
- **FR24:** Inference prompts stored server-side, editable in settings, reset-to-default available.
|
||||
Woo taxonomy. Output: species, wood categories, edge type, figure, grade —
|
||||
selected from Woo taxonomy, each with a confidence score. The model is
|
||||
constrained to choose from the synced Woo taxonomy lists.
|
||||
- **FR22a:** Confidence threshold: 0.7. If the model's confidence for any field
|
||||
is below 0.7, the field is left blank and requires manual user selection.
|
||||
Threshold is configurable in settings for tuning.
|
||||
- **FR22b:** Species bias: the prompt includes the full Woo species leaf list,
|
||||
constraining the model to select from known species only. This prevents
|
||||
hallucinated species and significantly improves accuracy.
|
||||
- **FR22c:** Free-text observations: character, inclusions, voids, and checks
|
||||
are free-text observations. The server maps them to Woo `feat-*` product
|
||||
tags after the call returns. WooCommerce is the authoritative source for
|
||||
feat-* tag definitions; the design does not duplicate them.
|
||||
- **FR23:** Call 2 (text): user-triggered. Can use curated Call 1 results OR
|
||||
manually-entered taxonomy. The LLM writes only descriptive prose
|
||||
(character, color, grain, use cases). The server assembles the final title,
|
||||
short description, and full description from deterministic templates with the
|
||||
LLM prose injected. Dimensions are never generated by the LLM.
|
||||
- **FR24:** Inference prompts are server-side text files, read fresh on each
|
||||
invocation. A reset-to-default script restores the shipped defaults. Prompts
|
||||
are not user-facing settings; they are tuned by the owner directly.
|
||||
- **FR25:** Progress indicator during inference calls (latency expected).
|
||||
- **FR26:** Timeout >45s or non-200 - visible error with retry option.
|
||||
- **FR26:** Timeout >45s or non-200 - visible error with retry option. Retry is
|
||||
available if the inference endpoint was previously tested as connected.
|
||||
Intermittent failures are expected in low-connectivity environments.
|
||||
- **FR27:** All inference results editable; no automatic publish of LLM output.
|
||||
- **FR28:** Inference endpoint configured via settings: base URL, API key, model name.
|
||||
Test connection verifies text + vision support.
|
||||
|
||||
### Photo normalization and output
|
||||
- **FR29:** Background removal: chroma-key for green/black, fallback to U2Net matting.
|
||||
- **FR30:** Crop to 80% frame fill, slab centered, aspect ratio preserved,
|
||||
- **FR30:** Crop to 80% frame fill, slab centered, 3:4 portrait aspect,
|
||||
minimum 1600 px on smaller dimension.
|
||||
- **FR31:** Output as transparent PNG (ideal for WooCommerce).
|
||||
- **FR32:** Store both original and processed images. Purge after successful publish.
|
||||
|
||||
Reference in New Issue
Block a user