fixes
This commit is contained in:
1 parent
3b0d692839
commit
8b540d22bc
14 files changed
+526
-82
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { readFileSync, writeFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
const root = resolve(import.meta.dirname, '../..');
|
||||
const source = resolve(root, 'apps/api/internal/aiprompts/defaults/prompt-rules-25.json');
|
||||
const target = resolve(root, 'apps/web/src/lib/categories/prompt-examples.ts');
|
||||
const rules = JSON.parse(readFileSync(source, 'utf8'));
|
||||
const output = `/**
|
||||
* GENERATED from apps/api/internal/aiprompts/defaults/prompt-rules-25.json.
|
||||
* Run: node scripts/seed/build-category-ui-examples.mjs
|
||||
* Read-only preview data; never writes category prompts automatically.
|
||||
*/
|
||||
import { DEFAULT_CONTENT_LANGUAGE, parseContentLanguage } from '../content-languages.ts';
|
||||
import type { EnhancePromptSectionId } from './prompt-sections';
|
||||
|
||||
export const CATEGORY_FORMULA_RULES: Record<string, Record<EnhancePromptSectionId, string>> = ${JSON.stringify(rules, null, 2)};
|
||||
|
||||
export const CATEGORY_PROMPT_EXAMPLES = CATEGORY_FORMULA_RULES;
|
||||
|
||||
export function localizedCategoryPromptExample(language: string, section: EnhancePromptSectionId): string {
|
||||
const code = parseContentLanguage(language, DEFAULT_CONTENT_LANGUAGE);
|
||||
return (CATEGORY_FORMULA_RULES[code] ?? CATEGORY_FORMULA_RULES.en)[section];
|
||||
}
|
||||
`;
|
||||
writeFileSync(target, output);
|
||||
console.log(`Generated ${Object.keys(rules).length} synchronized language examples.`);
|
||||
Reference in new issue
Block a user