Use source images as article references

This commit is contained in:
Loma Bot Ops
2026-11-28 20:37:11 +07:00
parent 58216d5263
commit 6f8f84f81f
8 changed files with 101 additions and 20 deletions
+2 -2
View File
@@ -23,8 +23,8 @@ export async function assertImageQuota(pageId: string): Promise<void> {
}
/** Image bytes come from the dedicated ChatGPT browser worker. */
export async function generateImage(prompt: string, size: ImageSizeKey, waitForWorker = false): Promise<GeneratedImage> {
const result = await runAutomation({ kind: "image", prompt, size }, { waitForWorker });
export async function generateImage(prompt: string, size: ImageSizeKey, waitForWorker = false, referenceImageUrl?: string): Promise<GeneratedImage> {
const result = await runAutomation({ kind: "image", prompt, size, ...(referenceImageUrl ? { referenceImageUrl } : {}) }, { waitForWorker });
if (typeof result.b64 !== "string" || !result.b64) throw new UserFacingError("Worker ไม่ส่งรูปกลับมา ตรวจการ login ChatGPT แล้วลองใหม่");
return { bytes: Buffer.from(result.b64, "base64"), contentType: "image/jpeg", inputTokens: 0, outputTokens: 0 };
}