supercompat 3.12.0 → 3.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8468,6 +8468,16 @@ var post21 = function(param) {
8468
8468
  annotations: annotations
8469
8469
  }
8470
8470
  };
8471
+ } else if (c.type === "image_file") {
8472
+ var imageFile = c.image_file || c.imageFile || {};
8473
+ var _imageFile_detail;
8474
+ return {
8475
+ type: "image_file",
8476
+ image_file: {
8477
+ file_id: imageFile.file_id || imageFile.fileId || "",
8478
+ detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
8479
+ }
8480
+ };
8471
8481
  }
8472
8482
  return c;
8473
8483
  }),
@@ -8583,6 +8593,16 @@ var get19 = function(param) {
8583
8593
  annotations: annotations
8584
8594
  }
8585
8595
  };
8596
+ } else if (c.type === "image_file") {
8597
+ var imageFile = c.image_file || c.imageFile || {};
8598
+ var _imageFile_detail;
8599
+ return {
8600
+ type: "image_file",
8601
+ image_file: {
8602
+ file_id: imageFile.file_id || imageFile.fileId || "",
8603
+ detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
8604
+ }
8605
+ };
8586
8606
  }
8587
8607
  return c;
8588
8608
  }),
@@ -12019,6 +12039,56 @@ function transformAnnotations(annotations) {
12019
12039
  return ann;
12020
12040
  });
12021
12041
  }
12042
+ function transformMessageContentItem(content) {
12043
+ if (content.type === "text") {
12044
+ var _content_text, _content_text1;
12045
+ return {
12046
+ type: "text",
12047
+ text: {
12048
+ value: ((_content_text = content.text) === null || _content_text === void 0 ? void 0 : _content_text.value) || "",
12049
+ annotations: transformAnnotations(((_content_text1 = content.text) === null || _content_text1 === void 0 ? void 0 : _content_text1.annotations) || [])
12050
+ }
12051
+ };
12052
+ }
12053
+ if (content.type === "image_file") {
12054
+ var imageFile = content.image_file || content.imageFile || {};
12055
+ var _imageFile_detail;
12056
+ return {
12057
+ type: "image_file",
12058
+ image_file: {
12059
+ file_id: imageFile.file_id || imageFile.fileId || "",
12060
+ detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
12061
+ }
12062
+ };
12063
+ }
12064
+ return content;
12065
+ }
12066
+ function transformMessageDeltaContentItem(content) {
12067
+ if (content.type === "text") {
12068
+ var _content_text, _content_text1;
12069
+ return {
12070
+ index: content.index || 0,
12071
+ type: "text",
12072
+ text: {
12073
+ value: ((_content_text = content.text) === null || _content_text === void 0 ? void 0 : _content_text.value) || "",
12074
+ annotations: transformAnnotations(((_content_text1 = content.text) === null || _content_text1 === void 0 ? void 0 : _content_text1.annotations) || [])
12075
+ }
12076
+ };
12077
+ }
12078
+ if (content.type === "image_file") {
12079
+ var imageFile = content.image_file || content.imageFile || {};
12080
+ var _imageFile_detail;
12081
+ return {
12082
+ index: content.index || 0,
12083
+ type: "image_file",
12084
+ image_file: {
12085
+ file_id: imageFile.file_id || imageFile.fileId || "",
12086
+ detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
12087
+ }
12088
+ };
12089
+ }
12090
+ return content;
12091
+ }
12022
12092
  function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12023
12093
  var event = azureEvent.event, data = azureEvent.data;
12024
12094
  var eventType = event;
@@ -12089,17 +12159,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12089
12159
  thread_id: data.threadId,
12090
12160
  role: data.role,
12091
12161
  content: ((_data_content = data.content) === null || _data_content === void 0 ? void 0 : _data_content.map(function(c) {
12092
- if (c.type === "text") {
12093
- var _c_text, _c_text1;
12094
- return {
12095
- type: "text",
12096
- text: {
12097
- value: ((_c_text = c.text) === null || _c_text === void 0 ? void 0 : _c_text.value) || "",
12098
- annotations: transformAnnotations(((_c_text1 = c.text) === null || _c_text1 === void 0 ? void 0 : _c_text1.annotations) || [])
12099
- }
12100
- };
12101
- }
12102
- return c;
12162
+ return transformMessageContentItem(c);
12103
12163
  })) || [],
12104
12164
  assistant_id: assistantId,
12105
12165
  run_id: data.runId || null,
@@ -12121,18 +12181,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12121
12181
  object: "thread.message.delta",
12122
12182
  delta: {
12123
12183
  content: ((_data_delta = data.delta) === null || _data_delta === void 0 ? void 0 : (_data_delta_content = _data_delta.content) === null || _data_delta_content === void 0 ? void 0 : _data_delta_content.map(function(c) {
12124
- if (c.type === "text") {
12125
- var _c_text, _c_text1;
12126
- return {
12127
- index: c.index || 0,
12128
- type: "text",
12129
- text: {
12130
- value: ((_c_text = c.text) === null || _c_text === void 0 ? void 0 : _c_text.value) || "",
12131
- annotations: transformAnnotations(((_c_text1 = c.text) === null || _c_text1 === void 0 ? void 0 : _c_text1.annotations) || [])
12132
- }
12133
- };
12134
- }
12135
- return c;
12184
+ return transformMessageDeltaContentItem(c);
12136
12185
  })) || []
12137
12186
  }
12138
12187
  }