tango-app-api-store-builder 1.1.6 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1467,26 +1467,28 @@ export async function updateBatchProgress( req, res ) {
|
|
|
1467
1467
|
logger.error( { functionName: 'updateBatchProgress', error: `Failed to process inlined response: ${e.message}` } );
|
|
1468
1468
|
}
|
|
1469
1469
|
}
|
|
1470
|
-
} else
|
|
1471
|
-
const resultFileName =
|
|
1472
|
-
|
|
1470
|
+
} else {
|
|
1471
|
+
const resultFileName = batchResponse?.responsesFile || batchMetadata?.output?.responsesFile;
|
|
1472
|
+
if ( resultFileName ) {
|
|
1473
|
+
const downloadUrl = `https://generativelanguage.googleapis.com/download/v1beta/${resultFileName}:download?alt=media`;
|
|
1473
1474
|
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1475
|
+
const downloadResponse = await fetch( downloadUrl, {
|
|
1476
|
+
method: 'GET',
|
|
1477
|
+
headers: { 'x-goog-api-key': apiKey },
|
|
1478
|
+
} );
|
|
1478
1479
|
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1480
|
+
if ( downloadResponse.ok ) {
|
|
1481
|
+
const resultText = await downloadResponse.text();
|
|
1482
|
+
const resultLines = resultText.split( '\n' ).filter( ( line ) => line.trim() );
|
|
1483
|
+
|
|
1484
|
+
for ( const line of resultLines ) {
|
|
1485
|
+
try {
|
|
1486
|
+
const parsed = JSON.parse( line );
|
|
1487
|
+
const operationKey = parsed.key || parsed.metadata?.key;
|
|
1488
|
+
if ( operationKey ) resultsByKey.set( operationKey, parsed );
|
|
1489
|
+
} catch ( e ) {
|
|
1490
|
+
logger.error( { functionName: 'updateBatchProgress', error: `Failed to parse result line: ${e.message}` } );
|
|
1491
|
+
}
|
|
1490
1492
|
}
|
|
1491
1493
|
}
|
|
1492
1494
|
}
|