diff --git a/src/PowderCoating.Infrastructure/Services/AiCatalogPriceCheckService.cs b/src/PowderCoating.Infrastructure/Services/AiCatalogPriceCheckService.cs index 783ea96..332e669 100644 --- a/src/PowderCoating.Infrastructure/Services/AiCatalogPriceCheckService.cs +++ b/src/PowderCoating.Infrastructure/Services/AiCatalogPriceCheckService.cs @@ -22,7 +22,7 @@ public class AiCatalogPriceCheckService : IAiCatalogPriceCheckService private const string Model = "claude-haiku-4-5-20251001"; private const int BatchSize = 25; - private const int MaxConcurrentBatches = 2; + private const int MaxConcurrentBatches = 1; // sequential avoids bursting past the 8k output TPM limit private const int RateLimitRetrySeconds = 65; private const int MinBatchIntervalSeconds = 20; // proactive pacing: ~3 batches/min × ~2k tokens = ~6k TPM, under the 8k limit diff --git a/src/PowderCoating.Web/wwwroot/js/catalog-price-check.js b/src/PowderCoating.Web/wwwroot/js/catalog-price-check.js index 8d0845d..5cee057 100644 --- a/src/PowderCoating.Web/wwwroot/js/catalog-price-check.js +++ b/src/PowderCoating.Web/wwwroot/js/catalog-price-check.js @@ -11,11 +11,10 @@ if (!form || !btn || !overlay) return; // Estimate total seconds based on item count. - // Haiku: 2 concurrent batches, ~25s per wave (includes occasional rate-limit waits). + // Haiku sequential: 1 batch at a time, ~22s each (API time + 20s pacing gap). function estimateDuration(itemCount) { var batches = Math.max(1, Math.ceil(itemCount / 25)); - var waves = Math.ceil(batches / 2); - return Math.max(30, waves * 25); + return Math.max(30, batches * 22); } // Messages keyed to approximate progress milestones (0–100).