feat(tools): publish 8 authentic SDXL and SD1.5 tools with comparison media and badges

This commit is contained in:
2026-11-12 16:02:15 +05:30
parent 6b5a387ceb
commit 58094db11d
51 changed files with 525 additions and 459 deletions
+27 -9
View File
@@ -111,18 +111,22 @@ export async function executeBackendTryIt(
// Prepare FormData
const formData = new FormData();
const blob = new Blob([new Uint8Array(effectiveBuffer)]);
// Find primary file parameter name
// Prioritize based on known conventions: 'original_image', 'image0', 'image', 'source', 'source1', 'file'
const primaryCandidates = ['original_image', 'image0', 'image', 'source', 'source1', 'file'];
const matchedPrimary = endpoint.params.find(
(p) => p.kind === 'file' && primaryCandidates.includes(p.name)
) || endpoint.params.find(
(p) => p.kind === 'file' && !p.name.toLowerCase().includes('mask') && !p.name.toLowerCase().includes('ref') && !p.name.toLowerCase().includes('target') && !p.name.toLowerCase().includes('bg') && !p.name.toLowerCase().includes('source2')
);
const fileParamName = matchedPrimary?.name || 'image0';
formData.append(fileParamName, blob, filename);
let fileParamName: string | undefined;
const hasFileParam = endpoint.params.some((p) => p.kind === 'file');
if (hasFileParam) {
const blob = new Blob([new Uint8Array(effectiveBuffer)]);
const primaryCandidates = ['original_image', 'image0', 'image', 'source', 'source1', 'file'];
const matchedPrimary = endpoint.params.find(
(p) => p.kind === 'file' && primaryCandidates.includes(p.name)
) || endpoint.params.find(
(p) => p.kind === 'file' && !p.name.toLowerCase().includes('mask') && !p.name.toLowerCase().includes('ref') && !p.name.toLowerCase().includes('target') && !p.name.toLowerCase().includes('bg') && !p.name.toLowerCase().includes('source2')
);
fileParamName = matchedPrimary?.name || 'image0';
formData.append(fileParamName, blob, filename);
}
// If mask buffer provided (Inpainting / Custom Mask / Auto Mask)
if (options.maskBuffer && Buffer.isBuffer(options.maskBuffer)) {
@@ -255,6 +259,20 @@ export async function executeBackendTryIt(
}
}
// Enforce max 720px dimension on generation endpoints
if (formData.has('width')) {
const w = parseInt(String(formData.get('width')), 10);
if (!isNaN(w) && w > 720) {
formData.set('width', '720');
}
}
if (formData.has('height')) {
const h = parseInt(String(formData.get('height')), 10);
if (!isNaN(h) && h > 720) {
formData.set('height', '720');
}
}
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), endpoint.limits.timeoutMs || 60000);