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>
When the server returns 402 (balance insufficient), the rendering loop
continued submitting all remaining scenes, each failing with the same 402.
Now it immediately stops the loop, sets a clear "余额不足,请充值后再生成视频"
error message, and aborts further scene submissions.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The renderScene function was passing local data URLs (data:image/png;base64,...)
as imageUrl and referenceUrls to createVideoTask, which the /api/ai/video endpoint
rejects with 400 Bad Request. The planning phase already uploads images to OSS
but the resulting URLs were not returned to the component.
- Add imageUrls field to EcommerceVideoPlanResult
- Return OSS imageUrls from runVideoPlan alongside existing plan data
- Use planResult.imageUrls[0] in handleRender instead of productImageDataUrls[0]
- Use planResult?.imageUrls[0] for sourceImage display fallback
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Logout and session expiry previously redirected to "workbench" which
requires authentication, causing 401 errors and a frozen page state.
Now correctly redirects to "login" page immediately.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
runVideoPlan was passing blob URLs as "dataUrl" to uploadAssetWithProgress,
which sent them to /api/oss/upload (base64 path). Blob URLs don't match
DATA_URL_PATTERN regex, causing corrupt 44-byte files on OSS.
Now uses uploadAssetBinary (FormData multipart) via /api/oss/upload-binary,
fetching blob → uploading binary directly, same as EcommercePage path.
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>