@superinterface/react 3.16.0 → 3.16.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 +116 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +82 -51
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1776,6 +1776,7 @@ import { useMutation, useQueryClient as useQueryClient2 } from "@tanstack/react-
|
|
|
1776
1776
|
// src/hooks/messages/useCreateMessage/lib/mutationOptions/onMutate/index.ts
|
|
1777
1777
|
import { omit } from "radash";
|
|
1778
1778
|
// src/hooks/messages/useCreateMessage/lib/mutationOptions/onMutate/data.ts
|
|
1779
|
+
import { isArray } from "radash";
|
|
1779
1780
|
import dayjs from "dayjs";
|
|
1780
1781
|
// src/lib/optimistic/optimisticId.ts
|
|
1781
1782
|
import { uid } from "radash";
|
|
@@ -1826,8 +1827,23 @@ function _toPrimitive6(t, r) {
|
|
|
1826
1827
|
}
|
|
1827
1828
|
return ("string" === r ? String : Number)(t);
|
|
1828
1829
|
}
|
|
1829
|
-
var
|
|
1830
|
+
var content = function(_ref) {
|
|
1830
1831
|
var newMessage = _ref.newMessage;
|
|
1832
|
+
if (isArray(newMessage.content)) {
|
|
1833
|
+
return newMessage.content;
|
|
1834
|
+
}
|
|
1835
|
+
return [
|
|
1836
|
+
{
|
|
1837
|
+
type: "text",
|
|
1838
|
+
text: {
|
|
1839
|
+
annotations: [],
|
|
1840
|
+
value: newMessage.content
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
];
|
|
1844
|
+
};
|
|
1845
|
+
var data = function(_ref2) {
|
|
1846
|
+
var newMessage = _ref2.newMessage;
|
|
1831
1847
|
return function(prevData) {
|
|
1832
1848
|
var _newMessage$attachmen;
|
|
1833
1849
|
var message = {
|
|
@@ -1835,15 +1851,9 @@ var data = function(_ref) {
|
|
|
1835
1851
|
role: "user",
|
|
1836
1852
|
created_at: dayjs().unix(),
|
|
1837
1853
|
object: "thread.message",
|
|
1838
|
-
content:
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
text: {
|
|
1842
|
-
annotations: [],
|
|
1843
|
-
value: newMessage.content
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
],
|
|
1854
|
+
content: content({
|
|
1855
|
+
newMessage: newMessage
|
|
1856
|
+
}),
|
|
1847
1857
|
run_id: null,
|
|
1848
1858
|
assistant_id: null,
|
|
1849
1859
|
thread_id: null,
|
|
@@ -2180,9 +2190,9 @@ var updatedContentPart = function(_ref) {
|
|
|
2180
2190
|
return prevContentPart;
|
|
2181
2191
|
};
|
|
2182
2192
|
var updatedContent = function(_ref2) {
|
|
2183
|
-
var
|
|
2184
|
-
if (!value.data.delta.content) return
|
|
2185
|
-
var result = _4.cloneDeep(
|
|
2193
|
+
var content2 = _ref2.content, value = _ref2.value;
|
|
2194
|
+
if (!value.data.delta.content) return content2;
|
|
2195
|
+
var result = _4.cloneDeep(content2);
|
|
2186
2196
|
value.data.delta.content.forEach(function(delta) {
|
|
2187
2197
|
result[delta.index] = updatedContentPart({
|
|
2188
2198
|
// @ts-ignore-next-line
|
|
@@ -4037,7 +4047,7 @@ var FilePathAnnotation = function(t0) {
|
|
|
4037
4047
|
import { IconButton as IconButton4, Popover as Popover4, Flex as Flex10, Text as Text5 } from "@radix-ui/themes";
|
|
4038
4048
|
import { jsx as _jsx41, jsxs as _jsxs14 } from "react/jsx-runtime";
|
|
4039
4049
|
var AnnotationBase = function(_ref) {
|
|
4040
|
-
var icon = _ref.icon,
|
|
4050
|
+
var icon = _ref.icon, content2 = _ref.content;
|
|
4041
4051
|
return /* @__PURE__ */ _jsxs14(Popover4.Root, {
|
|
4042
4052
|
children: [
|
|
4043
4053
|
/* @__PURE__ */ _jsx41(Popover4.Trigger, {
|
|
@@ -4055,7 +4065,7 @@ var AnnotationBase = function(_ref) {
|
|
|
4055
4065
|
children: /* @__PURE__ */ _jsx41(Text5, {
|
|
4056
4066
|
size: "1",
|
|
4057
4067
|
color: "gray",
|
|
4058
|
-
children:
|
|
4068
|
+
children: content2
|
|
4059
4069
|
})
|
|
4060
4070
|
})
|
|
4061
4071
|
})
|
|
@@ -4341,20 +4351,20 @@ function _toPrimitive23(t, r) {
|
|
|
4341
4351
|
return ("string" === r ? String : Number)(t);
|
|
4342
4352
|
}
|
|
4343
4353
|
var sortedAnnotations = function(_ref) {
|
|
4344
|
-
var
|
|
4345
|
-
return
|
|
4354
|
+
var content2 = _ref.content;
|
|
4355
|
+
return content2.text.annotations.sort(function(a, b) {
|
|
4346
4356
|
return a.start_index - b.start_index;
|
|
4347
4357
|
});
|
|
4348
4358
|
};
|
|
4349
4359
|
var remarkAnnotation = function(_ref2) {
|
|
4350
|
-
var
|
|
4360
|
+
var content2 = _ref2.content;
|
|
4351
4361
|
return function() {
|
|
4352
4362
|
return function(tree) {
|
|
4353
4363
|
flatMap(tree, function(node) {
|
|
4354
4364
|
if (node.type === "text" || node.type === "link") {
|
|
4355
4365
|
return processNodeWithAnnotations({
|
|
4356
4366
|
node: node,
|
|
4357
|
-
content:
|
|
4367
|
+
content: content2
|
|
4358
4368
|
});
|
|
4359
4369
|
} else {
|
|
4360
4370
|
return [
|
|
@@ -4367,8 +4377,8 @@ var remarkAnnotation = function(_ref2) {
|
|
|
4367
4377
|
};
|
|
4368
4378
|
var processNodeWithAnnotations = function(_ref3) {
|
|
4369
4379
|
var _content$text;
|
|
4370
|
-
var node = _ref3.node,
|
|
4371
|
-
if (!((_content$text =
|
|
4380
|
+
var node = _ref3.node, content2 = _ref3.content;
|
|
4381
|
+
if (!((_content$text = content2.text) !== null && _content$text !== void 0 && (_content$text = _content$text.annotations) !== null && _content$text !== void 0 && _content$text.length)) {
|
|
4372
4382
|
return [
|
|
4373
4383
|
node
|
|
4374
4384
|
];
|
|
@@ -4379,7 +4389,7 @@ var processNodeWithAnnotations = function(_ref3) {
|
|
|
4379
4389
|
];
|
|
4380
4390
|
}
|
|
4381
4391
|
var annotations = sortedAnnotations({
|
|
4382
|
-
content:
|
|
4392
|
+
content: content2
|
|
4383
4393
|
});
|
|
4384
4394
|
if (node.type === "text") {
|
|
4385
4395
|
return processTextNode({
|
|
@@ -4497,10 +4507,10 @@ var createAnnotationNode = function(_ref6) {
|
|
|
4497
4507
|
};
|
|
4498
4508
|
// src/contexts/markdown/MarkdownContext/lib/getRemarkPlugins.ts
|
|
4499
4509
|
var getRemarkPlugins = function(_ref) {
|
|
4500
|
-
var
|
|
4510
|
+
var content2 = _ref.content;
|
|
4501
4511
|
return [
|
|
4502
4512
|
remarkAnnotation({
|
|
4503
|
-
content:
|
|
4513
|
+
content: content2
|
|
4504
4514
|
}),
|
|
4505
4515
|
remarkGfm
|
|
4506
4516
|
];
|
|
@@ -4712,22 +4722,22 @@ var evaluate = /* @__PURE__ */ function() {
|
|
|
4712
4722
|
};
|
|
4713
4723
|
}();
|
|
4714
4724
|
var replaceExpressionsWithLiterals = function(_ref3) {
|
|
4715
|
-
var
|
|
4716
|
-
return
|
|
4725
|
+
var content2 = _ref3.content;
|
|
4726
|
+
return content2.replace(/\{([^}]+)\}/g, function(_match, expression) {
|
|
4717
4727
|
return "{'{'}".concat(expression, "{'}'}");
|
|
4718
4728
|
});
|
|
4719
4729
|
};
|
|
4720
4730
|
var TextContent = function(t0) {
|
|
4721
4731
|
var $ = _c22(13);
|
|
4722
|
-
var
|
|
4732
|
+
var content2 = t0.content;
|
|
4723
4733
|
var _useMarkdownContext = useMarkdownContext(), getRemarkPlugins2 = _useMarkdownContext.getRemarkPlugins, components2 = _useMarkdownContext.components;
|
|
4724
4734
|
var t1;
|
|
4725
4735
|
var t2;
|
|
4726
|
-
if ($[0] !==
|
|
4736
|
+
if ($[0] !== content2 || $[1] !== getRemarkPlugins2) {
|
|
4727
4737
|
t2 = getRemarkPlugins2({
|
|
4728
|
-
content:
|
|
4738
|
+
content: content2
|
|
4729
4739
|
});
|
|
4730
|
-
$[0] =
|
|
4740
|
+
$[0] = content2;
|
|
4731
4741
|
$[1] = getRemarkPlugins2;
|
|
4732
4742
|
$[2] = t2;
|
|
4733
4743
|
} else {
|
|
@@ -4738,7 +4748,7 @@ var TextContent = function(t0) {
|
|
|
4738
4748
|
var _useState3 = _sliced_to_array(useState3(null), 2), MDXComponent = _useState3[0], setMDXComponent = _useState3[1];
|
|
4739
4749
|
var t3;
|
|
4740
4750
|
var t4;
|
|
4741
|
-
if ($[3] !==
|
|
4751
|
+
if ($[3] !== content2 || $[4] !== remarkPlugins) {
|
|
4742
4752
|
t3 = function() {
|
|
4743
4753
|
var compileMDX = /* @__PURE__ */ function() {
|
|
4744
4754
|
var _ref4 = _asyncToGenerator5(function() {
|
|
@@ -4755,7 +4765,7 @@ var TextContent = function(t0) {
|
|
|
4755
4765
|
return [
|
|
4756
4766
|
4,
|
|
4757
4767
|
compile(replaceExpressionsWithLiterals({
|
|
4758
|
-
content:
|
|
4768
|
+
content: content2.text.value
|
|
4759
4769
|
}), {
|
|
4760
4770
|
outputFormat: "function-body",
|
|
4761
4771
|
remarkPlugins: remarkPlugins,
|
|
@@ -4805,10 +4815,10 @@ var TextContent = function(t0) {
|
|
|
4805
4815
|
compileMDX();
|
|
4806
4816
|
};
|
|
4807
4817
|
t4 = [
|
|
4808
|
-
|
|
4818
|
+
content2,
|
|
4809
4819
|
remarkPlugins
|
|
4810
4820
|
];
|
|
4811
|
-
$[3] =
|
|
4821
|
+
$[3] = content2;
|
|
4812
4822
|
$[4] = remarkPlugins;
|
|
4813
4823
|
$[5] = t3;
|
|
4814
4824
|
$[6] = t4;
|
|
@@ -4818,7 +4828,7 @@ var TextContent = function(t0) {
|
|
|
4818
4828
|
}
|
|
4819
4829
|
useEffect2(t3, t4);
|
|
4820
4830
|
if (!MDXComponent) {
|
|
4821
|
-
return
|
|
4831
|
+
return content2.text.value;
|
|
4822
4832
|
}
|
|
4823
4833
|
var t5;
|
|
4824
4834
|
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -4861,10 +4871,10 @@ import { c as _c23 } from "react-compiler-runtime";
|
|
|
4861
4871
|
import { jsx as _jsx45 } from "react/jsx-runtime";
|
|
4862
4872
|
var ImageFileContent = function(t0) {
|
|
4863
4873
|
var $ = _c23(2);
|
|
4864
|
-
var
|
|
4874
|
+
var content2 = t0.content;
|
|
4865
4875
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
4866
4876
|
var nextSearchParams = new URLSearchParams(superinterfaceContext.variables);
|
|
4867
|
-
var t1 = "".concat(superinterfaceContext.baseUrl, "/files/").concat(
|
|
4877
|
+
var t1 = "".concat(superinterfaceContext.baseUrl, "/files/").concat(content2.image_file.file_id, "/contents?").concat(nextSearchParams);
|
|
4868
4878
|
var t2;
|
|
4869
4879
|
if ($[0] !== t1) {
|
|
4870
4880
|
t2 = /* @__PURE__ */ _jsx45(Image, {
|
|
@@ -4882,27 +4892,27 @@ var ImageFileContent = function(t0) {
|
|
|
4882
4892
|
import { jsx as _jsx46 } from "react/jsx-runtime";
|
|
4883
4893
|
var ContentPart = function(t0) {
|
|
4884
4894
|
var $ = _c24(4);
|
|
4885
|
-
var
|
|
4886
|
-
if (
|
|
4895
|
+
var content2 = t0.content;
|
|
4896
|
+
if (content2.type === "text") {
|
|
4887
4897
|
var t1;
|
|
4888
|
-
if ($[0] !==
|
|
4898
|
+
if ($[0] !== content2) {
|
|
4889
4899
|
t1 = /* @__PURE__ */ _jsx46(TextContent, {
|
|
4890
|
-
content:
|
|
4900
|
+
content: content2
|
|
4891
4901
|
});
|
|
4892
|
-
$[0] =
|
|
4902
|
+
$[0] = content2;
|
|
4893
4903
|
$[1] = t1;
|
|
4894
4904
|
} else {
|
|
4895
4905
|
t1 = $[1];
|
|
4896
4906
|
}
|
|
4897
4907
|
return t1;
|
|
4898
4908
|
}
|
|
4899
|
-
if (
|
|
4909
|
+
if (content2.type === "image_file") {
|
|
4900
4910
|
var _t;
|
|
4901
|
-
if ($[2] !==
|
|
4911
|
+
if ($[2] !== content2) {
|
|
4902
4912
|
_t = /* @__PURE__ */ _jsx46(ImageFileContent, {
|
|
4903
|
-
content:
|
|
4913
|
+
content: content2
|
|
4904
4914
|
});
|
|
4905
|
-
$[2] =
|
|
4915
|
+
$[2] = content2;
|
|
4906
4916
|
$[3] = _t;
|
|
4907
4917
|
} else {
|
|
4908
4918
|
_t = $[3];
|
|
@@ -4916,9 +4926,9 @@ import { jsx as _jsx47, Fragment as _Fragment2 } from "react/jsx-runtime";
|
|
|
4916
4926
|
var MessageContent = function(_ref) {
|
|
4917
4927
|
var message = _ref.message;
|
|
4918
4928
|
return /* @__PURE__ */ _jsx47(_Fragment2, {
|
|
4919
|
-
children: message.content.map(function(
|
|
4929
|
+
children: message.content.map(function(content2, index) {
|
|
4920
4930
|
return /* @__PURE__ */ _jsx47(ContentPart, {
|
|
4921
|
-
content:
|
|
4931
|
+
content: content2
|
|
4922
4932
|
}, index);
|
|
4923
4933
|
})
|
|
4924
4934
|
});
|
|
@@ -6354,7 +6364,7 @@ var Root4 = function(_ref) {
|
|
|
6354
6364
|
return _ref2.apply(this, arguments);
|
|
6355
6365
|
};
|
|
6356
6366
|
}();
|
|
6357
|
-
var
|
|
6367
|
+
var content2 = watch("content");
|
|
6358
6368
|
return /* @__PURE__ */ _jsx65(MessageFormContext.Provider, {
|
|
6359
6369
|
value: {
|
|
6360
6370
|
isDisabled: isDisabled,
|
|
@@ -6362,7 +6372,7 @@ var Root4 = function(_ref) {
|
|
|
6362
6372
|
files: files,
|
|
6363
6373
|
setFiles: setFiles,
|
|
6364
6374
|
isFileLoading: isFileLoading,
|
|
6365
|
-
content:
|
|
6375
|
+
content: content2
|
|
6366
6376
|
},
|
|
6367
6377
|
children: /* @__PURE__ */ _jsx65(FormProvider, _objectSpread28(_objectSpread28({}, formProps), {}, {
|
|
6368
6378
|
children: /* @__PURE__ */ _jsx65(Box13, {
|
|
@@ -10889,7 +10899,28 @@ var useWebrtcAudioRuntime = function() {
|
|
|
10889
10899
|
8
|
|
10890
10900
|
]);
|
|
10891
10901
|
setUserIsPending(true);
|
|
10892
|
-
peerConn = new RTCPeerConnection(
|
|
10902
|
+
peerConn = new RTCPeerConnection({
|
|
10903
|
+
iceServers: [
|
|
10904
|
+
{
|
|
10905
|
+
urls: "stun:stun.l.google.com:19302"
|
|
10906
|
+
},
|
|
10907
|
+
{
|
|
10908
|
+
urls: "stun:stun1.l.google.com:19302"
|
|
10909
|
+
},
|
|
10910
|
+
{
|
|
10911
|
+
urls: "stun:stun2.l.google.com:19302"
|
|
10912
|
+
},
|
|
10913
|
+
{
|
|
10914
|
+
urls: "stun:stun3.l.google.com:19302"
|
|
10915
|
+
},
|
|
10916
|
+
{
|
|
10917
|
+
urls: "stun:stun4.l.google.com:19302"
|
|
10918
|
+
},
|
|
10919
|
+
{
|
|
10920
|
+
urls: "stun:global.stun.twilio.com:3478?transport=udp"
|
|
10921
|
+
}
|
|
10922
|
+
]
|
|
10923
|
+
});
|
|
10893
10924
|
pcRef.current = peerConn;
|
|
10894
10925
|
audioEl = document.createElement("audio");
|
|
10895
10926
|
audioEl.autoplay = true;
|