发布

  • [OPIK-6608] [SDK & FE] fix: strip data URI prefix when extracting base64 attachments (#6890)

    frostbyte_neo 发布于 2026-05-28 15:19:51 +00:00

    • [OPIK-6608] [SDK & FE] fix: strip data URI prefix when extracting base64 attachments

    The SDK base64 extractor matched only the payload, so attachments embedded in a
    data:;base64, URI (OpenAI/LangChain image_url.url) were sanitized to
    a malformed data:image/jpeg;base64,[input-attachment-...], which the anchored
    frontend placeholder resolver rejects, breaking inline image rendering.

    SDK: the pattern now optionally consumes the data:;base64, prefix and
    replaces the whole match with a bare placeholder. FE: resolveMedia strips the
    prefix at read time so already-ingested malformed traces still resolve.

    Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

    • fix(attachments): address PR review on OPIK-6608
    • SDK: rewrite _extract_from_string positionally via match.start()/end() so
      duplicate base64 chunks each get their own placeholder. str.replace was
      rewriting every occurrence on the first iteration, aliasing later matches
      to the first attachment's file name and orphaning their uploads.
    • FE: parseImageValue / parseVideoValue / parseAudioValue now bail when the
      value is a wrapped attachment placeholder, so legacy malformed traces
      stop rendering as a broken Base64 image in MediaCell, AutodetectCell and
      the experiment / playground cell renderers (these are sync and can't
      resolve the placeholder; falling back to text is the safest outcome).

    Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

    • test(attachments): update e2e for stripped data URI prefix on round-trip

    The pre-fix SDK regex matched only the base64 payload, so the
    data:<mime>;base64, prefix stayed attached to the placeholder and
    round-tripped back through reinjection — the e2e relied on that
    incidental behavior. OPIK-6608 makes the regex consume the whole data
    URI, so the reinjected value is now the bare base64 payload (the
    placeholder no longer carries a MIME hint for the backend to restore).

    Update the expected input for trace and span to the bare base64 to match
    the post-fix round-trip.

    Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com


    Co-authored-by: Claude Opus 4.7 (1M context) noreply@anthropic.com

    下载附件