Skip to content

ci(cover): 封面文生图改用 AI 网关 image-2(替代 ARK)#17

Merged
yi-ge merged 1 commit into
mainfrom
ci/changelog-cover-ai-gateway
Jun 27, 2026
Merged

ci(cover): 封面文生图改用 AI 网关 image-2(替代 ARK)#17
yi-ge merged 1 commit into
mainfrom
ci/changelog-cover-ai-gateway

Conversation

@yi-ge

@yi-ge yi-ge commented Jun 27, 2026

Copy link
Copy Markdown
Member

变更说明 / Summary

generate-changelog-cover.mjs 的背景图生成从火山方舟 ARK 迁移到 OpenAI 兼容的图像接口(默认模型 image-2),与 release notes 共用同一个 AI 网关。

Migrate the background-image generation in generate-changelog-cover.mjs from Volcano ARK to an OpenAI-compatible images endpoint (default model image-2), sharing the same AI gateway as release notes.

改动 / Changes

  • AI_BASE_URL / AI_API_KEY(替代 ARK_API_KEY),模型由 IMAGE_MODEL 区分(默认 image-2)。
  • 调用 OpenAI 兼容 /v1/images/generations,兼容 b64_jsonurl 两种返回。
  • 请求分辨率默认 2848x1600(可经 IMAGE_SIZE 覆盖),生成后统一 sharp resize 到 2848×1600,保证文字叠加层对齐。

配套 / Companion

主仓库 desirecore/desirecore PR #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_MODEL to this script.

- 读 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
Copilot AI review requested due to automatic review settings June 27, 2026 11:27
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Error Error Jun 27, 2026 11:27am

Request Review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_KEY to AI_BASE_URL + AI_API_KEY, with model selection via IMAGE_MODEL (default image-2) and request size via IMAGE_SIZE.
  • Call an OpenAI-compatible /v1/images/generations endpoint and handle both b64_json and url response 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' })
@yi-ge yi-ge merged commit 7e2405b into main Jun 27, 2026
3 of 4 checks passed
@yi-ge yi-ge deleted the ci/changelog-cover-ai-gateway branch June 27, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants