feat(discord-gateway): add local badword pre-filter, accurate token estimation, Piscina maxThreads config, and PromptMode support

This commit is contained in:
MythEclipse
2026-06-02 22:50:23 +07:00
parent 6d2da7ce1d
commit f163ead3cf
4 changed files with 69 additions and 1 deletions
@@ -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