fix(chatgpt): filter user-uploaded images in Chinese UI; allow large image uploads - #2261
Open
HARRY-BEAR wants to merge 1 commit into
Open
fix(chatgpt): filter user-uploaded images in Chinese UI; allow large image uploads#2261HARRY-BEAR wants to merge 1 commit into
HARRY-BEAR wants to merge 1 commit into
Conversation
…ge image payloads
- chatgpt image adapter: the attachment filter in getChatGPTVisibleImageUrls
only matched the English 'Open image:' button label and English keywords
(upload/uploaded/attachment). In the Chinese ChatGPT UI the button is
labeled '打开图片:用户上传的图片' (Open image: user uploaded image) and
the image alt is empty, so user-uploaded reference images escaped the
filter and were reported as generated results (the original photo was
downloaded instead of the generated image). Add the Chinese button label
prefix and the '上传' keyword to the filter.
- daemon: raise MAX_BODY from 1 MB to 32 MB. The chatgpt image upload
fallback (base64-in-evaluate) serializes the image into the command body;
a typical 2 MB photo becomes a >1 MB base64 payload and the daemon
rejected it with a connection reset ('fetch failed').
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two bugs break
opencli chatgpt image --image <photo>for non-trivial use cases:1. Chinese UI: user-uploaded reference image is reported as the generated result
getChatGPTVisibleImageUrlsfilters user-uploaded images viaisUserUploadPreview, which only matches:Open image:(the Chinese UI uses打开图片:用户上传的图片)upload|uploaded|attachment(Chinese UI says上传)In the Chinese ChatGPT UI, the re-rendered upload has an empty
alt, so it escapes the filter. The adapter then detects the re-rendered attachment as a "newly generated image", downloads it, and reports success — the user receives the original photo instead of the generated image.2. Uploads > ~750 KB fail with
fetch failedWhen CDP file input injection is unavailable,
uploadChatGPTImagesfalls back to base64-in-page.evaluate. The daemon caps request bodies atMAX_BODY = 1 MB; a typical 2 MB photo becomes a >1 MB base64 payload, the daemon destroys the connection (Body too large), and the CLI surfaces a barefetch failed.Fix
打开图片:and the keyword上传in the upload filter.MAX_BODYto 32 MB (still bounded, but fits base64 image payloads).Verification
npm run typecheckpasses;npm run test:adapterpasses (499 files / 5200 tests).