发布

  • [OPIK-3383] [BE] Add video MIME type auto-detection for Gemini (#4384)

    frostbyte_neo 发布于 2025-12-09 12:50:01 +00:00

    • [OPIK-3383] [BE] Add video MIME type auto-detection for Gemini
    • Add HTTP HEAD request fallback to detect MIME type from Content-Type header
    • Detect MIME type from URL file extension first (fast path)
    • Only make HTTP HEAD request if extension detection fails
    • Add optional mimeType field to VideoUrl for manual override
    • Fix 'Unsupported MIME type' error for video URLs without extensions (e.g., Snapchat CDN)
    • Revision 2: Simplify MIME detection - only use HTTP HEAD for URLs without extensions

    LangChain4j already handles MIME type detection for URLs with file extensions,
    so we only need to do HTTP HEAD requests for URLs without extensions (like CDN URLs).

    • Revision 3: Use Guava Files.getFileExtension() utility

    • Revision 4: Extract VideoMimeTypeUtils utility, use JDK HttpClient, address PR review comments

    • Revision 5: Simplify exception handling in VideoMimeTypeUtils

    • Revision 6: Use StringUtils.isBlank and add imports per PR review

    下载附件