|
67 | 67 | { |
68 | 68 | label: t('Start generation'), |
69 | 69 | options: { |
70 | | - class: 'w-3/5 px-5 py-2.5 bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 hover:bg-gradient-to-br focus:ring-4 focus:outline-none focus:ring-purple-300 dark:focus:ring-purple-800 rounded-md text-white border-none' |
| 70 | + class: 'w-3/5 px-5 py-2.5 bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 hover:bg-gradient-to-br focus:ring-4 focus:outline-none focus:ring-purple-300 dark:focus:ring-purple-800 rounded-md text-white border-none', |
| 71 | + loader: isCheckingRateLimits |
71 | 72 | }, |
72 | 73 | onclick: (dialog) => { runAiActions(); } |
73 | 74 | } |
@@ -283,6 +284,7 @@ const completedRecordIds = ref<Set<string>>(new Set()); |
283 | 284 | const isActiveGeneration = ref(false); |
284 | 285 | const pauseBreakpoints = computed(() => props.meta.askConfirmation || []); |
285 | 286 | const startedRecordCount = ref(0); |
| 287 | +const isCheckingRateLimits = ref(false); |
286 | 288 | let startGate = Promise.resolve(); |
287 | 289 | const tableRef = ref<any>(null); |
288 | 290 | const processedCount = computed(() => { |
@@ -383,11 +385,11 @@ async function getListOfIds() { |
383 | 385 | |
384 | 386 |
|
385 | 387 | async function runAiActions() { |
386 | | - popupMode.value = 'generation'; |
387 | 388 | if (!await checkRateLimits()) { |
388 | 389 | confirmDialog.value.close(); |
389 | 390 | return; |
390 | 391 | } |
| 392 | + popupMode.value = 'generation'; |
391 | 393 | isGenerationCancelled.value = false; |
392 | 394 | isGenerationPaused.value = false; |
393 | 395 | isActiveGeneration.value = true; |
@@ -639,6 +641,7 @@ async function processOneRecord(recordId: string) { |
639 | 641 | } |
640 | 642 |
|
641 | 643 | async function checkRateLimits() { |
| 644 | + isCheckingRateLimits.value = true; |
642 | 645 | const actionsToCheck: Array<'generate_images' | 'analyze' | 'analyze_no_images'> = []; |
643 | 646 | if (props.meta.isImageGeneration) { |
644 | 647 | actionsToCheck.push('generate_images'); |
@@ -670,9 +673,11 @@ async function checkRateLimits() { |
670 | 673 | variant: 'danger', |
671 | 674 | timeout: 'unlimited', |
672 | 675 | }); |
| 676 | + isCheckingRateLimits.value = false; |
673 | 677 | return false; |
674 | 678 | } |
675 | 679 | } |
| 680 | + isCheckingRateLimits.value = false; |
676 | 681 | return true; |
677 | 682 | } |
678 | 683 |
|
|
0 commit comments