Commit Graph
24 Commits
Author SHA1 Message Date
MythEclipse 367d8696c8 fix(moderation): revert API failures to pending instead of sticking in error state 2026-06-04 18:52:37 +07:00
MythEclipse 4996acfacf refactor(ai-moderation): unify worker pool entry points with discriminated union routing 2026-06-04 17:39:40 +07:00
MythEclipse 686dc2de4f refactor(ai-moderation): remove unused count variable in stale CB error pruning loop 2026-06-04 17:35:52 +07:00
MythEclipse 121b78198c feat(ai-moderation): add circuit breaker alert system with extensible handlers 2026-06-04 17:35:26 +07:00
MythEclipse 8c67eefede refactor(ai-moderation): offload individual message analysis to worker pool and add auto-delete notifications 2026-06-04 17:34:54 +07:00
MythEclipse ce8a42f5fd feat(ai-moderation): eliminate LLM-based badword detection in favor of pure rule-based matching 2026-06-04 17:33:08 +07:00
MythEclipse 3fc26592fc feat(ai-moderation): add simple text-only LLM fallback when normal analysis fails for small models 2026-06-04 13:40:25 +07:00
MythEclipse e55ee342b1 fix(ai-moderation): downgrade operational logs to debug and add missing debug logs to silent early-return paths 2026-06-04 13:13:55 +07:00
MythEclipse 6d2da7ce1d perf(discord-gateway): start AI moderation analysis immediately, running attachment uploads in parallel instead of blocking 2026-06-02 22:49:57 +07:00
MythEclipse b0a879647e feat(discord-gateway): add perceptual hash helpers for image deduplication in ai-moderation 2026-06-02 22:49:37 +07:00
MythEclipse bf6ec728c4 chore(discord-gateway): remove stale eslint-disable comment for sticker cache stats 2026-06-02 22:20:46 +07:00
MythEclipse 0a71e76e62 fix(ai-moderation): enforce concurrency cap, prune stale counters, and prevent retry collisions 2026-06-02 22:12:03 +07:00
MythEclipse 9c352c94c9 chore: no staged changes 2026-06-02 22:05:47 +07:00
MythEclipse 862586a863 No staged changes found. 2026-06-02 22:04:46 +07:00
MythEclipse 1359dd4955 chore: no staged changes 2026-06-02 22:04:09 +07:00
MythEclipse a4e91822f6 chore: no staged changes 2026-06-02 22:03:53 +07:00
MythEclipse 55042ca9eb chore: no staged changes 2026-06-02 22:03:44 +07:00
MythEclipse 1e1fbb4583 fix(discord-gateway): require LLM API key only when AI analysis is enabled 2026-06-02 21:46:15 +07:00
MythEclipse 19028cf244 refactor: migrate discord-gateway from winston to @bete/shared/logger and utils
- Replace all local logger imports (../../shared/logger/logger.js) with @bete/shared/logger across 26 files
- Remove winston dependency, add pino to discord-gateway package.json
- Delete shared/logger/logger.ts (winston-based, 132 lines) and serialization.ts (109 lines)
- Replace local retryWithBackoff imports with @bete/shared/utils across 6 files
- Delete shared/utils/retry.ts (42 lines)
- Add CustomLogger type alias to @bete/shared/logger for backwards compatibility
- Remove logger param from all retryWithBackoff calls and uploadToTele interfaces
- Frontend: convert entity type files to re-exports from shared/api/client.ts
- Full monorepo typecheck clean (4/4 packages)

35 files changed, 42 insertions(+), 488 deletions(-)
2026-06-02 21:23:12 +07:00
MythEclipse 505c30f124 chore(discord-gateway): remove unused imports from response logger
- aiAnalyzer.ts: removed unused logAnalysisSummary and logFalsePositiveDetected
- llmModerationClient.ts: removed unused logVisionAnalysis, logVisionError, logRetryAttempt

These functions are not called in the codebase.
2026-06-02 12:36:05 +07:00
MythEclipse 1acd452a2c fix(discord-gateway): resolve type errors in error logging - cast unknown error types to Error | string for logModerationError calls
- aiAnalyzer.ts: cast error to Error | string in individual fallback phase
- llmModerationClient.ts: cast parseError to Error | string in parse response phase

Fixes GitHub Actions build failure (exit code 2)
2026-06-02 12:30:59 +07:00
MythEclipseandClaude Opus 4.8 c5c667b147 feat: comprehensive UX improvements — messages, analysis, moderation
Fix #1 (CRITICAL): Wire message_analyzed through Redis EventBroadcaster
- DG aiAnalyzer.ts: Add broadcastAnalysisCompleted() helper that publishes
  to both in-memory WS broadcaster AND Redis EventBroadcaster
- DG bootstrap.ts: Pass eventBroadcaster to startPendingAIAnalysisWorker()
- Fixes broken real-time chain so analysis results appear instantly

Fix #2: Collapsible AI Analysis with Rich Formatting
- MessageCard: AI analysis now collapsible with color-coded severity border
  (red/yellow/blue), summary line showing categories + confidence + severity
- Default collapsed for clean, expanded for warn/flagged

Fix #3: Toast Notifications for Flagged Content
- Wrap app in ToastProvider; ModerationAlertListener component listens for
  moderation_alert custom events and shows toast with emoji + details

Fix #4: Discord-style Message Grouping
- MessageFeed: Group consecutive messages from same user within 5 min
- MessageCard: Compact variant hides avatar, reduces padding for non-first

Fix #5: Moderation Action Buttons in UI
- BE: POST /api/messages/:id/moderate endpoint + publishCommand() for Redis
- FE: Delete/Warn buttons on flagged/warned cards with confirmation dialog

Fix #6: Search Results Include Full Data
- BE analysis.service.ts: SELECT all 26 message columns instead of just 11
- Search results now render with full MessageCard including images/analysis

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 12:17:51 +07:00
MythEclipseandClaude Opus 4.8 64643bb066 perf: hapus semua cooldown/backoff delay — retry tanpa bottleneck
Semua retry sekarang instant (retries=0, minTimeout=0, maxTimeout=0):
- retry.ts (kedua) — default minTimeout/maxTimeout 0, factor 1
- config.ts (kedua) — DECODER_COOLDOWN_MS=0, AI_ANALYSIS_ERROR_COOLDOWN_MS=0
- llmModerationClient.ts (kedua) — retries 0 tanpa delay
- aiAnalyzer.ts (kedua) — retries 0, AI_ANALYSIS_ERROR_COOLDOWN jadi 0
- indonesianTextNormalizer.ts (kedua) — semua rate limit cooldown 0
- recorder.ts (kedua), teleUpload (3 files), uploader (2 files) — retry instant
- attachmentUploader (kedua) — retries 0
- syncRoutes.ts — BACKLOG_SYNC_COOLDOWN 0

20 files changed. Semua cooldown bottleneck dihapus.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 11:29:52 +07:00
MythEclipseandClaude Opus 4.8 c48a0c5e3b refactor: split monolith into 3 microservices (frontend, backend, discord-gateway)
- Extract services into services/{frontend,backend,discord-gateway}
- Create packages/shared/ for shared logger, errors, utils, types
- Setup Modular MVC pattern in backend (controller→service→repository)
- Setup event-driven architecture in discord-gateway with Redis pub/sub
- Move Docker files to infra/docker/ with per-service Dockerfiles
- Update docker-compose.yml to use Traefik-only routing (no port exposes)
- Update GitHub Actions deploy workflow for multi-service matrix build
- Fix all import paths and resolve type errors across all services
- All 3 services pass tsc --noEmit clean

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 21:44:29 +07:00