fixes
This commit is contained in:
1 parent
43cfaa0411
commit
3b0d692839
7 files changed
+341
-136
No files matched your search
@@ -0,0 +1,33 @@
|
||||
# A1 prompt cleanup repair
|
||||
|
||||
## Root causes
|
||||
|
||||
- `NormalizeA1DescriptionTemplate` attempted to `json.Unmarshal("")` before verifying that the optional `description_template` existed. This produced `unexpected end of JSON input` for A1 categories with empty templates.
|
||||
- The previous A1-recognition threshold required at least four H2/paragraph pairs. The original A1 seed frequently had only one to three, and partially cleaned prompts mixed old instructions with a rewritten third benefit.
|
||||
- The original generic spec-list instruction sometimes used a Unicode en dash (`3–10`) and had line breaks, causing it to survive beside a new spec list.
|
||||
- One imported template generated an extra H1, although the product page already supplies its H1.
|
||||
|
||||
## Fix
|
||||
|
||||
- Short-circuit null/empty JSON descriptions, including JSON objects without `sections`.
|
||||
- Recognize the known legacy Slovenian 100-word benefit boilerplate regardless of pair count, but don't rewrite unrelated custom descriptions.
|
||||
- Replace recognized obsolete description blocks with a semantically ordered `<p>`, optional `<h2><p>` and optional `<h2><ul><li>`.
|
||||
- Drop only the known imported generic technical-specification stub. Leave custom spec instructions intact.
|
||||
- Preserve category-specific title and meta rules.
|
||||
- Use identical normalization from the seed, standalone cleanup, bundled A1 data, and WordPress import path.
|
||||
- Changes are safe to rerun.
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
# Read-only preview (A1 only)
|
||||
npm run cleanup:a1:prompts
|
||||
|
||||
# Apply A1-only cleanup
|
||||
npm run cleanup:a1:prompts -- -apply
|
||||
|
||||
# Alternative: apply global offline defaults and A1 cleanup together
|
||||
npm run seed:category-prompts:i18n
|
||||
```
|
||||
|
||||
No OpenAI key or external translation call required. Back up PostgreSQL before applying production changes. Reprocess existing product descriptions separately if updated output is needed.
|
||||
Reference in new issue
Block a user