ci(cover): 封面文生图改用 AI 网关 image-2(替代 ARK)#17
Merged
Conversation
- 读 AI_BASE_URL/AI_API_KEY(与 release notes 共用网关),模型 IMAGE_MODEL(默认 image-2) - OpenAI 兼容 /v1/images/generations,兼容 b64_json/url 返回 - 请求分辨率默认 2848x1600(可经 IMAGE_SIZE 覆盖),生成后统一 resize 到 2848×1600
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR migrates the changelog cover background-image generation script from Volcano ARK to an OpenAI-compatible images endpoint, so it can reuse the same AI gateway configuration as release notes while keeping output size consistent for text overlay layout.
Changes:
- Switch authentication/config from
ARK_API_KEYtoAI_BASE_URL+AI_API_KEY, with model selection viaIMAGE_MODEL(defaultimage-2) and request size viaIMAGE_SIZE. - Call an OpenAI-compatible
/v1/images/generationsendpoint and handle bothb64_jsonandurlresponse formats. - Normalize generated background images by resizing and re-encoding to a fixed 2848×1600 PNG before compositing overlays.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+127
to
130
| if (!IMAGE_BASE_URL) { | ||
| console.error('错误: 未设置 AI_BASE_URL 环境变量') | ||
| process.exit(1) | ||
| } |
|
|
||
| // 统一 resize 到 WIDTH×HEIGHT,确保文字叠加层布局对齐(不依赖模型实际输出尺寸) | ||
| return sharp(rawBuffer) | ||
| .resize(WIDTH, HEIGHT, { fit: 'fill' }) |
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.
变更说明 / Summary
generate-changelog-cover.mjs的背景图生成从火山方舟 ARK 迁移到 OpenAI 兼容的图像接口(默认模型image-2),与 release notes 共用同一个 AI 网关。Migrate the background-image generation in
generate-changelog-cover.mjsfrom Volcano ARK to an OpenAI-compatible images endpoint (default modelimage-2), sharing the same AI gateway as release notes.改动 / Changes
AI_BASE_URL/AI_API_KEY(替代ARK_API_KEY),模型由IMAGE_MODEL区分(默认image-2)。/v1/images/generations,兼容b64_json与url两种返回。2848x1600(可经IMAGE_SIZE覆盖),生成后统一sharpresize 到 2848×1600,保证文字叠加层对齐。配套 / Companion
主仓库
desirecore/desirecorePR #907 同步把build.yml的封面步骤改为传入AI_BASE_URL/AI_API_KEY/IMAGE_MODEL。Main repo PR desirecore/desirecore#907 passes
AI_BASE_URL/AI_API_KEY/IMAGE_MODELto this script.