fix: support scale adjust provider mask params
This commit is contained in:
parent
84d843a8a4
commit
d058ff32e6
@ -19,6 +19,7 @@ export interface OpenAIImageParams {
|
||||
quality?: string;
|
||||
background?: string;
|
||||
outputFormat?: string;
|
||||
maskImageUrl?: string;
|
||||
}
|
||||
|
||||
interface UploadedImage {
|
||||
@ -643,6 +644,7 @@ async function requestOpenAIImageGeneration(params: {
|
||||
aspectRatio?: string;
|
||||
imageSizeLabel?: "1K" | "2K" | "4K";
|
||||
imageUrls: string[];
|
||||
maskImageUrl?: string;
|
||||
quality?: string;
|
||||
background?: string;
|
||||
outputFormat?: string;
|
||||
@ -656,6 +658,7 @@ async function requestOpenAIImageGeneration(params: {
|
||||
aspectRatio,
|
||||
imageSizeLabel,
|
||||
imageUrls,
|
||||
maskImageUrl,
|
||||
quality,
|
||||
background,
|
||||
outputFormat,
|
||||
@ -723,6 +726,10 @@ async function requestOpenAIImageGeneration(params: {
|
||||
formData.append("image[]", new Blob([image.buffer], { type: image.mimeType }), image.filename);
|
||||
}
|
||||
}
|
||||
if (maskImageUrl) {
|
||||
const mask = await loadInputImage(maskImageUrl);
|
||||
formData.append("mask", new Blob([mask.buffer], { type: mask.mimeType }), mask.filename);
|
||||
}
|
||||
|
||||
const response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
@ -898,6 +905,7 @@ export function createOpenAIImage({ apiKey, baseURL }: OpenAIImageConfig) {
|
||||
timeoutMs: resolveRequestTimeoutMs(baseURL, imageSize, activeModelId),
|
||||
useBltcyImageCompatParams: shouldUseBltcyImageCompatParams(baseURL),
|
||||
imageCount: imageUrls.length,
|
||||
hasMask: Boolean(options.imageParams?.maskImageUrl),
|
||||
baseURL: normalizeBaseURL(baseURL),
|
||||
});
|
||||
|
||||
@ -910,6 +918,7 @@ export function createOpenAIImage({ apiKey, baseURL }: OpenAIImageConfig) {
|
||||
aspectRatio: aspectRatio || undefined,
|
||||
imageSizeLabel: imageSize,
|
||||
imageUrls,
|
||||
maskImageUrl: options.imageParams?.maskImageUrl,
|
||||
quality,
|
||||
background,
|
||||
outputFormat,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user