@superinterface/react 2.0.7 → 2.0.8
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-Dp6WTBGJ.d.cts → index-u67QcaWg.d.cts} +0 -1
- package/dist/{index-Dp6WTBGJ.d.ts → index-u67QcaWg.d.ts} +0 -1
- package/dist/index.cjs +369 -258
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +340 -229
- package/dist/index.js.map +1 -1
- package/dist/queryFns.d.cts +1 -1
- package/dist/queryFns.d.ts +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +5 -1
- package/dist/types/index.d.ts +5 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/lib/misc/merge/index.ts
|
|
2
2
|
function _array_like_to_array(arr, len) {
|
|
3
3
|
if (len == null || len > arr.length) len = arr.length;
|
|
4
4
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -265,8 +265,6 @@ function _ts_generator(thisArg, body) {
|
|
|
265
265
|
}
|
|
266
266
|
var _2;
|
|
267
267
|
var _detect;
|
|
268
|
-
import { Toaster, toast } from "sonner";
|
|
269
|
-
// src/lib/misc/merge/index.ts
|
|
270
268
|
import _21 from "lodash";
|
|
271
269
|
// src/lib/misc/merge/customizer.ts
|
|
272
270
|
import _ from "lodash";
|
|
@@ -293,8 +291,7 @@ var SuperinterfaceContext = createContext({
|
|
|
293
291
|
defaultOptions: {
|
|
294
292
|
queries: {},
|
|
295
293
|
mutations: {}
|
|
296
|
-
}
|
|
297
|
-
isToasterRendered: false
|
|
294
|
+
}
|
|
298
295
|
});
|
|
299
296
|
// src/hooks/core/useSuperinterfaceContext/index.ts
|
|
300
297
|
import { useContext } from "react";
|
|
@@ -302,42 +299,28 @@ var useSuperinterfaceContext = function() {
|
|
|
302
299
|
return useContext(SuperinterfaceContext);
|
|
303
300
|
};
|
|
304
301
|
// src/components/core/SuperinterfaceProvider/index.tsx
|
|
305
|
-
import { jsx
|
|
302
|
+
import { jsx } from "react/jsx-runtime";
|
|
306
303
|
var SuperinterfaceProvider = function(param) {
|
|
307
304
|
var children = param.children, baseUrl = param.baseUrl, publicApiKey = param.publicApiKey, variables = param.variables, defaultOptions = param.defaultOptions;
|
|
308
305
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
309
|
-
var value = merge(superinterfaceContext,
|
|
306
|
+
var value = merge(superinterfaceContext, _object_spread({}, baseUrl ? {
|
|
310
307
|
baseUrl: baseUrl
|
|
311
308
|
} : {}, publicApiKey ? {
|
|
312
309
|
publicApiKey: publicApiKey
|
|
313
310
|
} : {}, variables ? {
|
|
314
311
|
variables: variables
|
|
315
|
-
} : {},
|
|
316
|
-
defaultOptions: {
|
|
317
|
-
mutations: {
|
|
318
|
-
onError: function(error) {
|
|
319
|
-
return toast.error(error.message);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}, defaultOptions !== null && defaultOptions !== void 0 ? defaultOptions : {
|
|
312
|
+
} : {}, defaultOptions ? {
|
|
324
313
|
defaultOptions: defaultOptions
|
|
325
|
-
}))
|
|
326
|
-
|
|
327
|
-
}));
|
|
328
|
-
return /* @__PURE__ */ jsxs(SuperinterfaceContext.Provider, {
|
|
314
|
+
} : {}));
|
|
315
|
+
return /* @__PURE__ */ jsx(SuperinterfaceContext.Provider, {
|
|
329
316
|
value: value,
|
|
330
|
-
children:
|
|
331
|
-
children,
|
|
332
|
-
!superinterfaceContext.isToasterRendered && /* @__PURE__ */ jsx(Toaster, {})
|
|
333
|
-
]
|
|
317
|
+
children: children
|
|
334
318
|
});
|
|
335
319
|
};
|
|
336
320
|
// src/components/threads/Thread/Messages/index.tsx
|
|
337
321
|
import { Flex as Flex12 } from "@radix-ui/themes";
|
|
338
322
|
// src/components/threads/Thread/Messages/Content/index.tsx
|
|
339
323
|
import { useEffect } from "react";
|
|
340
|
-
import { toast as toast2 } from "sonner";
|
|
341
324
|
// src/hooks/messages/useMessages/index.tsx
|
|
342
325
|
import { useMemo } from "react";
|
|
343
326
|
import { useInfiniteQuery, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
@@ -574,9 +557,9 @@ var Name = function(param) {
|
|
|
574
557
|
});
|
|
575
558
|
};
|
|
576
559
|
// src/components/skeletons/MessagesSkeleton/index.tsx
|
|
577
|
-
import { jsx as jsx4, jsxs
|
|
560
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
578
561
|
var MessagesSkeleton = forwardRef2(function MessagesSkeleton2(_props, ref) {
|
|
579
|
-
return /* @__PURE__ */
|
|
562
|
+
return /* @__PURE__ */ jsxs(MessageGroupBase, {
|
|
580
563
|
ref: ref,
|
|
581
564
|
children: [
|
|
582
565
|
/* @__PURE__ */ jsx4(Skeleton, {
|
|
@@ -586,7 +569,7 @@ var MessagesSkeleton = forwardRef2(function MessagesSkeleton2(_props, ref) {
|
|
|
586
569
|
size: "1"
|
|
587
570
|
})
|
|
588
571
|
}),
|
|
589
|
-
/* @__PURE__ */
|
|
572
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
590
573
|
pb: "3",
|
|
591
574
|
children: [
|
|
592
575
|
/* @__PURE__ */ jsx4(Name, {
|
|
@@ -622,26 +605,38 @@ var MessagesSkeleton = forwardRef2(function MessagesSkeleton2(_props, ref) {
|
|
|
622
605
|
]
|
|
623
606
|
});
|
|
624
607
|
});
|
|
608
|
+
// src/hooks/toasts/useToasts/index.ts
|
|
609
|
+
import { useContext as useContext2 } from "react";
|
|
610
|
+
// src/contexts/toasts/ToastsContext/index.ts
|
|
611
|
+
import { createContext as createContext2 } from "react";
|
|
612
|
+
var ToastsContext = createContext2({
|
|
613
|
+
toasts: [],
|
|
614
|
+
addToast: function() {}
|
|
615
|
+
});
|
|
616
|
+
// src/hooks/toasts/useToasts/index.ts
|
|
617
|
+
var useToasts = function() {
|
|
618
|
+
return useContext2(ToastsContext);
|
|
619
|
+
};
|
|
625
620
|
// src/components/threads/Thread/Messages/Content/MessageGroup/index.tsx
|
|
626
|
-
import { useContext as
|
|
621
|
+
import { useContext as useContext6 } from "react";
|
|
627
622
|
import { Box as Box9, Avatar as Avatar3 } from "@radix-ui/themes";
|
|
628
623
|
import { PersonIcon } from "@radix-ui/react-icons";
|
|
629
624
|
// src/components/messageGroups/MessageGroupBase/AssistantAvatar.tsx
|
|
630
|
-
import { useContext as
|
|
625
|
+
import { useContext as useContext3 } from "react";
|
|
631
626
|
import { Flex as Flex4 } from "@radix-ui/themes";
|
|
632
627
|
// src/contexts/assistants/AssistantAvatarContext/index.tsx
|
|
633
|
-
import { createContext as
|
|
628
|
+
import { createContext as createContext3 } from "react";
|
|
634
629
|
import { Avatar as Avatar2 } from "@radix-ui/themes";
|
|
635
630
|
import { LightningBoltIcon } from "@radix-ui/react-icons";
|
|
636
631
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
637
|
-
var AssistantAvatarContext =
|
|
632
|
+
var AssistantAvatarContext = createContext3(/* @__PURE__ */ jsx5(Avatar2, {
|
|
638
633
|
fallback: /* @__PURE__ */ jsx5(LightningBoltIcon, {}),
|
|
639
634
|
size: "1"
|
|
640
635
|
}));
|
|
641
636
|
// src/components/messageGroups/MessageGroupBase/AssistantAvatar.tsx
|
|
642
637
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
643
638
|
var AssistantAvatar = function() {
|
|
644
|
-
var AssistantAvatarContextValue =
|
|
639
|
+
var AssistantAvatarContextValue = useContext3(AssistantAvatarContext);
|
|
645
640
|
return /* @__PURE__ */ jsx6(Flex4, {
|
|
646
641
|
flexShrink: "0",
|
|
647
642
|
height: "24px",
|
|
@@ -654,8 +649,8 @@ var AssistantAvatar = function() {
|
|
|
654
649
|
});
|
|
655
650
|
};
|
|
656
651
|
// src/contexts/assistants/AssistantNameContext/index.tsx
|
|
657
|
-
import { createContext as
|
|
658
|
-
var AssistantNameContext =
|
|
652
|
+
import { createContext as createContext4 } from "react";
|
|
653
|
+
var AssistantNameContext = createContext4("Assistant");
|
|
659
654
|
// src/components/threads/Thread/Messages/Content/MessageGroup/Content/index.tsx
|
|
660
655
|
import { Flex as Flex10 } from "@radix-ui/themes";
|
|
661
656
|
// src/components/threads/Thread/Message/index.tsx
|
|
@@ -668,10 +663,10 @@ import { Flex as Flex8 } from "@radix-ui/themes";
|
|
|
668
663
|
// src/components/runSteps/RunStep/ToolCalls/ToolCall/index.tsx
|
|
669
664
|
import { Flex as Flex7 } from "@radix-ui/themes";
|
|
670
665
|
// src/components/runSteps/RunStep/ToolCalls/ToolCall/Fn/index.tsx
|
|
671
|
-
import { useContext as
|
|
666
|
+
import { useContext as useContext4 } from "react";
|
|
672
667
|
// src/contexts/functions/FunctionComponentsContext/index.tsx
|
|
673
|
-
import { createContext as
|
|
674
|
-
var FunctionComponentsContext =
|
|
668
|
+
import { createContext as createContext5 } from "react";
|
|
669
|
+
var FunctionComponentsContext = createContext5({});
|
|
675
670
|
// src/components/functions/FunctionBase/index.tsx
|
|
676
671
|
import { PopoverRoot, PopoverContent } from "@radix-ui/themes";
|
|
677
672
|
// src/components/toolCalls/ToolCallBase/index.tsx
|
|
@@ -721,7 +716,7 @@ var Icon = function(param) {
|
|
|
721
716
|
// src/components/functions/FunctionBase/Content.tsx
|
|
722
717
|
import { useMemo as useMemo3 } from "react";
|
|
723
718
|
import { Code, Box as Box2 } from "@radix-ui/themes";
|
|
724
|
-
import { jsx as jsx10, jsxs as
|
|
719
|
+
import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
725
720
|
var Content = function(param) {
|
|
726
721
|
var fn = param.fn;
|
|
727
722
|
var args = useMemo3(function() {
|
|
@@ -752,7 +747,7 @@ var Content = function(param) {
|
|
|
752
747
|
if (!args) {
|
|
753
748
|
return null;
|
|
754
749
|
}
|
|
755
|
-
return /* @__PURE__ */
|
|
750
|
+
return /* @__PURE__ */ jsxs2(Code, {
|
|
756
751
|
variant: "ghost",
|
|
757
752
|
color: "gold",
|
|
758
753
|
style: {
|
|
@@ -770,12 +765,12 @@ var Content = function(param) {
|
|
|
770
765
|
});
|
|
771
766
|
};
|
|
772
767
|
// src/components/functions/FunctionBase/index.tsx
|
|
773
|
-
import { jsx as jsx11, jsxs as
|
|
768
|
+
import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
774
769
|
var FunctionBase = function(param) {
|
|
775
770
|
var fn = param.fn, runStep = param.runStep, title2 = param.title;
|
|
776
|
-
return /* @__PURE__ */
|
|
771
|
+
return /* @__PURE__ */ jsxs3(PopoverRoot, {
|
|
777
772
|
children: [
|
|
778
|
-
/* @__PURE__ */
|
|
773
|
+
/* @__PURE__ */ jsxs3(ToolCallBase, {
|
|
779
774
|
children: [
|
|
780
775
|
/* @__PURE__ */ jsx11(Icon, {
|
|
781
776
|
runStep: runStep
|
|
@@ -824,7 +819,7 @@ var DefaultFunction = function(param) {
|
|
|
824
819
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
825
820
|
var Fn = function(param) {
|
|
826
821
|
var fn = param.fn, runStep = param.runStep;
|
|
827
|
-
var functionComponentsContext =
|
|
822
|
+
var functionComponentsContext = useContext4(FunctionComponentsContext);
|
|
828
823
|
var Component = functionComponentsContext[fn.name] || DefaultFunction;
|
|
829
824
|
return(// @ts-ignore-next-line
|
|
830
825
|
/* @__PURE__ */ jsx13(Component, {
|
|
@@ -864,11 +859,11 @@ var ToolCall = function(param) {
|
|
|
864
859
|
// src/components/runSteps/RunStep/ToolCalls/Starting/index.tsx
|
|
865
860
|
import { PopoverRoot as PopoverRoot2, PopoverContent as PopoverContent2, Text as Text3 } from "@radix-ui/themes";
|
|
866
861
|
import { CircleIcon as CircleIcon2 } from "@radix-ui/react-icons";
|
|
867
|
-
import { jsx as jsx16, jsxs as
|
|
862
|
+
import { jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
868
863
|
var Starting = function() {
|
|
869
|
-
return /* @__PURE__ */
|
|
864
|
+
return /* @__PURE__ */ jsxs4(PopoverRoot2, {
|
|
870
865
|
children: [
|
|
871
|
-
/* @__PURE__ */
|
|
866
|
+
/* @__PURE__ */ jsxs4(ToolCallBase, {
|
|
872
867
|
children: [
|
|
873
868
|
/* @__PURE__ */ jsx16(CircleIcon2, {}),
|
|
874
869
|
/* @__PURE__ */ jsx16(ToolCallTitle, {
|
|
@@ -888,10 +883,10 @@ var Starting = function() {
|
|
|
888
883
|
});
|
|
889
884
|
};
|
|
890
885
|
// src/components/runSteps/RunStep/ToolCalls/index.tsx
|
|
891
|
-
import { jsx as jsx17, jsxs as
|
|
886
|
+
import { jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
892
887
|
var ToolCalls = function(param) {
|
|
893
888
|
var stepDetails = param.stepDetails, runStep = param.runStep;
|
|
894
|
-
return /* @__PURE__ */
|
|
889
|
+
return /* @__PURE__ */ jsxs5(Flex8, {
|
|
895
890
|
direction: "column",
|
|
896
891
|
children: [
|
|
897
892
|
!stepDetails.tool_calls.length && /* @__PURE__ */ jsx17(Starting, {}),
|
|
@@ -930,8 +925,8 @@ var RunSteps = function(param) {
|
|
|
930
925
|
});
|
|
931
926
|
};
|
|
932
927
|
// src/contexts/messages/MessageContext/index.ts
|
|
933
|
-
import { createContext as
|
|
934
|
-
var MessageContext =
|
|
928
|
+
import { createContext as createContext6 } from "react";
|
|
929
|
+
var MessageContext = createContext6({
|
|
935
930
|
message: null
|
|
936
931
|
});
|
|
937
932
|
// src/components/threads/Thread/Message/Provider.tsx
|
|
@@ -939,9 +934,9 @@ var Provider = MessageContext.Provider;
|
|
|
939
934
|
// src/components/threads/Thread/Message/TextContent.tsx
|
|
940
935
|
import { useRemarkSync } from "react-remark";
|
|
941
936
|
// src/hooks/markdown/useMarkdownContext/index.ts
|
|
942
|
-
import { useContext as
|
|
937
|
+
import { useContext as useContext5 } from "react";
|
|
943
938
|
// src/contexts/markdown/MarkdownContext/index.ts
|
|
944
|
-
import { createContext as
|
|
939
|
+
import { createContext as createContext7 } from "react";
|
|
945
940
|
// src/contexts/markdown/MarkdownContext/lib/components/Paragraph.tsx
|
|
946
941
|
import { Box as Box3, Text as Text4 } from "@radix-ui/themes";
|
|
947
942
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
@@ -1056,7 +1051,7 @@ var components = {
|
|
|
1056
1051
|
code: Code2
|
|
1057
1052
|
};
|
|
1058
1053
|
// src/contexts/markdown/MarkdownContext/index.ts
|
|
1059
|
-
var MarkdownContext =
|
|
1054
|
+
var MarkdownContext = createContext7({
|
|
1060
1055
|
remarkPlugins: [],
|
|
1061
1056
|
rehypeReactOptions: {
|
|
1062
1057
|
components: components
|
|
@@ -1064,7 +1059,7 @@ var MarkdownContext = createContext6({
|
|
|
1064
1059
|
});
|
|
1065
1060
|
// src/hooks/markdown/useMarkdownContext/index.ts
|
|
1066
1061
|
var useMarkdownContext = function() {
|
|
1067
|
-
return
|
|
1062
|
+
return useContext5(MarkdownContext);
|
|
1068
1063
|
};
|
|
1069
1064
|
// src/components/threads/Thread/Message/TextContent.tsx
|
|
1070
1065
|
var TextContent = function(param) {
|
|
@@ -1073,7 +1068,7 @@ var TextContent = function(param) {
|
|
|
1073
1068
|
return useRemarkSync(content.text.value, markdownContext);
|
|
1074
1069
|
};
|
|
1075
1070
|
// src/components/threads/Thread/Message/index.tsx
|
|
1076
|
-
import { jsx as jsx28, jsxs as
|
|
1071
|
+
import { jsx as jsx28, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1077
1072
|
var Message = function(param) {
|
|
1078
1073
|
var message = param.message;
|
|
1079
1074
|
var _useMemo4 = _sliced_to_array(useMemo4(function() {
|
|
@@ -1112,7 +1107,7 @@ var Message = function(param) {
|
|
|
1112
1107
|
value: {
|
|
1113
1108
|
message: message
|
|
1114
1109
|
},
|
|
1115
|
-
children: /* @__PURE__ */
|
|
1110
|
+
children: /* @__PURE__ */ jsxs6(Box8, {
|
|
1116
1111
|
children: [
|
|
1117
1112
|
/* @__PURE__ */ jsx28(RunSteps, {
|
|
1118
1113
|
runSteps: olderRunSteps
|
|
@@ -1145,17 +1140,17 @@ var Content2 = function(param) {
|
|
|
1145
1140
|
});
|
|
1146
1141
|
};
|
|
1147
1142
|
// src/components/threads/Thread/Messages/Content/MessageGroup/index.tsx
|
|
1148
|
-
import { jsx as jsx30, jsxs as
|
|
1143
|
+
import { jsx as jsx30, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1149
1144
|
var MessageGroup = function(param) {
|
|
1150
1145
|
var messageGroup = param.messageGroup;
|
|
1151
|
-
var assistantNameContext =
|
|
1152
|
-
return /* @__PURE__ */
|
|
1146
|
+
var assistantNameContext = useContext6(AssistantNameContext);
|
|
1147
|
+
return /* @__PURE__ */ jsxs7(MessageGroupBase, {
|
|
1153
1148
|
children: [
|
|
1154
1149
|
messageGroup.role === "user" ? /* @__PURE__ */ jsx30(Avatar3, {
|
|
1155
1150
|
fallback: /* @__PURE__ */ jsx30(PersonIcon, {}),
|
|
1156
1151
|
size: "1"
|
|
1157
1152
|
}) : /* @__PURE__ */ jsx30(AssistantAvatar, {}),
|
|
1158
|
-
/* @__PURE__ */
|
|
1153
|
+
/* @__PURE__ */ jsxs7(Box9, {
|
|
1159
1154
|
flexGrow: "1",
|
|
1160
1155
|
children: [
|
|
1161
1156
|
/* @__PURE__ */ jsx30(Name, {
|
|
@@ -1173,15 +1168,20 @@ var MessageGroup = function(param) {
|
|
|
1173
1168
|
import { Fragment, jsx as jsx31 } from "react/jsx-runtime";
|
|
1174
1169
|
var Content3 = function() {
|
|
1175
1170
|
var _useMessages = useMessages(), messages2 = _useMessages.messages, isLoading = _useMessages.isLoading, isLoadingError = _useMessages.isLoadingError;
|
|
1171
|
+
var addToast = useToasts().addToast;
|
|
1176
1172
|
var _useMessageGroups = useMessageGroups({
|
|
1177
1173
|
messages: messages2
|
|
1178
1174
|
}), messageGroups2 = _useMessageGroups.messageGroups;
|
|
1179
1175
|
useEffect(function() {
|
|
1180
1176
|
if (isLoadingError) {
|
|
1181
|
-
|
|
1177
|
+
addToast({
|
|
1178
|
+
type: "error",
|
|
1179
|
+
message: "Could not load messages. Please try again."
|
|
1180
|
+
});
|
|
1182
1181
|
}
|
|
1183
1182
|
}, [
|
|
1184
|
-
isLoadingError
|
|
1183
|
+
isLoadingError,
|
|
1184
|
+
addToast
|
|
1185
1185
|
]);
|
|
1186
1186
|
if (isLoading || isLoadingError) {
|
|
1187
1187
|
return /* @__PURE__ */ jsx31(MessagesSkeleton, {});
|
|
@@ -1212,16 +1212,16 @@ var StartingContentSkeleton = function() {
|
|
|
1212
1212
|
});
|
|
1213
1213
|
};
|
|
1214
1214
|
// src/components/skeletons/StartingSkeleton/index.tsx
|
|
1215
|
-
import { useContext as
|
|
1215
|
+
import { useContext as useContext7 } from "react";
|
|
1216
1216
|
import { Box as Box10 } from "@radix-ui/themes";
|
|
1217
|
-
import { jsx as jsx33, jsxs as
|
|
1217
|
+
import { jsx as jsx33, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1218
1218
|
var StartingSkeleton = function(param) {
|
|
1219
1219
|
var children = param.children;
|
|
1220
|
-
var assistantNameContext =
|
|
1221
|
-
return /* @__PURE__ */
|
|
1220
|
+
var assistantNameContext = useContext7(AssistantNameContext);
|
|
1221
|
+
return /* @__PURE__ */ jsxs8(MessageGroupBase, {
|
|
1222
1222
|
children: [
|
|
1223
1223
|
/* @__PURE__ */ jsx33(AssistantAvatar, {}),
|
|
1224
|
-
/* @__PURE__ */
|
|
1224
|
+
/* @__PURE__ */ jsxs8(Box10, {
|
|
1225
1225
|
children: [
|
|
1226
1226
|
/* @__PURE__ */ jsx33(Name, {
|
|
1227
1227
|
children: assistantNameContext
|
|
@@ -1320,16 +1320,16 @@ var isRunEditingMessage = function(param) {
|
|
|
1320
1320
|
return !hasContent;
|
|
1321
1321
|
};
|
|
1322
1322
|
// src/hooks/runs/usePollingContext/index.ts
|
|
1323
|
-
import { useContext as
|
|
1323
|
+
import { useContext as useContext8 } from "react";
|
|
1324
1324
|
// src/contexts/runs/PollingContext/index.tsx
|
|
1325
|
-
import { createContext as
|
|
1326
|
-
var PollingContext =
|
|
1325
|
+
import { createContext as createContext8 } from "react";
|
|
1326
|
+
var PollingContext = createContext8({
|
|
1327
1327
|
isPollRefetching: false,
|
|
1328
1328
|
setIsPollRefetching: function() {}
|
|
1329
1329
|
});
|
|
1330
1330
|
// src/hooks/runs/usePollingContext/index.ts
|
|
1331
1331
|
var usePollingContext = function() {
|
|
1332
|
-
return
|
|
1332
|
+
return useContext8(PollingContext);
|
|
1333
1333
|
};
|
|
1334
1334
|
// src/hooks/runs/useIsRunActive/index.tsx
|
|
1335
1335
|
var progressStatuses = [
|
|
@@ -1398,7 +1398,7 @@ var useIsRunActive = function() {
|
|
|
1398
1398
|
]);
|
|
1399
1399
|
};
|
|
1400
1400
|
// src/components/threads/Thread/Messages/Progress/index.tsx
|
|
1401
|
-
import { jsx as jsx34, jsxs as
|
|
1401
|
+
import { jsx as jsx34, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1402
1402
|
var Progress = function() {
|
|
1403
1403
|
var _useIsRunActive = useIsRunActive(), isRunActive2 = _useIsRunActive.isRunActive;
|
|
1404
1404
|
var latestMessage = useLatestMessage().latestMessage;
|
|
@@ -1407,7 +1407,7 @@ var Progress = function() {
|
|
|
1407
1407
|
if (latestMessage.role === "user") {
|
|
1408
1408
|
return /* @__PURE__ */ jsx34(StartingSkeleton, {});
|
|
1409
1409
|
}
|
|
1410
|
-
return /* @__PURE__ */
|
|
1410
|
+
return /* @__PURE__ */ jsxs9(MessageGroupBase, {
|
|
1411
1411
|
children: [
|
|
1412
1412
|
/* @__PURE__ */ jsx34(Box11, {
|
|
1413
1413
|
pl: "5"
|
|
@@ -1473,7 +1473,6 @@ var useInfiniteScroll = function(param) {
|
|
|
1473
1473
|
};
|
|
1474
1474
|
};
|
|
1475
1475
|
// src/hooks/runs/useManageRuns/index.tsx
|
|
1476
|
-
import { toast as toast3 } from "sonner";
|
|
1477
1476
|
import { useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
1478
1477
|
import { useEffect as useEffect3, useState } from "react";
|
|
1479
1478
|
// src/hooks/runs/useCreateRun/index.ts
|
|
@@ -1724,6 +1723,9 @@ var onMutate = function(param) {
|
|
|
1724
1723
|
};
|
|
1725
1724
|
// src/hooks/runs/useCreateRun/index.ts
|
|
1726
1725
|
var useCreateRun = function() {
|
|
1726
|
+
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
1727
|
+
onError: function() {}
|
|
1728
|
+
}, _ref_onError = _ref.onError, onError = _ref_onError === void 0 ? function() {} : _ref_onError;
|
|
1727
1729
|
var queryClient = useQueryClient4();
|
|
1728
1730
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
1729
1731
|
var threadContext = useSuperinterfaceContext();
|
|
@@ -1736,7 +1738,8 @@ var useCreateRun = function() {
|
|
|
1736
1738
|
}),
|
|
1737
1739
|
onMutate: onMutate({
|
|
1738
1740
|
queryClient: queryClient
|
|
1739
|
-
})
|
|
1741
|
+
}),
|
|
1742
|
+
onError: onError
|
|
1740
1743
|
}, mutationOptions({
|
|
1741
1744
|
mutationKeyBase: [
|
|
1742
1745
|
"createRun"
|
|
@@ -1758,10 +1761,18 @@ var isOptimistic = function(param) {
|
|
|
1758
1761
|
};
|
|
1759
1762
|
// src/hooks/runs/useManageRuns/index.tsx
|
|
1760
1763
|
var useManageRuns = function() {
|
|
1764
|
+
var addToast = useToasts().addToast;
|
|
1761
1765
|
var queryClient = useQueryClient5();
|
|
1762
1766
|
var latestRunProps = useLatestRun();
|
|
1763
1767
|
var latestMessageProps = useLatestMessage();
|
|
1764
|
-
var createRunProps = useCreateRun(
|
|
1768
|
+
var createRunProps = useCreateRun({
|
|
1769
|
+
onError: function(error) {
|
|
1770
|
+
return addToast({
|
|
1771
|
+
type: "error",
|
|
1772
|
+
message: error.message
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
});
|
|
1765
1776
|
var threadContext = useSuperinterfaceContext();
|
|
1766
1777
|
var _useState = _sliced_to_array(useState([]), 2), toastedErrorRunIds = _useState[0], setToastedErrorRunIds = _useState[1];
|
|
1767
1778
|
useEffect3(function() {
|
|
@@ -1773,10 +1784,14 @@ var useManageRuns = function() {
|
|
|
1773
1784
|
latestRunProps.latestRun.id
|
|
1774
1785
|
]);
|
|
1775
1786
|
});
|
|
1776
|
-
|
|
1787
|
+
addToast({
|
|
1788
|
+
type: "error",
|
|
1789
|
+
message: "AI run failed. Please try again."
|
|
1790
|
+
});
|
|
1777
1791
|
}, [
|
|
1778
1792
|
latestRunProps,
|
|
1779
|
-
toastedErrorRunIds
|
|
1793
|
+
toastedErrorRunIds,
|
|
1794
|
+
addToast
|
|
1780
1795
|
]);
|
|
1781
1796
|
useEffect3(function() {
|
|
1782
1797
|
if (createRunProps.isPending) return;
|
|
@@ -1987,7 +2002,7 @@ var useLifecycle = function() {
|
|
|
1987
2002
|
return null;
|
|
1988
2003
|
};
|
|
1989
2004
|
// src/components/threads/Thread/Messages/Root/index.tsx
|
|
1990
|
-
import { jsx as jsx35, jsxs as
|
|
2005
|
+
import { jsx as jsx35, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1991
2006
|
var Root = function(param) {
|
|
1992
2007
|
var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
|
|
1993
2008
|
var _useMessages = useMessages(), isFetchingNextPage = _useMessages.isFetchingNextPage, hasNextPage = _useMessages.hasNextPage, fetchNextPage = _useMessages.fetchNextPage;
|
|
@@ -1997,7 +2012,7 @@ var Root = function(param) {
|
|
|
1997
2012
|
hasNextPage: hasNextPage,
|
|
1998
2013
|
fetchNextPage: fetchNextPage
|
|
1999
2014
|
}), containerRef = _useInfiniteScroll.containerRef, loaderRef = _useInfiniteScroll.loaderRef;
|
|
2000
|
-
return /* @__PURE__ */
|
|
2015
|
+
return /* @__PURE__ */ jsxs10(Flex11, {
|
|
2001
2016
|
ref: containerRef,
|
|
2002
2017
|
direction: "column-reverse",
|
|
2003
2018
|
flexGrow: "1",
|
|
@@ -2026,10 +2041,10 @@ var NextPageSkeleton = function() {
|
|
|
2026
2041
|
return /* @__PURE__ */ jsx36(MessagesSkeleton, {});
|
|
2027
2042
|
};
|
|
2028
2043
|
// src/components/threads/Thread/Messages/index.tsx
|
|
2029
|
-
import { jsx as jsx37, jsxs as
|
|
2044
|
+
import { jsx as jsx37, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2030
2045
|
var Messages = function(param) {
|
|
2031
2046
|
var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
|
|
2032
|
-
return /* @__PURE__ */
|
|
2047
|
+
return /* @__PURE__ */ jsxs11(Root, {
|
|
2033
2048
|
style: style,
|
|
2034
2049
|
children: [
|
|
2035
2050
|
/* @__PURE__ */ jsx37(Flex12, {
|
|
@@ -2056,16 +2071,16 @@ import { Flex as Flex14, Text as Text5 } from "@radix-ui/themes";
|
|
|
2056
2071
|
import { ArrowUpIcon } from "@radix-ui/react-icons";
|
|
2057
2072
|
import { Button as Button2, Spinner } from "@radix-ui/themes";
|
|
2058
2073
|
// src/hooks/messages/useMessageFormContext/index.ts
|
|
2059
|
-
import { useContext as
|
|
2074
|
+
import { useContext as useContext9 } from "react";
|
|
2060
2075
|
// src/contexts/messages/MessageFormContext/index.ts
|
|
2061
|
-
import { createContext as
|
|
2062
|
-
var MessageFormContext =
|
|
2076
|
+
import { createContext as createContext9 } from "react";
|
|
2077
|
+
var MessageFormContext = createContext9({
|
|
2063
2078
|
isDisabled: false,
|
|
2064
2079
|
isLoading: false
|
|
2065
2080
|
});
|
|
2066
2081
|
// src/hooks/messages/useMessageFormContext/index.ts
|
|
2067
2082
|
var useMessageFormContext = function() {
|
|
2068
|
-
return
|
|
2083
|
+
return useContext9(MessageFormContext);
|
|
2069
2084
|
};
|
|
2070
2085
|
// src/components/threads/Thread/MessageForm/Submit/index.tsx
|
|
2071
2086
|
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
@@ -2230,6 +2245,9 @@ var onSettled3 = function(param) {
|
|
|
2230
2245
|
};
|
|
2231
2246
|
// src/hooks/messages/useCreateMessage/index.ts
|
|
2232
2247
|
var useCreateMessage = function() {
|
|
2248
|
+
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
2249
|
+
onError: function() {}
|
|
2250
|
+
}, _ref_onError = _ref.onError, onError = _ref_onError === void 0 ? function() {} : _ref_onError;
|
|
2233
2251
|
var queryClient = useQueryClient9();
|
|
2234
2252
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
2235
2253
|
var threadContext = useSuperinterfaceContext();
|
|
@@ -2239,7 +2257,8 @@ var useCreateMessage = function() {
|
|
|
2239
2257
|
}),
|
|
2240
2258
|
onSettled: onSettled3({
|
|
2241
2259
|
queryClient: queryClient
|
|
2242
|
-
})
|
|
2260
|
+
}),
|
|
2261
|
+
onError: onError
|
|
2243
2262
|
}, mutationOptions({
|
|
2244
2263
|
mutationKeyBase: [
|
|
2245
2264
|
"createMessage"
|
|
@@ -2275,7 +2294,15 @@ var Root2 = function(param) {
|
|
|
2275
2294
|
isRunActive2,
|
|
2276
2295
|
isSubmitting
|
|
2277
2296
|
]);
|
|
2278
|
-
var
|
|
2297
|
+
var addToast = useToasts().addToast;
|
|
2298
|
+
var createMessage = useCreateMessage({
|
|
2299
|
+
onError: function(error) {
|
|
2300
|
+
return addToast({
|
|
2301
|
+
type: "error",
|
|
2302
|
+
message: error.message
|
|
2303
|
+
});
|
|
2304
|
+
}
|
|
2305
|
+
}).createMessage;
|
|
2279
2306
|
var onSubmit = function() {
|
|
2280
2307
|
var _ref = _async_to_generator(function(data3) {
|
|
2281
2308
|
return _ts_generator(this, function(_state) {
|
|
@@ -2324,14 +2351,14 @@ var Root2 = function(param) {
|
|
|
2324
2351
|
};
|
|
2325
2352
|
// src/components/threads/Thread/MessageForm/Field/index.tsx
|
|
2326
2353
|
import { usePrevious } from "react-use";
|
|
2327
|
-
import { useContext as
|
|
2354
|
+
import { useContext as useContext10, useMemo as useMemo10, useRef as useRef3, useEffect as useEffect5 } from "react";
|
|
2328
2355
|
// src/components/textareas/TextareaBase/index.tsx
|
|
2329
2356
|
import { forwardRef as forwardRef3 } from "react";
|
|
2330
2357
|
import TextareaAutosize from "react-textarea-autosize";
|
|
2331
|
-
import { Fragment as Fragment2, jsx as jsx40, jsxs as
|
|
2358
|
+
import { Fragment as Fragment2, jsx as jsx40, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2332
2359
|
var UPSCALE_RATIO = 16 / 14;
|
|
2333
2360
|
var TextareaBase = forwardRef3(function TextareaBase2(props, ref) {
|
|
2334
|
-
return /* @__PURE__ */
|
|
2361
|
+
return /* @__PURE__ */ jsxs12(Fragment2, {
|
|
2335
2362
|
children: [
|
|
2336
2363
|
/* @__PURE__ */ jsx40("style", {
|
|
2337
2364
|
children: ".superinterface-textarea { min-height: inherit; height: 30px; }\n.superinterface-textarea::placeholder { color: var(--gray-a10); }"
|
|
@@ -2392,7 +2419,7 @@ var Root3 = function(param) {
|
|
|
2392
2419
|
});
|
|
2393
2420
|
};
|
|
2394
2421
|
var Control = function() {
|
|
2395
|
-
var assistantNameContext =
|
|
2422
|
+
var assistantNameContext = useContext10(AssistantNameContext);
|
|
2396
2423
|
var register = useFormContext().register;
|
|
2397
2424
|
var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading;
|
|
2398
2425
|
var isSubmitDisabled = useMemo10(function() {
|
|
@@ -2438,10 +2465,10 @@ var Field = {
|
|
|
2438
2465
|
Control: Control
|
|
2439
2466
|
};
|
|
2440
2467
|
// src/components/threads/Thread/MessageForm/index.tsx
|
|
2441
|
-
import { jsx as jsx42, jsxs as
|
|
2468
|
+
import { jsx as jsx42, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2442
2469
|
var MessageForm = function() {
|
|
2443
2470
|
return /* @__PURE__ */ jsx42(Root2, {
|
|
2444
|
-
children: /* @__PURE__ */
|
|
2471
|
+
children: /* @__PURE__ */ jsxs13(Field.Root, {
|
|
2445
2472
|
children: [
|
|
2446
2473
|
/* @__PURE__ */ jsx42(Text5, {
|
|
2447
2474
|
size: "2",
|
|
@@ -2504,9 +2531,9 @@ var Root4 = function(_param) {
|
|
|
2504
2531
|
}));
|
|
2505
2532
|
};
|
|
2506
2533
|
// src/components/threads/Thread/index.tsx
|
|
2507
|
-
import { jsx as jsx46, jsxs as
|
|
2534
|
+
import { jsx as jsx46, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2508
2535
|
var Thread = function(props) {
|
|
2509
|
-
return /* @__PURE__ */
|
|
2536
|
+
return /* @__PURE__ */ jsxs14(Root4, _object_spread_props(_object_spread({}, props), {
|
|
2510
2537
|
children: [
|
|
2511
2538
|
/* @__PURE__ */ jsx46(Messages, {}),
|
|
2512
2539
|
/* @__PURE__ */ jsx46(MessageForm, {})
|
|
@@ -2517,24 +2544,24 @@ Thread.Root = Root4;
|
|
|
2517
2544
|
Thread.Messages = Messages;
|
|
2518
2545
|
Thread.MessageForm = MessageForm;
|
|
2519
2546
|
// src/hooks/messages/useMessageContext/index.ts
|
|
2520
|
-
import { useContext as
|
|
2547
|
+
import { useContext as useContext11 } from "react";
|
|
2521
2548
|
var useMessageContext = function() {
|
|
2522
|
-
return
|
|
2549
|
+
return useContext11(MessageContext);
|
|
2523
2550
|
};
|
|
2524
2551
|
// src/components/threads/ThreadDialog/Root/index.tsx
|
|
2525
|
-
import { Flex as
|
|
2552
|
+
import { Flex as Flex17 } from "@radix-ui/themes";
|
|
2526
2553
|
// src/components/threads/ThreadDialog/Provider/index.tsx
|
|
2527
2554
|
import { useState as useState3 } from "react";
|
|
2528
2555
|
// src/contexts/threads/ThreadDialogContext/index.ts
|
|
2529
|
-
import { createContext as
|
|
2530
|
-
var ThreadDialogContext =
|
|
2556
|
+
import { createContext as createContext10 } from "react";
|
|
2557
|
+
var ThreadDialogContext = createContext10({
|
|
2531
2558
|
isOpen: false,
|
|
2532
2559
|
setIsOpen: function() {}
|
|
2533
2560
|
});
|
|
2534
2561
|
// src/hooks/threads/useThreadDialogContext/index.ts
|
|
2535
|
-
import { useContext as
|
|
2562
|
+
import { useContext as useContext12 } from "react";
|
|
2536
2563
|
var useThreadDialogContext = function() {
|
|
2537
|
-
return
|
|
2564
|
+
return useContext12(ThreadDialogContext);
|
|
2538
2565
|
};
|
|
2539
2566
|
// src/components/threads/ThreadDialog/Provider/index.tsx
|
|
2540
2567
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
@@ -2550,33 +2577,117 @@ var Provider3 = function(param) {
|
|
|
2550
2577
|
children: children
|
|
2551
2578
|
});
|
|
2552
2579
|
};
|
|
2580
|
+
// src/components/toasts/ToastsProvider/index.tsx
|
|
2581
|
+
import { useState as useState4, useCallback as useCallback2 } from "react";
|
|
2582
|
+
import * as Toast2 from "@radix-ui/react-toast";
|
|
2583
|
+
// src/components/toasts/ToastsProvider/CustomToast.tsx
|
|
2584
|
+
import * as Toast from "@radix-ui/react-toast";
|
|
2585
|
+
import { Card, Text as Text6, Flex as Flex16 } from "@radix-ui/themes";
|
|
2586
|
+
import { CheckCircledIcon as CheckCircledIcon2, CrossCircledIcon } from "@radix-ui/react-icons";
|
|
2587
|
+
import { jsx as jsx48, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2588
|
+
var CustomToast = function(param) {
|
|
2589
|
+
var toast = param.toast;
|
|
2590
|
+
return /* @__PURE__ */ jsx48(Toast.Root, {
|
|
2591
|
+
children: /* @__PURE__ */ jsx48(Card, {
|
|
2592
|
+
children: /* @__PURE__ */ jsx48(Toast.Title, {
|
|
2593
|
+
children: /* @__PURE__ */ jsxs15(Flex16, {
|
|
2594
|
+
children: [
|
|
2595
|
+
/* @__PURE__ */ jsx48(Flex16, {
|
|
2596
|
+
pr: "2",
|
|
2597
|
+
height: "14px",
|
|
2598
|
+
align: "center",
|
|
2599
|
+
children: toast.type === "success" ? /* @__PURE__ */ jsx48(CheckCircledIcon2, {
|
|
2600
|
+
color: "var(--mint-9)"
|
|
2601
|
+
}) : /* @__PURE__ */ jsx48(CrossCircledIcon, {
|
|
2602
|
+
color: "var(--red-9)"
|
|
2603
|
+
})
|
|
2604
|
+
}),
|
|
2605
|
+
/* @__PURE__ */ jsx48(Text6, {
|
|
2606
|
+
weight: "medium",
|
|
2607
|
+
size: "1",
|
|
2608
|
+
children: toast.message
|
|
2609
|
+
})
|
|
2610
|
+
]
|
|
2611
|
+
})
|
|
2612
|
+
})
|
|
2613
|
+
})
|
|
2614
|
+
});
|
|
2615
|
+
};
|
|
2616
|
+
// src/components/toasts/ToastsProvider/index.tsx
|
|
2617
|
+
import { jsx as jsx49, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2618
|
+
var ToastsProvider = function(param) {
|
|
2619
|
+
var children = param.children;
|
|
2620
|
+
var _useState4 = _sliced_to_array(useState4([]), 2), toasts = _useState4[0], setToasts = _useState4[1];
|
|
2621
|
+
var addToast = useCallback2(function(toast) {
|
|
2622
|
+
return setToasts(function(prevToasts) {
|
|
2623
|
+
return _to_consumable_array(prevToasts).concat([
|
|
2624
|
+
toast
|
|
2625
|
+
]);
|
|
2626
|
+
});
|
|
2627
|
+
}, []);
|
|
2628
|
+
return /* @__PURE__ */ jsx49(ToastsContext.Provider, {
|
|
2629
|
+
value: {
|
|
2630
|
+
toasts: toasts,
|
|
2631
|
+
addToast: addToast
|
|
2632
|
+
},
|
|
2633
|
+
children: /* @__PURE__ */ jsxs16(Toast2.Provider, {
|
|
2634
|
+
children: [
|
|
2635
|
+
children,
|
|
2636
|
+
Array.from(toasts).map(function(toast, index) {
|
|
2637
|
+
return /* @__PURE__ */ jsx49(CustomToast, {
|
|
2638
|
+
toast: toast
|
|
2639
|
+
}, index);
|
|
2640
|
+
}),
|
|
2641
|
+
/* @__PURE__ */ jsx49(Toast2.Viewport, {
|
|
2642
|
+
style: {
|
|
2643
|
+
position: "absolute",
|
|
2644
|
+
bottom: 0,
|
|
2645
|
+
right: 0,
|
|
2646
|
+
display: "flex",
|
|
2647
|
+
flexDirection: "column",
|
|
2648
|
+
padding: "var(--space-5)",
|
|
2649
|
+
gap: "var(--space-3)",
|
|
2650
|
+
width: "390px",
|
|
2651
|
+
maxWidth: "100vw",
|
|
2652
|
+
margin: 0,
|
|
2653
|
+
listStyle: "none",
|
|
2654
|
+
zIndex: 99999999999999,
|
|
2655
|
+
outline: "none"
|
|
2656
|
+
}
|
|
2657
|
+
})
|
|
2658
|
+
]
|
|
2659
|
+
})
|
|
2660
|
+
});
|
|
2661
|
+
};
|
|
2553
2662
|
// src/components/threads/ThreadDialog/Root/index.tsx
|
|
2554
|
-
import { jsx as
|
|
2555
|
-
var
|
|
2663
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
2664
|
+
var Root6 = function(param) {
|
|
2556
2665
|
var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
|
|
2557
|
-
return /* @__PURE__ */
|
|
2558
|
-
children: /* @__PURE__ */
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2666
|
+
return /* @__PURE__ */ jsx50(ToastsProvider, {
|
|
2667
|
+
children: /* @__PURE__ */ jsx50(Provider3, {
|
|
2668
|
+
children: /* @__PURE__ */ jsx50(Flex17, {
|
|
2669
|
+
direction: "column",
|
|
2670
|
+
justify: "end",
|
|
2671
|
+
align: "end",
|
|
2672
|
+
position: "fixed",
|
|
2673
|
+
style: _object_spread({
|
|
2674
|
+
bottom: "24px",
|
|
2675
|
+
right: "24px",
|
|
2676
|
+
top: "24px",
|
|
2677
|
+
zIndex: 9999999999
|
|
2678
|
+
}, style),
|
|
2679
|
+
children: children
|
|
2680
|
+
})
|
|
2570
2681
|
})
|
|
2571
2682
|
});
|
|
2572
2683
|
};
|
|
2573
2684
|
// src/components/threads/ThreadDialog/Trigger/index.tsx
|
|
2574
|
-
import { Flex as
|
|
2575
|
-
import { jsx as
|
|
2685
|
+
import { Flex as Flex18 } from "@radix-ui/themes";
|
|
2686
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
2576
2687
|
var Trigger = function(param) {
|
|
2577
2688
|
var children = param.children;
|
|
2578
2689
|
var setIsOpen = useThreadDialogContext().setIsOpen;
|
|
2579
|
-
return /* @__PURE__ */
|
|
2690
|
+
return /* @__PURE__ */ jsx51(Flex18, {
|
|
2580
2691
|
onClick: function() {
|
|
2581
2692
|
return setIsOpen(function(prev) {
|
|
2582
2693
|
return !prev;
|
|
@@ -2590,22 +2701,22 @@ var Trigger = function(param) {
|
|
|
2590
2701
|
// src/components/threads/ThreadDialog/Button/index.tsx
|
|
2591
2702
|
import { IconButton } from "@radix-ui/themes";
|
|
2592
2703
|
import { ChatBubbleIcon } from "@radix-ui/react-icons";
|
|
2593
|
-
import { jsx as
|
|
2704
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
2594
2705
|
var Button3 = function() {
|
|
2595
|
-
return /* @__PURE__ */
|
|
2706
|
+
return /* @__PURE__ */ jsx52(IconButton, {
|
|
2596
2707
|
size: "4",
|
|
2597
2708
|
radius: "full",
|
|
2598
|
-
children: /* @__PURE__ */
|
|
2709
|
+
children: /* @__PURE__ */ jsx52(ChatBubbleIcon, {})
|
|
2599
2710
|
});
|
|
2600
2711
|
};
|
|
2601
2712
|
// src/components/threads/ThreadDialog/Content/index.tsx
|
|
2602
|
-
import { Card, Inset, Flex as
|
|
2603
|
-
import { jsx as
|
|
2604
|
-
var
|
|
2713
|
+
import { Card as Card2, Inset, Flex as Flex19 } from "@radix-ui/themes";
|
|
2714
|
+
import { jsx as jsx53, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2715
|
+
var Root7 = function(param) {
|
|
2605
2716
|
var children = param.children;
|
|
2606
2717
|
var isOpen = useThreadDialogContext().isOpen;
|
|
2607
2718
|
if (!isOpen) return null;
|
|
2608
|
-
return /* @__PURE__ */
|
|
2719
|
+
return /* @__PURE__ */ jsx53(Card2, {
|
|
2609
2720
|
mb: "3",
|
|
2610
2721
|
style: {
|
|
2611
2722
|
display: "flex",
|
|
@@ -2614,7 +2725,7 @@ var Root6 = function(param) {
|
|
|
2614
2725
|
maxWidth: "400px",
|
|
2615
2726
|
maxHeight: "720px"
|
|
2616
2727
|
},
|
|
2617
|
-
children: /* @__PURE__ */
|
|
2728
|
+
children: /* @__PURE__ */ jsx53(Inset, {
|
|
2618
2729
|
clip: "padding-box",
|
|
2619
2730
|
side: "all",
|
|
2620
2731
|
pb: "current",
|
|
@@ -2627,51 +2738,51 @@ var Root6 = function(param) {
|
|
|
2627
2738
|
});
|
|
2628
2739
|
};
|
|
2629
2740
|
var Content4 = function() {
|
|
2630
|
-
return /* @__PURE__ */
|
|
2631
|
-
children: /* @__PURE__ */
|
|
2741
|
+
return /* @__PURE__ */ jsx53(Root7, {
|
|
2742
|
+
children: /* @__PURE__ */ jsxs17(Thread.Root, {
|
|
2632
2743
|
children: [
|
|
2633
|
-
/* @__PURE__ */
|
|
2744
|
+
/* @__PURE__ */ jsx53(Thread.Messages, {
|
|
2634
2745
|
style: {
|
|
2635
2746
|
paddingTop: "var(--space-5)",
|
|
2636
2747
|
paddingRight: "var(--space-5)",
|
|
2637
2748
|
paddingLeft: "var(--space-5)"
|
|
2638
2749
|
}
|
|
2639
2750
|
}),
|
|
2640
|
-
/* @__PURE__ */
|
|
2751
|
+
/* @__PURE__ */ jsx53(Flex19, {
|
|
2641
2752
|
direction: "column",
|
|
2642
2753
|
pl: "5",
|
|
2643
2754
|
pr: "5",
|
|
2644
2755
|
pb: "3",
|
|
2645
2756
|
flexShrink: "0",
|
|
2646
|
-
children: /* @__PURE__ */
|
|
2757
|
+
children: /* @__PURE__ */ jsx53(Thread.MessageForm, {})
|
|
2647
2758
|
})
|
|
2648
2759
|
]
|
|
2649
2760
|
})
|
|
2650
2761
|
});
|
|
2651
2762
|
};
|
|
2652
|
-
Content4.Root =
|
|
2763
|
+
Content4.Root = Root7;
|
|
2653
2764
|
// src/components/threads/ThreadDialog/index.tsx
|
|
2654
|
-
import { jsx as
|
|
2765
|
+
import { jsx as jsx54, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2655
2766
|
var ThreadDialog = function() {
|
|
2656
|
-
return /* @__PURE__ */
|
|
2767
|
+
return /* @__PURE__ */ jsxs18(Root6, {
|
|
2657
2768
|
children: [
|
|
2658
|
-
/* @__PURE__ */
|
|
2659
|
-
/* @__PURE__ */
|
|
2660
|
-
children: /* @__PURE__ */
|
|
2769
|
+
/* @__PURE__ */ jsx54(Content4, {}),
|
|
2770
|
+
/* @__PURE__ */ jsx54(Trigger, {
|
|
2771
|
+
children: /* @__PURE__ */ jsx54(Button3, {})
|
|
2661
2772
|
})
|
|
2662
2773
|
]
|
|
2663
2774
|
});
|
|
2664
2775
|
};
|
|
2665
|
-
ThreadDialog.Root =
|
|
2776
|
+
ThreadDialog.Root = Root6;
|
|
2666
2777
|
ThreadDialog.Trigger = Trigger;
|
|
2667
2778
|
ThreadDialog.Button = Button3;
|
|
2668
2779
|
ThreadDialog.Content = Content4;
|
|
2669
2780
|
// src/components/threads/AudioThread/Root/index.tsx
|
|
2670
2781
|
import "regenerator-runtime/runtime";
|
|
2671
|
-
import { Flex as
|
|
2782
|
+
import { Flex as Flex20 } from "@radix-ui/themes";
|
|
2672
2783
|
// src/contexts/threads/AudioThreadContext/index.ts
|
|
2673
|
-
import { createContext as
|
|
2674
|
-
var AudioThreadContext =
|
|
2784
|
+
import { createContext as createContext11 } from "react";
|
|
2785
|
+
var AudioThreadContext = createContext11({
|
|
2675
2786
|
status: "idle",
|
|
2676
2787
|
recorderProps: {
|
|
2677
2788
|
status: "idle",
|
|
@@ -2766,18 +2877,18 @@ var useStatus = function(param) {
|
|
|
2766
2877
|
// src/hooks/audioThreads/useRecorder/index.ts
|
|
2767
2878
|
import dayjs from "dayjs";
|
|
2768
2879
|
import { useAudioCapture } from "use-audio-capture";
|
|
2769
|
-
import { useMemo as useMemo12, useRef as useRef4, useState as
|
|
2880
|
+
import { useMemo as useMemo12, useRef as useRef4, useState as useState5, useCallback as useCallback3, useEffect as useEffect6 } from "react";
|
|
2770
2881
|
import { useAudioPlayer } from "react-use-audio-player";
|
|
2771
2882
|
import { useInterval as useInterval2 } from "react-use";
|
|
2772
2883
|
var useRecorder = function(param) {
|
|
2773
2884
|
var isStopOnSilence = param.isStopOnSilence, onStart = param.onStart, onStop = param.onStop;
|
|
2774
|
-
var
|
|
2775
|
-
var
|
|
2776
|
-
var
|
|
2777
|
-
var
|
|
2885
|
+
var _useState5 = _sliced_to_array(useState5(null), 2), silenceStart = _useState5[0], setSilenceStart = _useState5[1];
|
|
2886
|
+
var _useState51 = _sliced_to_array(useState5(null), 2), noiseStart = _useState51[0], setNoiseStart = _useState51[1];
|
|
2887
|
+
var _useState52 = _sliced_to_array(useState5(null), 2), mediaStream = _useState52[0], setMediaStream = _useState52[1];
|
|
2888
|
+
var _useState53 = _sliced_to_array(useState5("idle"), 2), status = _useState53[0], setStatus = _useState53[1];
|
|
2778
2889
|
var startAudioPlayer = useAudioPlayer();
|
|
2779
2890
|
var endAudioPlayer = useAudioPlayer();
|
|
2780
|
-
var
|
|
2891
|
+
var _useState54 = _sliced_to_array(useState5(false), 2), isLoaded = _useState54[0], setIsLoaded = _useState54[1];
|
|
2781
2892
|
useEffect6(function() {
|
|
2782
2893
|
if (isLoaded) return;
|
|
2783
2894
|
setIsLoaded(true);
|
|
@@ -2836,7 +2947,7 @@ var useRecorder = function(param) {
|
|
|
2836
2947
|
setNoiseStart(null);
|
|
2837
2948
|
}
|
|
2838
2949
|
});
|
|
2839
|
-
var
|
|
2950
|
+
var _useState55 = _sliced_to_array(useState5(null), 2), audioEngine = _useState55[0], setAudioEngine = _useState55[1];
|
|
2840
2951
|
var isInited = useRef4(false);
|
|
2841
2952
|
useEffect6(function() {
|
|
2842
2953
|
if (!mediaStream) return;
|
|
@@ -2868,7 +2979,7 @@ var useRecorder = function(param) {
|
|
|
2868
2979
|
}, [
|
|
2869
2980
|
audioEngine
|
|
2870
2981
|
]);
|
|
2871
|
-
var handleSilence =
|
|
2982
|
+
var handleSilence = useCallback3(function() {
|
|
2872
2983
|
if (!silenceAnalyser) return;
|
|
2873
2984
|
var frequencyData = new Uint8Array(silenceAnalyser.frequencyBinCount);
|
|
2874
2985
|
silenceAnalyser.getByteFrequencyData(frequencyData);
|
|
@@ -2914,7 +3025,7 @@ var useRecorder = function(param) {
|
|
|
2914
3025
|
});
|
|
2915
3026
|
};
|
|
2916
3027
|
// src/hooks/audioThreads/useMessageAudio/index.ts
|
|
2917
|
-
import { useMemo as useMemo13, useRef as useRef5, useState as
|
|
3028
|
+
import { useMemo as useMemo13, useRef as useRef5, useState as useState6, useEffect as useEffect7 } from "react";
|
|
2918
3029
|
import { Howler } from "howler";
|
|
2919
3030
|
import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
|
|
2920
3031
|
// src/hooks/audioThreads/useMessageAudio/lib/input.ts
|
|
@@ -2940,7 +3051,7 @@ var isHtmlAudioSupported = !unsupportedNames.includes(((_detect = detect()) ===
|
|
|
2940
3051
|
// src/hooks/audioThreads/useMessageAudio/index.ts
|
|
2941
3052
|
var useMessageAudio = function(param) {
|
|
2942
3053
|
var onEnd = param.onEnd;
|
|
2943
|
-
var
|
|
3054
|
+
var _useState6 = _sliced_to_array(useState6([]), 2), playedMessageIds = _useState6[0], setPlayedMessageIds = _useState6[1];
|
|
2944
3055
|
var audioPlayer = useAudioPlayer2();
|
|
2945
3056
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
2946
3057
|
var latestMessageProps = useLatestMessage();
|
|
@@ -2979,7 +3090,7 @@ var useMessageAudio = function(param) {
|
|
|
2979
3090
|
onEnd
|
|
2980
3091
|
]);
|
|
2981
3092
|
var isInited = useRef5(false);
|
|
2982
|
-
var
|
|
3093
|
+
var _useState61 = _sliced_to_array(useState6(null), 2), audioEngine = _useState61[0], setAudioEngine = _useState61[1];
|
|
2983
3094
|
useEffect7(function() {
|
|
2984
3095
|
if (!audioPlayer.playing) return;
|
|
2985
3096
|
if (isInited.current) return;
|
|
@@ -3015,8 +3126,8 @@ var useMessageAudio = function(param) {
|
|
|
3015
3126
|
});
|
|
3016
3127
|
};
|
|
3017
3128
|
// src/components/threads/AudioThread/Root/index.tsx
|
|
3018
|
-
import { jsx as
|
|
3019
|
-
var
|
|
3129
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
3130
|
+
var Root8 = function(param) {
|
|
3020
3131
|
var children = param.children;
|
|
3021
3132
|
useLifecycle();
|
|
3022
3133
|
var createMessageProps = useCreateMessage();
|
|
@@ -3075,13 +3186,13 @@ var Root7 = function(param) {
|
|
|
3075
3186
|
createMessageProps: createMessageProps,
|
|
3076
3187
|
messageAudioProps: messageAudioProps
|
|
3077
3188
|
}).status;
|
|
3078
|
-
return /* @__PURE__ */
|
|
3189
|
+
return /* @__PURE__ */ jsx55(AudioThreadContext.Provider, {
|
|
3079
3190
|
value: {
|
|
3080
3191
|
status: status,
|
|
3081
3192
|
recorderProps: recorderProps,
|
|
3082
3193
|
messageAudioProps: messageAudioProps
|
|
3083
3194
|
},
|
|
3084
|
-
children: /* @__PURE__ */
|
|
3195
|
+
children: /* @__PURE__ */ jsx55(Flex20, {
|
|
3085
3196
|
direction: "column",
|
|
3086
3197
|
flexGrow: "1",
|
|
3087
3198
|
p: "5",
|
|
@@ -3090,23 +3201,23 @@ var Root7 = function(param) {
|
|
|
3090
3201
|
});
|
|
3091
3202
|
};
|
|
3092
3203
|
// src/components/threads/AudioThread/Visualization/index.tsx
|
|
3093
|
-
import { Flex as
|
|
3204
|
+
import { Flex as Flex21 } from "@radix-ui/themes";
|
|
3094
3205
|
// src/hooks/threads/useAudioThreadContext/index.ts
|
|
3095
|
-
import { useContext as
|
|
3206
|
+
import { useContext as useContext13 } from "react";
|
|
3096
3207
|
var useAudioThreadContext = function() {
|
|
3097
|
-
return
|
|
3208
|
+
return useContext13(AudioThreadContext);
|
|
3098
3209
|
};
|
|
3099
3210
|
// src/components/threads/AudioThread/Visualization/index.tsx
|
|
3100
|
-
import { jsx as
|
|
3211
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
3101
3212
|
var Visualization = function() {
|
|
3102
3213
|
var audioThreadContext = useAudioThreadContext();
|
|
3103
|
-
return /* @__PURE__ */
|
|
3214
|
+
return /* @__PURE__ */ jsx56(Flex21, {
|
|
3104
3215
|
direction: "column",
|
|
3105
3216
|
align: "center",
|
|
3106
3217
|
justify: "center",
|
|
3107
3218
|
mb: "3",
|
|
3108
3219
|
flexGrow: "1",
|
|
3109
|
-
children: /* @__PURE__ */
|
|
3220
|
+
children: /* @__PURE__ */ jsx56(Flex21, {
|
|
3110
3221
|
align: "center",
|
|
3111
3222
|
justify: "center",
|
|
3112
3223
|
height: "200px",
|
|
@@ -3120,22 +3231,22 @@ var Visualization = function() {
|
|
|
3120
3231
|
};
|
|
3121
3232
|
// src/components/threads/AudioThread/Form/index.tsx
|
|
3122
3233
|
import { SpeakerModerateIcon } from "@radix-ui/react-icons";
|
|
3123
|
-
import { Flex as
|
|
3234
|
+
import { Flex as Flex24 } from "@radix-ui/themes";
|
|
3124
3235
|
// src/components/threads/AudioThread/Form/Visualizer/index.tsx
|
|
3125
3236
|
import _7 from "lodash";
|
|
3126
|
-
import { Flex as
|
|
3127
|
-
import { useState as
|
|
3237
|
+
import { Flex as Flex22, Grid } from "@radix-ui/themes";
|
|
3238
|
+
import { useState as useState7, useEffect as useEffect8, useCallback as useCallback4 } from "react";
|
|
3128
3239
|
import { cluster } from "radash";
|
|
3129
|
-
import { jsx as
|
|
3240
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
3130
3241
|
var barCount = 4;
|
|
3131
3242
|
var Visualizer = function() {
|
|
3132
3243
|
var audioThreadContext = useAudioThreadContext();
|
|
3133
3244
|
var visualizationAnalyser = audioThreadContext.recorderProps.visualizationAnalyser;
|
|
3134
|
-
var
|
|
3245
|
+
var _useState7 = _sliced_to_array(useState7(function() {
|
|
3135
3246
|
return new AudioContext().createAnalyser();
|
|
3136
|
-
}), 1), emptyVisualizer =
|
|
3137
|
-
var
|
|
3138
|
-
var draw =
|
|
3247
|
+
}), 1), emptyVisualizer = _useState7[0];
|
|
3248
|
+
var _useState71 = _sliced_to_array(useState7([]), 2), barHeights = _useState71[0], setBarHeights = _useState71[1];
|
|
3249
|
+
var draw = useCallback4(function(param) {
|
|
3139
3250
|
var visualizationAnalyser2 = param.visualizationAnalyser;
|
|
3140
3251
|
var frequencyData = new Uint8Array(visualizationAnalyser2.frequencyBinCount / 15);
|
|
3141
3252
|
visualizationAnalyser2.getByteFrequencyData(frequencyData);
|
|
@@ -3158,7 +3269,7 @@ var Visualizer = function() {
|
|
|
3158
3269
|
visualizationAnalyser,
|
|
3159
3270
|
emptyVisualizer
|
|
3160
3271
|
]);
|
|
3161
|
-
return /* @__PURE__ */
|
|
3272
|
+
return /* @__PURE__ */ jsx57(Grid, {
|
|
3162
3273
|
columns: "".concat(barCount),
|
|
3163
3274
|
gap: "1",
|
|
3164
3275
|
width: "auto",
|
|
@@ -3167,12 +3278,12 @@ var Visualizer = function() {
|
|
|
3167
3278
|
gridTemplateColumns: "repeat(4, minmax(0, 1fr))"
|
|
3168
3279
|
},
|
|
3169
3280
|
children: barHeights.map(function(barHeight, index) {
|
|
3170
|
-
return /* @__PURE__ */
|
|
3281
|
+
return /* @__PURE__ */ jsx57(Flex22, {
|
|
3171
3282
|
direction: "column",
|
|
3172
3283
|
align: "center",
|
|
3173
3284
|
justify: "center",
|
|
3174
3285
|
height: "20px",
|
|
3175
|
-
children: /* @__PURE__ */
|
|
3286
|
+
children: /* @__PURE__ */ jsx57(Flex22, {
|
|
3176
3287
|
minHeight: "50%",
|
|
3177
3288
|
maxHeight: "100%",
|
|
3178
3289
|
height: "".concat(barHeight + 20, "%"),
|
|
@@ -3187,31 +3298,31 @@ var Visualizer = function() {
|
|
|
3187
3298
|
});
|
|
3188
3299
|
};
|
|
3189
3300
|
// src/components/threads/AudioThread/Form/ActionButton/index.tsx
|
|
3190
|
-
import { Flex as
|
|
3301
|
+
import { Flex as Flex23, IconButton as IconButton2, Tooltip } from "@radix-ui/themes";
|
|
3191
3302
|
import { PauseIcon, ArrowUpIcon as ArrowUpIcon2, ResumeIcon } from "@radix-ui/react-icons";
|
|
3192
|
-
import { jsx as
|
|
3303
|
+
import { jsx as jsx58, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3193
3304
|
var ActionButton = function() {
|
|
3194
3305
|
var audioThreadContext = useAudioThreadContext();
|
|
3195
3306
|
if (audioThreadContext.status === "recording") {
|
|
3196
|
-
return /* @__PURE__ */
|
|
3307
|
+
return /* @__PURE__ */ jsxs19(Flex23, {
|
|
3197
3308
|
align: "center",
|
|
3198
3309
|
children: [
|
|
3199
|
-
/* @__PURE__ */
|
|
3310
|
+
/* @__PURE__ */ jsx58(Flex23, {
|
|
3200
3311
|
mr: "3",
|
|
3201
3312
|
ml: "-7",
|
|
3202
|
-
children: /* @__PURE__ */
|
|
3313
|
+
children: /* @__PURE__ */ jsx58(IconButton2, {
|
|
3203
3314
|
onClick: audioThreadContext.recorderProps.pause,
|
|
3204
3315
|
color: "gray",
|
|
3205
3316
|
radius: "full",
|
|
3206
3317
|
size: "1",
|
|
3207
|
-
children: /* @__PURE__ */
|
|
3318
|
+
children: /* @__PURE__ */ jsx58(PauseIcon, {})
|
|
3208
3319
|
})
|
|
3209
3320
|
}),
|
|
3210
|
-
/* @__PURE__ */
|
|
3321
|
+
/* @__PURE__ */ jsx58(Tooltip, {
|
|
3211
3322
|
open: true,
|
|
3212
3323
|
content: "Send your message",
|
|
3213
3324
|
side: "bottom",
|
|
3214
|
-
children: /* @__PURE__ */
|
|
3325
|
+
children: /* @__PURE__ */ jsx58(IconButton2, {
|
|
3215
3326
|
onClick: audioThreadContext.recorderProps.stop,
|
|
3216
3327
|
color: "gray",
|
|
3217
3328
|
highContrast: true,
|
|
@@ -3220,14 +3331,14 @@ var ActionButton = function() {
|
|
|
3220
3331
|
style: {
|
|
3221
3332
|
border: "2px solid var(--gray-8)"
|
|
3222
3333
|
},
|
|
3223
|
-
children: /* @__PURE__ */
|
|
3334
|
+
children: /* @__PURE__ */ jsx58(ArrowUpIcon2, {})
|
|
3224
3335
|
})
|
|
3225
3336
|
})
|
|
3226
3337
|
]
|
|
3227
3338
|
});
|
|
3228
3339
|
}
|
|
3229
3340
|
if (audioThreadContext.status === "recorderPaused") {
|
|
3230
|
-
return /* @__PURE__ */
|
|
3341
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3231
3342
|
onClick: audioThreadContext.recorderProps.resume,
|
|
3232
3343
|
color: "red",
|
|
3233
3344
|
radius: "full",
|
|
@@ -3235,11 +3346,11 @@ var ActionButton = function() {
|
|
|
3235
3346
|
style: {
|
|
3236
3347
|
border: "2px solid var(--gray-8)"
|
|
3237
3348
|
},
|
|
3238
|
-
children: /* @__PURE__ */
|
|
3349
|
+
children: /* @__PURE__ */ jsx58(ResumeIcon, {})
|
|
3239
3350
|
});
|
|
3240
3351
|
}
|
|
3241
3352
|
if (audioThreadContext.status === "idle") {
|
|
3242
|
-
return /* @__PURE__ */
|
|
3353
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3243
3354
|
onClick: function() {
|
|
3244
3355
|
return audioThreadContext.recorderProps.start();
|
|
3245
3356
|
},
|
|
@@ -3252,7 +3363,7 @@ var ActionButton = function() {
|
|
|
3252
3363
|
});
|
|
3253
3364
|
}
|
|
3254
3365
|
if (audioThreadContext.status === "playing") {
|
|
3255
|
-
return /* @__PURE__ */
|
|
3366
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3256
3367
|
onClick: function() {
|
|
3257
3368
|
return audioThreadContext.messageAudioProps.pause();
|
|
3258
3369
|
},
|
|
@@ -3262,11 +3373,11 @@ var ActionButton = function() {
|
|
|
3262
3373
|
style: {
|
|
3263
3374
|
border: "2px solid var(--gray-8)"
|
|
3264
3375
|
},
|
|
3265
|
-
children: /* @__PURE__ */
|
|
3376
|
+
children: /* @__PURE__ */ jsx58(PauseIcon, {})
|
|
3266
3377
|
});
|
|
3267
3378
|
}
|
|
3268
3379
|
if (audioThreadContext.status === "playerPaused") {
|
|
3269
|
-
return /* @__PURE__ */
|
|
3380
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3270
3381
|
onClick: function() {
|
|
3271
3382
|
return audioThreadContext.messageAudioProps.play();
|
|
3272
3383
|
},
|
|
@@ -3276,10 +3387,10 @@ var ActionButton = function() {
|
|
|
3276
3387
|
style: {
|
|
3277
3388
|
border: "2px solid var(--gray-8)"
|
|
3278
3389
|
},
|
|
3279
|
-
children: /* @__PURE__ */
|
|
3390
|
+
children: /* @__PURE__ */ jsx58(ResumeIcon, {})
|
|
3280
3391
|
});
|
|
3281
3392
|
}
|
|
3282
|
-
return /* @__PURE__ */
|
|
3393
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3283
3394
|
size: "4",
|
|
3284
3395
|
color: "red",
|
|
3285
3396
|
radius: "full",
|
|
@@ -3290,70 +3401,70 @@ var ActionButton = function() {
|
|
|
3290
3401
|
});
|
|
3291
3402
|
};
|
|
3292
3403
|
// src/components/threads/AudioThread/Form/index.tsx
|
|
3293
|
-
import { jsx as
|
|
3404
|
+
import { jsx as jsx59, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3294
3405
|
var Form = function() {
|
|
3295
3406
|
var audioThreadContext = useAudioThreadContext();
|
|
3296
|
-
return /* @__PURE__ */
|
|
3407
|
+
return /* @__PURE__ */ jsxs20(Flex24, {
|
|
3297
3408
|
direction: "column",
|
|
3298
3409
|
align: "center",
|
|
3299
3410
|
children: [
|
|
3300
|
-
/* @__PURE__ */
|
|
3411
|
+
/* @__PURE__ */ jsxs20(Flex24, {
|
|
3301
3412
|
pb: "3",
|
|
3302
3413
|
align: "center",
|
|
3303
3414
|
children: [
|
|
3304
|
-
/* @__PURE__ */
|
|
3415
|
+
/* @__PURE__ */ jsx59(Flex24, {
|
|
3305
3416
|
ml: "-5",
|
|
3306
3417
|
mr: "2",
|
|
3307
3418
|
align: "center",
|
|
3308
|
-
children: /* @__PURE__ */
|
|
3419
|
+
children: /* @__PURE__ */ jsx59(SpeakerModerateIcon, {
|
|
3309
3420
|
style: {
|
|
3310
3421
|
color: "var(--".concat(audioThreadContext.status === "recording" ? "mint" : "gray", "-12)")
|
|
3311
3422
|
}
|
|
3312
3423
|
})
|
|
3313
3424
|
}),
|
|
3314
|
-
/* @__PURE__ */
|
|
3425
|
+
/* @__PURE__ */ jsx59(Flex24, {
|
|
3315
3426
|
px: "2",
|
|
3316
3427
|
py: "1",
|
|
3317
3428
|
style: {
|
|
3318
3429
|
backgroundColor: "var(--".concat(audioThreadContext.status === "recording" ? "mint" : "gray", "-4)"),
|
|
3319
3430
|
borderRadius: "var(--radius-6)"
|
|
3320
3431
|
},
|
|
3321
|
-
children: /* @__PURE__ */
|
|
3432
|
+
children: /* @__PURE__ */ jsx59(Visualizer, {})
|
|
3322
3433
|
})
|
|
3323
3434
|
]
|
|
3324
3435
|
}),
|
|
3325
|
-
/* @__PURE__ */
|
|
3436
|
+
/* @__PURE__ */ jsx59(ActionButton, {})
|
|
3326
3437
|
]
|
|
3327
3438
|
});
|
|
3328
3439
|
};
|
|
3329
3440
|
// src/components/threads/AudioThread/index.tsx
|
|
3330
|
-
import { jsx as
|
|
3441
|
+
import { jsx as jsx60, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3331
3442
|
var AudioThread = function(props) {
|
|
3332
|
-
return /* @__PURE__ */
|
|
3443
|
+
return /* @__PURE__ */ jsxs21(Root8, _object_spread_props(_object_spread({}, props), {
|
|
3333
3444
|
children: [
|
|
3334
|
-
/* @__PURE__ */
|
|
3335
|
-
/* @__PURE__ */
|
|
3445
|
+
/* @__PURE__ */ jsx60(Visualization, {}),
|
|
3446
|
+
/* @__PURE__ */ jsx60(Form, {})
|
|
3336
3447
|
]
|
|
3337
3448
|
}));
|
|
3338
3449
|
};
|
|
3339
|
-
AudioThread.Root =
|
|
3450
|
+
AudioThread.Root = Root8;
|
|
3340
3451
|
AudioThread.Visualization = Visualization;
|
|
3341
3452
|
AudioThread.Form = Form;
|
|
3342
3453
|
// src/components/threads/AudioThreadDialog/index.tsx
|
|
3343
|
-
import { jsx as
|
|
3454
|
+
import { jsx as jsx61, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3344
3455
|
var AudioThreadDialog = function() {
|
|
3345
|
-
return /* @__PURE__ */
|
|
3456
|
+
return /* @__PURE__ */ jsxs22(Root6, {
|
|
3346
3457
|
children: [
|
|
3347
|
-
/* @__PURE__ */
|
|
3348
|
-
children: /* @__PURE__ */
|
|
3458
|
+
/* @__PURE__ */ jsx61(Content4.Root, {
|
|
3459
|
+
children: /* @__PURE__ */ jsx61(AudioThread, {})
|
|
3349
3460
|
}),
|
|
3350
|
-
/* @__PURE__ */
|
|
3351
|
-
children: /* @__PURE__ */
|
|
3461
|
+
/* @__PURE__ */ jsx61(Trigger, {
|
|
3462
|
+
children: /* @__PURE__ */ jsx61(Button3, {})
|
|
3352
3463
|
})
|
|
3353
3464
|
]
|
|
3354
3465
|
});
|
|
3355
3466
|
};
|
|
3356
|
-
AudioThreadDialog.Root =
|
|
3467
|
+
AudioThreadDialog.Root = Root6;
|
|
3357
3468
|
AudioThreadDialog.Trigger = Trigger;
|
|
3358
3469
|
AudioThreadDialog.Button = Button3;
|
|
3359
3470
|
AudioThreadDialog.Content = Content4;
|
|
@@ -3363,15 +3474,15 @@ import { useMemo as useMemo15 } from "react";
|
|
|
3363
3474
|
import { useMemo as useMemo14 } from "react";
|
|
3364
3475
|
import { isEmpty as isEmpty2 } from "radash";
|
|
3365
3476
|
import { onlyText } from "react-children-utilities";
|
|
3366
|
-
import { Flex as
|
|
3477
|
+
import { Flex as Flex25 } from "@radix-ui/themes";
|
|
3367
3478
|
// src/components/suggestions/Suggestions/Item.tsx
|
|
3368
3479
|
import { ArrowUpIcon as ArrowUpIcon3 } from "@radix-ui/react-icons";
|
|
3369
|
-
import { Text as
|
|
3370
|
-
import { jsx as
|
|
3480
|
+
import { Text as Text7, Button as Button4, Spinner as Spinner2 } from "@radix-ui/themes";
|
|
3481
|
+
import { jsx as jsx62, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3371
3482
|
var Item = function(param) {
|
|
3372
3483
|
var suggestion = param.suggestion, isDisabled = param.isDisabled;
|
|
3373
3484
|
var _useCreateMessage = useCreateMessage(), createMessage = _useCreateMessage.createMessage, isPending = _useCreateMessage.isPending;
|
|
3374
|
-
return /* @__PURE__ */
|
|
3485
|
+
return /* @__PURE__ */ jsx62(Content5, {
|
|
3375
3486
|
onClick: function() {
|
|
3376
3487
|
createMessage({
|
|
3377
3488
|
// @ts-ignore-next-line
|
|
@@ -3385,26 +3496,26 @@ var Item = function(param) {
|
|
|
3385
3496
|
};
|
|
3386
3497
|
var Content5 = function(param) {
|
|
3387
3498
|
var onClick = param.onClick, isDisabled = param.isDisabled, isPending = param.isPending, children = param.children;
|
|
3388
|
-
return /* @__PURE__ */
|
|
3499
|
+
return /* @__PURE__ */ jsxs23(Button4, {
|
|
3389
3500
|
variant: "soft",
|
|
3390
3501
|
onClick: onClick,
|
|
3391
3502
|
disabled: isDisabled,
|
|
3392
3503
|
children: [
|
|
3393
|
-
/* @__PURE__ */
|
|
3504
|
+
/* @__PURE__ */ jsx62(Text7, {
|
|
3394
3505
|
size: "1",
|
|
3395
3506
|
weight: "regular",
|
|
3396
3507
|
children: children
|
|
3397
3508
|
}),
|
|
3398
|
-
/* @__PURE__ */
|
|
3509
|
+
/* @__PURE__ */ jsx62(Spinner2, {
|
|
3399
3510
|
loading: isPending,
|
|
3400
|
-
children: /* @__PURE__ */
|
|
3511
|
+
children: /* @__PURE__ */ jsx62(ArrowUpIcon3, {})
|
|
3401
3512
|
})
|
|
3402
3513
|
]
|
|
3403
3514
|
});
|
|
3404
3515
|
};
|
|
3405
3516
|
Item.Content = Content5;
|
|
3406
3517
|
// src/components/suggestions/Suggestions/Content.tsx
|
|
3407
|
-
import { jsx as
|
|
3518
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
3408
3519
|
var Content6 = function(param) {
|
|
3409
3520
|
var children = param.children;
|
|
3410
3521
|
var messageContext = useMessageContext();
|
|
@@ -3428,12 +3539,12 @@ var Content6 = function(param) {
|
|
|
3428
3539
|
isRunActiveProps
|
|
3429
3540
|
]);
|
|
3430
3541
|
if (isEmpty2(suggestions)) return null;
|
|
3431
|
-
return /* @__PURE__ */
|
|
3542
|
+
return /* @__PURE__ */ jsx63(Flex25, {
|
|
3432
3543
|
gap: "2",
|
|
3433
3544
|
py: "2",
|
|
3434
3545
|
wrap: "wrap",
|
|
3435
3546
|
children: suggestions.map(function(suggestion) {
|
|
3436
|
-
return /* @__PURE__ */
|
|
3547
|
+
return /* @__PURE__ */ jsx63(Item, {
|
|
3437
3548
|
suggestion: suggestion,
|
|
3438
3549
|
isDisabled: isDisabled
|
|
3439
3550
|
}, suggestion);
|
|
@@ -3441,7 +3552,7 @@ var Content6 = function(param) {
|
|
|
3441
3552
|
});
|
|
3442
3553
|
};
|
|
3443
3554
|
// src/components/suggestions/Suggestions/index.tsx
|
|
3444
|
-
import { jsx as
|
|
3555
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
3445
3556
|
var Suggestions = function(param) {
|
|
3446
3557
|
var children = param.children;
|
|
3447
3558
|
var latestMessageProps = useLatestMessage();
|
|
@@ -3454,14 +3565,14 @@ var Suggestions = function(param) {
|
|
|
3454
3565
|
]);
|
|
3455
3566
|
if (latestMessageProps.isLoading) return null;
|
|
3456
3567
|
if (isDisabled) return null;
|
|
3457
|
-
return /* @__PURE__ */
|
|
3568
|
+
return /* @__PURE__ */ jsx64(Content6, {
|
|
3458
3569
|
children: children
|
|
3459
3570
|
});
|
|
3460
3571
|
};
|
|
3461
3572
|
Suggestions.Item = Item;
|
|
3462
3573
|
// src/components/markdown/MarkdownProvider/index.tsx
|
|
3463
3574
|
import { useMemo as useMemo16 } from "react";
|
|
3464
|
-
import { jsx as
|
|
3575
|
+
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
3465
3576
|
var MarkdownProvider = function(_param) {
|
|
3466
3577
|
var children = _param.children, rest = _object_without_properties(_param, [
|
|
3467
3578
|
"children"
|
|
@@ -3473,7 +3584,7 @@ var MarkdownProvider = function(_param) {
|
|
|
3473
3584
|
rest,
|
|
3474
3585
|
prevMarkdownContext
|
|
3475
3586
|
]);
|
|
3476
|
-
return /* @__PURE__ */
|
|
3587
|
+
return /* @__PURE__ */ jsx65(MarkdownContext.Provider, {
|
|
3477
3588
|
value: value,
|
|
3478
3589
|
children: children
|
|
3479
3590
|
});
|