@adminforth/bulk-ai-flow 1.4.1 → 1.5.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.
@@ -11,6 +11,7 @@
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
13
  "@iconify-prerendered/vue-mdi": "^0.25.1718880438",
14
+ "adminforth": "^2.4.0-next.112",
14
15
  "medium-zoom": "^1.1.0"
15
16
  }
16
- }
17
+ }
@@ -66,7 +66,7 @@
66
66
 
67
67
  <script lang="ts" setup>
68
68
  import { callAdminForthApi } from '@/utils';
69
- import { handleError, ref, watch } from 'vue'
69
+ import { ref, watch } from 'vue'
70
70
  import { Dialog, Button } from '@/afcl';
71
71
  import VisionTable from './visionTable.vue'
72
72
  import adminforth from '@/adminforth';
@@ -143,7 +143,7 @@ const openDialog = async () => {
143
143
  }
144
144
 
145
145
  watch(selected, (val) => {
146
- console.log('Selected changed:', val);
146
+ //console.log('Selected changed:', val);
147
147
  checkedCount.value = val.filter(item => item.isChecked === true).length;
148
148
  }, { deep: true });
149
149
 
@@ -158,6 +158,7 @@ const closeDialog = () => {
158
158
  tableColumns.value = [];
159
159
  tableColumnsIndexes.value = [];
160
160
  isError.value = false;
161
+ isCriticalError.value = false;
161
162
  errorMessage.value = '';
162
163
  }
163
164
 
@@ -340,22 +341,42 @@ async function analyzeFields() {
340
341
 
341
342
  isAiResponseReceivedAnalize.value = props.checkboxes.map(() => true);
342
343
 
343
- res.result.forEach((item, idx) => {
344
- const pk = selected.value[idx]?.[primaryKey]
344
+ if (res?.error) {
345
+ adminforth.alert({
346
+ message: res.error,
347
+ variant: 'danger',
348
+ timeout: 'unlimited',
349
+ });
345
350
 
346
- if (pk) {
347
- selected.value[idx] = {
348
- ...selected.value[idx],
349
- ...item,
350
- isChecked: true,
351
- [primaryKey]: pk
351
+ console.error('Failed to analyze image(s):', res.error);
352
+ isError.value = true;
353
+ isCriticalError.value = true;
354
+ errorMessage.value = `Failed to fetch analyze image(s). Please, try to re-run the action.`;
355
+ } else {
356
+ res.result.forEach((item, idx) => {
357
+ const pk = selected.value[idx]?.[primaryKey]
358
+
359
+ if (pk) {
360
+ selected.value[idx] = {
361
+ ...selected.value[idx],
362
+ ...item,
363
+ isChecked: true,
364
+ [primaryKey]: pk
365
+ }
352
366
  }
353
- }
354
- })
367
+ })
368
+ }
355
369
  } catch (error) {
370
+ adminforth.alert({
371
+ message: error,
372
+ variant: 'danger',
373
+ timeout: 'unlimited',
374
+ });
375
+
356
376
  console.error('Failed to analyze image(s):', error);
357
377
  isError.value = true;
358
- errorMessage.value = `Failed to fetch analyze image(s). Please, try to re-run the action.`;
378
+ isCriticalError.value = true;
379
+ errorMessage.value = res.error;
359
380
  }
360
381
  }
361
382
 
@@ -374,23 +395,40 @@ async function analyzeFieldsNoImages() {
374
395
  if(!props.meta.isFieldsForAnalizeFromImages) {
375
396
  isAiResponseReceivedAnalize.value = props.checkboxes.map(() => true);
376
397
  }
377
-
378
- res.result.forEach((item, idx) => {
379
- const pk = selected.value[idx]?.[primaryKey]
380
-
381
- if (pk) {
382
- selected.value[idx] = {
383
- ...selected.value[idx],
384
- ...item,
385
- isChecked: true,
386
- [primaryKey]: pk
398
+ if(res?.error) {
399
+ adminforth.alert({
400
+ message: res.error,
401
+ variant: 'danger',
402
+ timeout: 'unlimited',
403
+ });
404
+ console.error('Failed to analyze fields:', res.error);
405
+ isError.value = true;
406
+ isCriticalError.value = true;
407
+ errorMessage.value = res.error;
408
+ } else {
409
+ res.result.forEach((item, idx) => {
410
+ const pk = selected.value[idx]?.[primaryKey]
411
+
412
+ if (pk) {
413
+ selected.value[idx] = {
414
+ ...selected.value[idx],
415
+ ...item,
416
+ isChecked: true,
417
+ [primaryKey]: pk
418
+ }
387
419
  }
388
- }
389
- })
420
+ })
421
+ }
390
422
  } catch (error) {
391
- console.error('Failed to analyze fields:', error);
392
- isError.value = true;
393
- errorMessage.value = `Failed to analyze fields. Please, try to re-run the action.`;
423
+ adminforth.alert({
424
+ message: error,
425
+ variant: 'danger',
426
+ timeout: 'unlimited',
427
+ });
428
+ console.error('Failed to analyze fields:', error);
429
+ isError.value = true;
430
+ isCriticalError.value = true;
431
+ errorMessage.value = `Failed to analyze fields. Please, try to re-run the action.`;
394
432
  }
395
433
  }
396
434
 
@@ -490,7 +528,10 @@ async function generateImages() {
490
528
  message: error,
491
529
  variant: 'danger',
492
530
  timeout: 'unlimited',
493
- });
531
+ });;
532
+ isError.value = true;
533
+ isCriticalError.value = true;
534
+ errorMessage.value = error;
494
535
  } else {
495
536
  res.result.forEach((item, idx) => {
496
537
  const pk = selected.value[idx]?.[primaryKey]