Просмотр исходного кода

fix: SD.cpp Fetch Output returned every file twice

Its output carried both "files" and a "file" holding the first entry, meant as
a convenience for the single-image case. JSON has no references, so "file" was
a second copy of the same base64, not a pointer to it.

Two consequences. The execution record held every downloaded image twice, which
for a 512x512 PNG is half a megabyte of duplicate base64 per run. And anything
walking the output looking for images - the editor's output viewer does exactly
that - found each image twice and displayed it twice, so a workflow that
generated one image appeared to have generated two.

Removed. Use files[0] for the single-image case.

Verified by regenerating: the fetch node's output is now count, files,
totalBytes and storage, with one image in it. Full suite 55/55.
fszontagh 1 месяц назад
Родитель
Сommit
ab709d1813
1 измененных файлов с 5 добавлено и 5 удалено
  1. 5 5
      nodes/sdcpp/sdcpp-fetch-output.js

+ 5 - 5
nodes/sdcpp/sdcpp-fetch-output.js

@@ -80,10 +80,6 @@ const outputSchema = {
             type: 'array',
             type: 'array',
             description: 'One entry per file, each a binary file object other nodes accept'
             description: 'One entry per file, each a binary file object other nodes accept'
         },
         },
-        file: {
-            type: 'object',
-            description: 'The first file, for the common case of a single image feeding a node that takes one'
-        },
         totalBytes: { type: 'number' },
         totalBytes: { type: 'number' },
         storage: { type: 'array', description: 'Collection and id of each stored file, when storing was enabled' }
         storage: { type: 'array', description: 'Collection and id of each stored file, when storing was enabled' }
     }
     }
@@ -331,10 +327,14 @@ async function execute(config, input, context) {
     smartbotic.log.info('SD.cpp: downloaded ' + files.length + ' output file(s), ' +
     smartbotic.log.info('SD.cpp: downloaded ' + files.length + ' output file(s), ' +
         totalBytes + ' bytes');
         totalBytes + ' bytes');
 
 
+    // Only "files". There used to be a "file" alongside it holding the first
+    // entry, meant as a convenience for the single-image case - but JSON has no
+    // references, so it was a second copy of the same base64. The execution
+    // record carried every image twice, and anything that walks the output
+    // looking for images found and displayed each one twice. Use files[0].
     return {
     return {
         count: files.length,
         count: files.length,
         files: files,
         files: files,
-        file: files[0],
         totalBytes: totalBytes,
         totalBytes: totalBytes,
         storage: storage
         storage: storage
     };
     };