perf(discord-gateway): start AI moderation analysis immediately, running attachment uploads in parallel instead of blocking

This commit is contained in:
MythEclipse
2026-06-02 22:49:57 +07:00
parent b0a879647e
commit 6d2da7ce1d
4 changed files with 68 additions and 3 deletions
@@ -1,5 +1,6 @@
import { createChildLogger } from "@bete/shared/logger";
import { retryWithBackoff } from "@bete/shared/utils";
import { LRUCache } from "lru-cache";
import type { ChatCompletion } from "openai/resources/chat/completions";
import { AbortError } from "p-retry";
import { z } from "zod";
@@ -28,11 +29,14 @@ import {
buildStickerVisionPrompt,
} from "./stickerPrompt.js";
import {
computeImagePhash,
getCachedMediaAnalysis,
getCachedMediaByPhash,
makeCustomEmojiCacheKey,
makeImageCacheKey,
makeStickerCacheKey,
upsertCachedMediaAnalysis,
upsertCachedMediaByPhash,
} from "./textCacheStore.js";
import { extractUrlsFromText, fetchUrlSafely } from "./urlFetcher.js";