Previously all 4 image tools generated a single image and duplicated
it across 5 fixed card slots. Now:
- Set (套图) mode: uses cloneSetCounts (卖点图/白底图/场景图 quantity)
to determine how many images to generate. Each type gets its own
createImageTask call with a type-specific prompt, so images differ
by category (selling-point vs white-background vs lifestyle scene).
- Preview cards are dynamically built from cloneSetCounts, not from
the fixed 5-slot productSetPreviewCards template. A card labeled
"卖点图 1", "卖点图 2" etc for count > 1, or just "卖点图" for
count = 1.
- clonePreview: shows dynamic card grid for set mode, single result
for detail/model/hot modes.
- setPreview: shows original image as main card, then all generated
set cards in the grid.
- generateSetImages: new async function that loops over each count
type and generates images sequentially with distinct prompts.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The set/detail preview areas were using static placeholder images
instead of the API-generated results. Fix:
- Add productSetResultImages state for set tool results
- Add detailResultUrl state for detail tool results
- Create setPreviewCards (like clonePreviewCards) that overlays
generated URLs onto static card templates
- Replace setPreview JSX references from productSetPreviewCards
to setPreviewCards so generated URLs are displayed
- Replace detailPreview longPage image with detailResultUrl fallback
- Update handleSetGenerate setResultFn to save URLs via
setProductSetResultImages
- Update handleDetailGenerate setResultFn to save URL via
setDetailResultUrl
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
All four image tools (套图, 详情图, 模特图, 爆款图复刻) previously used
setTimeout + static sample images. Now they:
1. Upload product images to OSS via uploadAssetBinary
2. Build contextual prompts including platform/ratio/language/market + user text
3. Call aiGenerationClient.createImageTask with model=gpt-image-2
4. Poll task status via waitForTask (SSE + fallback polling)
5. Display the generated result URL in the preview grid
Key changes:
- Add ServerRequestError + waitForTask imports
- Add imageAbortRef for task cancellation
- Add uploadCloneImages() (generic version of uploadProductImages)
- Add buildEcommerceImagePrompt() with output-type-specific instructions
- Add generateEcommerceImage() orchestrating upload → prompt → API → result
- Replace all 5 mock handlers (handleGenerate, handleSetGenerate,
handleDetailGenerate, handleTryOnGenerate, handleGenerateModel) with
real async API calls
- Handle 402 (Payment Required) with user-friendly error message
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Add uploadAssetBinary method to aiGenerationClient (FormData + busboy)
- Replace base64 dataUrl upload in uploadProductImages with direct blob upload
via /oss/upload-binary multipart endpoint
- This eliminates the DATA_URL_PATTERN regex parsing bug that produced
44-byte corrupt files on OSS, causing DashScope "image format illegal" errors
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Upgrade VISION_MODEL to qwen3.7-plus (latest, confirmed working with image_url)
- Add VISION_FALLBACK_MODEL = qwen-vl-plus for retry on "image format" errors
- Normalize upload MIME types: unsupported formats (HEIC/AVIF) fall back to image/png
to prevent server saving as .bin which DashScope can't read
- Server-side: add image/avif, image/heic, image/heif to MIME_EXTENSIONS
Root cause: DashScope returned "image format is illegal" when uploaded images
had unrecognized MIME types → saved as .bin → DashScope couldn't decode.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Remove all local file imports referencing ../../../tu/ and
../../assets/ directories. Replace with OSS muban prefix URLs:
https://stringtest.oss-cn-hangzhou.aliyuncs.com/muban/
This fixes build failure on server (missing local image files)
and ensures images load from centralized OSS storage.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>