@adminforth/bulk-ai-flow 1.17.3 → 1.17.5

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 CHANGED
@@ -13,5 +13,5 @@ custom/package-lock.json
13
13
  custom/package.json
14
14
  custom/tsconfig.json
15
15
 
16
- sent 88,319 bytes received 172 bytes 176,982.00 bytes/sec
17
- total size is 87,674 speedup is 0.99
16
+ sent 89,057 bytes received 172 bytes 178,458.00 bytes/sec
17
+ total size is 88,412 speedup is 0.99
@@ -137,7 +137,9 @@ import VisionTable from './VisionTable.vue'
137
137
  import adminforth from '@/adminforth';
138
138
  import { useI18n } from 'vue-i18n';
139
139
  import { AdminUser, type AdminForthResourceCommon } from '@/types/Common';
140
- import { run } from 'node:test';
140
+ import { useCoreStore } from '@/stores/core';
141
+
142
+ const coreStore = useCoreStore();
141
143
 
142
144
  const { t } = useI18n();
143
145
  const props = defineProps<{
@@ -623,6 +625,7 @@ async function runAiAction({
623
625
  recordId: checkbox,
624
626
  ...(customPrompt !== undefined ? { customPrompt: JSON.stringify(customPrompt) } : {}),
625
627
  },
628
+ silentError: true,
626
629
  });
627
630
 
