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.cjs
CHANGED
|
@@ -6342,7 +6342,7 @@ var serializeThread2 = function(param) {
|
|
|
6342
6342
|
};
|
|
6343
6343
|
// src/adapters/storage/responsesStorageAdapter/threads/post.ts
|
|
6344
6344
|
var post15 = function(param) {
|
|
6345
|
-
var client = param.client;
|
|
6345
|
+
var client = param.client, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6346
6346
|
return function(_urlString, options) {
|
|
6347
6347
|
return _async_to_generator(function() {
|
|
6348
6348
|
var body, messages5, metadata, conversation;
|
|
@@ -6360,15 +6360,82 @@ var post15 = function(param) {
|
|
|
6360
6360
|
client.conversations.create({
|
|
6361
6361
|
metadata: metadata,
|
|
6362
6362
|
items: messages5.map(function(message) {
|
|
6363
|
+
var contentType = message.role === "user" ? "input_text" : "output_text";
|
|
6364
|
+
var contentArray;
|
|
6365
|
+
if (typeof message.content === "string") {
|
|
6366
|
+
var contentItem = {
|
|
6367
|
+
type: contentType,
|
|
6368
|
+
text: message.content
|
|
6369
|
+
};
|
|
6370
|
+
if (addAnnotations) {
|
|
6371
|
+
contentItem.annotations = [];
|
|
6372
|
+
}
|
|
6373
|
+
contentArray = [
|
|
6374
|
+
contentItem
|
|
6375
|
+
];
|
|
6376
|
+
} else if (Array.isArray(message.content)) {
|
|
6377
|
+
contentArray = message.content.map(function(part) {
|
|
6378
|
+
if (typeof part === "string") {
|
|
6379
|
+
var item2 = {
|
|
6380
|
+
type: contentType,
|
|
6381
|
+
text: part
|
|
6382
|
+
};
|
|
6383
|
+
if (addAnnotations) {
|
|
6384
|
+
item2.annotations = [];
|
|
6385
|
+
}
|
|
6386
|
+
return item2;
|
|
6387
|
+
}
|
|
6388
|
+
if (part.type === "text") {
|
|
6389
|
+
var item21 = {
|
|
6390
|
+
type: contentType,
|
|
6391
|
+
text: part.text
|
|
6392
|
+
};
|
|
6393
|
+
if (addAnnotations) {
|
|
6394
|
+
item21.annotations = [];
|
|
6395
|
+
}
|
|
6396
|
+
return item21;
|
|
6397
|
+
}
|
|
6398
|
+
if (part.type === "image_file") {
|
|
6399
|
+
var _part_image_file_detail;
|
|
6400
|
+
return {
|
|
6401
|
+
type: "input_image",
|
|
6402
|
+
file_id: part.image_file.file_id,
|
|
6403
|
+
detail: (_part_image_file_detail = part.image_file.detail) !== null && _part_image_file_detail !== void 0 ? _part_image_file_detail : "auto"
|
|
6404
|
+
};
|
|
6405
|
+
}
|
|
6406
|
+
if (part.type === "image_url") {
|
|
6407
|
+
var _part_image_url_detail;
|
|
6408
|
+
return {
|
|
6409
|
+
type: "input_image",
|
|
6410
|
+
image_url: part.image_url.url,
|
|
6411
|
+
detail: (_part_image_url_detail = part.image_url.detail) !== null && _part_image_url_detail !== void 0 ? _part_image_url_detail : "auto"
|
|
6412
|
+
};
|
|
6413
|
+
}
|
|
6414
|
+
var item = {
|
|
6415
|
+
type: contentType,
|
|
6416
|
+
text: ""
|
|
6417
|
+
};
|
|
6418
|
+
if (addAnnotations) {
|
|
6419
|
+
item.annotations = [];
|
|
6420
|
+
}
|
|
6421
|
+
return item;
|
|
6422
|
+
});
|
|
6423
|
+
} else {
|
|
6424
|
+
var contentItem1 = {
|
|
6425
|
+
type: contentType,
|
|
6426
|
+
text: ""
|
|
6427
|
+
};
|
|
6428
|
+
if (addAnnotations) {
|
|
6429
|
+
contentItem1.annotations = [];
|
|
6430
|
+
}
|
|
6431
|
+
contentArray = [
|
|
6432
|
+
contentItem1
|
|
6433
|
+
];
|
|
6434
|
+
}
|
|
6363
6435
|
return {
|
|
6364
6436
|
type: "message",
|
|
6365
6437
|
role: message.role === "user" ? "user" : "assistant",
|
|
6366
|
-
content:
|
|
6367
|
-
{
|
|
6368
|
-
type: message.role === "user" ? "input_text" : "output_text",
|
|
6369
|
-
text: message.content
|
|
6370
|
-
}
|
|
6371
|
-
]
|
|
6438
|
+
content: contentArray
|
|
6372
6439
|
};
|
|
6373
6440
|
})
|
|
6374
6441
|
})
|
|
@@ -6393,10 +6460,11 @@ var post15 = function(param) {
|
|
|
6393
6460
|
};
|
|
6394
6461
|
// src/adapters/storage/responsesStorageAdapter/threads/index.ts
|
|
6395
6462
|
var threads2 = function(param) {
|
|
6396
|
-
var client = param.client;
|
|
6463
|
+
var client = param.client, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6397
6464
|
return {
|
|
6398
6465
|
post: post15({
|
|
6399
|
-
client: client
|
|
6466
|
+
client: client,
|
|
6467
|
+
addAnnotations: addAnnotations
|
|
6400
6468
|
})
|
|
6401
6469
|
};
|
|
6402
6470
|
};
|
|
@@ -6504,14 +6572,18 @@ var serializeItemAsMessage = function(param) {
|
|
|
6504
6572
|
};
|
|
6505
6573
|
// src/adapters/storage/responsesStorageAdapter/threads/messages/post.ts
|
|
6506
6574
|
var contentBlocksFromContent = function(param) {
|
|
6507
|
-
var content = param.content;
|
|
6575
|
+
var content = param.content, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6508
6576
|
if ((0, import_radash15.isArray)(content)) {
|
|
6509
6577
|
return content.map(function(item) {
|
|
6510
6578
|
if (item.type === "text") {
|
|
6511
|
-
|
|
6579
|
+
var textItem3 = {
|
|
6512
6580
|
type: "input_text",
|
|
6513
6581
|
text: item.text
|
|
6514
6582
|
};
|
|
6583
|
+
if (addAnnotations) {
|
|
6584
|
+
textItem3.annotations = [];
|
|
6585
|
+
}
|
|
6586
|
+
return textItem3;
|
|
6515
6587
|
}
|
|
6516
6588
|
if (item.type === "image_file") {
|
|
6517
6589
|
var _item_image_file_detail;
|
|
@@ -6529,17 +6601,25 @@ var contentBlocksFromContent = function(param) {
|
|
|
6529
6601
|
detail: (_item_image_url_detail = item.image_url.detail) !== null && _item_image_url_detail !== void 0 ? _item_image_url_detail : "auto"
|
|
6530
6602
|
};
|
|
6531
6603
|
}
|
|
6532
|
-
|
|
6604
|
+
var textItem2 = {
|
|
6533
6605
|
type: "input_text",
|
|
6534
6606
|
text: ""
|
|
6535
6607
|
};
|
|
6608
|
+
if (addAnnotations) {
|
|
6609
|
+
textItem2.annotations = [];
|
|
6610
|
+
}
|
|
6611
|
+
return textItem2;
|
|
6536
6612
|
});
|
|
6537
6613
|
}
|
|
6614
|
+
var textItem = {
|
|
6615
|
+
type: "input_text",
|
|
6616
|
+
text: content !== null && content !== void 0 ? content : ""
|
|
6617
|
+
};
|
|
6618
|
+
if (addAnnotations) {
|
|
6619
|
+
textItem.annotations = [];
|
|
6620
|
+
}
|
|
6538
6621
|
return [
|
|
6539
|
-
|
|
6540
|
-
type: "input_text",
|
|
6541
|
-
text: content !== null && content !== void 0 ? content : ""
|
|
6542
|
-
}
|
|
6622
|
+
textItem
|
|
6543
6623
|
];
|
|
6544
6624
|
};
|
|
6545
6625
|
var contentBlocksFromAttachments = function(param) {
|
|
@@ -6552,15 +6632,16 @@ var contentBlocksFromAttachments = function(param) {
|
|
|
6552
6632
|
});
|
|
6553
6633
|
};
|
|
6554
6634
|
var messageContentBlocks2 = function(param) {
|
|
6555
|
-
var content = param.content, attachments = param.attachments;
|
|
6635
|
+
var content = param.content, attachments = param.attachments, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6556
6636
|
return _to_consumable_array(contentBlocksFromContent({
|
|
6557
|
-
content: content
|
|
6637
|
+
content: content,
|
|
6638
|
+
addAnnotations: addAnnotations
|
|
6558
6639
|
})).concat(_to_consumable_array(contentBlocksFromAttachments({
|
|
6559
6640
|
attachments: attachments
|
|
6560
6641
|
})));
|
|
6561
6642
|
};
|
|
6562
6643
|
var post16 = function(param) {
|
|
6563
|
-
var runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
6644
|
+
var runAdapter = param.runAdapter, createResponseItems = param.createResponseItems, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6564
6645
|
return function(urlString, options) {
|
|
6565
6646
|
return _async_to_generator(function() {
|
|
6566
6647
|
var url, _url_pathname_match, threadId, body, role, content, _body_attachments, attachments, item, openaiAssistant;
|
|
@@ -6579,7 +6660,8 @@ var post16 = function(param) {
|
|
|
6579
6660
|
role: role,
|
|
6580
6661
|
content: messageContentBlocks2({
|
|
6581
6662
|
content: content,
|
|
6582
|
-
attachments: attachments
|
|
6663
|
+
attachments: attachments,
|
|
6664
|
+
addAnnotations: addAnnotations
|
|
6583
6665
|
})
|
|
6584
6666
|
};
|
|
6585
6667
|
createResponseItems.push(item);
|
|
@@ -6861,11 +6943,12 @@ var assignTimestamps = function(param) {
|
|
|
6861
6943
|
};
|
|
6862
6944
|
// src/adapters/storage/responsesStorageAdapter/threads/messages/index.ts
|
|
6863
6945
|
var messages3 = function(param) {
|
|
6864
|
-
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems;
|
|
6946
|
+
var client = param.client, runAdapter = param.runAdapter, createResponseItems = param.createResponseItems, _param_addAnnotations = param.addAnnotations, addAnnotations = _param_addAnnotations === void 0 ? false : _param_addAnnotations;
|
|
6865
6947
|
return {
|
|
6866
6948
|
post: post16({
|
|
6867
6949
|
runAdapter: runAdapter,
|
|
6868
|
-
createResponseItems: createResponseItems
|
|
6950
|
+
createResponseItems: createResponseItems,
|
|
6951
|
+
addAnnotations: addAnnotations
|
|
6869
6952
|
}),
|
|
6870
6953
|
get: get15({
|
|
6871
6954
|
client: client,
|
|
@@ -8734,13 +8817,39 @@ var azureResponsesStorageAdapter = function() {
|
|
|
8734
8817
|
};
|
|
8735
8818
|
};
|
|
8736
8819
|
var createWrappedHandlers = function(handlerFactory, methods) {
|
|
8820
|
+
var additionalArgs = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
8737
8821
|
var wrapped = {};
|
|
8738
8822
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8739
8823
|
try {
|
|
8740
|
-
|
|
8824
|
+
var _loop = function() {
|
|
8741
8825
|
var method = _step.value;
|
|
8742
|
-
wrapped[method] =
|
|
8743
|
-
|
|
8826
|
+
wrapped[method] = function(urlString, options) {
|
|
8827
|
+
return _async_to_generator(function() {
|
|
8828
|
+
var openaiClient, handler;
|
|
8829
|
+
return _ts_generator(this, function(_state) {
|
|
8830
|
+
switch(_state.label){
|
|
8831
|
+
case 0:
|
|
8832
|
+
return [
|
|
8833
|
+
4,
|
|
8834
|
+
getAzureClient()
|
|
8835
|
+
];
|
|
8836
|
+
case 1:
|
|
8837
|
+
openaiClient = _state.sent();
|
|
8838
|
+
handler = handlerFactory(_object_spread({
|
|
8839
|
+
client: openaiClient,
|
|
8840
|
+
runAdapter: wrappedRunAdapter,
|
|
8841
|
+
createResponseItems: createResponseItems
|
|
8842
|
+
}, additionalArgs));
|
|
8843
|
+
return [
|
|
8844
|
+
2,
|
|
8845
|
+
handler[method](urlString, options)
|
|
8846
|
+
];
|
|
8847
|
+
}
|
|
8848
|
+
});
|
|
8849
|
+
})();
|
|
8850
|
+
};
|
|
8851
|
+
};
|
|
8852
|
+
for(var _iterator = methods[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
8744
8853
|
} catch (err) {
|
|
8745
8854
|
_didIteratorError = true;
|
|
8746
8855
|
_iteratorError = err;
|
|
@@ -8765,7 +8874,9 @@ var azureResponsesStorageAdapter = function() {
|
|
|
8765
8874
|
}),
|
|
8766
8875
|
"^/(?:v1|/?openai)/threads$": createWrappedHandlers(threads2, [
|
|
8767
8876
|
"post"
|
|
8768
|
-
]
|
|
8877
|
+
], {
|
|
8878
|
+
addAnnotations: true
|
|
8879
|
+
})
|
|
8769
8880
|
}, _define_property(_obj, messagesRegexp, createWrappedHandlers(messages3, [
|
|
8770
8881
|
"get",
|
|
8771
8882
|
"post"
|