@superinterface/react 2.0.7 → 2.0.9
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 +384 -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 +367 -241
- 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;
|
|
@@ -1808,8 +1823,9 @@ var useManageRuns = function() {
|
|
|
1808
1823
|
return null;
|
|
1809
1824
|
};
|
|
1810
1825
|
// src/hooks/runs/usePolling/index.tsx
|
|
1826
|
+
import { useEffect as useEffect4 } from "react";
|
|
1811
1827
|
import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
1812
|
-
import { useInterval } from "react-use";
|
|
1828
|
+
import { useInterval, usePrevious } from "react-use";
|
|
1813
1829
|
// src/hooks/runs/usePolling/lib/refetch.ts
|
|
1814
1830
|
var refetch = function() {
|
|
1815
1831
|
var _ref = _async_to_generator(function(param) {
|
|
@@ -1878,11 +1894,25 @@ var usePolling = function() {
|
|
|
1878
1894
|
}
|
|
1879
1895
|
});
|
|
1880
1896
|
}), isRunActiveProps.isRunActive ? 3e3 : null);
|
|
1897
|
+
var prevIsRunActive = usePrevious(isRunActiveProps.isRunActive);
|
|
1898
|
+
useEffect4(function() {
|
|
1899
|
+
if (prevIsRunActive && !isRunActiveProps.isRunActive) {
|
|
1900
|
+
refetch({
|
|
1901
|
+
queryClient: queryClient,
|
|
1902
|
+
threadContext: threadContext
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
}, [
|
|
1906
|
+
queryClient,
|
|
1907
|
+
threadContext,
|
|
1908
|
+
isRunActiveProps,
|
|
1909
|
+
prevIsRunActive
|
|
1910
|
+
]);
|
|
1881
1911
|
return null;
|
|
1882
1912
|
};
|
|
1883
1913
|
// src/hooks/actions/useManageActions/index.tsx
|
|
1884
1914
|
import { useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
1885
|
-
import { useEffect as
|
|
1915
|
+
import { useEffect as useEffect5 } from "react";
|
|
1886
1916
|
// src/hooks/actions/useHandleAction/index.tsx
|
|
1887
1917
|
import { partob as partob2 } from "radash";
|
|
1888
1918
|
import { useMutation as useMutation2, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
@@ -1955,7 +1985,7 @@ var useManageActions = function() {
|
|
|
1955
1985
|
var threadContext = useSuperinterfaceContext();
|
|
1956
1986
|
var latestRunProps = useLatestRun();
|
|
1957
1987
|
var handleActionProps = useHandleAction();
|
|
1958
|
-
|
|
1988
|
+
useEffect5(function() {
|
|
1959
1989
|
if (handleActionProps.isPending) return;
|
|
1960
1990
|
if (latestRunProps.isFetching) return;
|
|
1961
1991
|
if (!latestRunProps.latestRun) return;
|
|
@@ -1987,7 +2017,7 @@ var useLifecycle = function() {
|
|
|
1987
2017
|
return null;
|
|
1988
2018
|
};
|
|
1989
2019
|
// src/components/threads/Thread/Messages/Root/index.tsx
|
|
1990
|
-
import { jsx as jsx35, jsxs as
|
|
2020
|
+
import { jsx as jsx35, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1991
2021
|
var Root = function(param) {
|
|
1992
2022
|
var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
|
|
1993
2023
|
var _useMessages = useMessages(), isFetchingNextPage = _useMessages.isFetchingNextPage, hasNextPage = _useMessages.hasNextPage, fetchNextPage = _useMessages.fetchNextPage;
|
|
@@ -1997,7 +2027,7 @@ var Root = function(param) {
|
|
|
1997
2027
|
hasNextPage: hasNextPage,
|
|
1998
2028
|
fetchNextPage: fetchNextPage
|
|
1999
2029
|
}), containerRef = _useInfiniteScroll.containerRef, loaderRef = _useInfiniteScroll.loaderRef;
|
|
2000
|
-
return /* @__PURE__ */
|
|
2030
|
+
return /* @__PURE__ */ jsxs10(Flex11, {
|
|
2001
2031
|
ref: containerRef,
|
|
2002
2032
|
direction: "column-reverse",
|
|
2003
2033
|
flexGrow: "1",
|
|
@@ -2026,10 +2056,10 @@ var NextPageSkeleton = function() {
|
|
|
2026
2056
|
return /* @__PURE__ */ jsx36(MessagesSkeleton, {});
|
|
2027
2057
|
};
|
|
2028
2058
|
// src/components/threads/Thread/Messages/index.tsx
|
|
2029
|
-
import { jsx as jsx37, jsxs as
|
|
2059
|
+
import { jsx as jsx37, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2030
2060
|
var Messages = function(param) {
|
|
2031
2061
|
var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
|
|
2032
|
-
return /* @__PURE__ */
|
|
2062
|
+
return /* @__PURE__ */ jsxs11(Root, {
|
|
2033
2063
|
style: style,
|
|
2034
2064
|
children: [
|
|
2035
2065
|
/* @__PURE__ */ jsx37(Flex12, {
|
|
@@ -2056,16 +2086,16 @@ import { Flex as Flex14, Text as Text5 } from "@radix-ui/themes";
|
|
|
2056
2086
|
import { ArrowUpIcon } from "@radix-ui/react-icons";
|
|
2057
2087
|
import { Button as Button2, Spinner } from "@radix-ui/themes";
|
|
2058
2088
|
// src/hooks/messages/useMessageFormContext/index.ts
|
|
2059
|
-
import { useContext as
|
|
2089
|
+
import { useContext as useContext9 } from "react";
|
|
2060
2090
|
// src/contexts/messages/MessageFormContext/index.ts
|
|
2061
|
-
import { createContext as
|
|
2062
|
-
var MessageFormContext =
|
|
2091
|
+
import { createContext as createContext9 } from "react";
|
|
2092
|
+
var MessageFormContext = createContext9({
|
|
2063
2093
|
isDisabled: false,
|
|
2064
2094
|
isLoading: false
|
|
2065
2095
|
});
|
|
2066
2096
|
// src/hooks/messages/useMessageFormContext/index.ts
|
|
2067
2097
|
var useMessageFormContext = function() {
|
|
2068
|
-
return
|
|
2098
|
+
return useContext9(MessageFormContext);
|
|
2069
2099
|
};
|
|
2070
2100
|
// src/components/threads/Thread/MessageForm/Submit/index.tsx
|
|
2071
2101
|
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
@@ -2230,6 +2260,9 @@ var onSettled3 = function(param) {
|
|
|
2230
2260
|
};
|
|
2231
2261
|
// src/hooks/messages/useCreateMessage/index.ts
|
|
2232
2262
|
var useCreateMessage = function() {
|
|
2263
|
+
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
2264
|
+
onError: function() {}
|
|
2265
|
+
}, _ref_onError = _ref.onError, onError = _ref_onError === void 0 ? function() {} : _ref_onError;
|
|
2233
2266
|
var queryClient = useQueryClient9();
|
|
2234
2267
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
2235
2268
|
var threadContext = useSuperinterfaceContext();
|
|
@@ -2239,7 +2272,8 @@ var useCreateMessage = function() {
|
|
|
2239
2272
|
}),
|
|
2240
2273
|
onSettled: onSettled3({
|
|
2241
2274
|
queryClient: queryClient
|
|
2242
|
-
})
|
|
2275
|
+
}),
|
|
2276
|
+
onError: onError
|
|
2243
2277
|
}, mutationOptions({
|
|
2244
2278
|
mutationKeyBase: [
|
|
2245
2279
|
"createMessage"
|
|
@@ -2275,7 +2309,15 @@ var Root2 = function(param) {
|
|
|
2275
2309
|
isRunActive2,
|
|
2276
2310
|
isSubmitting
|
|
2277
2311
|
]);
|
|
2278
|
-
var
|
|
2312
|
+
var addToast = useToasts().addToast;
|
|
2313
|
+
var createMessage = useCreateMessage({
|
|
2314
|
+
onError: function(error) {
|
|
2315
|
+
return addToast({
|
|
2316
|
+
type: "error",
|
|
2317
|
+
message: error.message
|
|
2318
|
+
});
|
|
2319
|
+
}
|
|
2320
|
+
}).createMessage;
|
|
2279
2321
|
var onSubmit = function() {
|
|
2280
2322
|
var _ref = _async_to_generator(function(data3) {
|
|
2281
2323
|
return _ts_generator(this, function(_state) {
|
|
@@ -2323,15 +2365,15 @@ var Root2 = function(param) {
|
|
|
2323
2365
|
});
|
|
2324
2366
|
};
|
|
2325
2367
|
// src/components/threads/Thread/MessageForm/Field/index.tsx
|
|
2326
|
-
import { usePrevious } from "react-use";
|
|
2327
|
-
import { useContext as
|
|
2368
|
+
import { usePrevious as usePrevious2 } from "react-use";
|
|
2369
|
+
import { useContext as useContext10, useMemo as useMemo10, useRef as useRef3, useEffect as useEffect6 } from "react";
|
|
2328
2370
|
// src/components/textareas/TextareaBase/index.tsx
|
|
2329
2371
|
import { forwardRef as forwardRef3 } from "react";
|
|
2330
2372
|
import TextareaAutosize from "react-textarea-autosize";
|
|
2331
|
-
import { Fragment as Fragment2, jsx as jsx40, jsxs as
|
|
2373
|
+
import { Fragment as Fragment2, jsx as jsx40, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2332
2374
|
var UPSCALE_RATIO = 16 / 14;
|
|
2333
2375
|
var TextareaBase = forwardRef3(function TextareaBase2(props, ref) {
|
|
2334
|
-
return /* @__PURE__ */
|
|
2376
|
+
return /* @__PURE__ */ jsxs12(Fragment2, {
|
|
2335
2377
|
children: [
|
|
2336
2378
|
/* @__PURE__ */ jsx40("style", {
|
|
2337
2379
|
children: ".superinterface-textarea { min-height: inherit; height: 30px; }\n.superinterface-textarea::placeholder { color: var(--gray-a10); }"
|
|
@@ -2392,7 +2434,7 @@ var Root3 = function(param) {
|
|
|
2392
2434
|
});
|
|
2393
2435
|
};
|
|
2394
2436
|
var Control = function() {
|
|
2395
|
-
var assistantNameContext =
|
|
2437
|
+
var assistantNameContext = useContext10(AssistantNameContext);
|
|
2396
2438
|
var register = useFormContext().register;
|
|
2397
2439
|
var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading;
|
|
2398
2440
|
var isSubmitDisabled = useMemo10(function() {
|
|
@@ -2401,10 +2443,10 @@ var Control = function() {
|
|
|
2401
2443
|
isDisabled,
|
|
2402
2444
|
isLoading
|
|
2403
2445
|
]);
|
|
2404
|
-
var isDisabledPrevious =
|
|
2446
|
+
var isDisabledPrevious = usePrevious2(isDisabled);
|
|
2405
2447
|
var textareaRef = useRef3(null);
|
|
2406
2448
|
var textareaProps = register("content");
|
|
2407
|
-
|
|
2449
|
+
useEffect6(function() {
|
|
2408
2450
|
if (isDisabled) return;
|
|
2409
2451
|
if (!isDisabledPrevious) return;
|
|
2410
2452
|
if (!textareaRef.current) return;
|
|
@@ -2438,10 +2480,10 @@ var Field = {
|
|
|
2438
2480
|
Control: Control
|
|
2439
2481
|
};
|
|
2440
2482
|
// src/components/threads/Thread/MessageForm/index.tsx
|
|
2441
|
-
import { jsx as jsx42, jsxs as
|
|
2483
|
+
import { jsx as jsx42, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2442
2484
|
var MessageForm = function() {
|
|
2443
2485
|
return /* @__PURE__ */ jsx42(Root2, {
|
|
2444
|
-
children: /* @__PURE__ */
|
|
2486
|
+
children: /* @__PURE__ */ jsxs13(Field.Root, {
|
|
2445
2487
|
children: [
|
|
2446
2488
|
/* @__PURE__ */ jsx42(Text5, {
|
|
2447
2489
|
size: "2",
|
|
@@ -2504,9 +2546,9 @@ var Root4 = function(_param) {
|
|
|
2504
2546
|
}));
|
|
2505
2547
|
};
|
|
2506
2548
|
// src/components/threads/Thread/index.tsx
|
|
2507
|
-
import { jsx as jsx46, jsxs as
|
|
2549
|
+
import { jsx as jsx46, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2508
2550
|
var Thread = function(props) {
|
|
2509
|
-
return /* @__PURE__ */
|
|
2551
|
+
return /* @__PURE__ */ jsxs14(Root4, _object_spread_props(_object_spread({}, props), {
|
|
2510
2552
|
children: [
|
|
2511
2553
|
/* @__PURE__ */ jsx46(Messages, {}),
|
|
2512
2554
|
/* @__PURE__ */ jsx46(MessageForm, {})
|
|
@@ -2517,24 +2559,24 @@ Thread.Root = Root4;
|
|
|
2517
2559
|
Thread.Messages = Messages;
|
|
2518
2560
|
Thread.MessageForm = MessageForm;
|
|
2519
2561
|
// src/hooks/messages/useMessageContext/index.ts
|
|
2520
|
-
import { useContext as
|
|
2562
|
+
import { useContext as useContext11 } from "react";
|
|
2521
2563
|
var useMessageContext = function() {
|
|
2522
|
-
return
|
|
2564
|
+
return useContext11(MessageContext);
|
|
2523
2565
|
};
|
|
2524
2566
|
// src/components/threads/ThreadDialog/Root/index.tsx
|
|
2525
|
-
import { Flex as
|
|
2567
|
+
import { Flex as Flex17 } from "@radix-ui/themes";
|
|
2526
2568
|
// src/components/threads/ThreadDialog/Provider/index.tsx
|
|
2527
2569
|
import { useState as useState3 } from "react";
|
|
2528
2570
|
// src/contexts/threads/ThreadDialogContext/index.ts
|
|
2529
|
-
import { createContext as
|
|
2530
|
-
var ThreadDialogContext =
|
|
2571
|
+
import { createContext as createContext10 } from "react";
|
|
2572
|
+
var ThreadDialogContext = createContext10({
|
|
2531
2573
|
isOpen: false,
|
|
2532
2574
|
setIsOpen: function() {}
|
|
2533
2575
|
});
|
|
2534
2576
|
// src/hooks/threads/useThreadDialogContext/index.ts
|
|
2535
|
-
import { useContext as
|
|
2577
|
+
import { useContext as useContext12 } from "react";
|
|
2536
2578
|
var useThreadDialogContext = function() {
|
|
2537
|
-
return
|
|
2579
|
+
return useContext12(ThreadDialogContext);
|
|
2538
2580
|
};
|
|
2539
2581
|
// src/components/threads/ThreadDialog/Provider/index.tsx
|
|
2540
2582
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
@@ -2550,33 +2592,117 @@ var Provider3 = function(param) {
|
|
|
2550
2592
|
children: children
|
|
2551
2593
|
});
|
|
2552
2594
|
};
|
|
2595
|
+
// src/components/toasts/ToastsProvider/index.tsx
|
|
2596
|
+
import { useState as useState4, useCallback as useCallback2 } from "react";
|
|
2597
|
+
import * as Toast2 from "@radix-ui/react-toast";
|
|
2598
|
+
// src/components/toasts/ToastsProvider/CustomToast.tsx
|
|
2599
|
+
import * as Toast from "@radix-ui/react-toast";
|
|
2600
|
+
import { Card, Text as Text6, Flex as Flex16 } from "@radix-ui/themes";
|
|
2601
|
+
import { CheckCircledIcon as CheckCircledIcon2, CrossCircledIcon } from "@radix-ui/react-icons";
|
|
2602
|
+
import { jsx as jsx48, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2603
|
+
var CustomToast = function(param) {
|
|
2604
|
+
var toast = param.toast;
|
|
2605
|
+
return /* @__PURE__ */ jsx48(Toast.Root, {
|
|
2606
|
+
children: /* @__PURE__ */ jsx48(Card, {
|
|
2607
|
+
children: /* @__PURE__ */ jsx48(Toast.Title, {
|
|
2608
|
+
children: /* @__PURE__ */ jsxs15(Flex16, {
|
|
2609
|
+
children: [
|
|
2610
|
+
/* @__PURE__ */ jsx48(Flex16, {
|
|
2611
|
+
pr: "2",
|
|
2612
|
+
height: "14px",
|
|
2613
|
+
align: "center",
|
|
2614
|
+
children: toast.type === "success" ? /* @__PURE__ */ jsx48(CheckCircledIcon2, {
|
|
2615
|
+
color: "var(--mint-9)"
|
|
2616
|
+
}) : /* @__PURE__ */ jsx48(CrossCircledIcon, {
|
|
2617
|
+
color: "var(--red-9)"
|
|
2618
|
+
})
|
|
2619
|
+
}),
|
|
2620
|
+
/* @__PURE__ */ jsx48(Text6, {
|
|
2621
|
+
weight: "medium",
|
|
2622
|
+
size: "1",
|
|
2623
|
+
children: toast.message
|
|
2624
|
+
})
|
|
2625
|
+
]
|
|
2626
|
+
})
|
|
2627
|
+
})
|
|
2628
|
+
})
|
|
2629
|
+
});
|
|
2630
|
+
};
|
|
2631
|
+
// src/components/toasts/ToastsProvider/index.tsx
|
|
2632
|
+
import { jsx as jsx49, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2633
|
+
var ToastsProvider = function(param) {
|
|
2634
|
+
var children = param.children;
|
|
2635
|
+
var _useState4 = _sliced_to_array(useState4([]), 2), toasts = _useState4[0], setToasts = _useState4[1];
|
|
2636
|
+
var addToast = useCallback2(function(toast) {
|
|
2637
|
+
return setToasts(function(prevToasts) {
|
|
2638
|
+
return _to_consumable_array(prevToasts).concat([
|
|
2639
|
+
toast
|
|
2640
|
+
]);
|
|
2641
|
+
});
|
|
2642
|
+
}, []);
|
|
2643
|
+
return /* @__PURE__ */ jsx49(ToastsContext.Provider, {
|
|
2644
|
+
value: {
|
|
2645
|
+
toasts: toasts,
|
|
2646
|
+
addToast: addToast
|
|
2647
|
+
},
|
|
2648
|
+
children: /* @__PURE__ */ jsxs16(Toast2.Provider, {
|
|
2649
|
+
children: [
|
|
2650
|
+
children,
|
|
2651
|
+
Array.from(toasts).map(function(toast, index) {
|
|
2652
|
+
return /* @__PURE__ */ jsx49(CustomToast, {
|
|
2653
|
+
toast: toast
|
|
2654
|
+
}, index);
|
|
2655
|
+
}),
|
|
2656
|
+
/* @__PURE__ */ jsx49(Toast2.Viewport, {
|
|
2657
|
+
style: {
|
|
2658
|
+
position: "absolute",
|
|
2659
|
+
bottom: 0,
|
|
2660
|
+
right: 0,
|
|
2661
|
+
display: "flex",
|
|
2662
|
+
flexDirection: "column",
|
|
2663
|
+
padding: "var(--space-5)",
|
|
2664
|
+
gap: "var(--space-3)",
|
|
2665
|
+
width: "390px",
|
|
2666
|
+
maxWidth: "100vw",
|
|
2667
|
+
margin: 0,
|
|
2668
|
+
listStyle: "none",
|
|
2669
|
+
zIndex: 99999999999999,
|
|
2670
|
+
outline: "none"
|
|
2671
|
+
}
|
|
2672
|
+
})
|
|
2673
|
+
]
|
|
2674
|
+
})
|
|
2675
|
+
});
|
|
2676
|
+
};
|
|
2553
2677
|
// src/components/threads/ThreadDialog/Root/index.tsx
|
|
2554
|
-
import { jsx as
|
|
2555
|
-
var
|
|
2678
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
2679
|
+
var Root6 = function(param) {
|
|
2556
2680
|
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
|
-
|
|
2681
|
+
return /* @__PURE__ */ jsx50(ToastsProvider, {
|
|
2682
|
+
children: /* @__PURE__ */ jsx50(Provider3, {
|
|
2683
|
+
children: /* @__PURE__ */ jsx50(Flex17, {
|
|
2684
|
+
direction: "column",
|
|
2685
|
+
justify: "end",
|
|
2686
|
+
align: "end",
|
|
2687
|
+
position: "fixed",
|
|
2688
|
+
style: _object_spread({
|
|
2689
|
+
bottom: "24px",
|
|
2690
|
+
right: "24px",
|
|
2691
|
+
top: "24px",
|
|
2692
|
+
zIndex: 9999999999
|
|
2693
|
+
}, style),
|
|
2694
|
+
children: children
|
|
2695
|
+
})
|
|
2570
2696
|
})
|
|
2571
2697
|
});
|
|
2572
2698
|
};
|
|
2573
2699
|
// src/components/threads/ThreadDialog/Trigger/index.tsx
|
|
2574
|
-
import { Flex as
|
|
2575
|
-
import { jsx as
|
|
2700
|
+
import { Flex as Flex18 } from "@radix-ui/themes";
|
|
2701
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
2576
2702
|
var Trigger = function(param) {
|
|
2577
2703
|
var children = param.children;
|
|
2578
2704
|
var setIsOpen = useThreadDialogContext().setIsOpen;
|
|
2579
|
-
return /* @__PURE__ */
|
|
2705
|
+
return /* @__PURE__ */ jsx51(Flex18, {
|
|
2580
2706
|
onClick: function() {
|
|
2581
2707
|
return setIsOpen(function(prev) {
|
|
2582
2708
|
return !prev;
|
|
@@ -2590,22 +2716,22 @@ var Trigger = function(param) {
|
|
|
2590
2716
|
// src/components/threads/ThreadDialog/Button/index.tsx
|
|
2591
2717
|
import { IconButton } from "@radix-ui/themes";
|
|
2592
2718
|
import { ChatBubbleIcon } from "@radix-ui/react-icons";
|
|
2593
|
-
import { jsx as
|
|
2719
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
2594
2720
|
var Button3 = function() {
|
|
2595
|
-
return /* @__PURE__ */
|
|
2721
|
+
return /* @__PURE__ */ jsx52(IconButton, {
|
|
2596
2722
|
size: "4",
|
|
2597
2723
|
radius: "full",
|
|
2598
|
-
children: /* @__PURE__ */
|
|
2724
|
+
children: /* @__PURE__ */ jsx52(ChatBubbleIcon, {})
|
|
2599
2725
|
});
|
|
2600
2726
|
};
|
|
2601
2727
|
// src/components/threads/ThreadDialog/Content/index.tsx
|
|
2602
|
-
import { Card, Inset, Flex as
|
|
2603
|
-
import { jsx as
|
|
2604
|
-
var
|
|
2728
|
+
import { Card as Card2, Inset, Flex as Flex19 } from "@radix-ui/themes";
|
|
2729
|
+
import { jsx as jsx53, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2730
|
+
var Root7 = function(param) {
|
|
2605
2731
|
var children = param.children;
|
|
2606
2732
|
var isOpen = useThreadDialogContext().isOpen;
|
|
2607
2733
|
if (!isOpen) return null;
|
|
2608
|
-
return /* @__PURE__ */
|
|
2734
|
+
return /* @__PURE__ */ jsx53(Card2, {
|
|
2609
2735
|
mb: "3",
|
|
2610
2736
|
style: {
|
|
2611
2737
|
display: "flex",
|
|
@@ -2614,7 +2740,7 @@ var Root6 = function(param) {
|
|
|
2614
2740
|
maxWidth: "400px",
|
|
2615
2741
|
maxHeight: "720px"
|
|
2616
2742
|
},
|
|
2617
|
-
children: /* @__PURE__ */
|
|
2743
|
+
children: /* @__PURE__ */ jsx53(Inset, {
|
|
2618
2744
|
clip: "padding-box",
|
|
2619
2745
|
side: "all",
|
|
2620
2746
|
pb: "current",
|
|
@@ -2627,51 +2753,51 @@ var Root6 = function(param) {
|
|
|
2627
2753
|
});
|
|
2628
2754
|
};
|
|
2629
2755
|
var Content4 = function() {
|
|
2630
|
-
return /* @__PURE__ */
|
|
2631
|
-
children: /* @__PURE__ */
|
|
2756
|
+
return /* @__PURE__ */ jsx53(Root7, {
|
|
2757
|
+
children: /* @__PURE__ */ jsxs17(Thread.Root, {
|
|
2632
2758
|
children: [
|
|
2633
|
-
/* @__PURE__ */
|
|
2759
|
+
/* @__PURE__ */ jsx53(Thread.Messages, {
|
|
2634
2760
|
style: {
|
|
2635
2761
|
paddingTop: "var(--space-5)",
|
|
2636
2762
|
paddingRight: "var(--space-5)",
|
|
2637
2763
|
paddingLeft: "var(--space-5)"
|
|
2638
2764
|
}
|
|
2639
2765
|
}),
|
|
2640
|
-
/* @__PURE__ */
|
|
2766
|
+
/* @__PURE__ */ jsx53(Flex19, {
|
|
2641
2767
|
direction: "column",
|
|
2642
2768
|
pl: "5",
|
|
2643
2769
|
pr: "5",
|
|
2644
2770
|
pb: "3",
|
|
2645
2771
|
flexShrink: "0",
|
|
2646
|
-
children: /* @__PURE__ */
|
|
2772
|
+
children: /* @__PURE__ */ jsx53(Thread.MessageForm, {})
|
|
2647
2773
|
})
|
|
2648
2774
|
]
|
|
2649
2775
|
})
|
|
2650
2776
|
});
|
|
2651
2777
|
};
|
|
2652
|
-
Content4.Root =
|
|
2778
|
+
Content4.Root = Root7;
|
|
2653
2779
|
// src/components/threads/ThreadDialog/index.tsx
|
|
2654
|
-
import { jsx as
|
|
2780
|
+
import { jsx as jsx54, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2655
2781
|
var ThreadDialog = function() {
|
|
2656
|
-
return /* @__PURE__ */
|
|
2782
|
+
return /* @__PURE__ */ jsxs18(Root6, {
|
|
2657
2783
|
children: [
|
|
2658
|
-
/* @__PURE__ */
|
|
2659
|
-
/* @__PURE__ */
|
|
2660
|
-
children: /* @__PURE__ */
|
|
2784
|
+
/* @__PURE__ */ jsx54(Content4, {}),
|
|
2785
|
+
/* @__PURE__ */ jsx54(Trigger, {
|
|
2786
|
+
children: /* @__PURE__ */ jsx54(Button3, {})
|
|
2661
2787
|
})
|
|
2662
2788
|
]
|
|
2663
2789
|
});
|
|
2664
2790
|
};
|
|
2665
|
-
ThreadDialog.Root =
|
|
2791
|
+
ThreadDialog.Root = Root6;
|
|
2666
2792
|
ThreadDialog.Trigger = Trigger;
|
|
2667
2793
|
ThreadDialog.Button = Button3;
|
|
2668
2794
|
ThreadDialog.Content = Content4;
|
|
2669
2795
|
// src/components/threads/AudioThread/Root/index.tsx
|
|
2670
2796
|
import "regenerator-runtime/runtime";
|
|
2671
|
-
import { Flex as
|
|
2797
|
+
import { Flex as Flex20 } from "@radix-ui/themes";
|
|
2672
2798
|
// src/contexts/threads/AudioThreadContext/index.ts
|
|
2673
|
-
import { createContext as
|
|
2674
|
-
var AudioThreadContext =
|
|
2799
|
+
import { createContext as createContext11 } from "react";
|
|
2800
|
+
var AudioThreadContext = createContext11({
|
|
2675
2801
|
status: "idle",
|
|
2676
2802
|
recorderProps: {
|
|
2677
2803
|
status: "idle",
|
|
@@ -2766,19 +2892,19 @@ var useStatus = function(param) {
|
|
|
2766
2892
|
// src/hooks/audioThreads/useRecorder/index.ts
|
|
2767
2893
|
import dayjs from "dayjs";
|
|
2768
2894
|
import { useAudioCapture } from "use-audio-capture";
|
|
2769
|
-
import { useMemo as useMemo12, useRef as useRef4, useState as
|
|
2895
|
+
import { useMemo as useMemo12, useRef as useRef4, useState as useState5, useCallback as useCallback3, useEffect as useEffect7 } from "react";
|
|
2770
2896
|
import { useAudioPlayer } from "react-use-audio-player";
|
|
2771
2897
|
import { useInterval as useInterval2 } from "react-use";
|
|
2772
2898
|
var useRecorder = function(param) {
|
|
2773
2899
|
var isStopOnSilence = param.isStopOnSilence, onStart = param.onStart, onStop = param.onStop;
|
|
2774
|
-
var
|
|
2775
|
-
var
|
|
2776
|
-
var
|
|
2777
|
-
var
|
|
2900
|
+
var _useState5 = _sliced_to_array(useState5(null), 2), silenceStart = _useState5[0], setSilenceStart = _useState5[1];
|
|
2901
|
+
var _useState51 = _sliced_to_array(useState5(null), 2), noiseStart = _useState51[0], setNoiseStart = _useState51[1];
|
|
2902
|
+
var _useState52 = _sliced_to_array(useState5(null), 2), mediaStream = _useState52[0], setMediaStream = _useState52[1];
|
|
2903
|
+
var _useState53 = _sliced_to_array(useState5("idle"), 2), status = _useState53[0], setStatus = _useState53[1];
|
|
2778
2904
|
var startAudioPlayer = useAudioPlayer();
|
|
2779
2905
|
var endAudioPlayer = useAudioPlayer();
|
|
2780
|
-
var
|
|
2781
|
-
|
|
2906
|
+
var _useState54 = _sliced_to_array(useState5(false), 2), isLoaded = _useState54[0], setIsLoaded = _useState54[1];
|
|
2907
|
+
useEffect7(function() {
|
|
2782
2908
|
if (isLoaded) return;
|
|
2783
2909
|
setIsLoaded(true);
|
|
2784
2910
|
}, [
|
|
@@ -2836,9 +2962,9 @@ var useRecorder = function(param) {
|
|
|
2836
2962
|
setNoiseStart(null);
|
|
2837
2963
|
}
|
|
2838
2964
|
});
|
|
2839
|
-
var
|
|
2965
|
+
var _useState55 = _sliced_to_array(useState5(null), 2), audioEngine = _useState55[0], setAudioEngine = _useState55[1];
|
|
2840
2966
|
var isInited = useRef4(false);
|
|
2841
|
-
|
|
2967
|
+
useEffect7(function() {
|
|
2842
2968
|
if (!mediaStream) return;
|
|
2843
2969
|
if (isInited.current) return;
|
|
2844
2970
|
isInited.current = true;
|
|
@@ -2868,7 +2994,7 @@ var useRecorder = function(param) {
|
|
|
2868
2994
|
}, [
|
|
2869
2995
|
audioEngine
|
|
2870
2996
|
]);
|
|
2871
|
-
var handleSilence =
|
|
2997
|
+
var handleSilence = useCallback3(function() {
|
|
2872
2998
|
if (!silenceAnalyser) return;
|
|
2873
2999
|
var frequencyData = new Uint8Array(silenceAnalyser.frequencyBinCount);
|
|
2874
3000
|
silenceAnalyser.getByteFrequencyData(frequencyData);
|
|
@@ -2891,7 +3017,7 @@ var useRecorder = function(param) {
|
|
|
2891
3017
|
setNoiseStart,
|
|
2892
3018
|
setSilenceStart
|
|
2893
3019
|
]);
|
|
2894
|
-
|
|
3020
|
+
useEffect7(function() {
|
|
2895
3021
|
if (!isStopOnSilence) return;
|
|
2896
3022
|
requestAnimationFrame(function() {
|
|
2897
3023
|
return handleSilence();
|
|
@@ -2914,7 +3040,7 @@ var useRecorder = function(param) {
|
|
|
2914
3040
|
});
|
|
2915
3041
|
};
|
|
2916
3042
|
// src/hooks/audioThreads/useMessageAudio/index.ts
|
|
2917
|
-
import { useMemo as useMemo13, useRef as useRef5, useState as
|
|
3043
|
+
import { useMemo as useMemo13, useRef as useRef5, useState as useState6, useEffect as useEffect8 } from "react";
|
|
2918
3044
|
import { Howler } from "howler";
|
|
2919
3045
|
import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
|
|
2920
3046
|
// src/hooks/audioThreads/useMessageAudio/lib/input.ts
|
|
@@ -2940,11 +3066,11 @@ var isHtmlAudioSupported = !unsupportedNames.includes(((_detect = detect()) ===
|
|
|
2940
3066
|
// src/hooks/audioThreads/useMessageAudio/index.ts
|
|
2941
3067
|
var useMessageAudio = function(param) {
|
|
2942
3068
|
var onEnd = param.onEnd;
|
|
2943
|
-
var
|
|
3069
|
+
var _useState6 = _sliced_to_array(useState6([]), 2), playedMessageIds = _useState6[0], setPlayedMessageIds = _useState6[1];
|
|
2944
3070
|
var audioPlayer = useAudioPlayer2();
|
|
2945
3071
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
2946
3072
|
var latestMessageProps = useLatestMessage();
|
|
2947
|
-
|
|
3073
|
+
useEffect8(function() {
|
|
2948
3074
|
if (audioPlayer.playing) return;
|
|
2949
3075
|
if (!latestMessageProps.latestMessage) return;
|
|
2950
3076
|
if (latestMessageProps.latestMessage.role !== "assistant") return;
|
|
@@ -2979,8 +3105,8 @@ var useMessageAudio = function(param) {
|
|
|
2979
3105
|
onEnd
|
|
2980
3106
|
]);
|
|
2981
3107
|
var isInited = useRef5(false);
|
|
2982
|
-
var
|
|
2983
|
-
|
|
3108
|
+
var _useState61 = _sliced_to_array(useState6(null), 2), audioEngine = _useState61[0], setAudioEngine = _useState61[1];
|
|
3109
|
+
useEffect8(function() {
|
|
2984
3110
|
if (!audioPlayer.playing) return;
|
|
2985
3111
|
if (isInited.current) return;
|
|
2986
3112
|
isInited.current = true;
|
|
@@ -3015,8 +3141,8 @@ var useMessageAudio = function(param) {
|
|
|
3015
3141
|
});
|
|
3016
3142
|
};
|
|
3017
3143
|
// src/components/threads/AudioThread/Root/index.tsx
|
|
3018
|
-
import { jsx as
|
|
3019
|
-
var
|
|
3144
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
3145
|
+
var Root8 = function(param) {
|
|
3020
3146
|
var children = param.children;
|
|
3021
3147
|
useLifecycle();
|
|
3022
3148
|
var createMessageProps = useCreateMessage();
|
|
@@ -3075,13 +3201,13 @@ var Root7 = function(param) {
|
|
|
3075
3201
|
createMessageProps: createMessageProps,
|
|
3076
3202
|
messageAudioProps: messageAudioProps
|
|
3077
3203
|
}).status;
|
|
3078
|
-
return /* @__PURE__ */
|
|
3204
|
+
return /* @__PURE__ */ jsx55(AudioThreadContext.Provider, {
|
|
3079
3205
|
value: {
|
|
3080
3206
|
status: status,
|
|
3081
3207
|
recorderProps: recorderProps,
|
|
3082
3208
|
messageAudioProps: messageAudioProps
|
|
3083
3209
|
},
|
|
3084
|
-
children: /* @__PURE__ */
|
|
3210
|
+
children: /* @__PURE__ */ jsx55(Flex20, {
|
|
3085
3211
|
direction: "column",
|
|
3086
3212
|
flexGrow: "1",
|
|
3087
3213
|
p: "5",
|
|
@@ -3090,23 +3216,23 @@ var Root7 = function(param) {
|
|
|
3090
3216
|
});
|
|
3091
3217
|
};
|
|
3092
3218
|
// src/components/threads/AudioThread/Visualization/index.tsx
|
|
3093
|
-
import { Flex as
|
|
3219
|
+
import { Flex as Flex21 } from "@radix-ui/themes";
|
|
3094
3220
|
// src/hooks/threads/useAudioThreadContext/index.ts
|
|
3095
|
-
import { useContext as
|
|
3221
|
+
import { useContext as useContext13 } from "react";
|
|
3096
3222
|
var useAudioThreadContext = function() {
|
|
3097
|
-
return
|
|
3223
|
+
return useContext13(AudioThreadContext);
|
|
3098
3224
|
};
|
|
3099
3225
|
// src/components/threads/AudioThread/Visualization/index.tsx
|
|
3100
|
-
import { jsx as
|
|
3226
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
3101
3227
|
var Visualization = function() {
|
|
3102
3228
|
var audioThreadContext = useAudioThreadContext();
|
|
3103
|
-
return /* @__PURE__ */
|
|
3229
|
+
return /* @__PURE__ */ jsx56(Flex21, {
|
|
3104
3230
|
direction: "column",
|
|
3105
3231
|
align: "center",
|
|
3106
3232
|
justify: "center",
|
|
3107
3233
|
mb: "3",
|
|
3108
3234
|
flexGrow: "1",
|
|
3109
|
-
children: /* @__PURE__ */
|
|
3235
|
+
children: /* @__PURE__ */ jsx56(Flex21, {
|
|
3110
3236
|
align: "center",
|
|
3111
3237
|
justify: "center",
|
|
3112
3238
|
height: "200px",
|
|
@@ -3120,22 +3246,22 @@ var Visualization = function() {
|
|
|
3120
3246
|
};
|
|
3121
3247
|
// src/components/threads/AudioThread/Form/index.tsx
|
|
3122
3248
|
import { SpeakerModerateIcon } from "@radix-ui/react-icons";
|
|
3123
|
-
import { Flex as
|
|
3249
|
+
import { Flex as Flex24 } from "@radix-ui/themes";
|
|
3124
3250
|
// src/components/threads/AudioThread/Form/Visualizer/index.tsx
|
|
3125
3251
|
import _7 from "lodash";
|
|
3126
|
-
import { Flex as
|
|
3127
|
-
import { useState as
|
|
3252
|
+
import { Flex as Flex22, Grid } from "@radix-ui/themes";
|
|
3253
|
+
import { useState as useState7, useEffect as useEffect9, useCallback as useCallback4 } from "react";
|
|
3128
3254
|
import { cluster } from "radash";
|
|
3129
|
-
import { jsx as
|
|
3255
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
3130
3256
|
var barCount = 4;
|
|
3131
3257
|
var Visualizer = function() {
|
|
3132
3258
|
var audioThreadContext = useAudioThreadContext();
|
|
3133
3259
|
var visualizationAnalyser = audioThreadContext.recorderProps.visualizationAnalyser;
|
|
3134
|
-
var
|
|
3260
|
+
var _useState7 = _sliced_to_array(useState7(function() {
|
|
3135
3261
|
return new AudioContext().createAnalyser();
|
|
3136
|
-
}), 1), emptyVisualizer =
|
|
3137
|
-
var
|
|
3138
|
-
var draw =
|
|
3262
|
+
}), 1), emptyVisualizer = _useState7[0];
|
|
3263
|
+
var _useState71 = _sliced_to_array(useState7([]), 2), barHeights = _useState71[0], setBarHeights = _useState71[1];
|
|
3264
|
+
var draw = useCallback4(function(param) {
|
|
3139
3265
|
var visualizationAnalyser2 = param.visualizationAnalyser;
|
|
3140
3266
|
var frequencyData = new Uint8Array(visualizationAnalyser2.frequencyBinCount / 15);
|
|
3141
3267
|
visualizationAnalyser2.getByteFrequencyData(frequencyData);
|
|
@@ -3149,7 +3275,7 @@ var Visualizer = function() {
|
|
|
3149
3275
|
});
|
|
3150
3276
|
});
|
|
3151
3277
|
}, []);
|
|
3152
|
-
|
|
3278
|
+
useEffect9(function() {
|
|
3153
3279
|
draw({
|
|
3154
3280
|
visualizationAnalyser: visualizationAnalyser || emptyVisualizer
|
|
3155
3281
|
});
|
|
@@ -3158,7 +3284,7 @@ var Visualizer = function() {
|
|
|
3158
3284
|
visualizationAnalyser,
|
|
3159
3285
|
emptyVisualizer
|
|
3160
3286
|
]);
|
|
3161
|
-
return /* @__PURE__ */
|
|
3287
|
+
return /* @__PURE__ */ jsx57(Grid, {
|
|
3162
3288
|
columns: "".concat(barCount),
|
|
3163
3289
|
gap: "1",
|
|
3164
3290
|
width: "auto",
|
|
@@ -3167,12 +3293,12 @@ var Visualizer = function() {
|
|
|
3167
3293
|
gridTemplateColumns: "repeat(4, minmax(0, 1fr))"
|
|
3168
3294
|
},
|
|
3169
3295
|
children: barHeights.map(function(barHeight, index) {
|
|
3170
|
-
return /* @__PURE__ */
|
|
3296
|
+
return /* @__PURE__ */ jsx57(Flex22, {
|
|
3171
3297
|
direction: "column",
|
|
3172
3298
|
align: "center",
|
|
3173
3299
|
justify: "center",
|
|
3174
3300
|
height: "20px",
|
|
3175
|
-
children: /* @__PURE__ */
|
|
3301
|
+
children: /* @__PURE__ */ jsx57(Flex22, {
|
|
3176
3302
|
minHeight: "50%",
|
|
3177
3303
|
maxHeight: "100%",
|
|
3178
3304
|
height: "".concat(barHeight + 20, "%"),
|
|
@@ -3187,31 +3313,31 @@ var Visualizer = function() {
|
|
|
3187
3313
|
});
|
|
3188
3314
|
};
|
|
3189
3315
|
// src/components/threads/AudioThread/Form/ActionButton/index.tsx
|
|
3190
|
-
import { Flex as
|
|
3316
|
+
import { Flex as Flex23, IconButton as IconButton2, Tooltip } from "@radix-ui/themes";
|
|
3191
3317
|
import { PauseIcon, ArrowUpIcon as ArrowUpIcon2, ResumeIcon } from "@radix-ui/react-icons";
|
|
3192
|
-
import { jsx as
|
|
3318
|
+
import { jsx as jsx58, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3193
3319
|
var ActionButton = function() {
|
|
3194
3320
|
var audioThreadContext = useAudioThreadContext();
|
|
3195
3321
|
if (audioThreadContext.status === "recording") {
|
|
3196
|
-
return /* @__PURE__ */
|
|
3322
|
+
return /* @__PURE__ */ jsxs19(Flex23, {
|
|
3197
3323
|
align: "center",
|
|
3198
3324
|
children: [
|
|
3199
|
-
/* @__PURE__ */
|
|
3325
|
+
/* @__PURE__ */ jsx58(Flex23, {
|
|
3200
3326
|
mr: "3",
|
|
3201
3327
|
ml: "-7",
|
|
3202
|
-
children: /* @__PURE__ */
|
|
3328
|
+
children: /* @__PURE__ */ jsx58(IconButton2, {
|
|
3203
3329
|
onClick: audioThreadContext.recorderProps.pause,
|
|
3204
3330
|
color: "gray",
|
|
3205
3331
|
radius: "full",
|
|
3206
3332
|
size: "1",
|
|
3207
|
-
children: /* @__PURE__ */
|
|
3333
|
+
children: /* @__PURE__ */ jsx58(PauseIcon, {})
|
|
3208
3334
|
})
|
|
3209
3335
|
}),
|
|
3210
|
-
/* @__PURE__ */
|
|
3336
|
+
/* @__PURE__ */ jsx58(Tooltip, {
|
|
3211
3337
|
open: true,
|
|
3212
3338
|
content: "Send your message",
|
|
3213
3339
|
side: "bottom",
|
|
3214
|
-
children: /* @__PURE__ */
|
|
3340
|
+
children: /* @__PURE__ */ jsx58(IconButton2, {
|
|
3215
3341
|
onClick: audioThreadContext.recorderProps.stop,
|
|
3216
3342
|
color: "gray",
|
|
3217
3343
|
highContrast: true,
|
|
@@ -3220,14 +3346,14 @@ var ActionButton = function() {
|
|
|
3220
3346
|
style: {
|
|
3221
3347
|
border: "2px solid var(--gray-8)"
|
|
3222
3348
|
},
|
|
3223
|
-
children: /* @__PURE__ */
|
|
3349
|
+
children: /* @__PURE__ */ jsx58(ArrowUpIcon2, {})
|
|
3224
3350
|
})
|
|
3225
3351
|
})
|
|
3226
3352
|
]
|
|
3227
3353
|
});
|
|
3228
3354
|
}
|
|
3229
3355
|
if (audioThreadContext.status === "recorderPaused") {
|
|
3230
|
-
return /* @__PURE__ */
|
|
3356
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3231
3357
|
onClick: audioThreadContext.recorderProps.resume,
|
|
3232
3358
|
color: "red",
|
|
3233
3359
|
radius: "full",
|
|
@@ -3235,11 +3361,11 @@ var ActionButton = function() {
|
|
|
3235
3361
|
style: {
|
|
3236
3362
|
border: "2px solid var(--gray-8)"
|
|
3237
3363
|
},
|
|
3238
|
-
children: /* @__PURE__ */
|
|
3364
|
+
children: /* @__PURE__ */ jsx58(ResumeIcon, {})
|
|
3239
3365
|
});
|
|
3240
3366
|
}
|
|
3241
3367
|
if (audioThreadContext.status === "idle") {
|
|
3242
|
-
return /* @__PURE__ */
|
|
3368
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3243
3369
|
onClick: function() {
|
|
3244
3370
|
return audioThreadContext.recorderProps.start();
|
|
3245
3371
|
},
|
|
@@ -3252,7 +3378,7 @@ var ActionButton = function() {
|
|
|
3252
3378
|
});
|
|
3253
3379
|
}
|
|
3254
3380
|
if (audioThreadContext.status === "playing") {
|
|
3255
|
-
return /* @__PURE__ */
|
|
3381
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3256
3382
|
onClick: function() {
|
|
3257
3383
|
return audioThreadContext.messageAudioProps.pause();
|
|
3258
3384
|
},
|
|
@@ -3262,11 +3388,11 @@ var ActionButton = function() {
|
|
|
3262
3388
|
style: {
|
|
3263
3389
|
border: "2px solid var(--gray-8)"
|
|
3264
3390
|
},
|
|
3265
|
-
children: /* @__PURE__ */
|
|
3391
|
+
children: /* @__PURE__ */ jsx58(PauseIcon, {})
|
|
3266
3392
|
});
|
|
3267
3393
|
}
|
|
3268
3394
|
if (audioThreadContext.status === "playerPaused") {
|
|
3269
|
-
return /* @__PURE__ */
|
|
3395
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3270
3396
|
onClick: function() {
|
|
3271
3397
|
return audioThreadContext.messageAudioProps.play();
|
|
3272
3398
|
},
|
|
@@ -3276,10 +3402,10 @@ var ActionButton = function() {
|
|
|
3276
3402
|
style: {
|
|
3277
3403
|
border: "2px solid var(--gray-8)"
|
|
3278
3404
|
},
|
|
3279
|
-
children: /* @__PURE__ */
|
|
3405
|
+
children: /* @__PURE__ */ jsx58(ResumeIcon, {})
|
|
3280
3406
|
});
|
|
3281
3407
|
}
|
|
3282
|
-
return /* @__PURE__ */
|
|
3408
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3283
3409
|
size: "4",
|
|
3284
3410
|
color: "red",
|
|
3285
3411
|
radius: "full",
|
|
@@ -3290,70 +3416,70 @@ var ActionButton = function() {
|
|
|
3290
3416
|
});
|
|
3291
3417
|
};
|
|
3292
3418
|
// src/components/threads/AudioThread/Form/index.tsx
|
|
3293
|
-
import { jsx as
|
|
3419
|
+
import { jsx as jsx59, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3294
3420
|
var Form = function() {
|
|
3295
3421
|
var audioThreadContext = useAudioThreadContext();
|
|
3296
|
-
return /* @__PURE__ */
|
|
3422
|
+
return /* @__PURE__ */ jsxs20(Flex24, {
|
|
3297
3423
|
direction: "column",
|
|
3298
3424
|
align: "center",
|
|
3299
3425
|
children: [
|
|
3300
|
-
/* @__PURE__ */
|
|
3426
|
+
/* @__PURE__ */ jsxs20(Flex24, {
|
|
3301
3427
|
pb: "3",
|
|
3302
3428
|
align: "center",
|
|
3303
3429
|
children: [
|
|
3304
|
-
/* @__PURE__ */
|
|
3430
|
+
/* @__PURE__ */ jsx59(Flex24, {
|
|
3305
3431
|
ml: "-5",
|
|
3306
3432
|
mr: "2",
|
|
3307
3433
|
align: "center",
|
|
3308
|
-
children: /* @__PURE__ */
|
|
3434
|
+
children: /* @__PURE__ */ jsx59(SpeakerModerateIcon, {
|
|
3309
3435
|
style: {
|
|
3310
3436
|
color: "var(--".concat(audioThreadContext.status === "recording" ? "mint" : "gray", "-12)")
|
|
3311
3437
|
}
|
|
3312
3438
|
})
|
|
3313
3439
|
}),
|
|
3314
|
-
/* @__PURE__ */
|
|
3440
|
+
/* @__PURE__ */ jsx59(Flex24, {
|
|
3315
3441
|
px: "2",
|
|
3316
3442
|
py: "1",
|
|
3317
3443
|
style: {
|
|
3318
3444
|
backgroundColor: "var(--".concat(audioThreadContext.status === "recording" ? "mint" : "gray", "-4)"),
|
|
3319
3445
|
borderRadius: "var(--radius-6)"
|
|
3320
3446
|
},
|
|
3321
|
-
children: /* @__PURE__ */
|
|
3447
|
+
children: /* @__PURE__ */ jsx59(Visualizer, {})
|
|
3322
3448
|
})
|
|
3323
3449
|
]
|
|
3324
3450
|
}),
|
|
3325
|
-
/* @__PURE__ */
|
|
3451
|
+
/* @__PURE__ */ jsx59(ActionButton, {})
|
|
3326
3452
|
]
|
|
3327
3453
|
});
|
|
3328
3454
|
};
|
|
3329
3455
|
// src/components/threads/AudioThread/index.tsx
|
|
3330
|
-
import { jsx as
|
|
3456
|
+
import { jsx as jsx60, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3331
3457
|
var AudioThread = function(props) {
|
|
3332
|
-
return /* @__PURE__ */
|
|
3458
|
+
return /* @__PURE__ */ jsxs21(Root8, _object_spread_props(_object_spread({}, props), {
|
|
3333
3459
|
children: [
|
|
3334
|
-
/* @__PURE__ */
|
|
3335
|
-
/* @__PURE__ */
|
|
3460
|
+
/* @__PURE__ */ jsx60(Visualization, {}),
|
|
3461
|
+
/* @__PURE__ */ jsx60(Form, {})
|
|
3336
3462
|
]
|
|
3337
3463
|
}));
|
|
3338
3464
|
};
|
|
3339
|
-
AudioThread.Root =
|
|
3465
|
+
AudioThread.Root = Root8;
|
|
3340
3466
|
AudioThread.Visualization = Visualization;
|
|
3341
3467
|
AudioThread.Form = Form;
|
|
3342
3468
|
// src/components/threads/AudioThreadDialog/index.tsx
|
|
3343
|
-
import { jsx as
|
|
3469
|
+
import { jsx as jsx61, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3344
3470
|
var AudioThreadDialog = function() {
|
|
3345
|
-
return /* @__PURE__ */
|
|
3471
|
+
return /* @__PURE__ */ jsxs22(Root6, {
|
|
3346
3472
|
children: [
|
|
3347
|
-
/* @__PURE__ */
|
|
3348
|
-
children: /* @__PURE__ */
|
|
3473
|
+
/* @__PURE__ */ jsx61(Content4.Root, {
|
|
3474
|
+
children: /* @__PURE__ */ jsx61(AudioThread, {})
|
|
3349
3475
|
}),
|
|
3350
|
-
/* @__PURE__ */
|
|
3351
|
-
children: /* @__PURE__ */
|
|
3476
|
+
/* @__PURE__ */ jsx61(Trigger, {
|
|
3477
|
+
children: /* @__PURE__ */ jsx61(Button3, {})
|
|
3352
3478
|
})
|
|
3353
3479
|
]
|
|
3354
3480
|
});
|
|
3355
3481
|
};
|
|
3356
|
-
AudioThreadDialog.Root =
|
|
3482
|
+
AudioThreadDialog.Root = Root6;
|
|
3357
3483
|
AudioThreadDialog.Trigger = Trigger;
|
|
3358
3484
|
AudioThreadDialog.Button = Button3;
|
|
3359
3485
|
AudioThreadDialog.Content = Content4;
|
|
@@ -3363,15 +3489,15 @@ import { useMemo as useMemo15 } from "react";
|
|
|
3363
3489
|
import { useMemo as useMemo14 } from "react";
|
|
3364
3490
|
import { isEmpty as isEmpty2 } from "radash";
|
|
3365
3491
|
import { onlyText } from "react-children-utilities";
|
|
3366
|
-
import { Flex as
|
|
3492
|
+
import { Flex as Flex25 } from "@radix-ui/themes";
|
|
3367
3493
|
// src/components/suggestions/Suggestions/Item.tsx
|
|
3368
3494
|
import { ArrowUpIcon as ArrowUpIcon3 } from "@radix-ui/react-icons";
|
|
3369
|
-
import { Text as
|
|
3370
|
-
import { jsx as
|
|
3495
|
+
import { Text as Text7, Button as Button4, Spinner as Spinner2 } from "@radix-ui/themes";
|
|
3496
|
+
import { jsx as jsx62, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3371
3497
|
var Item = function(param) {
|
|
3372
3498
|
var suggestion = param.suggestion, isDisabled = param.isDisabled;
|
|
3373
3499
|
var _useCreateMessage = useCreateMessage(), createMessage = _useCreateMessage.createMessage, isPending = _useCreateMessage.isPending;
|
|
3374
|
-
return /* @__PURE__ */
|
|
3500
|
+
return /* @__PURE__ */ jsx62(Content5, {
|
|
3375
3501
|
onClick: function() {
|
|
3376
3502
|
createMessage({
|
|
3377
3503
|
// @ts-ignore-next-line
|
|
@@ -3385,26 +3511,26 @@ var Item = function(param) {
|
|
|
3385
3511
|
};
|
|
3386
3512
|
var Content5 = function(param) {
|
|
3387
3513
|
var onClick = param.onClick, isDisabled = param.isDisabled, isPending = param.isPending, children = param.children;
|
|
3388
|
-
return /* @__PURE__ */
|
|
3514
|
+
return /* @__PURE__ */ jsxs23(Button4, {
|
|
3389
3515
|
variant: "soft",
|
|
3390
3516
|
onClick: onClick,
|
|
3391
3517
|
disabled: isDisabled,
|
|
3392
3518
|
children: [
|
|
3393
|
-
/* @__PURE__ */
|
|
3519
|
+
/* @__PURE__ */ jsx62(Text7, {
|
|
3394
3520
|
size: "1",
|
|
3395
3521
|
weight: "regular",
|
|
3396
3522
|
children: children
|
|
3397
3523
|
}),
|
|
3398
|
-
/* @__PURE__ */
|
|
3524
|
+
/* @__PURE__ */ jsx62(Spinner2, {
|
|
3399
3525
|
loading: isPending,
|
|
3400
|
-
children: /* @__PURE__ */
|
|
3526
|
+
children: /* @__PURE__ */ jsx62(ArrowUpIcon3, {})
|
|
3401
3527
|
})
|
|
3402
3528
|
]
|
|
3403
3529
|
});
|
|
3404
3530
|
};
|
|
3405
3531
|
Item.Content = Content5;
|
|
3406
3532
|
// src/components/suggestions/Suggestions/Content.tsx
|
|
3407
|
-
import { jsx as
|
|
3533
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
3408
3534
|
var Content6 = function(param) {
|
|
3409
3535
|
var children = param.children;
|
|
3410
3536
|
var messageContext = useMessageContext();
|
|
@@ -3428,12 +3554,12 @@ var Content6 = function(param) {
|
|
|
3428
3554
|
isRunActiveProps
|
|
3429
3555
|
]);
|
|
3430
3556
|
if (isEmpty2(suggestions)) return null;
|
|
3431
|
-
return /* @__PURE__ */
|
|
3557
|
+
return /* @__PURE__ */ jsx63(Flex25, {
|
|
3432
3558
|
gap: "2",
|
|
3433
3559
|
py: "2",
|
|
3434
3560
|
wrap: "wrap",
|
|
3435
3561
|
children: suggestions.map(function(suggestion) {
|
|
3436
|
-
return /* @__PURE__ */
|
|
3562
|
+
return /* @__PURE__ */ jsx63(Item, {
|
|
3437
3563
|
suggestion: suggestion,
|
|
3438
3564
|
isDisabled: isDisabled
|
|
3439
3565
|
}, suggestion);
|
|
@@ -3441,7 +3567,7 @@ var Content6 = function(param) {
|
|
|
3441
3567
|
});
|
|
3442
3568
|
};
|
|
3443
3569
|
// src/components/suggestions/Suggestions/index.tsx
|
|
3444
|
-
import { jsx as
|
|
3570
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
3445
3571
|
var Suggestions = function(param) {
|
|
3446
3572
|
var children = param.children;
|
|
3447
3573
|
var latestMessageProps = useLatestMessage();
|
|
@@ -3454,14 +3580,14 @@ var Suggestions = function(param) {
|
|
|
3454
3580
|
]);
|
|
3455
3581
|
if (latestMessageProps.isLoading) return null;
|
|
3456
3582
|
if (isDisabled) return null;
|
|
3457
|
-
return /* @__PURE__ */
|
|
3583
|
+
return /* @__PURE__ */ jsx64(Content6, {
|
|
3458
3584
|
children: children
|
|
3459
3585
|
});
|
|
3460
3586
|
};
|
|
3461
3587
|
Suggestions.Item = Item;
|
|
3462
3588
|
// src/components/markdown/MarkdownProvider/index.tsx
|
|
3463
3589
|
import { useMemo as useMemo16 } from "react";
|
|
3464
|
-
import { jsx as
|
|
3590
|
+
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
3465
3591
|
var MarkdownProvider = function(_param) {
|
|
3466
3592
|
var children = _param.children, rest = _object_without_properties(_param, [
|
|
3467
3593
|
"children"
|
|
@@ -3473,7 +3599,7 @@ var MarkdownProvider = function(_param) {
|
|
|
3473
3599
|
rest,
|
|
3474
3600
|
prevMarkdownContext
|
|
3475
3601
|
]);
|
|
3476
|
-
return /* @__PURE__ */
|
|
3602
|
+
return /* @__PURE__ */ jsx65(MarkdownContext.Provider, {
|
|
3477
3603
|
value: value,
|
|
3478
3604
|
children: children
|
|
3479
3605
|
});
|