@adminforth/bulk-ai-flow 1.16.1 → 1.17.1
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 +16 -6
- package/dist/custom/VisionAction.vue +16 -6
- package/dist/index.js +0 -1
- package/index.ts +0 -1
- package/package.json +1 -1
package/build.log
CHANGED
|
@@ -13,5 +13,5 @@ custom/package-lock.json
|
|
|
13
13
|
custom/package.json
|
|
14
14
|
custom/tsconfig.json
|
|
15
15
|
|
|
16
|
-
sent 88,
|
|
17
|
-
total size is 87,
|
|
16
|
+
sent 88,319 bytes received 172 bytes 176,982.00 bytes/sec
|
|
17
|
+
total size is 87,674 speedup is 0.99
|
package/custom/VisionAction.vue
CHANGED
|
@@ -200,10 +200,12 @@ const imageGenerationErrorMessage = ref<string[]>([]);
|
|
|
200
200
|
const isImageHasPreviewUrl = ref<Record<string, boolean>>({});
|
|
201
201
|
const popupMode = ref<'generation' | 'confirmation' | 'settings'>('confirmation');
|
|
202
202
|
const generationPrompts = ref<any>({});
|
|
203
|
+
const isDataSaved = ref(false);
|
|
203
204
|
|
|
204
205
|
const regeneratingFieldsStatus = ref<Record<string, Record<string, boolean>>>({});
|
|
205
206
|
|
|
206
207
|
const openDialog = async () => {
|
|
208
|
+
window.addEventListener('beforeunload', beforeUnloadHandler);
|
|
207
209
|
if (props.meta.askConfirmationBeforeGenerating) {
|
|
208
210
|
popupMode.value = 'confirmation';
|
|
209
211
|
} else {
|
|
@@ -277,6 +279,7 @@ function runAiActions() {
|
|
|
277
279
|
}
|
|
278
280
|
|
|
279
281
|
const closeDialog = () => {
|
|
282
|
+
window.removeEventListener('beforeunload', beforeUnloadHandler);
|
|
280
283
|
isAiResponseReceivedAnalizeImage.value = [];
|
|
281
284
|
isAiResponseReceivedAnalizeNoImage.value = [];
|
|
282
285
|
isAiResponseReceivedImage.value = [];
|
|
@@ -292,6 +295,7 @@ const closeDialog = () => {
|
|
|
292
295
|
errorMessage.value = '';
|
|
293
296
|
isDialogOpen.value = false;
|
|
294
297
|
popupMode.value = 'confirmation';
|
|
298
|
+
isDataSaved.value = false;
|
|
295
299
|
}
|
|
296
300
|
|
|
297
301
|
watch(selected, (val) => {
|
|
@@ -537,6 +541,8 @@ async function saveData() {
|
|
|
537
541
|
errorMessage.value = t(`Failed to save data. Please, try to re-run the action.`);
|
|
538
542
|
} finally {
|
|
539
543
|
isLoading.value = false;
|
|
544
|
+
isDataSaved.value = true;
|
|
545
|
+
window.removeEventListener('beforeunload', beforeUnloadHandler);
|
|
540
546
|
}
|
|
541
547
|
}
|
|
542
548
|
|
|
@@ -944,7 +950,6 @@ function checkAndAddNewFieldsToPrompts(savedPrompts, defaultPrompts) {
|
|
|
944
950
|
}
|
|
945
951
|
|
|
946
952
|
async function regenerateCell(recordInfo: any) {
|
|
947
|
-
console.log('Regenerating cell for record:', recordInfo.recordId, 'field:', recordInfo.fieldName);
|
|
948
953
|
if (!regeneratingFieldsStatus.value[recordInfo.recordId]) {
|
|
949
954
|
regeneratingFieldsStatus.value[recordInfo.recordId] = {};
|
|
950
955
|
}
|
|
@@ -965,7 +970,6 @@ async function regenerateCell(recordInfo: any) {
|
|
|
965
970
|
} else if (actionType === 'analyze_no_images') {
|
|
966
971
|
generationPromptsForField = generationPrompts.value.plainFieldsPrompts || {};
|
|
967
972
|
}
|
|
968
|
-
console.log('Using generation prompts for field regeneration:', generationPromptsForField);
|
|
969
973
|
|
|
970
974
|
let res;
|
|
971
975
|
try {
|
|
@@ -980,6 +984,7 @@ async function regenerateCell(recordInfo: any) {
|
|
|
980
984
|
},
|
|
981
985
|
});
|
|
982
986
|
} catch (e) {
|
|
987
|
+
regeneratingFieldsStatus.value[recordInfo.recordId][recordInfo.fieldName] = false;
|
|
983
988
|
console.error(`Error during cell regeneration for record ${recordInfo.recordId}, field ${recordInfo.fieldName}:`, e);
|
|
984
989
|
}
|
|
985
990
|
if ( res.ok === false) {
|
|
@@ -988,15 +993,13 @@ async function regenerateCell(recordInfo: any) {
|
|
|
988
993
|
variant: 'danger',
|
|
989
994
|
});
|
|
990
995
|
isError.value = true;
|
|
991
|
-
errorMessage.value = t(`Failed to regenerate field
|
|
996
|
+
errorMessage.value = t(`Failed to regenerate field`);
|
|
997
|
+
regeneratingFieldsStatus.value[recordInfo.recordId][recordInfo.fieldName] = false;
|
|
992
998
|
return;
|
|
993
999
|
}
|
|
994
|
-
console.log('Regeneration response:', res);
|
|
995
1000
|
const index = selected.value.findIndex(item => String(item[primaryKey]) === String(recordInfo.recordId));
|
|
996
|
-
console.log('Found index in selected array:', index);
|
|
997
1001
|
|
|
998
1002
|
const pk = selected.value[index]?.[primaryKey];
|
|
999
|
-
console.log('Primary key for the record:', pk);
|
|
1000
1003
|
if (pk) {
|
|
1001
1004
|
selected.value[index] = {
|
|
1002
1005
|
...selected.value[index],
|
|
@@ -1007,4 +1010,11 @@ async function regenerateCell(recordInfo: any) {
|
|
|
1007
1010
|
}
|
|
1008
1011
|
regeneratingFieldsStatus.value[recordInfo.recordId][recordInfo.fieldName] = false;
|
|
1009
1012
|
}
|
|
1013
|
+
|
|
1014
|
+
const beforeUnloadHandler = (event) => {
|
|
1015
|
+
if (isDataSaved.value) return;
|
|
1016
|
+
event.preventDefault();
|
|
1017
|
+
event.returnValue = '';
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1010
1020
|
</script>
|
|
@@ -200,10 +200,12 @@ const imageGenerationErrorMessage = ref<string[]>([]);
|
|
|
200
200
|
const isImageHasPreviewUrl = ref<Record<string, boolean>>({});
|
|
201
201
|
const popupMode = ref<'generation' | 'confirmation' | 'settings'>('confirmation');
|
|
202
202
|
const generationPrompts = ref<any>({});
|
|
203
|
+
const isDataSaved = ref(false);
|
|
203
204
|
|
|
204
205
|
const regeneratingFieldsStatus = ref<Record<string, Record<string, boolean>>>({});
|
|
205
206
|
|
|
206
207
|
const openDialog = async () => {
|
|
208
|
+
window.addEventListener('beforeunload', beforeUnloadHandler);
|
|
207
209
|
if (props.meta.askConfirmationBeforeGenerating) {
|
|
208
210
|
popupMode.value = 'confirmation';
|
|
209
211
|
} else {
|
|
@@ -277,6 +279,7 @@ function runAiActions() {
|
|
|
277
279
|
}
|
|
278
280
|
|
|
279
281
|
const closeDialog = () => {
|
|
282
|
+
window.removeEventListener('beforeunload', beforeUnloadHandler);
|
|
280
283
|
isAiResponseReceivedAnalizeImage.value = [];
|
|
281
284
|
isAiResponseReceivedAnalizeNoImage.value = [];
|
|
282
285
|
isAiResponseReceivedImage.value = [];
|
|
@@ -292,6 +295,7 @@ const closeDialog = () => {
|
|
|
292
295
|
errorMessage.value = '';
|
|
293
296
|
isDialogOpen.value = false;
|
|
294
297
|
popupMode.value = 'confirmation';
|
|
298
|
+
isDataSaved.value = false;
|
|
295
299
|
}
|
|
296
300
|
|
|
297
301
|
watch(selected, (val) => {
|
|
@@ -537,6 +541,8 @@ async function saveData() {
|
|
|
537
541
|
errorMessage.value = t(`Failed to save data. Please, try to re-run the action.`);
|
|
538
542
|
} finally {
|
|
539
543
|
isLoading.value = false;
|
|
544
|
+
isDataSaved.value = true;
|
|
545
|
+
window.removeEventListener('beforeunload', beforeUnloadHandler);
|
|
540
546
|
}
|
|
541
547
|
}
|
|
542
548
|
|
|
@@ -944,7 +950,6 @@ function checkAndAddNewFieldsToPrompts(savedPrompts, defaultPrompts) {
|
|
|
944
950
|
}
|
|
945
951
|
|
|
946
952
|
async function regenerateCell(recordInfo: any) {
|
|
947
|
-
console.log('Regenerating cell for record:', recordInfo.recordId, 'field:', recordInfo.fieldName);
|
|
948
953
|
if (!regeneratingFieldsStatus.value[recordInfo.recordId]) {
|
|
949
954
|
regeneratingFieldsStatus.value[recordInfo.recordId] = {};
|
|
950
955
|
}
|
|
@@ -965,7 +970,6 @@ async function regenerateCell(recordInfo: any) {
|
|
|
965
970
|
} else if (actionType === 'analyze_no_images') {
|
|
966
971
|
generationPromptsForField = generationPrompts.value.plainFieldsPrompts || {};
|
|
967
972
|
}
|
|
968
|
-
console.log('Using generation prompts for field regeneration:', generationPromptsForField);
|
|
969
973
|
|
|
970
974
|
let res;
|
|
971
975
|
try {
|
|
@@ -980,6 +984,7 @@ async function regenerateCell(recordInfo: any) {
|
|
|
980
984
|
},
|
|
981
985
|
});
|
|
982
986
|
} catch (e) {
|
|
987
|
+
regeneratingFieldsStatus.value[recordInfo.recordId][recordInfo.fieldName] = false;
|
|
983
988
|
console.error(`Error during cell regeneration for record ${recordInfo.recordId}, field ${recordInfo.fieldName}:`, e);
|
|
984
989
|
}
|
|
985
990
|
if ( res.ok === false) {
|
|
@@ -988,15 +993,13 @@ async function regenerateCell(recordInfo: any) {
|
|
|
988
993
|
variant: 'danger',
|
|
989
994
|
});
|
|
990
995
|
isError.value = true;
|
|
991
|
-
errorMessage.value = t(`Failed to regenerate field
|
|
996
|
+
errorMessage.value = t(`Failed to regenerate field`);
|
|
997
|
+
regeneratingFieldsStatus.value[recordInfo.recordId][recordInfo.fieldName] = false;
|
|
992
998
|
return;
|
|
993
999
|
}
|
|
994
|
-
console.log('Regeneration response:', res);
|
|
995
1000
|
const index = selected.value.findIndex(item => String(item[primaryKey]) === String(recordInfo.recordId));
|
|
996
|
-
console.log('Found index in selected array:', index);
|
|
997
1001
|
|
|
998
1002
|
const pk = selected.value[index]?.[primaryKey];
|
|
999
|
-
console.log('Primary key for the record:', pk);
|
|
1000
1003
|
if (pk) {
|
|
1001
1004
|
selected.value[index] = {
|
|
1002
1005
|
...selected.value[index],
|
|
@@ -1007,4 +1010,11 @@ async function regenerateCell(recordInfo: any) {
|
|
|
1007
1010
|
}
|
|
1008
1011
|
regeneratingFieldsStatus.value[recordInfo.recordId][recordInfo.fieldName] = false;
|
|
1009
1012
|
}
|
|
1013
|
+
|
|
1014
|
+
const beforeUnloadHandler = (event) => {
|
|
1015
|
+
if (isDataSaved.value) return;
|
|
1016
|
+
event.preventDefault();
|
|
1017
|
+
event.returnValue = '';
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1010
1020
|
</script>
|
package/dist/index.js
CHANGED
|
@@ -845,7 +845,6 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
845
845
|
const fieldToRegenerate = body.fieldToRegenerate;
|
|
846
846
|
let prompt = body.prompt;
|
|
847
847
|
const actionType = body.actionType;
|
|
848
|
-
console.log('Regenerate cell called with:', { recordId, fieldToRegenerate, actionType, prompt });
|
|
849
848
|
if (!fieldToRegenerate || !recordId || !actionType) {
|
|
850
849
|
return { ok: false, error: "Missing parameters" };
|
|
851
850
|
}
|
package/index.ts
CHANGED
|
@@ -869,7 +869,6 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
869
869
|
const fieldToRegenerate = body.fieldToRegenerate;
|
|
870
870
|
let prompt = body.prompt;
|
|
871
871
|
const actionType = body.actionType;
|
|
872
|
-
console.log('Regenerate cell called with:', { recordId, fieldToRegenerate, actionType, prompt });
|
|
873
872
|
if (!fieldToRegenerate || !recordId || !actionType ) {
|
|
874
873
|
return { ok: false, error: "Missing parameters" };
|
|
875
874
|
}
|