|
@@ -1,3 +1,4 @@
|
|
|
|
|
+import assert from 'node:assert';
|
|
|
import { Readable, Transform } from 'stream';
|
|
import { Readable, Transform } from 'stream';
|
|
|
|
|
|
|
|
import { PageGrant, isPopulated } from '@growi/core';
|
|
import { PageGrant, isPopulated } from '@growi/core';
|
|
@@ -64,6 +65,7 @@ class OpenaiService implements IOpenaiService {
|
|
|
const workers = pages.map(processUploadFile);
|
|
const workers = pages.map(processUploadFile);
|
|
|
|
|
|
|
|
// Wait for all processing to complete.
|
|
// Wait for all processing to complete.
|
|
|
|
|
+ assert(workers.length <= BATCH_SIZE, 'workers.length must be less than or equal to BATCH_SIZE');
|
|
|
const fileUploadResult = await Promise.allSettled(workers);
|
|
const fileUploadResult = await Promise.allSettled(workers);
|
|
|
fileUploadResult.forEach((result) => {
|
|
fileUploadResult.forEach((result) => {
|
|
|
if (result.status === 'rejected') {
|
|
if (result.status === 'rejected') {
|