@adminforth/bulk-ai-flow 1.9.2 → 1.10.0
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/build.log +2 -2
- package/custom/VisionAction.vue +21 -2
- package/dist/custom/VisionAction.vue +21 -2
- package/dist/index.js +5 -5
- package/index.ts +5 -5
- package/package.json +1 -1
package/build.log
CHANGED
|
@@ -11,5 +11,5 @@ custom/package-lock.json
|
|
|
11
11
|
custom/package.json
|
|
12
12
|
custom/tsconfig.json
|
|
13
13
|
|
|
14
|
-
sent
|
|
15
|
-
total size is 185,
|
|
14
|
+
sent 186,334 bytes received 134 bytes 372,936.00 bytes/sec
|
|
15
|
+
total size is 185,801 speedup is 1.00
|
package/custom/VisionAction.vue
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
ref="confirmDialog"
|
|
10
10
|
header="Bulk AI Flow"
|
|
11
11
|
class="!max-w-full w-full lg:w-[1600px] !lg:max-w-[1600px]"
|
|
12
|
+
:beforeCloseFunction="closeDialog"
|
|
12
13
|
:buttons="[
|
|
13
14
|
{ label: checkedCount > 1 ? 'Save fields' : 'Save field', options: { disabled: isLoading || checkedCount < 1 || isCriticalError || isFetchingRecords || isGeneratingImages || isAnalizingFields || isAnalizingImages, loader: isLoading, class: 'w-fit sm:w-40' }, onclick: (dialog) => { saveData(); dialog.hide(); } },
|
|
14
15
|
{ label: 'Cancel', onclick: (dialog) => dialog.hide() },
|
|
@@ -91,9 +92,10 @@ const checkedCount = ref(0);
|
|
|
91
92
|
const isGeneratingImages = ref(false);
|
|
92
93
|
const isAnalizingFields = ref(false);
|
|
93
94
|
const isAnalizingImages = ref(false);
|
|
94
|
-
|
|
95
|
+
const isDialogOpen = ref(false);
|
|
95
96
|
|
|
96
97
|
const openDialog = async () => {
|
|
98
|
+
isDialogOpen.value = true;
|
|
97
99
|
confirmDialog.value.open();
|
|
98
100
|
isFetchingRecords.value = true;
|
|
99
101
|
await getRecords();
|
|
@@ -143,6 +145,23 @@ const openDialog = async () => {
|
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
const closeDialog = () => {
|
|
149
|
+
confirmDialog.value.close();
|
|
150
|
+
isAiResponseReceivedAnalize.value = [];
|
|
151
|
+
isAiResponseReceivedImage.value = [];
|
|
152
|
+
|
|
153
|
+
records.value = [];
|
|
154
|
+
images.value = [];
|
|
155
|
+
selected.value = [];
|
|
156
|
+
tableColumns.value = [];
|
|
157
|
+
tableColumnsIndexes.value = [];
|
|
158
|
+
isError.value = false;
|
|
159
|
+
isCriticalError.value = false;
|
|
160
|
+
isImageGenerationError.value = false;
|
|
161
|
+
errorMessage.value = '';
|
|
162
|
+
isDialogOpen.value = false;
|
|
163
|
+
}
|
|
164
|
+
|
|
146
165
|
watch(selected, (val) => {
|
|
147
166
|
//console.log('Selected changed:', val);
|
|
148
167
|
checkedCount.value = val.filter(item => item.isChecked === true).length;
|
|
@@ -468,7 +487,7 @@ async function runAiAction({
|
|
|
468
487
|
//polling jobs
|
|
469
488
|
let isInProgress = true;
|
|
470
489
|
//if no jobs were created, skip polling
|
|
471
|
-
while (isInProgress) {
|
|
490
|
+
while (isInProgress && isDialogOpen.value) {
|
|
472
491
|
//check if at least one job is still in progress
|
|
473
492
|
let isAtLeastOneInProgress = false;
|
|
474
493
|
//checking status of each job
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
ref="confirmDialog"
|
|
10
10
|
header="Bulk AI Flow"
|
|
11
11
|
class="!max-w-full w-full lg:w-[1600px] !lg:max-w-[1600px]"
|
|
12
|
+
:beforeCloseFunction="closeDialog"
|
|
12
13
|
:buttons="[
|
|
13
14
|
{ label: checkedCount > 1 ? 'Save fields' : 'Save field', options: { disabled: isLoading || checkedCount < 1 || isCriticalError || isFetchingRecords || isGeneratingImages || isAnalizingFields || isAnalizingImages, loader: isLoading, class: 'w-fit sm:w-40' }, onclick: (dialog) => { saveData(); dialog.hide(); } },
|
|
14
15
|
{ label: 'Cancel', onclick: (dialog) => dialog.hide() },
|
|
@@ -91,9 +92,10 @@ const checkedCount = ref(0);
|
|
|
91
92
|
const isGeneratingImages = ref(false);
|
|
92
93
|
const isAnalizingFields = ref(false);
|
|
93
94
|
const isAnalizingImages = ref(false);
|
|
94
|
-
|
|
95
|
+
const isDialogOpen = ref(false);
|
|
95
96
|
|
|
96
97
|
const openDialog = async () => {
|
|
98
|
+
isDialogOpen.value = true;
|
|
97
99
|
confirmDialog.value.open();
|
|
98
100
|
isFetchingRecords.value = true;
|
|
99
101
|
await getRecords();
|
|
@@ -143,6 +145,23 @@ const openDialog = async () => {
|
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
const closeDialog = () => {
|
|
149
|
+
confirmDialog.value.close();
|
|
150
|
+
isAiResponseReceivedAnalize.value = [];
|
|
151
|
+
isAiResponseReceivedImage.value = [];
|
|
152
|
+
|
|
153
|
+
records.value = [];
|
|
154
|
+
images.value = [];
|
|
155
|
+
selected.value = [];
|
|
156
|
+
tableColumns.value = [];
|
|
157
|
+
tableColumnsIndexes.value = [];
|
|
158
|
+
isError.value = false;
|
|
159
|
+
isCriticalError.value = false;
|
|
160
|
+
isImageGenerationError.value = false;
|
|
161
|
+
errorMessage.value = '';
|
|
162
|
+
isDialogOpen.value = false;
|
|
163
|
+
}
|
|
164
|
+
|
|
146
165
|
watch(selected, (val) => {
|
|
147
166
|
//console.log('Selected changed:', val);
|
|
148
167
|
checkedCount.value = val.filter(item => item.isChecked === true).length;
|
|
@@ -468,7 +487,7 @@ async function runAiAction({
|
|
|
468
487
|
//polling jobs
|
|
469
488
|
let isInProgress = true;
|
|
470
489
|
//if no jobs were created, skip polling
|
|
471
|
-
while (isInProgress) {
|
|
490
|
+
while (isInProgress && isDialogOpen.value) {
|
|
472
491
|
//check if at least one job is still in progress
|
|
473
492
|
let isAtLeastOneInProgress = false;
|
|
474
493
|
//checking status of each job
|
package/dist/index.js
CHANGED
|
@@ -602,25 +602,25 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
602
602
|
}
|
|
603
603
|
switch (actionType) {
|
|
604
604
|
case 'generate_images':
|
|
605
|
-
|
|
605
|
+
this.initialImageGenerate(jobId, recordId, adminUser, headers);
|
|
606
606
|
break;
|
|
607
607
|
case 'analyze_no_images':
|
|
608
|
-
|
|
608
|
+
this.analyzeNoImages(jobId, recordId, adminUser, headers);
|
|
609
609
|
break;
|
|
610
610
|
case 'analyze':
|
|
611
|
-
|
|
611
|
+
this.analyze_image(jobId, recordId, adminUser, headers);
|
|
612
612
|
break;
|
|
613
613
|
case 'regenerate_images':
|
|
614
614
|
if (!body.prompt || !body.fieldName) {
|
|
615
615
|
jobs.set(jobId, { status: "failed", error: "Missing prompt or field name" });
|
|
616
616
|
break;
|
|
617
617
|
}
|
|
618
|
-
|
|
618
|
+
this.regenerateImage(jobId, recordId, body.fieldName, body.prompt, adminUser, headers);
|
|
619
619
|
break;
|
|
620
620
|
default:
|
|
621
621
|
jobs.set(jobId, { status: "failed", error: "Unknown action type" });
|
|
622
622
|
}
|
|
623
|
-
setTimeout(() => jobs.delete(jobId),
|
|
623
|
+
setTimeout(() => jobs.delete(jobId), 1800000);
|
|
624
624
|
return { ok: true, jobId };
|
|
625
625
|
})
|
|
626
626
|
});
|
package/index.ts
CHANGED
|
@@ -642,25 +642,25 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
642
642
|
|
|
643
643
|
switch(actionType) {
|
|
644
644
|
case 'generate_images':
|
|
645
|
-
|
|
645
|
+
this.initialImageGenerate(jobId, recordId, adminUser, headers);
|
|
646
646
|
break;
|
|
647
647
|
case 'analyze_no_images':
|
|
648
|
-
|
|
648
|
+
this.analyzeNoImages(jobId, recordId, adminUser, headers);
|
|
649
649
|
break;
|
|
650
650
|
case 'analyze':
|
|
651
|
-
|
|
651
|
+
this.analyze_image(jobId, recordId, adminUser, headers);
|
|
652
652
|
break;
|
|
653
653
|
case 'regenerate_images':
|
|
654
654
|
if (!body.prompt || !body.fieldName) {
|
|
655
655
|
jobs.set(jobId, { status: "failed", error: "Missing prompt or field name" });
|
|
656
656
|
break;
|
|
657
657
|
}
|
|
658
|
-
|
|
658
|
+
this.regenerateImage(jobId, recordId, body.fieldName, body.prompt, adminUser, headers);
|
|
659
659
|
break;
|
|
660
660
|
default:
|
|
661
661
|
jobs.set(jobId, { status: "failed", error: "Unknown action type" });
|
|
662
662
|
}
|
|
663
|
-
setTimeout(() => jobs.delete(jobId),
|
|
663
|
+
setTimeout(() => jobs.delete(jobId), 1_800_000);
|
|
664
664
|
return { ok: true, jobId };
|
|
665
665
|
}
|
|
666
666
|
});
|