@ai-sdk__openai-compatible@2.0.60.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. diff --git a/dist/index.js b/dist/index.js
  2. index 6d3fc0792a237a90ab5f1d0a7a4bc20434ee1981..ef4f93163d649848ea1ca58f7f623f8dddabfbc7 100644
  3. --- a/dist/index.js
  4. +++ b/dist/index.js
  5. @@ -181,6 +181,17 @@ function convertToOpenAICompatibleChatMessages(prompt) {
  6. ...partMetadata
  7. };
  8. }
  9. + if (part.mediaType.startsWith("video/")) {
  10. + // zcode patch: video/* file part -> OpenAI-compatible video_url content part.
  11. + // Video bytes are serialized as a base64 data URL.
  12. + return {
  13. + type: "video_url",
  14. + video_url: {
  15. + url: `data:${part.mediaType};base64,${(0, import_provider_utils.convertToBase64)(part.data)}`
  16. + },
  17. + ...partMetadata
  18. + };
  19. + }
  20. if (part.mediaType === "application/pdf") {
  21. if (part.data instanceof URL) {
  22. throw new import_provider.UnsupportedFunctionalityError({
  23. diff --git a/dist/index.mjs b/dist/index.mjs
  24. index 499fd17e4c9ac77352789c1f1f69ed32809218a4..759273c1a5035dfb699753164dd79b0dcba3cb4e 100644
  25. --- a/dist/index.mjs
  26. +++ b/dist/index.mjs
  27. @@ -165,6 +165,17 @@ function convertToOpenAICompatibleChatMessages(prompt) {
  28. ...partMetadata
  29. };
  30. }
  31. + if (part.mediaType.startsWith("video/")) {
  32. + // zcode patch: video/* file part -> OpenAI-compatible video_url content part.
  33. + // Video bytes are serialized as a base64 data URL.
  34. + return {
  35. + type: "video_url",
  36. + video_url: {
  37. + url: `data:${part.mediaType};base64,${convertToBase64(part.data)}`
  38. + },
  39. + ...partMetadata
  40. + };
  41. + }
  42. if (part.mediaType === "application/pdf") {
  43. if (part.data instanceof URL) {
  44. throw new UnsupportedFunctionalityError({