feat(discord-gateway): add local badword pre-filter, accurate token estimation, Piscina maxThreads config, and PromptMode support
This commit is contained in:
@@ -508,6 +508,16 @@ function hasMediaContent(
|
||||
// Single-image vision analysis (reused by both text-only and media paths)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* In-memory LRU cache for vision analysis results.
|
||||
* Fastest path — avoids DB round-trip for frequently seen images.
|
||||
* Max 500 entries, 24-hour TTL.
|
||||
*/
|
||||
const visionLruCache = new LRUCache<string, string>({
|
||||
max: 500,
|
||||
ttl: 24 * 60 * 60 * 1000,
|
||||
});
|
||||
|
||||
/**
|
||||
* In-flight deduplication map — prevents concurrent vision API calls for
|
||||
* the same cache key. Multiple concurrent requests for an identical image
|
||||
|
||||
Reference in New Issue
Block a user