@blueharford/scrypted-spatial-awareness 0.6.31 → 0.6.32

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/dist/plugin.zip CHANGED
Binary file
@@ -37502,14 +37502,22 @@ class TrackingEngine {
37502
37502
  this.lastLlmCallTime = Date.now();
37503
37503
  }
37504
37504
  /** Check and record LLM call - returns false if rate limited */
37505
- tryLlmCall() {
37505
+ tryLlmCall(silent = false) {
37506
37506
  if (!this.isLlmCallAllowed()) {
37507
- this.console.log('[LLM] Rate limited, skipping LLM call');
37507
+ // Only log once per rate limit window, not every call
37508
+ if (!silent && !this.rateLimitLogged) {
37509
+ const remaining = Math.ceil((this.config.llmDebounceInterval || 30000) - (Date.now() - this.lastLlmCallTime)) / 1000;
37510
+ this.console.log(`[LLM] Rate limited, ${remaining.toFixed(0)}s until next call allowed`);
37511
+ this.rateLimitLogged = true;
37512
+ }
37508
37513
  return false;
37509
37514
  }
37515
+ this.rateLimitLogged = false;
37510
37516
  this.recordLlmCall();
37511
37517
  return true;
37512
37518
  }
37519
+ /** Track if we've already logged rate limit message */
37520
+ rateLimitLogged = false;
37513
37521
  /** Get spatial reasoning result for movement (uses RAG + LLM) with debouncing and fallback */
37514
37522
  async getSpatialDescription(tracked, fromCameraId, toCameraId, transitTime, currentCameraId) {
37515
37523
  const fallbackEnabled = this.config.llmFallbackEnabled ?? true;
@@ -39373,7 +39381,7 @@ class SpatialAwarenessPlugin extends sdk_1.ScryptedDeviceBase {
39373
39381
  llmDebounceInterval: {
39374
39382
  title: 'LLM Rate Limit (seconds)',
39375
39383
  type: 'number',
39376
- defaultValue: 30,
39384
+ defaultValue: 5,
39377
39385
  description: 'Minimum time between LLM calls to prevent API rate limiting. Increase if you get rate limit errors. (0 = no limit)',
39378
39386
  group: 'AI & Spatial Reasoning',
39379
39387
  },