[codex] Add static subject designer catalog - #2
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27173e0761
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| function legacySubject(character: string): SubjectProfile { | ||
| return { ...DEFAULT_SUBJECT_PROFILE, baseMode: 'custom', customSubject: '', personalityIds: [], propIds: [], roleId: 'none', extraDetails: character || '' }; |
There was a problem hiding this comment.
Populate custom subject during legacy migration
When a v2/v3/v4 project without reference photos is loaded, this migrated profile is immediately invalid because baseMode: 'custom' is paired with customSubject: ''; the new validateSubjectProfile(..., false) check then returns 請輸入自訂主體, so users cannot download a new MD task or export ZIPs from legacy projects until they manually re-enter a subject even though the old settings.character was preserved in extraDetails.
Useful? React with 👍 / 👎.
| try { const manifest = parseTaskMarkdown(await file.text()); const targetCount = (manifest.targetCount ?? manifest.count) as typeof project.settings.count; const cells = manifest.cellCount ?? manifest.count; | ||
| dispatch({ type: 'update', patch: (current) => ({ ...current, generationProvider: manifest.provider, | ||
| settings: { ...current.settings, character: manifest.character, count: targetCount, rows: manifest.rows, columns: manifest.columns }, | ||
| subjectProfile: manifest.subjectProfile ?? { ...current.subjectProfile, baseMode: 'custom', customSubject: '', roleId: 'none', personalityIds: [], propIds: [], extraDetails: manifest.character }, |
There was a problem hiding this comment.
Preserve legacy task character as the custom subject
Importing an older v1/v2 task with no subjectProfile creates the same invalid state for projects without reference photos: the imported character text is stored only in extraDetails, while customSubject stays empty and baseMode is custom, so the next MD download is blocked by validateSubjectProfile with 請輸入自訂主體 despite the imported manifest containing a valid character.
Useful? React with 👍 / 👎.
| try { const manifest = parseTaskMarkdown(await file.text()); const targetCount = (manifest.targetCount ?? manifest.count) as typeof project.settings.count; const cells = manifest.cellCount ?? manifest.count; | ||
| dispatch({ type: 'update', patch: (current) => ({ ...current, generationProvider: manifest.provider, | ||
| settings: { ...current.settings, character: manifest.character, count: targetCount, rows: manifest.rows, columns: manifest.columns }, | ||
| subjectProfile: manifest.subjectProfile ?? { ...current.subjectProfile, baseMode: 'custom', customSubject: '', roleId: 'none', personalityIds: [], propIds: [], extraDetails: manifest.character }, |
There was a problem hiding this comment.
Preserve photo task character when importing v3 MD
When a v3 task MD was created in photo mode and is imported into a project that does not already have those reference-photo blobs, this assigns the saved subjectProfile but leaves referencePhotos empty; the next download then rebuilds manifest.character from the catalog/custom profile instead of the imported characterDescription that mentioned the photo subject, silently turning a photo-based task back into the default/catalog subject. In that no-photo import context, either the imported description needs to become the custom subject or the missing photos need to be required before regenerating the task.
Useful? React with 👍 / 👎.
What changed
Why
Creators can define a coherent original sticker subject without writing prompts from scratch. Uploaded photos become safe appearance references, while projects without photos can use a curated offline catalog inspired by generic Taiwan LINE STORE trends.
Boundaries
getSubjectCatalog()so a remote provider can be added laterValidation
npm run typechecknpm test— 27 testsnpm run buildnpm run test:e2enpm audit --audit-level=high— 0 vulnerabilities