refactor: migrate sticker cache to PostgreSQL, remove versioning

- Replace file-based sticker cache (.dat + index.json) with PostgreSQL sticker_cache table
- Remove model_version column and all versioning logic (git branch detection, GitHub API, CACHE_MODEL_VERSION)
- Strip VISION_MODEL_VERSION, logCacheEvent calls, and version filtering from SQL queries
- Remove STICKER_CACHE_DIR and STICKER_CACHE_MAX_SIZE_MB config variables
- Delete dead migration add_model_version_to_cache.sql

textCacheStore.ts reduced 482→204 lines (-57%)
stickerCache.ts reduced 210→144 lines (-31%)
Total: 11 files changed, 233 insertions, 591 deletions
This commit is contained in:
MythEclipse
2026-06-02 14:05:51 +07:00
parent e584a7941e
commit 406a6cbf79
11 changed files with 233 additions and 591 deletions
@@ -43,7 +43,6 @@ export interface CacheHitEvent {
type: "hit" | "miss";
cacheKey: string;
source: "text" | "media" | "sticker";
modelVersion: string;
timestamp: number;
}
@@ -154,27 +153,22 @@ export function logCacheEvent(
type: "hit" | "miss",
cacheKey: string,
source: "text" | "media" | "sticker",
modelVersion: string,
): void {
const event: CacheHitEvent = {
type,
cacheKey,
source,
modelVersion,
timestamp: Date.now(),
};
const level = type === "hit" ? "debug" : "debug";
logger.log(
{ level },
logger.debug(
{
cache_type: type.toUpperCase(),
source,
key_length: cacheKey.length,
key_preview: cacheKey.substring(0, 50),
model_version: modelVersion,
},
`Cache ${type.toUpperCase()}: ${source} (version: ${modelVersion})`,
`Cache ${type.toUpperCase()}: ${source}`,
);
}