feat(GPTImageGen): 上传一个gpt image 2生图插件。增强插件鲁棒性与文档完善 v1.1.0#309
Merged
lioensky merged 1 commit intolioensky:mainfrom Apr 29, 2026
Merged
Conversation
- 修复默认 OPENAI_BASE_URL 硬编码为反代地址的问题 - 新增 429/503 指数退避自动重试机制 (MAX_RETRIES 可配置) - 新增图生图输入图片 4MB 大小校验 - 改进图片保存扩展名推断 (从 Content-Type 而非仅 URL 扩展名) - 新增纯数字 size 参数自动兼容 (如 1024 -> 1024x1024) - 完善 plugin-manifest.json: 更新作者/版本/configSchema 描述 - 补充 transparent 背景限制、4MB 限制、quality 档位等说明 Co-authored-by: 小飒 (Xiaosa) <like147222@users.noreply.github.com>
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.
概述
对 @like147222 (小飒) 开发的 GPTImageGen 插件进行鲁棒性增强和文档完善,从 v1.0.0 升级到 v1.1.0。
原始插件由小飒开发,本次改进由 infinite-vector 完成,已获得小飒授权。
改动内容
🔒 安全性
修复源码中
OPENAI_BASE_URL
默认值硬编码为开发用反代地址的问题,改为
https://api.openai.com
🔄 稳定性
新增
httpRequestWithRetry()
包装器,对 429 (Rate Limit) 和 503 (Service Unavailable) 自动指数退避重试
重试次数和基础延迟可通过
MAX_RETRIES
/
RETRY_BASE_DELAY_MS
环境变量配置
✅ 正确性
图生图输入图片新增 4MB 大小校验(OpenAI /v1/images/edits 端点限制),支持 data URI / URL / 本地文件三种来源的校验
纯数字 size 参数自动兼容(如
1024
→
1024x1024
),防止用户配置错误
🎨 兼容性
downloadImage()
现在返回
{data, contentType}
而非裸 Buffer
saveImageToLocal()
根据 Content-Type 推断扩展名(jpg/webp/gif/png),不再硬编码 .png
新增
inferImageExtension()
统一扩展名推断逻辑
📝 文档
plugin-manifest.json
更新:author、version、configSchema(改为带 description 的对象格式)
invocationCommands 描述补充:quality 各档位说明、transparent 背景限制、4MB 图片限制、版本快照用法、重试机制说明
测试
✅ 文生图 (GPTGenerateImage) 测试通过
✅ 图生图 (GPTEditImage) 测试通过(本地文件路径输入)
✅ 插件热重载后正常加载