feat(discord-gateway): use Discord CDN for image analysis, uploader archive-only

- mediaDownloader: flip URL candidate order so discord_url is tried
  before uploaded_url (uploaded_url is archive-only fallback)
- ai-analysis-worker: remove upload-pending race guard that blocked
  analysis until Tele upload completed; analysis now runs immediately
  on the Discord CDN URL
- batchProcessor: remove upload-pending defer/poll-backoff logic
- individualFallbackProcessor: remove upload_pending requeue loop
- batchOutcomeClassifier/fallbackResultClassifier: drop upload_pending
  classification (no longer needed)
- tests: update batchOutcomeClassifier + fallbackResultClassifier tests
  to reflect removed upload_pending signal
This commit is contained in:
asepharyana committed 2026-08-28 22:07:37 +07:00
1 parent ffbe9959ab
commit 9c9cd8917e
8 files changed
+56 -331

No files matched your search

@@ -296,14 +296,13 @@ export async function downloadAndExtractFrame(
imageMap: Map<string, MessageImagePart[]>,
): Promise<void> {
const log = createChildLogger("mediaAnalysis");
// Prefer the upload proxy (uploaded_url); the Discord CDN link can expire
// or be purged (404), and a non-OK response used to silently drop the image
// from vision analysis (no log, empty image map → text-only verdict). Try
// each candidate URL in order and surface failures.
// Analysis now uses the Discord CDN URL directly (uploaded_url is archive-only).
// Try discord_url first; fall back to uploaded_url (Tele proxy) if the CDN
// link returns a non-OK response (expired/purged).
const urlCandidates = [
att.uploaded_url,
att.discord_url && att.discord_url !== att.uploaded_url
? att.discord_url
att.discord_url,
att.uploaded_url && att.uploaded_url !== att.discord_url
? att.uploaded_url
: null,
].filter((u): u is string => Boolean(u));
if (urlCandidates.length === 0) return;