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.cjs CHANGED
@@ -8588,6 +8588,16 @@ var post21 = function(param) {
8588
8588
  annotations: annotations
8589
8589
  }
8590
8590
  };
8591
+ } else if (c.type === "image_file") {
8592
+ var imageFile = c.image_file || c.imageFile || {};
8593
+ var _imageFile_detail;
8594
+ return {
8595
+ type: "image_file",
8596
+ image_file: {
8597
+ file_id: imageFile.file_id || imageFile.fileId || "",
8598
+ detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
8599
+ }
8600
+ };
8591
8601
  }
8592
8602
  return c;
8593
8603
  }),
@@ -8703,6 +8713,16 @@ var get19 = function(param) {
8703
8713
  annotations: annotations
8704
8714
  }
8705
8715
  };
8716
+ } else if (c.type === "image_file") {
8717
+ var imageFile = c.image_file || c.imageFile || {};
8718
+ var _imageFile_detail;
8719
+ return {
8720
+ type: "image_file",
8721
+ image_file: {
8722
+ file_id: imageFile.file_id || imageFile.fileId || "",
8723
+ detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
8724
+ }
8725
+ };
8706
8726
  }
8707
8727
  return c;
8708
8728
  }),
@@ -12139,6 +12159,56 @@ function transformAnnotations(annotations) {
12139
12159
  return ann;
12140
12160
  });
12141
12161
  }
12162
+ function transformMessageContentItem(content) {
12163
+ if (content.type === "text") {
12164
+ var _content_text, _content_text1;
12165
+ return {
12166
+ type: "text",
12167
+ text: {
12168
+ value: ((_content_text = content.text) === null || _content_text === void 0 ? void 0 : _content_text.value) || "",
12169
+ annotations: transformAnnotations(((_content_text1 = content.text) === null || _content_text1 === void 0 ? void 0 : _content_text1.annotations) || [])
12170
+ }
12171
+ };
12172
+ }
12173
+ if (content.type === "image_file") {
12174
+ var imageFile = content.image_file || content.imageFile || {};
12175
+ var _imageFile_detail;
12176
+ return {
12177
+ type: "image_file",
12178
+ image_file: {
12179
+ file_id: imageFile.file_id || imageFile.fileId || "",
12180
+ detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
12181
+ }
12182
+ };
12183
+ }
12184
+ return content;
12185
+ }
12186
+ function transformMessageDeltaContentItem(content) {
12187
+ if (content.type === "text") {
12188
+ var _content_text, _content_text1;
12189
+ return {
12190
+ index: content.index || 0,
12191
+ type: "text",
12192
+ text: {
12193
+ value: ((_content_text = content.text) === null || _content_text === void 0 ? void 0 : _content_text.value) || "",
12194
+ annotations: transformAnnotations(((_content_text1 = content.text) === null || _content_text1 === void 0 ? void 0 : _content_text1.annotations) || [])
12195
+ }
12196
+ };
12197
+ }
12198
+ if (content.type === "image_file") {
12199
+ var imageFile = content.image_file || content.imageFile || {};
12200
+ var _imageFile_detail;
12201
+ return {
12202
+ index: content.index || 0,
12203
+ type: "image_file",
12204
+ image_file: {
12205
+ file_id: imageFile.file_id || imageFile.fileId || "",
12206
+ detail: (_imageFile_detail = imageFile.detail) !== null && _imageFile_detail !== void 0 ? _imageFile_detail : "auto"
12207
+ }
12208
+ };
12209
+ }
12210
+ return content;
12211
+ }
12142
12212
  function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12143
12213
  var event = azureEvent.event, data = azureEvent.data;
12144
12214
  var eventType = event;
@@ -12209,17 +12279,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12209
12279
  thread_id: data.threadId,
12210
12280
  role: data.role,
12211
12281
  content: ((_data_content = data.content) === null || _data_content === void 0 ? void 0 : _data_content.map(function(c) {
12212
- if (c.type === "text") {
12213
- var _c_text, _c_text1;
12214
- return {
12215
- type: "text",
12216
- text: {
12217
- value: ((_c_text = c.text) === null || _c_text === void 0 ? void 0 : _c_text.value) || "",
12218
- annotations: transformAnnotations(((_c_text1 = c.text) === null || _c_text1 === void 0 ? void 0 : _c_text1.annotations) || [])
12219
- }
12220
- };
12221
- }
12222
- return c;
12282
+ return transformMessageContentItem(c);
12223
12283
  })) || [],
12224
12284
  assistant_id: assistantId,
12225
12285
  run_id: data.runId || null,
@@ -12241,18 +12301,7 @@ function convertAzureEventToOpenAI2(azureEvent, assistantId) {
12241
12301
  object: "thread.message.delta",
12242
12302
  delta: {
12243
12303
  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) {
12244
- if (c.type === "text") {
12245
- var _c_text, _c_text1;
12246
- return {
12247
- index: c.index || 0,
12248
- type: "text",
12249
- text: {
12250
- value: ((_c_text = c.text) === null || _c_text === void 0 ? void 0 : _c_text.value) || "",
12251
- annotations: transformAnnotations(((_c_text1 = c.text) === null || _c_text1 === void 0 ? void 0 : _c_text1.annotations) || [])
12252
- }
12253
- };
12254
- }
12255
- return c;
12304
+ return transformMessageDeltaContentItem(c);
12256
12305
  })) || []
12257
12306
  }
12258
12307
  }