supercompat 3.15.1 → 3.15.2
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 +137 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +137 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6220,7 +6220,7 @@ var serializeThread2 = function(param) {
|
|
|
6220
6220
|
};
|
|
6221
6221
|
// src/adapters/storage/responsesStorageAdapter/threads/post.ts
|
|
6222
6222
|
var post15 = function(param) {
|
|
6223
|
-
var client = param.client;
|
|
6223
|
+
var client = param.client, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6224
6224
|
return function(_urlString, options) {
|
|
6225
6225
|
return _async_to_generator(function() {
|
|
6226
6226
|
var body, messages5, metadata, conversation;
|
|
@@ -6238,15 +6238,82 @@ var post15 = function(param) {
|
|
|
6238
6238
|
client.conversations.create({
|
|
6239
6239
|
metadata: metadata,
|
|
6240
6240
|
items: messages5.map(function(message) {
|
|
6241
|
+
var contentType = message.role === "user" ? "input_text" : "output_text";
|
|
6242
|
+
var contentArray;
|
|
6243
|
+
if (typeof message.content === "string") {
|
|
6244
|
+
var contentItem = {
|
|
6245
|
+
type: contentType,
|
|
6246
|
+
text: message.content
|
|
6247
|
+
};
|
|
6248
|
+
if (addAnnotations) {
|
|
6249
|
+
contentItem.annotations = [];
|
|
6250
|
+
}
|
|
6251
|
+
contentArray = [
|
|
6252
|
+
contentItem
|
|
6253
|
+
];
|
|
6254
|
+
} else if (Array.isArray(message.content)) {
|
|
6255
|
+
contentArray = message.content.map(function(part) {
|
|
6256
|
+
if (typeof part === "string") {
|
|
6257
|
+
var item2 = {
|
|
6258
|
+
type: contentType,
|
|
6259
|
+
text: part
|
|
6260
|
+
};
|
|
6261
|
+
if (addAnnotations) {
|
|
6262
|
+
item2.annotations = [];
|
|
6263
|
+
}
|
|
6264
|
+
return item2;
|
|
6265
|
+
}
|
|
6266
|
+
if (part.type === "text") {
|
|
6267
|
+
var item21 = {
|
|
6268
|
+
type: contentType,
|
|
6269
|
+
text: part.text
|
|
6270
|
+
};
|
|
6271
|
+
if (addAnnotations) {
|
|
6272
|
+
item21.annotations = [];
|
|
6273
|
+
}
|
|
6274
|
+
return item21;
|
|
6275
|
+
}
|
|
6276
|
+
if (part.type === "image_file") {
|
|
6277
|
+
var _part_image_file_detail;
|
|
6278
|
+
return {
|
|
6279
|
+
type: "input_image",
|
|
6280
|
+
file_id: part.image_file.file_id,
|
|
6281
|
+
detail: (_part_image_file_detail = part.image_file.detail) !== null && _part_image_file_detail !== void 0 ? _part_image_file_detail : "auto"
|
|
6282
|
+
};
|
|
6283
|
+
}
|
|
6284
|
+
if (part.type === "image_url") {
|
|
6285
|
+
var _part_image_url_detail;
|
|
6286
|
+
return {
|
|
6287
|
+
type: "input_image",
|
|
6288
|
+
image_url: part.image_url.url,
|
|
6289
|
+
detail: (_part_image_url_detail = part.image_url.detail) !== null && _part_image_url_detail !== void 0 ? _part_image_url_detail : "auto"
|
|
6290
|
+
};
|
|
6291
|
+
}
|
|
6292
|
+
var item = {
|
|
6293
|
+
type: contentType,
|
|
6294
|
+
text: ""
|
|
6295
|
+
};
|
|
6296
|
+
if (addAnnotations) {
|
|
6297
|
+
item.annotations = [];
|
|
6298
|
+
}
|
|
6299
|
+
return item;
|
|
6300
|
+
});
|
|
6301
|
+
} else {
|
|
6302
|
+
var contentItem1 = {
|
|
6303
|
+
type: contentType,
|
|
6304
|
+
text: ""
|
|
6305
|
+
};
|
|
6306
|
+
if (addAnnotations) {
|
|
6307
|
+
contentItem1.annotations = [];
|
|
6308
|
+
}
|
|
6309
|
+
contentArray = [
|
|
6310
|
+
contentItem1
|
|
6311
|
+
];
|
|
6312
|
+
}
|
|
6241
6313
|
return {
|
|
6242
6314
|
type: "message",
|
|
6243
6315
|
role: message.role === "user" ? "user" : "assistant",
|
|
6244
|
-
content:
|
|
6245
|
-
{
|
|
6246
|
-
type: message.role === "user" ? "input_text" : "output_text",
|
|
6247
|
-
text: message.content
|
|
6248
|
-
}
|
|
6249
|
-
]
|
|
6316
|
+
content: contentArray
|
|
6250
6317
|
};
|
|
6251
6318
|
})
|
|
6252
6319
|
})
|
|
@@ -6271,10 +6338,11 @@ var post15 = function(param) {
|
|
|
6271
6338
|
};
|
|
6272
6339
|
// src/adapters/storage/responsesStorageAdapter/threads/index.ts
|
|
6273
6340
|
var threads2 = function(param) {
|
|
6274
|
-
var client = param.client;
|
|
6341
|
+
var client = param.client, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6275
6342
|
return {
|
|
6276
6343
|
post: post15({
|
|
6277
|
-
client: client
|
|
6344
|
+
client: client,
|
|
6345
|
+
addAnnotations: addAnnotations
|
|
6278
6346
|
})
|
|
6279
6347
|
};
|
|
6280
6348
|
};
|
|
@@ -6382,14 +6450,18 @@ var serializeItemAsMessage = function(param) {
|
|
|
6382
6450
|
};
|
|
6383
6451
|
// src/adapters/storage/responsesStorageAdapter/threads/messages/post.ts
|
|
6384
6452
|
var contentBlocksFromContent = function(param) {
|
|
6385
|
-
var content = param.content;
|
|
6453
|
+
var content = param.content, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6386
6454
|
if (isArray3(content)) {
|
|
6387
6455
|
return content.map(function(item) {
|
|
6388
6456
|
if (item.type === "text") {
|
|
6389
|
-
|
|
6457
|
+
var textItem3 = {
|
|
6390
6458
|
type: "input_text",
|
|
6391
6459
|
text: item.text
|
|
6392
6460
|
};
|
|
6461
|
+
if (addAnnotations) {
|
|
6462
|
+
textItem3.annotations = [];
|
|
6463
|
+
}
|
|
6464
|
+
return textItem3;
|
|
6393
6465
|
}
|
|
6394
6466
|
if (item.type === "image_file") {
|
|
6395
6467
|
var _item_image_file_detail;
|
|
@@ -6407,17 +6479,25 @@ var contentBlocksFromContent = function(param) {
|
|
|
6407
6479
|
detail: (_item_image_url_detail = item.image_url.detail) !== null && _item_image_url_detail !== void 0 ? _item_image_url_detail : "auto"
|
|
6408
6480
|
};
|
|
6409
6481
|
}
|
|
6410
|
-
|
|
6482
|
+
var textItem2 = {
|
|
6411
6483
|
type: "input_text",
|
|
6412
6484
|
text: ""
|
|
6413
6485
|
};
|
|
6486
|
+
if (addAnnotations) {
|
|
6487
|
+
textItem2.annotations = [];
|
|
6488
|
+
}
|
|
6489
|
+
return textItem2;
|
|
6414
6490
|
});
|
|
6415
6491
|
}
|
|
6492
|
+
var textItem = {
|
|
6493
|
+
type: "input_text",
|
|
6494
|
+
text: content !== null && content !== void 0 ? content : ""
|
|
6495
|
+
};
|
|
6496
|
+
if (addAnnotations) {
|
|
6497
|
+
textItem.annotations = [];
|
|
6498
|
+
}
|
|
6416
6499
|
return [
|
|
6417
|
-
|
|
6418
|
-
type: "input_text",
|
|
6419
|
-
text: content !== null && content !== void 0 ? content : ""
|
|
6420
|
-
}
|
|
6500
|
+
textItem
|
|
6421
6501
|
];
|
|
6422
6502
|
};
|
|
6423
6503
|
var contentBlocksFromAttachments = function(param) {
|
|
@@ -6430,15 +6510,16 @@ var contentBlocksFromAttachments = function(param) {
|
|
|
6430
6510
|
});
|
|
6431
6511
|
};
|
|
6432
6512
|
var messageContentBlocks2 = function(param) {
|
|
6433
|
-
var content = param.content, attachments = param.attachments;
|
|
6513
|
+
var content = param.content, attachments = param.attachments, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6434
6514
|
return _to_consumable_array(contentBlocksFromContent({
|
|
6435
|
-
content: content
|
|
6515
|
+
content: content,
|
|
6516
|
+
addAnnotations: addAnnotations
|
|
6436
6517
|
})).concat(_to_consumable_array(contentBlocksFromAttachments({
|
|
6437
6518
|
attachments: attachments
|
|
6438
6519
|
})));
|
|
6439
6520
|
};
|
|
6440
6521
|
var post16 = function(param) {
|
|
6441
|
-
var runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
6522
|
+
var runAdapter = param.runAdapter, createResponseItems = param.createResponseItems, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6442
6523
|
return function(urlString, options) {
|
|
6443
6524
|
return _async_to_generator(function() {
|
|
6444
6525
|
var url, _url_pathname_match, threadId, body, role, content, _body_attachments, attachments, item, openaiAssistant;
|
|
@@ -6457,7 +6538,8 @@ var post16 = function(param) {
|
|
|
6457
6538
|
role: role,
|
|
6458
6539
|
content: messageContentBlocks2({
|
|
6459
6540
|
content: content,
|
|
6460
|
-
attachments: attachments
|
|
6541
|
+
attachments: attachments,
|
|
6542
|
+
addAnnotations: addAnnotations
|
|
6461
6543
|
})
|
|
6462
6544
|
};
|
|
6463
6545
|
createResponseItems.push(item);
|
|
@@ -6739,11 +6821,12 @@ var assignTimestamps = function(param) {
|
|
|
6739
6821
|
};
|
|
6740
6822
|
// src/adapters/storage/responsesStorageAdapter/threads/messages/index.ts
|
|
6741
6823
|
var messages3 = function(param) {
|
|
6742
|
-
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
6824
|
+
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6743
6825
|
return {
|
|
6744
6826
|
post: post16({
|
|
6745
6827
|
runAdapter: runAdapter,
|
|
6746
|
-
createResponseItems: createResponseItems
|
|
6828
|
+
createResponseItems: createResponseItems,
|
|
6829
|
+
addAnnotations: addAnnotations
|
|
6747
6830
|
}),
|
|
6748
6831
|
get: get15({
|
|
6749
6832
|
client: client,
|
|
@@ -8611,13 +8694,39 @@ var azureResponsesStorageAdapter = function() {
|
|
|
8611
8694
|
};
|
|
8612
8695
|
};
|
|
8613
8696
|
var createWrappedHandlers = function(handlerFactory, methods) {
|
|
8697
|
+
var additionalArgs = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
8614
8698
|
var wrapped = {};
|
|
8615
8699
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8616
8700
|
try {
|
|
8617
|
-
|
|
8701
|
+
var _loop = function() {
|
|
8618
8702
|
var method = _step.value;
|
|
8619
|
-
wrapped[method] =
|
|
8620
|
-
|
|
8703
|
+
wrapped[method] = function(urlString, options) {
|
|
8704
|
+
return _async_to_generator(function() {
|
|
8705
|
+
var openaiClient, handler;
|
|
8706
|
+
return _ts_generator(this, function(_state) {
|
|
8707
|
+
switch(_state.label){
|
|
8708
|
+
case 0:
|
|
8709
|
+
return [
|
|
8710
|
+
4,
|
|
8711
|
+
getAzureClient()
|
|
8712
|
+
];
|
|
8713
|
+
case 1:
|
|
8714
|
+
openaiClient = _state.sent();
|
|
8715
|
+
handler = handlerFactory(_object_spread({
|
|
8716
|
+
client: openaiClient,
|
|
8717
|
+
runAdapter: wrappedRunAdapter,
|
|
8718
|
+
createResponseItems: createResponseItems
|
|
8719
|
+
}, additionalArgs));
|
|
8720
|
+
return [
|
|
8721
|
+
2,
|
|
8722
|
+
handler[method](urlString, options)
|
|
8723
|
+
];
|
|
8724
|
+
}
|
|
8725
|
+
});
|
|
8726
|
+
})();
|
|
8727
|
+
};
|
|
8728
|
+
};
|
|
8729
|
+
for(var _iterator = methods[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
8621
8730
|
} catch (err) {
|
|
8622
8731
|
_didIteratorError = true;
|
|
8623
8732
|
_iteratorError = err;
|
|
@@ -8642,7 +8751,9 @@ var azureResponsesStorageAdapter = function() {
|
|
|
8642
8751
|
}),
|
|
8643
8752
|
"^/(?:v1|/?openai)/threads$": createWrappedHandlers(threads2, [
|
|
8644
8753
|
"post"
|
|
8645
|
-
]
|
|
8754
|
+
], {
|
|
8755
|
+
addAnnotations: true
|
|
8756
|
+
})
|
|
8646
8757
|
}, _define_property(_obj, messagesRegexp, createWrappedHandlers(messages3, [
|
|
8647
8758
|
"get",
|
|
8648
8759
|
"post"
|