feat: add response logger for moderation/vision audit trail + cache model versioning

- Add responseLogger.ts with comprehensive logging: vision analysis, moderation
  analysis batches, cache hit/miss events, errors, retries, false positives,
  model version changes, cache invalidation
- Integrate responseLogger calls into llmModerationClient.ts (cache events,
  moderation results, errors, retries)
- Add model_version column to text_analysis_cache schema with composite
  index for efficient filtering
- Add migration SQL for model_version column
- Document CACHE_MODEL_VERSION in .env.example
This commit is contained in:
MythEclipse
2026-06-02 12:23:52 +07:00
parent f4db42e11c
commit 385fc0bbbf
6 changed files with 505 additions and 18 deletions
+7
View File
@@ -92,3 +92,10 @@ AUTO_DELETE_ALLOWED_SEVERITIES=critical,high,medium
# Safe default: run migrations on startup before the app accepts traffic.
AUTO_MIGRATE_ON_STARTUP=true
# Cache Model Versioning
# Bump this version when the vision/LLM model prompt changes significantly.
# Old cache entries with mismatched versions are automatically ignored, forcing fresh analysis.
# Format: "v<N>" or "v<N>-<date>-<description>"
# Example progression: v1 → v2-2026-06-02-terminal-fix → v3-2026-06-15-new-model
# CACHE_MODEL_VERSION=v2-2026-06-02