@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.cjs CHANGED
@@ -44936,8 +44936,7 @@ var Root8 = function(_ref) {
44936
44936
  var latestMessage = useLatestMessage().latestMessage;
44937
44937
  var isDisabled = (0, import_react51.useMemo)(function() {
44938
44938
  var _latestMessage$metada;
44939
- return(// @ts-ignore-next-line
44940
- (latestMessage === null || latestMessage === void 0 || (_latestMessage$metada = latestMessage.metadata) === null || _latestMessage$metada === void 0 ? void 0 : _latestMessage$metada.isBlocking) || isDisabledArg);
44939
+ return !!(latestMessage !== null && latestMessage !== void 0 && (_latestMessage$metada = latestMessage.metadata) !== null && _latestMessage$metada !== void 0 && _latestMessage$metada.isBlocking) || !!isDisabledArg;
44941
44940
  }, [
44942
44941
  latestMessage,
44943
44942
  isDisabledArg
@@ -44947,7 +44946,7 @@ var Root8 = function(_ref) {
44947
44946
  createMessage: createMessage
44948
44947
  }) : /* @__PURE__ */ function() {
44949
44948
  var _ref2 = _asyncToGenerator6(function(data2) {
44950
- var attachments;
44949
+ var attachments, imageFileContentParts;
44951
44950
  return _ts_generator(this, function(_state) {
44952
44951
  switch(_state.label){
44953
44952
  case 0:
@@ -44962,9 +44961,11 @@ var Root8 = function(_ref) {
44962
44961
  ];
44963
44962
  reset();
44964
44963
  setFiles([]);
44965
- attachments = files.map(function(file_0) {
44964
+ attachments = files.filter(function(file_0) {
44965
+ return file_0.purpose === "assistants";
44966
+ }).map(function(file_1) {
44966
44967
  return {
44967
- file_id: file_0.id,
44968
+ file_id: file_1.id,
44968
44969
  tools: [
44969
44970
  {
44970
44971
  type: "file_search"
@@ -44972,11 +44973,25 @@ var Root8 = function(_ref) {
44972
44973
  ]
44973
44974
  };
44974
44975
  });
44976
+ imageFileContentParts = files.filter(function(file_2) {
44977
+ return file_2.purpose === "vision";
44978
+ }).map(function(file_3) {
44979
+ return {
44980
+ type: "image_file",
44981
+ image_file: {
44982
+ file_id: file_3.id
44983
+ }
44984
+ };
44985
+ });
44975
44986
  return [
44976
44987
  4,
44977
44988
  createMessage(_objectSpread29({
44978
- // @ts-ignore-next-line
44979
- content: data2.content
44989
+ content: _to_consumable_array(imageFileContentParts).concat([
44990
+ {
44991
+ type: "text",
44992
+ text: data2.content
44993
+ }
44994
+ ])
44980
44995
  }, attachments.length ? {
44981
44996
  attachments: attachments
44982
44997
  } : {}))
@@ -45881,13 +45896,20 @@ function AsyncFromSyncIterator(r) {
45881
45896
  }
45882
45897
  }, new AsyncFromSyncIterator(r);
45883
45898
  }
45884
- 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";
45899
+ 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";
45900
+ var purpose = function(_ref) {
45901
+ var fileObject = _ref.fileObject;
45902
+ if (fileObject.type.startsWith("image/")) {
45903
+ return "vision";
45904
+ }
45905
+ return "assistants";
45906
+ };
45885
45907
  var Control2 = function(props) {
45886
45908
  var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading, setFiles = _useMessageFormContext.setFiles;
45887
45909
  var createFile = useCreateFile().createFile;
45888
45910
  var addToast = useToasts().addToast;
45889
45911
  var onChange = (0, import_react55.useCallback)(/* @__PURE__ */ function() {
45890
- var _ref = _asyncToGenerator8(function(event) {
45912
+ var _ref2 = _asyncToGenerator8(function(event) {
45891
45913
  var fileObjects, newFiles, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step, err;
45892
45914
  return _ts_generator(this, function(_state) {
45893
45915
  switch(_state.label){
@@ -45901,7 +45923,9 @@ var Control2 = function(props) {
45901
45923
  id: optimisticId(),
45902
45924
  filename: fileObject.name,
45903
45925
  object: "file",
45904
- purpose: "assistants",
45926
+ purpose: purpose({
45927
+ fileObject: fileObject
45928
+ }),
45905
45929
  created_at: (0, import_dayjs2.default)().unix(),
45906
45930
  bytes: fileObject.size,
45907
45931
  status: "processed",
@@ -45934,10 +45958,11 @@ var Control2 = function(props) {
45934
45958
  return [
45935
45959
  4,
45936
45960
  createFile({
45937
- file: newFile.fileObject
45961
+ file: newFile.fileObject,
45962
+ purpose: newFile.purpose
45938
45963
  }, {
45939
- onSuccess: function(_ref2) {
45940
- var file = _ref2.file;
45964
+ onSuccess: function(_ref3) {
45965
+ var file = _ref3.file;
45941
45966
  return setFiles(function(prev) {
45942
45967
  return _to_consumable_array(prev.filter(function(prevFile) {
45943
45968
  return prevFile.id !== newFile.id;
@@ -46047,7 +46072,7 @@ var Control2 = function(props) {
46047
46072
  });
46048
46073
  });
46049
46074
  return function(_x) {
46050
- return _ref.apply(this, arguments);
46075
+ return _ref2.apply(this, arguments);
46051
46076
  };
46052
46077
  }(), [
46053
46078
  addToast,
@@ -49385,7 +49410,7 @@ var Status = function(props) {
49385
49410
  var _t5;
49386
49411
  if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
49387
49412
  _t5 = [
49388
- "Click the button below to interrupt"
49413
+ "Listening"
49389
49414
  ];
49390
49415
  $[6] = _t5;
49391
49416
  } else {