INNER CODE UNIT · TypeScript

extractImageAttachments

Beever-AI/beever-atlas · bot/src/index.ts:490

export async function extractImageAttachments(
  message: { attachments?: IncomingAttachment[]; text?: string },
  threadId: string,
  resolveProxy: (platform: string) => ProxyFile | null = defaultProxyFileResolver,
): Promise<ImageAttachment[]> {
  if (!VISION_ENABLED) return [];
  const all = message.attachments || [];
  const images = all.filter(isImageAttachment).slice(0, VISION_MAX_IMAGES);
  if (images.length === 0) return [];

  const platform = extractPlatform(threadId);
  const proxyFile = resolveProxy(platform);
  if (!proxyFile) {
    // No safe byte-fetch path for this platform → skip every image. Never fall
    // back to a raw fetch (SSRF + token-leak risk).
    console.log(`[vision] no proxyFile for ${platform}; skipping ${images.length} image(s)`);
    return [];
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…