chore(repo): 将生产源码基线同步回 main #1

Merged
WuYongJie merged 265 commits from codex/production-48-20261030 into main 2026-10-30 16:39:58 +08:00
Showing only changes of commit 0a364f537f - Show all commits

View File

@ -644,20 +644,14 @@ async function downloadReferenceImageFromStorage(
async function normalizeReferenceImage(buffer: Buffer, mimeType: string) {
try {
const metadata = await sharp(buffer, { failOn: "none" }).metadata();
const pipeline = sharp(buffer, { failOn: "none" })
const normalized = await sharp(buffer, { failOn: "none" })
.rotate()
.resize(2048, 2048, { fit: "inside", withoutEnlargement: true });
if (metadata.hasAlpha || /png/i.test(mimeType)) {
return {
buffer: await pipeline.png({ compressionLevel: 6 }).toBuffer(),
extension: "png",
};
}
.resize(1920, 1920, { fit: "inside", withoutEnlargement: true })
.flatten({ background: "#ffffff" })
.jpeg({ quality: 92, chromaSubsampling: "4:4:4", mozjpeg: true })
.toBuffer();
return {
buffer: await pipeline
.jpeg({ quality: 95, chromaSubsampling: "4:4:4", mozjpeg: true })
.toBuffer(),
buffer: normalized,
extension: "jpg",
};
} catch (error) {