@superinterface/react 3.27.3 → 3.28.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 +54 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +54 -17
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.cts +20 -1
- package/dist/types/index.d.ts +20 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39555,7 +39555,18 @@ function _toPrimitive6(t, r) {
|
|
|
39555
39555
|
var content = function(_ref) {
|
|
39556
39556
|
var newMessage = _ref.newMessage;
|
|
39557
39557
|
if (isArray(newMessage.content)) {
|
|
39558
|
-
return newMessage.content
|
|
39558
|
+
return newMessage.content.map(function(item) {
|
|
39559
|
+
if (item.type === "text") {
|
|
39560
|
+
return {
|
|
39561
|
+
type: "text",
|
|
39562
|
+
text: {
|
|
39563
|
+
annotations: [],
|
|
39564
|
+
value: item.text
|
|
39565
|
+
}
|
|
39566
|
+
};
|
|
39567
|
+
}
|
|
39568
|
+
return item;
|
|
39569
|
+
});
|
|
39559
39570
|
}
|
|
39560
39571
|
return [
|
|
39561
39572
|
{
|
|
@@ -44800,8 +44811,7 @@ var Root8 = function(_ref) {
|
|
|
44800
44811
|
var latestMessage = useLatestMessage().latestMessage;
|
|
44801
44812
|
var isDisabled = useMemo13(function() {
|
|
44802
44813
|
var _latestMessage$metada;
|
|
44803
|
-
return(
|
|
44804
|
-
(latestMessage === null || latestMessage === void 0 || (_latestMessage$metada = latestMessage.metadata) === null || _latestMessage$metada === void 0 ? void 0 : _latestMessage$metada.isBlocking) || isDisabledArg);
|
|
44814
|
+
return !!(latestMessage !== null && latestMessage !== void 0 && (_latestMessage$metada = latestMessage.metadata) !== null && _latestMessage$metada !== void 0 && _latestMessage$metada.isBlocking) || !!isDisabledArg;
|
|
44805
44815
|
}, [
|
|
44806
44816
|
latestMessage,
|
|
44807
44817
|
isDisabledArg
|
|
@@ -44811,7 +44821,7 @@ var Root8 = function(_ref) {
|
|
|
44811
44821
|
createMessage: createMessage
|
|
44812
44822
|
}) : /* @__PURE__ */ function() {
|
|
44813
44823
|
var _ref2 = _asyncToGenerator6(function(data2) {
|
|
44814
|
-
var attachments;
|
|
44824
|
+
var attachments, imageFileContentParts, content2;
|
|
44815
44825
|
return _ts_generator(this, function(_state) {
|
|
44816
44826
|
switch(_state.label){
|
|
44817
44827
|
case 0:
|
|
@@ -44826,9 +44836,11 @@ var Root8 = function(_ref) {
|
|
|
44826
44836
|
];
|
|
44827
44837
|
reset();
|
|
44828
44838
|
setFiles([]);
|
|
44829
|
-
attachments = files.
|
|
44839
|
+
attachments = files.filter(function(file_0) {
|
|
44840
|
+
return file_0.purpose === "assistants";
|
|
44841
|
+
}).map(function(file_1) {
|
|
44830
44842
|
return {
|
|
44831
|
-
file_id:
|
|
44843
|
+
file_id: file_1.id,
|
|
44832
44844
|
tools: [
|
|
44833
44845
|
{
|
|
44834
44846
|
type: "file_search"
|
|
@@ -44836,11 +44848,26 @@ var Root8 = function(_ref) {
|
|
|
44836
44848
|
]
|
|
44837
44849
|
};
|
|
44838
44850
|
});
|
|
44851
|
+
imageFileContentParts = files.filter(function(file_2) {
|
|
44852
|
+
return file_2.purpose === "vision";
|
|
44853
|
+
}).map(function(file_3) {
|
|
44854
|
+
return {
|
|
44855
|
+
type: "image_file",
|
|
44856
|
+
image_file: {
|
|
44857
|
+
file_id: file_3.id
|
|
44858
|
+
}
|
|
44859
|
+
};
|
|
44860
|
+
});
|
|
44861
|
+
content2 = _to_consumable_array(imageFileContentParts).concat([
|
|
44862
|
+
{
|
|
44863
|
+
type: "text",
|
|
44864
|
+
text: data2.content
|
|
44865
|
+
}
|
|
44866
|
+
]);
|
|
44839
44867
|
return [
|
|
44840
44868
|
4,
|
|
44841
44869
|
createMessage(_objectSpread29({
|
|
44842
|
-
|
|
44843
|
-
content: data2.content
|
|
44870
|
+
content: content2
|
|
44844
44871
|
}, attachments.length ? {
|
|
44845
44872
|
attachments: attachments
|
|
44846
44873
|
} : {}))
|
|
@@ -44857,7 +44884,7 @@ var Root8 = function(_ref) {
|
|
|
44857
44884
|
return _ref2.apply(this, arguments);
|
|
44858
44885
|
};
|
|
44859
44886
|
}();
|
|
44860
|
-
var
|
|
44887
|
+
var content_0 = watch("content");
|
|
44861
44888
|
return /* @__PURE__ */ _jsx68(MessageFormContext.Provider, {
|
|
44862
44889
|
value: {
|
|
44863
44890
|
isDisabled: isDisabled,
|
|
@@ -44865,7 +44892,7 @@ var Root8 = function(_ref) {
|
|
|
44865
44892
|
files: files,
|
|
44866
44893
|
setFiles: setFiles,
|
|
44867
44894
|
isFileLoading: isFileLoading,
|
|
44868
|
-
content:
|
|
44895
|
+
content: content_0
|
|
44869
44896
|
},
|
|
44870
44897
|
children: /* @__PURE__ */ _jsx68(FormProvider, _objectSpread29(_objectSpread29({}, formProps), {}, {
|
|
44871
44898
|
children: /* @__PURE__ */ _jsx68(Box14, {
|
|
@@ -45745,13 +45772,20 @@ function AsyncFromSyncIterator(r) {
|
|
|
45745
45772
|
}
|
|
45746
45773
|
}, new AsyncFromSyncIterator(r);
|
|
45747
45774
|
}
|
|
45748
|
-
var accept = ".c,text/x-c,\n.cs,text/x-csharp,\n.cpp,text/x-c++,\n.doc,application/msword,\n.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document,\n.html,text/html,\n.java,text/x-java,\n.json,application/json,\n.md,text/markdown,\n.pdf,application/pdf,\n.php,text/x-php,\n.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation,\n.py,text/x-python,\n.py,text/x-script.python,\n.rb,text/x-ruby,\n.tex,text/x-tex,\n.txt,text/plain,\n.css,text/css,\n.js,text/javascript,\n.sh,application/x-sh,\n.ts,application/typescript";
|
|
45775
|
+
var accept = ".c,text/x-c,\n.cs,text/x-csharp,\n.cpp,text/x-c++,\n.doc,application/msword,\n.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document,\n.html,text/html,\n.java,text/x-java,\n.json,application/json,\n.md,text/markdown,\n.pdf,application/pdf,\n.php,text/x-php,\n.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation,\n.py,text/x-python,\n.py,text/x-script.python,\n.rb,text/x-ruby,\n.tex,text/x-tex,\n.txt,text/plain,\n.css,text/css,\n.js,text/javascript,\n.sh,application/x-sh,\n.ts,application/typescript,\n.png,image/png,\n.jpeg,image/jpeg,\n.jpg,image/jpeg,\n.webp,image/webp,\n.gif,image/gif";
|
|
45776
|
+
var purpose = function(_ref) {
|
|
45777
|
+
var fileObject = _ref.fileObject;
|
|
45778
|
+
if (fileObject.type.startsWith("image/")) {
|
|
45779
|
+
return "vision";
|
|
45780
|
+
}
|
|
45781
|
+
return "assistants";
|
|
45782
|
+
};
|
|
45749
45783
|
var Control2 = function(props) {
|
|
45750
45784
|
var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading, setFiles = _useMessageFormContext.setFiles;
|
|
45751
45785
|
var createFile = useCreateFile().createFile;
|
|
45752
45786
|
var addToast = useToasts().addToast;
|
|
45753
45787
|
var onChange = useCallback3(/* @__PURE__ */ function() {
|
|
45754
|
-
var
|
|
45788
|
+
var _ref2 = _asyncToGenerator8(function(event) {
|
|
45755
45789
|
var fileObjects, newFiles, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step, err;
|
|
45756
45790
|
return _ts_generator(this, function(_state) {
|
|
45757
45791
|
switch(_state.label){
|
|
@@ -45765,7 +45799,9 @@ var Control2 = function(props) {
|
|
|
45765
45799
|
id: optimisticId(),
|
|
45766
45800
|
filename: fileObject.name,
|
|
45767
45801
|
object: "file",
|
|
45768
|
-
purpose:
|
|
45802
|
+
purpose: purpose({
|
|
45803
|
+
fileObject: fileObject
|
|
45804
|
+
}),
|
|
45769
45805
|
created_at: dayjs2().unix(),
|
|
45770
45806
|
bytes: fileObject.size,
|
|
45771
45807
|
status: "processed",
|
|
@@ -45798,10 +45834,11 @@ var Control2 = function(props) {
|
|
|
45798
45834
|
return [
|
|
45799
45835
|
4,
|
|
45800
45836
|
createFile({
|
|
45801
|
-
file: newFile.fileObject
|
|
45837
|
+
file: newFile.fileObject,
|
|
45838
|
+
purpose: newFile.purpose
|
|
45802
45839
|
}, {
|
|
45803
|
-
onSuccess: function(
|
|
45804
|
-
var file =
|
|
45840
|
+
onSuccess: function(_ref3) {
|
|
45841
|
+
var file = _ref3.file;
|
|
45805
45842
|
return setFiles(function(prev) {
|
|
45806
45843
|
return _to_consumable_array(prev.filter(function(prevFile) {
|
|
45807
45844
|
return prevFile.id !== newFile.id;
|
|
@@ -45911,7 +45948,7 @@ var Control2 = function(props) {
|
|
|
45911
45948
|
});
|
|
45912
45949
|
});
|
|
45913
45950
|
return function(_x) {
|
|
45914
|
-
return
|
|
45951
|
+
return _ref2.apply(this, arguments);
|
|
45915
45952
|
};
|
|
45916
45953
|
}(), [
|
|
45917
45954
|
addToast,
|