@superinterface/react 3.27.2 → 3.28.0

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
@@ -44800,8 +44800,7 @@ var Root8 = function(_ref) {
44800
44800
  var latestMessage = useLatestMessage().latestMessage;
44801
44801
  var isDisabled = useMemo13(function() {
44802
44802
  var _latestMessage$metada;
44803
- return(// @ts-ignore-next-line
44804
- (latestMessage === null || latestMessage === void 0 || (_latestMessage$metada = latestMessage.metadata) === null || _latestMessage$metada === void 0 ? void 0 : _latestMessage$metada.isBlocking) || isDisabledArg);
44803
+ return !!(latestMessage !== null && latestMessage !== void 0 && (_latestMessage$metada = latestMessage.metadata) !== null && _latestMessage$metada !== void 0 && _latestMessage$metada.isBlocking) || !!isDisabledArg;
44805
44804
  }, [
44806
44805
  latestMessage,
44807
44806
  isDisabledArg
@@ -44811,7 +44810,7 @@ var Root8 = function(_ref) {
44811
44810
  createMessage: createMessage
44812
44811
  }) : /* @__PURE__ */ function() {
44813
44812
  var _ref2 = _asyncToGenerator6(function(data2) {
44814
- var attachments;
44813
+ var attachments, imageFileContentParts;
44815
44814
  return _ts_generator(this, function(_state) {
44816
44815
  switch(_state.label){
44817
44816
  case 0:
@@ -44826,9 +44825,11 @@ var Root8 = function(_ref) {
44826
44825
  ];
44827
44826
  reset();
44828
44827
  setFiles([]);
44829
- attachments = files.map(function(file_0) {
44828
+ attachments = files.filter(function(file_0) {
44829
+ return file_0.purpose === "assistants";
44830
+ }).map(function(file_1) {
44830
44831
  return {
44831
- file_id: file_0.id,
44832
+ file_id: file_1.id,
44832
44833
  tools: [
44833
44834
  {
44834
44835
  type: "file_search"
@@ -44836,11 +44837,25 @@ var Root8 = function(_ref) {
44836
44837
  ]
44837
44838
  };
44838
44839
  });
44840
+ imageFileContentParts = files.filter(function(file_2) {
44841
+ return file_2.purpose === "vision";
44842
+ }).map(function(file_3) {
44843
+ return {
44844
+ type: "image_file",
44845
+ image_file: {
44846
+ file_id: file_3.id
44847
+ }
44848
+ };
44849
+ });
44839
44850
  return [
44840
44851
  4,
44841
44852
  createMessage(_objectSpread29({
44842
- // @ts-ignore-next-line
44843
- content: data2.content
44853
+ content: _to_consumable_array(imageFileContentParts).concat([
44854
+ {
44855
+ type: "text",
44856
+ text: data2.content
44857
+ }
44858
+ ])
44844
44859
  }, attachments.length ? {
44845
44860
  attachments: attachments
44846
44861
  } : {}))
@@ -45745,13 +45760,20 @@ function AsyncFromSyncIterator(r) {
45745
45760
  }
45746
45761
  }, new AsyncFromSyncIterator(r);
45747
45762
  }
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";
45763
+ 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";
45764
+ var purpose = function(_ref) {
45765
+ var fileObject = _ref.fileObject;
45766
+ if (fileObject.type.startsWith("image/")) {
45767
+ return "vision";
45768
+ }
45769
+ return "assistants";
45770
+ };
45749
45771
  var Control2 = function(props) {
45750
45772
  var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading, setFiles = _useMessageFormContext.setFiles;
45751
45773
  var createFile = useCreateFile().createFile;
45752
45774
  var addToast = useToasts().addToast;
45753
45775
  var onChange = useCallback3(/* @__PURE__ */ function() {
45754
- var _ref = _asyncToGenerator8(function(event) {
45776
+ var _ref2 = _asyncToGenerator8(function(event) {
45755
45777
  var fileObjects, newFiles, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step, err;
45756
45778
  return _ts_generator(this, function(_state) {
45757
45779
  switch(_state.label){
@@ -45765,7 +45787,9 @@ var Control2 = function(props) {
45765
45787
  id: optimisticId(),
45766
45788
  filename: fileObject.name,
45767
45789
  object: "file",
45768
- purpose: "assistants",
45790
+ purpose: purpose({
45791
+ fileObject: fileObject
45792
+ }),
45769
45793
  created_at: dayjs2().unix(),
45770
45794
  bytes: fileObject.size,
45771
45795
  status: "processed",
@@ -45798,10 +45822,11 @@ var Control2 = function(props) {
45798
45822
  return [
45799
45823
  4,
45800
45824
  createFile({
45801
- file: newFile.fileObject
45825
+ file: newFile.fileObject,
45826
+ purpose: newFile.purpose
45802
45827
  }, {
45803
- onSuccess: function(_ref2) {
45804
- var file = _ref2.file;
45828
+ onSuccess: function(_ref3) {
45829
+ var file = _ref3.file;
45805
45830
  return setFiles(function(prev) {
45806
45831
  return _to_consumable_array(prev.filter(function(prevFile) {
45807
45832
  return prevFile.id !== newFile.id;
@@ -45911,7 +45936,7 @@ var Control2 = function(props) {
45911
45936
  });
45912
45937
  });
45913
45938
  return function(_x) {
45914
- return _ref.apply(this, arguments);
45939
+ return _ref2.apply(this, arguments);
45915
45940
  };
45916
45941
  }(), [
45917
45942
  addToast,
@@ -49249,7 +49274,7 @@ var Status = function(props) {
49249
49274
  var _t5;
49250
49275
  if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
49251
49276
  _t5 = [
49252
- "Click the button below to interrupt"
49277
+ "Listening"
49253
49278
  ];
49254
49279
  $[6] = _t5;
49255
49280
  } else {