fix
This commit is contained in:
1 parent
7537a41955
commit
ff6c2df618
14 files changed
+767
-349
No files matched your search
@@ -30,21 +30,29 @@ npm run seed:category-prompts:i18n -- -dry-run
|
||||
npm run seed:category-prompts:i18n
|
||||
```
|
||||
|
||||
**The seed does not come with precalculated live translations.** When executed,
|
||||
OpenAI translates the built-in prompts for each of the 25 supported languages
|
||||
into a shared PostgreSQL cache. This can make thousands of translation API calls,
|
||||
so run with a controlled budget and review output. `OPENAI_API_KEY` and
|
||||
`DATABASE_URL` must be set. The seed is resumable and never overwrites an existing
|
||||
cached translation. `-langs sl,hr,de` and `-limit 1` can be used for pilot runs.
|
||||
The script validates placeholders, HTML tags, language selection and text length.
|
||||
If any language fails, it logs the failure and exits with an error; rerun to retry
|
||||
missing values.
|
||||
**The seed ships with 25 prelocalized title, description and meta instruction sets.**
|
||||
There are **no network translation calls, no OpenAI credentials, and no costs**
|
||||
for translation. Only `DATABASE_URL` is required. The platform-standard
|
||||
translations are intentionally shared across taxonomy categories; the original
|
||||
category-specific English defaults and structured title/description formulas
|
||||
remain available in English. This preserves the default layout and avoids
|
||||
inventing localized category-specific naming variants. Company-authored prompts
|
||||
in any language are never replaced. Running the seed stores missing defaults
|
||||
in the cache for future companies and categories, and cleans duplicates in
|
||||
A1's existing category prompts without replacing A1's custom instructions.
|
||||
|
||||
## A1 Slovenia: remove repeated descriptions
|
||||
The seed never overwrites previously stored language values, including values
|
||||
from older runs. For a subset you can run `-langs sl,hr,de` or `-limit 1`.
|
||||
Failures are reported and produce a nonzero exit code.
|
||||
|
||||
The bundled `scripts/seed/a1-category-prompts.json` has been cleaned of **exact
|
||||
repeated** H2/paragraph pairs in 59 category definitions. The product-naming,
|
||||
benefit inclusion/exclusion, HTML specification list, and SEO rules are kept.
|
||||
## A1 Slovenia: rewrite repeated benefits without losing sections
|
||||
|
||||
The bundled `scripts/seed/a1-category-prompts.json` is normalized so it
|
||||
contains **no duplicate H2 benefit instructions**. When a live A1 prompt repeats
|
||||
an instruction, the cleanup rewrites later headings/paragraph instructions with
|
||||
distinct benefit numbers rather than deleting sections. The paragraph's original
|
||||
product-name inclusion/exclusion rule, naming formula, meta rules and technical
|
||||
specifications are retained. It avoids inventing specific product claims.
|
||||
|
||||
Existing DB categories can be cleaned with:
|
||||
|
||||
@@ -56,18 +64,19 @@ npm run cleanup:a1:prompts
|
||||
npm run cleanup:a1:prompts -- -apply
|
||||
```
|
||||
|
||||
This command only removes exact duplicate heading/paragraph pairs from stored
|
||||
category prompt language variants and structured description templates; it never
|
||||
rewrites the category title formula or SEO metadata. It uses optimistic
|
||||
concurrency checks and can be rerun. Take a database backup first.
|
||||
The global translation seed now also performs this A1 cleanup automatically.
|
||||
The standalone command remains available to rerun separately. It differentiates
|
||||
repeated benefit instructions in stored category prompt language variants and
|
||||
structured description templates; it never rewrites title or SEO formulas.
|
||||
It uses optimistic concurrency checks, preserves section counts, and can be rerun. Take a database backup first.
|
||||
|
||||
If A1 content is later re-imported from an older WordPress SQL dump, that dump
|
||||
may reintroduce duplicates. Run the cleanup command again after that import.
|
||||
A1 reimport, A1 repair, and WordPress SQL input now normalize duplicate pairs
|
||||
before saving, so the older source cannot reintroduce them.
|
||||
|
||||
## Validation
|
||||
|
||||
- 25-language example test: pass.
|
||||
- Isolated Go default/formula and A1 duplicate tests: pass.
|
||||
- Offline Go tests for 25 bundled locales, HTML A1 normalization, structured A1 normalization, and idempotence: pass.
|
||||
- Backend integration suite: not run here; project requires Go 1.25 and PostgreSQL.
|
||||
- Full frontend test suite: 288 passed, 6 pre-existing locale-key failures (not
|
||||
introduced by this change).
|
||||
Reference in new issue
Block a user