@superinterface/react 2.0.6 → 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 +371 -259
- 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 +342 -230
- 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,17 +2351,17 @@ 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
|
-
children: ".superinterface-textarea { min-height: inherit; height: 30px; }"
|
|
2364
|
+
children: ".superinterface-textarea { min-height: inherit; height: 30px; }\n.superinterface-textarea::placeholder { color: var(--gray-a10); }"
|
|
2338
2365
|
}),
|
|
2339
2366
|
/* @__PURE__ */ jsx40(TextareaAutosize, _object_spread({
|
|
2340
2367
|
ref: ref,
|
|
@@ -2344,6 +2371,7 @@ var TextareaBase = forwardRef3(function TextareaBase2(props, ref) {
|
|
|
2344
2371
|
outline: 0,
|
|
2345
2372
|
boxSizing: "border-box",
|
|
2346
2373
|
resize: "none",
|
|
2374
|
+
color: "var(--gray-12)",
|
|
2347
2375
|
fontSize: "".concat(14 * UPSCALE_RATIO, "px"),
|
|
2348
2376
|
lineHeight: "".concat(24 * UPSCALE_RATIO, "px"),
|
|
2349
2377
|
transform: "scale(".concat(1 / UPSCALE_RATIO, ")"),
|
|
@@ -2391,7 +2419,7 @@ var Root3 = function(param) {
|
|
|
2391
2419
|
});
|
|
2392
2420
|
};
|
|
2393
2421
|
var Control = function() {
|
|
2394
|
-
var assistantNameContext =
|
|
2422
|
+
var assistantNameContext = useContext10(AssistantNameContext);
|
|
2395
2423
|
var register = useFormContext().register;
|
|
2396
2424
|
var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading;
|
|
2397
2425
|
var isSubmitDisabled = useMemo10(function() {
|
|
@@ -2437,10 +2465,10 @@ var Field = {
|
|
|
2437
2465
|
Control: Control
|
|
2438
2466
|
};
|
|
2439
2467
|
// src/components/threads/Thread/MessageForm/index.tsx
|
|
2440
|
-
import { jsx as jsx42, jsxs as
|
|
2468
|
+
import { jsx as jsx42, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2441
2469
|
var MessageForm = function() {
|
|
2442
2470
|
return /* @__PURE__ */ jsx42(Root2, {
|
|
2443
|
-
children: /* @__PURE__ */
|
|
2471
|
+
children: /* @__PURE__ */ jsxs13(Field.Root, {
|
|
2444
2472
|
children: [
|
|
2445
2473
|
/* @__PURE__ */ jsx42(Text5, {
|
|
2446
2474
|
size: "2",
|
|
@@ -2503,9 +2531,9 @@ var Root4 = function(_param) {
|
|
|
2503
2531
|
}));
|
|
2504
2532
|
};
|
|
2505
2533
|
// src/components/threads/Thread/index.tsx
|
|
2506
|
-
import { jsx as jsx46, jsxs as
|
|
2534
|
+
import { jsx as jsx46, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2507
2535
|
var Thread = function(props) {
|
|
2508
|
-
return /* @__PURE__ */
|
|
2536
|
+
return /* @__PURE__ */ jsxs14(Root4, _object_spread_props(_object_spread({}, props), {
|
|
2509
2537
|
children: [
|
|
2510
2538
|
/* @__PURE__ */ jsx46(Messages, {}),
|
|
2511
2539
|
/* @__PURE__ */ jsx46(MessageForm, {})
|
|
@@ -2516,24 +2544,24 @@ Thread.Root = Root4;
|
|
|
2516
2544
|
Thread.Messages = Messages;
|
|
2517
2545
|
Thread.MessageForm = MessageForm;
|
|
2518
2546
|
// src/hooks/messages/useMessageContext/index.ts
|
|
2519
|
-
import { useContext as
|
|
2547
|
+
import { useContext as useContext11 } from "react";
|
|
2520
2548
|
var useMessageContext = function() {
|
|
2521
|
-
return
|
|
2549
|
+
return useContext11(MessageContext);
|
|
2522
2550
|
};
|
|
2523
2551
|
// src/components/threads/ThreadDialog/Root/index.tsx
|
|
2524
|
-
import { Flex as
|
|
2552
|
+
import { Flex as Flex17 } from "@radix-ui/themes";
|
|
2525
2553
|
// src/components/threads/ThreadDialog/Provider/index.tsx
|
|
2526
2554
|
import { useState as useState3 } from "react";
|
|
2527
2555
|
// src/contexts/threads/ThreadDialogContext/index.ts
|
|
2528
|
-
import { createContext as
|
|
2529
|
-
var ThreadDialogContext =
|
|
2556
|
+
import { createContext as createContext10 } from "react";
|
|
2557
|
+
var ThreadDialogContext = createContext10({
|
|
2530
2558
|
isOpen: false,
|
|
2531
2559
|
setIsOpen: function() {}
|
|
2532
2560
|
});
|
|
2533
2561
|
// src/hooks/threads/useThreadDialogContext/index.ts
|
|
2534
|
-
import { useContext as
|
|
2562
|
+
import { useContext as useContext12 } from "react";
|
|
2535
2563
|
var useThreadDialogContext = function() {
|
|
2536
|
-
return
|
|
2564
|
+
return useContext12(ThreadDialogContext);
|
|
2537
2565
|
};
|
|
2538
2566
|
// src/components/threads/ThreadDialog/Provider/index.tsx
|
|
2539
2567
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
@@ -2549,33 +2577,117 @@ var Provider3 = function(param) {
|
|
|
2549
2577
|
children: children
|
|
2550
2578
|
});
|
|
2551
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
|
+
};
|
|
2552
2662
|
// src/components/threads/ThreadDialog/Root/index.tsx
|
|
2553
|
-
import { jsx as
|
|
2554
|
-
var
|
|
2663
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
2664
|
+
var Root6 = function(param) {
|
|
2555
2665
|
var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
|
|
2556
|
-
return /* @__PURE__ */
|
|
2557
|
-
children: /* @__PURE__ */
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
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
|
+
})
|
|
2569
2681
|
})
|
|
2570
2682
|
});
|
|
2571
2683
|
};
|
|
2572
2684
|
// src/components/threads/ThreadDialog/Trigger/index.tsx
|
|
2573
|
-
import { Flex as
|
|
2574
|
-
import { jsx as
|
|
2685
|
+
import { Flex as Flex18 } from "@radix-ui/themes";
|
|
2686
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
2575
2687
|
var Trigger = function(param) {
|
|
2576
2688
|
var children = param.children;
|
|
2577
2689
|
var setIsOpen = useThreadDialogContext().setIsOpen;
|
|
2578
|
-
return /* @__PURE__ */
|
|
2690
|
+
return /* @__PURE__ */ jsx51(Flex18, {
|
|
2579
2691
|
onClick: function() {
|
|
2580
2692
|
return setIsOpen(function(prev) {
|
|
2581
2693
|
return !prev;
|
|
@@ -2589,22 +2701,22 @@ var Trigger = function(param) {
|
|
|
2589
2701
|
// src/components/threads/ThreadDialog/Button/index.tsx
|
|
2590
2702
|
import { IconButton } from "@radix-ui/themes";
|
|
2591
2703
|
import { ChatBubbleIcon } from "@radix-ui/react-icons";
|
|
2592
|
-
import { jsx as
|
|
2704
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
2593
2705
|
var Button3 = function() {
|
|
2594
|
-
return /* @__PURE__ */
|
|
2706
|
+
return /* @__PURE__ */ jsx52(IconButton, {
|
|
2595
2707
|
size: "4",
|
|
2596
2708
|
radius: "full",
|
|
2597
|
-
children: /* @__PURE__ */
|
|
2709
|
+
children: /* @__PURE__ */ jsx52(ChatBubbleIcon, {})
|
|
2598
2710
|
});
|
|
2599
2711
|
};
|
|
2600
2712
|
// src/components/threads/ThreadDialog/Content/index.tsx
|
|
2601
|
-
import { Card, Inset, Flex as
|
|
2602
|
-
import { jsx as
|
|
2603
|
-
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) {
|
|
2604
2716
|
var children = param.children;
|
|
2605
2717
|
var isOpen = useThreadDialogContext().isOpen;
|
|
2606
2718
|
if (!isOpen) return null;
|
|
2607
|
-
return /* @__PURE__ */
|
|
2719
|
+
return /* @__PURE__ */ jsx53(Card2, {
|
|
2608
2720
|
mb: "3",
|
|
2609
2721
|
style: {
|
|
2610
2722
|
display: "flex",
|
|
@@ -2613,7 +2725,7 @@ var Root6 = function(param) {
|
|
|
2613
2725
|
maxWidth: "400px",
|
|
2614
2726
|
maxHeight: "720px"
|
|
2615
2727
|
},
|
|
2616
|
-
children: /* @__PURE__ */
|
|
2728
|
+
children: /* @__PURE__ */ jsx53(Inset, {
|
|
2617
2729
|
clip: "padding-box",
|
|
2618
2730
|
side: "all",
|
|
2619
2731
|
pb: "current",
|
|
@@ -2626,51 +2738,51 @@ var Root6 = function(param) {
|
|
|
2626
2738
|
});
|
|
2627
2739
|
};
|
|
2628
2740
|
var Content4 = function() {
|
|
2629
|
-
return /* @__PURE__ */
|
|
2630
|
-
children: /* @__PURE__ */
|
|
2741
|
+
return /* @__PURE__ */ jsx53(Root7, {
|
|
2742
|
+
children: /* @__PURE__ */ jsxs17(Thread.Root, {
|
|
2631
2743
|
children: [
|
|
2632
|
-
/* @__PURE__ */
|
|
2744
|
+
/* @__PURE__ */ jsx53(Thread.Messages, {
|
|
2633
2745
|
style: {
|
|
2634
2746
|
paddingTop: "var(--space-5)",
|
|
2635
2747
|
paddingRight: "var(--space-5)",
|
|
2636
2748
|
paddingLeft: "var(--space-5)"
|
|
2637
2749
|
}
|
|
2638
2750
|
}),
|
|
2639
|
-
/* @__PURE__ */
|
|
2751
|
+
/* @__PURE__ */ jsx53(Flex19, {
|
|
2640
2752
|
direction: "column",
|
|
2641
2753
|
pl: "5",
|
|
2642
2754
|
pr: "5",
|
|
2643
2755
|
pb: "3",
|
|
2644
2756
|
flexShrink: "0",
|
|
2645
|
-
children: /* @__PURE__ */
|
|
2757
|
+
children: /* @__PURE__ */ jsx53(Thread.MessageForm, {})
|
|
2646
2758
|
})
|
|
2647
2759
|
]
|
|
2648
2760
|
})
|
|
2649
2761
|
});
|
|
2650
2762
|
};
|
|
2651
|
-
Content4.Root =
|
|
2763
|
+
Content4.Root = Root7;
|
|
2652
2764
|
// src/components/threads/ThreadDialog/index.tsx
|
|
2653
|
-
import { jsx as
|
|
2765
|
+
import { jsx as jsx54, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2654
2766
|
var ThreadDialog = function() {
|
|
2655
|
-
return /* @__PURE__ */
|
|
2767
|
+
return /* @__PURE__ */ jsxs18(Root6, {
|
|
2656
2768
|
children: [
|
|
2657
|
-
/* @__PURE__ */
|
|
2658
|
-
/* @__PURE__ */
|
|
2659
|
-
children: /* @__PURE__ */
|
|
2769
|
+
/* @__PURE__ */ jsx54(Content4, {}),
|
|
2770
|
+
/* @__PURE__ */ jsx54(Trigger, {
|
|
2771
|
+
children: /* @__PURE__ */ jsx54(Button3, {})
|
|
2660
2772
|
})
|
|
2661
2773
|
]
|
|
2662
2774
|
});
|
|
2663
2775
|
};
|
|
2664
|
-
ThreadDialog.Root =
|
|
2776
|
+
ThreadDialog.Root = Root6;
|
|
2665
2777
|
ThreadDialog.Trigger = Trigger;
|
|
2666
2778
|
ThreadDialog.Button = Button3;
|
|
2667
2779
|
ThreadDialog.Content = Content4;
|
|
2668
2780
|
// src/components/threads/AudioThread/Root/index.tsx
|
|
2669
2781
|
import "regenerator-runtime/runtime";
|
|
2670
|
-
import { Flex as
|
|
2782
|
+
import { Flex as Flex20 } from "@radix-ui/themes";
|
|
2671
2783
|
// src/contexts/threads/AudioThreadContext/index.ts
|
|
2672
|
-
import { createContext as
|
|
2673
|
-
var AudioThreadContext =
|
|
2784
|
+
import { createContext as createContext11 } from "react";
|
|
2785
|
+
var AudioThreadContext = createContext11({
|
|
2674
2786
|
status: "idle",
|
|
2675
2787
|
recorderProps: {
|
|
2676
2788
|
status: "idle",
|
|
@@ -2765,18 +2877,18 @@ var useStatus = function(param) {
|
|
|
2765
2877
|
// src/hooks/audioThreads/useRecorder/index.ts
|
|
2766
2878
|
import dayjs from "dayjs";
|
|
2767
2879
|
import { useAudioCapture } from "use-audio-capture";
|
|
2768
|
-
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";
|
|
2769
2881
|
import { useAudioPlayer } from "react-use-audio-player";
|
|
2770
2882
|
import { useInterval as useInterval2 } from "react-use";
|
|
2771
2883
|
var useRecorder = function(param) {
|
|
2772
2884
|
var isStopOnSilence = param.isStopOnSilence, onStart = param.onStart, onStop = param.onStop;
|
|
2773
|
-
var
|
|
2774
|
-
var
|
|
2775
|
-
var
|
|
2776
|
-
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];
|
|
2777
2889
|
var startAudioPlayer = useAudioPlayer();
|
|
2778
2890
|
var endAudioPlayer = useAudioPlayer();
|
|
2779
|
-
var
|
|
2891
|
+
var _useState54 = _sliced_to_array(useState5(false), 2), isLoaded = _useState54[0], setIsLoaded = _useState54[1];
|
|
2780
2892
|
useEffect6(function() {
|
|
2781
2893
|
if (isLoaded) return;
|
|
2782
2894
|
setIsLoaded(true);
|
|
@@ -2835,7 +2947,7 @@ var useRecorder = function(param) {
|
|
|
2835
2947
|
setNoiseStart(null);
|
|
2836
2948
|
}
|
|
2837
2949
|
});
|
|
2838
|
-
var
|
|
2950
|
+
var _useState55 = _sliced_to_array(useState5(null), 2), audioEngine = _useState55[0], setAudioEngine = _useState55[1];
|
|
2839
2951
|
var isInited = useRef4(false);
|
|
2840
2952
|
useEffect6(function() {
|
|
2841
2953
|
if (!mediaStream) return;
|
|
@@ -2867,7 +2979,7 @@ var useRecorder = function(param) {
|
|
|
2867
2979
|
}, [
|
|
2868
2980
|
audioEngine
|
|
2869
2981
|
]);
|
|
2870
|
-
var handleSilence =
|
|
2982
|
+
var handleSilence = useCallback3(function() {
|
|
2871
2983
|
if (!silenceAnalyser) return;
|
|
2872
2984
|
var frequencyData = new Uint8Array(silenceAnalyser.frequencyBinCount);
|
|
2873
2985
|
silenceAnalyser.getByteFrequencyData(frequencyData);
|
|
@@ -2913,7 +3025,7 @@ var useRecorder = function(param) {
|
|
|
2913
3025
|
});
|
|
2914
3026
|
};
|
|
2915
3027
|
// src/hooks/audioThreads/useMessageAudio/index.ts
|
|
2916
|
-
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";
|
|
2917
3029
|
import { Howler } from "howler";
|
|
2918
3030
|
import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
|
|
2919
3031
|
// src/hooks/audioThreads/useMessageAudio/lib/input.ts
|
|
@@ -2939,7 +3051,7 @@ var isHtmlAudioSupported = !unsupportedNames.includes(((_detect = detect()) ===
|
|
|
2939
3051
|
// src/hooks/audioThreads/useMessageAudio/index.ts
|
|
2940
3052
|
var useMessageAudio = function(param) {
|
|
2941
3053
|
var onEnd = param.onEnd;
|
|
2942
|
-
var
|
|
3054
|
+
var _useState6 = _sliced_to_array(useState6([]), 2), playedMessageIds = _useState6[0], setPlayedMessageIds = _useState6[1];
|
|
2943
3055
|
var audioPlayer = useAudioPlayer2();
|
|
2944
3056
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
2945
3057
|
var latestMessageProps = useLatestMessage();
|
|
@@ -2978,7 +3090,7 @@ var useMessageAudio = function(param) {
|
|
|
2978
3090
|
onEnd
|
|
2979
3091
|
]);
|
|
2980
3092
|
var isInited = useRef5(false);
|
|
2981
|
-
var
|
|
3093
|
+
var _useState61 = _sliced_to_array(useState6(null), 2), audioEngine = _useState61[0], setAudioEngine = _useState61[1];
|
|
2982
3094
|
useEffect7(function() {
|
|
2983
3095
|
if (!audioPlayer.playing) return;
|
|
2984
3096
|
if (isInited.current) return;
|
|
@@ -3014,8 +3126,8 @@ var useMessageAudio = function(param) {
|
|
|
3014
3126
|
});
|
|
3015
3127
|
};
|
|
3016
3128
|
// src/components/threads/AudioThread/Root/index.tsx
|
|
3017
|
-
import { jsx as
|
|
3018
|
-
var
|
|
3129
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
3130
|
+
var Root8 = function(param) {
|
|
3019
3131
|
var children = param.children;
|
|
3020
3132
|
useLifecycle();
|
|
3021
3133
|
var createMessageProps = useCreateMessage();
|
|
@@ -3074,13 +3186,13 @@ var Root7 = function(param) {
|
|
|
3074
3186
|
createMessageProps: createMessageProps,
|
|
3075
3187
|
messageAudioProps: messageAudioProps
|
|
3076
3188
|
}).status;
|
|
3077
|
-
return /* @__PURE__ */
|
|
3189
|
+
return /* @__PURE__ */ jsx55(AudioThreadContext.Provider, {
|
|
3078
3190
|
value: {
|
|
3079
3191
|
status: status,
|
|
3080
3192
|
recorderProps: recorderProps,
|
|
3081
3193
|
messageAudioProps: messageAudioProps
|
|
3082
3194
|
},
|
|
3083
|
-
children: /* @__PURE__ */
|
|
3195
|
+
children: /* @__PURE__ */ jsx55(Flex20, {
|
|
3084
3196
|
direction: "column",
|
|
3085
3197
|
flexGrow: "1",
|
|
3086
3198
|
p: "5",
|
|
@@ -3089,23 +3201,23 @@ var Root7 = function(param) {
|
|
|
3089
3201
|
});
|
|
3090
3202
|
};
|
|
3091
3203
|
// src/components/threads/AudioThread/Visualization/index.tsx
|
|
3092
|
-
import { Flex as
|
|
3204
|
+
import { Flex as Flex21 } from "@radix-ui/themes";
|
|
3093
3205
|
// src/hooks/threads/useAudioThreadContext/index.ts
|
|
3094
|
-
import { useContext as
|
|
3206
|
+
import { useContext as useContext13 } from "react";
|
|
3095
3207
|
var useAudioThreadContext = function() {
|
|
3096
|
-
return
|
|
3208
|
+
return useContext13(AudioThreadContext);
|
|
3097
3209
|
};
|
|
3098
3210
|
// src/components/threads/AudioThread/Visualization/index.tsx
|
|
3099
|
-
import { jsx as
|
|
3211
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
3100
3212
|
var Visualization = function() {
|
|
3101
3213
|
var audioThreadContext = useAudioThreadContext();
|
|
3102
|
-
return /* @__PURE__ */
|
|
3214
|
+
return /* @__PURE__ */ jsx56(Flex21, {
|
|
3103
3215
|
direction: "column",
|
|
3104
3216
|
align: "center",
|
|
3105
3217
|
justify: "center",
|
|
3106
3218
|
mb: "3",
|
|
3107
3219
|
flexGrow: "1",
|
|
3108
|
-
children: /* @__PURE__ */
|
|
3220
|
+
children: /* @__PURE__ */ jsx56(Flex21, {
|
|
3109
3221
|
align: "center",
|
|
3110
3222
|
justify: "center",
|
|
3111
3223
|
height: "200px",
|
|
@@ -3119,22 +3231,22 @@ var Visualization = function() {
|
|
|
3119
3231
|
};
|
|
3120
3232
|
// src/components/threads/AudioThread/Form/index.tsx
|
|
3121
3233
|
import { SpeakerModerateIcon } from "@radix-ui/react-icons";
|
|
3122
|
-
import { Flex as
|
|
3234
|
+
import { Flex as Flex24 } from "@radix-ui/themes";
|
|
3123
3235
|
// src/components/threads/AudioThread/Form/Visualizer/index.tsx
|
|
3124
3236
|
import _7 from "lodash";
|
|
3125
|
-
import { Flex as
|
|
3126
|
-
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";
|
|
3127
3239
|
import { cluster } from "radash";
|
|
3128
|
-
import { jsx as
|
|
3240
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
3129
3241
|
var barCount = 4;
|
|
3130
3242
|
var Visualizer = function() {
|
|
3131
3243
|
var audioThreadContext = useAudioThreadContext();
|
|
3132
3244
|
var visualizationAnalyser = audioThreadContext.recorderProps.visualizationAnalyser;
|
|
3133
|
-
var
|
|
3245
|
+
var _useState7 = _sliced_to_array(useState7(function() {
|
|
3134
3246
|
return new AudioContext().createAnalyser();
|
|
3135
|
-
}), 1), emptyVisualizer =
|
|
3136
|
-
var
|
|
3137
|
-
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) {
|
|
3138
3250
|
var visualizationAnalyser2 = param.visualizationAnalyser;
|
|
3139
3251
|
var frequencyData = new Uint8Array(visualizationAnalyser2.frequencyBinCount / 15);
|
|
3140
3252
|
visualizationAnalyser2.getByteFrequencyData(frequencyData);
|
|
@@ -3157,7 +3269,7 @@ var Visualizer = function() {
|
|
|
3157
3269
|
visualizationAnalyser,
|
|
3158
3270
|
emptyVisualizer
|
|
3159
3271
|
]);
|
|
3160
|
-
return /* @__PURE__ */
|
|
3272
|
+
return /* @__PURE__ */ jsx57(Grid, {
|
|
3161
3273
|
columns: "".concat(barCount),
|
|
3162
3274
|
gap: "1",
|
|
3163
3275
|
width: "auto",
|
|
@@ -3166,12 +3278,12 @@ var Visualizer = function() {
|
|
|
3166
3278
|
gridTemplateColumns: "repeat(4, minmax(0, 1fr))"
|
|
3167
3279
|
},
|
|
3168
3280
|
children: barHeights.map(function(barHeight, index) {
|
|
3169
|
-
return /* @__PURE__ */
|
|
3281
|
+
return /* @__PURE__ */ jsx57(Flex22, {
|
|
3170
3282
|
direction: "column",
|
|
3171
3283
|
align: "center",
|
|
3172
3284
|
justify: "center",
|
|
3173
3285
|
height: "20px",
|
|
3174
|
-
children: /* @__PURE__ */
|
|
3286
|
+
children: /* @__PURE__ */ jsx57(Flex22, {
|
|
3175
3287
|
minHeight: "50%",
|
|
3176
3288
|
maxHeight: "100%",
|
|
3177
3289
|
height: "".concat(barHeight + 20, "%"),
|
|
@@ -3186,31 +3298,31 @@ var Visualizer = function() {
|
|
|
3186
3298
|
});
|
|
3187
3299
|
};
|
|
3188
3300
|
// src/components/threads/AudioThread/Form/ActionButton/index.tsx
|
|
3189
|
-
import { Flex as
|
|
3301
|
+
import { Flex as Flex23, IconButton as IconButton2, Tooltip } from "@radix-ui/themes";
|
|
3190
3302
|
import { PauseIcon, ArrowUpIcon as ArrowUpIcon2, ResumeIcon } from "@radix-ui/react-icons";
|
|
3191
|
-
import { jsx as
|
|
3303
|
+
import { jsx as jsx58, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3192
3304
|
var ActionButton = function() {
|
|
3193
3305
|
var audioThreadContext = useAudioThreadContext();
|
|
3194
3306
|
if (audioThreadContext.status === "recording") {
|
|
3195
|
-
return /* @__PURE__ */
|
|
3307
|
+
return /* @__PURE__ */ jsxs19(Flex23, {
|
|
3196
3308
|
align: "center",
|
|
3197
3309
|
children: [
|
|
3198
|
-
/* @__PURE__ */
|
|
3310
|
+
/* @__PURE__ */ jsx58(Flex23, {
|
|
3199
3311
|
mr: "3",
|
|
3200
3312
|
ml: "-7",
|
|
3201
|
-
children: /* @__PURE__ */
|
|
3313
|
+
children: /* @__PURE__ */ jsx58(IconButton2, {
|
|
3202
3314
|
onClick: audioThreadContext.recorderProps.pause,
|
|
3203
3315
|
color: "gray",
|
|
3204
3316
|
radius: "full",
|
|
3205
3317
|
size: "1",
|
|
3206
|
-
children: /* @__PURE__ */
|
|
3318
|
+
children: /* @__PURE__ */ jsx58(PauseIcon, {})
|
|
3207
3319
|
})
|
|
3208
3320
|
}),
|
|
3209
|
-
/* @__PURE__ */
|
|
3321
|
+
/* @__PURE__ */ jsx58(Tooltip, {
|
|
3210
3322
|
open: true,
|
|
3211
3323
|
content: "Send your message",
|
|
3212
3324
|
side: "bottom",
|
|
3213
|
-
children: /* @__PURE__ */
|
|
3325
|
+
children: /* @__PURE__ */ jsx58(IconButton2, {
|
|
3214
3326
|
onClick: audioThreadContext.recorderProps.stop,
|
|
3215
3327
|
color: "gray",
|
|
3216
3328
|
highContrast: true,
|
|
@@ -3219,14 +3331,14 @@ var ActionButton = function() {
|
|
|
3219
3331
|
style: {
|
|
3220
3332
|
border: "2px solid var(--gray-8)"
|
|
3221
3333
|
},
|
|
3222
|
-
children: /* @__PURE__ */
|
|
3334
|
+
children: /* @__PURE__ */ jsx58(ArrowUpIcon2, {})
|
|
3223
3335
|
})
|
|
3224
3336
|
})
|
|
3225
3337
|
]
|
|
3226
3338
|
});
|
|
3227
3339
|
}
|
|
3228
3340
|
if (audioThreadContext.status === "recorderPaused") {
|
|
3229
|
-
return /* @__PURE__ */
|
|
3341
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3230
3342
|
onClick: audioThreadContext.recorderProps.resume,
|
|
3231
3343
|
color: "red",
|
|
3232
3344
|
radius: "full",
|
|
@@ -3234,11 +3346,11 @@ var ActionButton = function() {
|
|
|
3234
3346
|
style: {
|
|
3235
3347
|
border: "2px solid var(--gray-8)"
|
|
3236
3348
|
},
|
|
3237
|
-
children: /* @__PURE__ */
|
|
3349
|
+
children: /* @__PURE__ */ jsx58(ResumeIcon, {})
|
|
3238
3350
|
});
|
|
3239
3351
|
}
|
|
3240
3352
|
if (audioThreadContext.status === "idle") {
|
|
3241
|
-
return /* @__PURE__ */
|
|
3353
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3242
3354
|
onClick: function() {
|
|
3243
3355
|
return audioThreadContext.recorderProps.start();
|
|
3244
3356
|
},
|
|
@@ -3251,7 +3363,7 @@ var ActionButton = function() {
|
|
|
3251
3363
|
});
|
|
3252
3364
|
}
|
|
3253
3365
|
if (audioThreadContext.status === "playing") {
|
|
3254
|
-
return /* @__PURE__ */
|
|
3366
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3255
3367
|
onClick: function() {
|
|
3256
3368
|
return audioThreadContext.messageAudioProps.pause();
|
|
3257
3369
|
},
|
|
@@ -3261,11 +3373,11 @@ var ActionButton = function() {
|
|
|
3261
3373
|
style: {
|
|
3262
3374
|
border: "2px solid var(--gray-8)"
|
|
3263
3375
|
},
|
|
3264
|
-
children: /* @__PURE__ */
|
|
3376
|
+
children: /* @__PURE__ */ jsx58(PauseIcon, {})
|
|
3265
3377
|
});
|
|
3266
3378
|
}
|
|
3267
3379
|
if (audioThreadContext.status === "playerPaused") {
|
|
3268
|
-
return /* @__PURE__ */
|
|
3380
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3269
3381
|
onClick: function() {
|
|
3270
3382
|
return audioThreadContext.messageAudioProps.play();
|
|
3271
3383
|
},
|
|
@@ -3275,10 +3387,10 @@ var ActionButton = function() {
|
|
|
3275
3387
|
style: {
|
|
3276
3388
|
border: "2px solid var(--gray-8)"
|
|
3277
3389
|
},
|
|
3278
|
-
children: /* @__PURE__ */
|
|
3390
|
+
children: /* @__PURE__ */ jsx58(ResumeIcon, {})
|
|
3279
3391
|
});
|
|
3280
3392
|
}
|
|
3281
|
-
return /* @__PURE__ */
|
|
3393
|
+
return /* @__PURE__ */ jsx58(IconButton2, {
|
|
3282
3394
|
size: "4",
|
|
3283
3395
|
color: "red",
|
|
3284
3396
|
radius: "full",
|
|
@@ -3289,70 +3401,70 @@ var ActionButton = function() {
|
|
|
3289
3401
|
});
|
|
3290
3402
|
};
|
|
3291
3403
|
// src/components/threads/AudioThread/Form/index.tsx
|
|
3292
|
-
import { jsx as
|
|
3404
|
+
import { jsx as jsx59, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3293
3405
|
var Form = function() {
|
|
3294
3406
|
var audioThreadContext = useAudioThreadContext();
|
|
3295
|
-
return /* @__PURE__ */
|
|
3407
|
+
return /* @__PURE__ */ jsxs20(Flex24, {
|
|
3296
3408
|
direction: "column",
|
|
3297
3409
|
align: "center",
|
|
3298
3410
|
children: [
|
|
3299
|
-
/* @__PURE__ */
|
|
3411
|
+
/* @__PURE__ */ jsxs20(Flex24, {
|
|
3300
3412
|
pb: "3",
|
|
3301
3413
|
align: "center",
|
|
3302
3414
|
children: [
|
|
3303
|
-
/* @__PURE__ */
|
|
3415
|
+
/* @__PURE__ */ jsx59(Flex24, {
|
|
3304
3416
|
ml: "-5",
|
|
3305
3417
|
mr: "2",
|
|
3306
3418
|
align: "center",
|
|
3307
|
-
children: /* @__PURE__ */
|
|
3419
|
+
children: /* @__PURE__ */ jsx59(SpeakerModerateIcon, {
|
|
3308
3420
|
style: {
|
|
3309
3421
|
color: "var(--".concat(audioThreadContext.status === "recording" ? "mint" : "gray", "-12)")
|
|
3310
3422
|
}
|
|
3311
3423
|
})
|
|
3312
3424
|
}),
|
|
3313
|
-
/* @__PURE__ */
|
|
3425
|
+
/* @__PURE__ */ jsx59(Flex24, {
|
|
3314
3426
|
px: "2",
|
|
3315
3427
|
py: "1",
|
|
3316
3428
|
style: {
|
|
3317
3429
|
backgroundColor: "var(--".concat(audioThreadContext.status === "recording" ? "mint" : "gray", "-4)"),
|
|
3318
3430
|
borderRadius: "var(--radius-6)"
|
|
3319
3431
|
},
|
|
3320
|
-
children: /* @__PURE__ */
|
|
3432
|
+
children: /* @__PURE__ */ jsx59(Visualizer, {})
|
|
3321
3433
|
})
|
|
3322
3434
|
]
|
|
3323
3435
|
}),
|
|
3324
|
-
/* @__PURE__ */
|
|
3436
|
+
/* @__PURE__ */ jsx59(ActionButton, {})
|
|
3325
3437
|
]
|
|
3326
3438
|
});
|
|
3327
3439
|
};
|
|
3328
3440
|
// src/components/threads/AudioThread/index.tsx
|
|
3329
|
-
import { jsx as
|
|
3441
|
+
import { jsx as jsx60, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3330
3442
|
var AudioThread = function(props) {
|
|
3331
|
-
return /* @__PURE__ */
|
|
3443
|
+
return /* @__PURE__ */ jsxs21(Root8, _object_spread_props(_object_spread({}, props), {
|
|
3332
3444
|
children: [
|
|
3333
|
-
/* @__PURE__ */
|
|
3334
|
-
/* @__PURE__ */
|
|
3445
|
+
/* @__PURE__ */ jsx60(Visualization, {}),
|
|
3446
|
+
/* @__PURE__ */ jsx60(Form, {})
|
|
3335
3447
|
]
|
|
3336
3448
|
}));
|
|
3337
3449
|
};
|
|
3338
|
-
AudioThread.Root =
|
|
3450
|
+
AudioThread.Root = Root8;
|
|
3339
3451
|
AudioThread.Visualization = Visualization;
|
|
3340
3452
|
AudioThread.Form = Form;
|
|
3341
3453
|
// src/components/threads/AudioThreadDialog/index.tsx
|
|
3342
|
-
import { jsx as
|
|
3454
|
+
import { jsx as jsx61, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3343
3455
|
var AudioThreadDialog = function() {
|
|
3344
|
-
return /* @__PURE__ */
|
|
3456
|
+
return /* @__PURE__ */ jsxs22(Root6, {
|
|
3345
3457
|
children: [
|
|
3346
|
-
/* @__PURE__ */
|
|
3347
|
-
children: /* @__PURE__ */
|
|
3458
|
+
/* @__PURE__ */ jsx61(Content4.Root, {
|
|
3459
|
+
children: /* @__PURE__ */ jsx61(AudioThread, {})
|
|
3348
3460
|
}),
|
|
3349
|
-
/* @__PURE__ */
|
|
3350
|
-
children: /* @__PURE__ */
|
|
3461
|
+
/* @__PURE__ */ jsx61(Trigger, {
|
|
3462
|
+
children: /* @__PURE__ */ jsx61(Button3, {})
|
|
3351
3463
|
})
|
|
3352
3464
|
]
|
|
3353
3465
|
});
|
|
3354
3466
|
};
|
|
3355
|
-
AudioThreadDialog.Root =
|
|
3467
|
+
AudioThreadDialog.Root = Root6;
|
|
3356
3468
|
AudioThreadDialog.Trigger = Trigger;
|
|
3357
3469
|
AudioThreadDialog.Button = Button3;
|
|
3358
3470
|
AudioThreadDialog.Content = Content4;
|
|
@@ -3362,15 +3474,15 @@ import { useMemo as useMemo15 } from "react";
|
|
|
3362
3474
|
import { useMemo as useMemo14 } from "react";
|
|
3363
3475
|
import { isEmpty as isEmpty2 } from "radash";
|
|
3364
3476
|
import { onlyText } from "react-children-utilities";
|
|
3365
|
-
import { Flex as
|
|
3477
|
+
import { Flex as Flex25 } from "@radix-ui/themes";
|
|
3366
3478
|
// src/components/suggestions/Suggestions/Item.tsx
|
|
3367
3479
|
import { ArrowUpIcon as ArrowUpIcon3 } from "@radix-ui/react-icons";
|
|
3368
|
-
import { Text as
|
|
3369
|
-
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";
|
|
3370
3482
|
var Item = function(param) {
|
|
3371
3483
|
var suggestion = param.suggestion, isDisabled = param.isDisabled;
|
|
3372
3484
|
var _useCreateMessage = useCreateMessage(), createMessage = _useCreateMessage.createMessage, isPending = _useCreateMessage.isPending;
|
|
3373
|
-
return /* @__PURE__ */
|
|
3485
|
+
return /* @__PURE__ */ jsx62(Content5, {
|
|
3374
3486
|
onClick: function() {
|
|
3375
3487
|
createMessage({
|
|
3376
3488
|
// @ts-ignore-next-line
|
|
@@ -3384,26 +3496,26 @@ var Item = function(param) {
|
|
|
3384
3496
|
};
|
|
3385
3497
|
var Content5 = function(param) {
|
|
3386
3498
|
var onClick = param.onClick, isDisabled = param.isDisabled, isPending = param.isPending, children = param.children;
|
|
3387
|
-
return /* @__PURE__ */
|
|
3499
|
+
return /* @__PURE__ */ jsxs23(Button4, {
|
|
3388
3500
|
variant: "soft",
|
|
3389
3501
|
onClick: onClick,
|
|
3390
3502
|
disabled: isDisabled,
|
|
3391
3503
|
children: [
|
|
3392
|
-
/* @__PURE__ */
|
|
3504
|
+
/* @__PURE__ */ jsx62(Text7, {
|
|
3393
3505
|
size: "1",
|
|
3394
3506
|
weight: "regular",
|
|
3395
3507
|
children: children
|
|
3396
3508
|
}),
|
|
3397
|
-
/* @__PURE__ */
|
|
3509
|
+
/* @__PURE__ */ jsx62(Spinner2, {
|
|
3398
3510
|
loading: isPending,
|
|
3399
|
-
children: /* @__PURE__ */
|
|
3511
|
+
children: /* @__PURE__ */ jsx62(ArrowUpIcon3, {})
|
|
3400
3512
|
})
|
|
3401
3513
|
]
|
|
3402
3514
|
});
|
|
3403
3515
|
};
|
|
3404
3516
|
Item.Content = Content5;
|
|
3405
3517
|
// src/components/suggestions/Suggestions/Content.tsx
|
|
3406
|
-
import { jsx as
|
|
3518
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
3407
3519
|
var Content6 = function(param) {
|
|
3408
3520
|
var children = param.children;
|
|
3409
3521
|
var messageContext = useMessageContext();
|
|
@@ -3427,12 +3539,12 @@ var Content6 = function(param) {
|
|
|
3427
3539
|
isRunActiveProps
|
|
3428
3540
|
]);
|
|
3429
3541
|
if (isEmpty2(suggestions)) return null;
|
|
3430
|
-
return /* @__PURE__ */
|
|
3542
|
+
return /* @__PURE__ */ jsx63(Flex25, {
|
|
3431
3543
|
gap: "2",
|
|
3432
3544
|
py: "2",
|
|
3433
3545
|
wrap: "wrap",
|
|
3434
3546
|
children: suggestions.map(function(suggestion) {
|
|
3435
|
-
return /* @__PURE__ */
|
|
3547
|
+
return /* @__PURE__ */ jsx63(Item, {
|
|
3436
3548
|
suggestion: suggestion,
|
|
3437
3549
|
isDisabled: isDisabled
|
|
3438
3550
|
}, suggestion);
|
|
@@ -3440,7 +3552,7 @@ var Content6 = function(param) {
|
|
|
3440
3552
|
});
|
|
3441
3553
|
};
|
|
3442
3554
|
// src/components/suggestions/Suggestions/index.tsx
|
|
3443
|
-
import { jsx as
|
|
3555
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
3444
3556
|
var Suggestions = function(param) {
|
|
3445
3557
|
var children = param.children;
|
|
3446
3558
|
var latestMessageProps = useLatestMessage();
|
|
@@ -3453,14 +3565,14 @@ var Suggestions = function(param) {
|
|
|
3453
3565
|
]);
|
|
3454
3566
|
if (latestMessageProps.isLoading) return null;
|
|
3455
3567
|
if (isDisabled) return null;
|
|
3456
|
-
return /* @__PURE__ */
|
|
3568
|
+
return /* @__PURE__ */ jsx64(Content6, {
|
|
3457
3569
|
children: children
|
|
3458
3570
|
});
|
|
3459
3571
|
};
|
|
3460
3572
|
Suggestions.Item = Item;
|
|
3461
3573
|
// src/components/markdown/MarkdownProvider/index.tsx
|
|
3462
3574
|
import { useMemo as useMemo16 } from "react";
|
|
3463
|
-
import { jsx as
|
|
3575
|
+
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
3464
3576
|
var MarkdownProvider = function(_param) {
|
|
3465
3577
|
var children = _param.children, rest = _object_without_properties(_param, [
|
|
3466
3578
|
"children"
|
|
@@ -3472,7 +3584,7 @@ var MarkdownProvider = function(_param) {
|
|
|
3472
3584
|
rest,
|
|
3473
3585
|
prevMarkdownContext
|
|
3474
3586
|
]);
|
|
3475
|
-
return /* @__PURE__ */
|
|
3587
|
+
return /* @__PURE__ */ jsx65(MarkdownContext.Provider, {
|
|
3476
3588
|
value: value,
|
|
3477
3589
|
children: children
|
|
3478
3590
|
});
|