@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/out/plugin.zip CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueharford/scrypted-spatial-awareness",
3
- "version": "0.6.31",
3
+ "version": "0.6.32",
4
4
  "description": "Cross-camera object tracking for Scrypted NVR with spatial awareness",
5
5
  "author": "Joshua Seidel <blueharford>",
6
6
  "license": "Apache-2.0",
Binary file
@@ -328,15 +328,24 @@ export class TrackingEngine {
328
328
  }
329
329
 
330
330
  /** Check and record LLM call - returns false if rate limited */
331
- private tryLlmCall(): boolean {
331
+ private tryLlmCall(silent: boolean = false): boolean {
332
332
  if (!this.isLlmCallAllowed()) {
333
- this.console.log('[LLM] Rate limited, skipping LLM call');
333
+ // Only log once per rate limit window, not every call
334
+ if (!silent && !this.rateLimitLogged) {
335
+ const remaining = Math.ceil((this.config.llmDebounceInterval || 30000) - (Date.now() - this.lastLlmCallTime)) / 1000;
336
+ this.console.log(`[LLM] Rate limited, ${remaining.toFixed(0)}s until next call allowed`);
337
+ this.rateLimitLogged = true;
338
+ }
334
339
  return false;
335
340
  }
341
+ this.rateLimitLogged = false;
336
342
  this.recordLlmCall();
337
343
  return true;
338
344
  }
339
345
 
346
+ /** Track if we've already logged rate limit message */
347
+ private rateLimitLogged: boolean = false;
348
+
340
349
  /** Get spatial reasoning result for movement (uses RAG + LLM) with debouncing and fallback */
341
350
  private async getSpatialDescription(
342
351
  tracked: TrackedObject,
package/src/main.ts CHANGED
@@ -130,7 +130,7 @@ export class SpatialAwarenessPlugin extends ScryptedDeviceBase
130
130
  llmDebounceInterval: {
131
131
  title: 'LLM Rate Limit (seconds)',
132
132
  type: 'number',
133
- defaultValue: 30,
133
+ defaultValue: 5,
134
134
  description: 'Minimum time between LLM calls to prevent API rate limiting. Increase if you get rate limit errors. (0 = no limit)',
135
135
  group: 'AI & Spatial Reasoning',
136
136
  },