fix(GPTImageGen): 修复 Edit 模式多图输入时 JSON 数组字符串无法解析的问题#315
Merged
lioensky merged 1 commit intoMay 8, 2026
Merged
Conversation
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.
问题
通过 VCP 工具调用 GPTEditImage 传入多张图片时,image 参数以 JSON 数组
字符串的形式传入(如 '["path1.png", "path2.jpg"]'),而非 JS 原生数组。
这是因为 VCP 的「始」「末」参数解析器将所有参数值视为字符串。
导致 Array.isArray(imageInput) 返回 false,整个 JSON 数组字符串(包括
方括号和引号)被当作单个文件路径处理——该路径显然不存在,报错。
此外在 Windows 环境下,文件路径中的反斜杠 \ 不是合法的 JSON 转义序列,
直接 JSON.parse() 也会失败。
修复方案
const imageInput改为let imageInput,允许重新赋值[开头的字符串,则:\预处理为\\(兼容 Windows 路径)改动范围
Plugin/GPTImageGen/GPTImageGen.js:改动 1 个关键字 + 新增 10 行兼容代码README.md:GPTEditImage 文档补充多图数组格式说明和调用示例测试情况