628
631
  if (res?.error) {
@@ -656,8 +659,13 @@ async function runAiAction({
656
659
  path: `/plugin/${props.meta.pluginInstanceId}/get-job-status`,
657
660
  method: 'POST',
658
661
  body: { jobId },
662
+ silentError: true,
659
663
  });
660
664
  //check for errors
665
+ if (!jobResponse) {
666
+ isAtLeastOneInProgress = true;
667
+ continue;
668
+ }
661
669
  if (jobResponse?.error) {
662
670
  console.error(`Error during ${actionType}:`, jobResponse.error);
663
671
  break;
@@ -839,6 +847,14 @@ async function uploadImage(imgBlob, id, fieldName) {
839
847
  }
840
848
 
841
849
  function regenerateImages(recordInfo: any) {
850
+ if (coreStore.isInternetError) {
851
+ adminforth.alert({
852
+ message: t('Cannot regenerate images while internet connection is lost. Please check your connection and try again.'),
853
+ variant: 'danger',
854
+ timeout: 'unlimited',
855
+ });
856
+ return;
857
+ }
842
858
  isGeneratingImages.value = true;
843
859
  runAiAction({
844
860
  endpoint: 'initial_image_generate',
@@ -950,6 +966,14 @@ function checkAndAddNewFieldsToPrompts(savedPrompts, defaultPrompts) {
950
966
  }
951
967
 
952
968
  async function regenerateCell(recordInfo: any) {
969
+ if (coreStore.isInternetError) {
970
+ adminforth.alert({
971
+ message: t('Cannot regenerate column while internet connection is lost. Please check your connection and try again.'),
972
+ variant: 'danger',
973
+ timeout: 'unlimited',
974
+ });
975
+ return;
976
+ }
953
977
  if (!regeneratingFieldsStatus.value[recordInfo.recordId]) {
954
978
  regeneratingFieldsStatus.value[recordInfo.recordId] = {};
955
979
  }
@@ -982,6 +1006,7 @@ async function regenerateCell(recordInfo: any) {
982
1006
  actionType: actionType,
983
1007
  prompt: generationPromptsForField[recordInfo.fieldName] || null,
984
1008
  },
1009
+ silentError: true,
985
1010
  });
986
1011
  } catch (e) {
987
1012
  regeneratingFieldsStatus.value[recordInfo.recordId][recordInfo.fieldName] = false;
@@ -137,7 +137,9 @@ import VisionTable from './VisionTable.vue'
137
137
  import adminforth from '@/adminforth';
138
138
  import { useI18n } from 'vue-i18n';
139
139
  import { AdminUser, type AdminForthResourceCommon } from '@/types/Common';
140
- import { run } from 'node:test';
140
+ import { useCoreStore } from '@/stores/core';
141
+
142
+ const coreStore = useCoreStore();
141
143
 
142
144
  const { t } = useI18n();
143
145
  const props = defineProps<{
@@ -623,6 +625,7 @@ async function runAiAction({
623
625
  recordId: checkbox,
624
626
  ...(customPrompt !== undefined ? { customPrompt: JSON.stringify(customPrompt) } : {}),
625
627
  },
628
+ silentError: true,
626
629
  });
627
630
 
628
631
  if (res?.error) {
@@ -656,8 +659,13 @@ async function runAiAction({
656
659
  path: `/plugin/${props.meta.pluginInstanceId}/get-job-status`,
657
660
  method: 'POST',
658
661
  body: { jobId },
662
+ silentError: true,
659
663
  });
660
664
  //check for errors
665
+ if (!jobResponse) {
666
+ isAtLeastOneInProgress = true;
667
+ continue;
668
+ }
661
669
  if (jobResponse?.error) {
662
670
  console.error(`Error during ${actionType}:`, jobResponse.error);
663
671
  break;
@@ -839,6 +847,14 @@ async function uploadImage(imgBlob, id, fieldName) {
839
847
  }
840
848
 
841
849
  function regenerateImages(recordInfo: any) {
850
+ if (coreStore.isInternetError) {
851
+ adminforth.alert({
852
+ message: t('Cannot regenerate images while internet connection is lost. Please check your connection and try again.'),
853
+ variant: 'danger',
854
+ timeout: 'unlimited',
855
+ });
856
+ return;
857
+ }
842
858
  isGeneratingImages.value = true;
843
859
  runAiAction({
844
860
  endpoint: 'initial_image_generate',
@@ -950,6 +966,14 @@ function checkAndAddNewFieldsToPrompts(savedPrompts, defaultPrompts) {
950
966
  }
951
967
 
952
968
  async function regenerateCell(recordInfo: any) {
969
+ if (coreStore.isInternetError) {
970
+ adminforth.alert({
971
+ message: t('Cannot regenerate column while internet connection is lost. Please check your connection and try again.'),
972
+ variant: 'danger',
973
+ timeout: 'unlimited',
974
+ });
975
+ return;
976
+ }
953
977
  if (!regeneratingFieldsStatus.value[recordInfo.recordId]) {
954
978
  regeneratingFieldsStatus.value[recordInfo.recordId] = {};
955
979
  }
@@ -982,6 +1006,7 @@ async function regenerateCell(recordInfo: any) {
982
1006
  actionType: actionType,
983
1007
  prompt: generationPromptsForField[recordInfo.fieldName] || null,
984
1008
  },
1009
+ silentError: true,
985
1010
  });
986
1011
  } catch (e) {
987
1012
  regeneratingFieldsStatus.value[recordInfo.recordId][recordInfo.fieldName] = false;
package/index.ts CHANGED
@@ -7,7 +7,7 @@ import { RateLimiter } from "adminforth";
7
7
  import { randomUUID } from "crypto";
8
8
 
9
9
  const STUB_MODE = false;
10
- const jobs = new Map();
10
+ const jobs = new Map();
11
11
  export default class BulkAiFlowPlugin extends AdminForthPlugin {
12
12
  options: PluginOptions;
13
13
  uploadPlugin: AdminForthPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/bulk-ai-flow",
3
- "version": "1.17.3",
3
+ "version": "1.17.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -30,7 +30,7 @@
30
30
  "handlebars": "^4.7.8"
31
31
  },
32
32
  "peerDependencies": {
33
- "adminforth": "^2.13.0-next.51"
33
+ "adminforth": "^2.13.0-next.60"
34
34
  },
35
35
  "release": {
36
36
  "plugins": [