@superinterface/react 2.0.4 → 2.0.6
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-u67QcaWg.d.cts → index-Dp6WTBGJ.d.cts} +1 -0
- package/dist/{index-u67QcaWg.d.ts → index-Dp6WTBGJ.d.ts} +1 -0
- package/dist/index.cjs +703 -531
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -21
- package/dist/index.d.ts +42 -21
- package/dist/index.js +651 -483
- package/dist/index.js.map +1 -1
- package/dist/queryFns.cjs +15 -3
- package/dist/queryFns.cjs.map +1 -1
- package/dist/queryFns.d.cts +1 -1
- package/dist/queryFns.d.ts +1 -1
- package/dist/queryFns.js +15 -3
- package/dist/queryFns.js.map +1 -1
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/components/core/SuperinterfaceProvider/index.tsx
|
|
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,6 +265,8 @@ 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
|
|
268
270
|
import _21 from "lodash";
|
|
269
271
|
// src/lib/misc/merge/customizer.ts
|
|
270
272
|
import _ from "lodash";
|
|
@@ -291,7 +293,8 @@ var SuperinterfaceContext = createContext({
|
|
|
291
293
|
defaultOptions: {
|
|
292
294
|
queries: {},
|
|
293
295
|
mutations: {}
|
|
294
|
-
}
|
|
296
|
+
},
|
|
297
|
+
isToasterRendered: false
|
|
295
298
|
});
|
|
296
299
|
// src/hooks/core/useSuperinterfaceContext/index.ts
|
|
297
300
|
import { useContext } from "react";
|
|
@@ -299,26 +302,42 @@ var useSuperinterfaceContext = function() {
|
|
|
299
302
|
return useContext(SuperinterfaceContext);
|
|
300
303
|
};
|
|
301
304
|
// src/components/core/SuperinterfaceProvider/index.tsx
|
|
302
|
-
import { jsx } from "react/jsx-runtime";
|
|
305
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
303
306
|
var SuperinterfaceProvider = function(param) {
|
|
304
307
|
var children = param.children, baseUrl = param.baseUrl, publicApiKey = param.publicApiKey, variables = param.variables, defaultOptions = param.defaultOptions;
|
|
305
308
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
306
|
-
var value = merge(superinterfaceContext, _object_spread({}, baseUrl ? {
|
|
309
|
+
var value = merge(superinterfaceContext, _object_spread_props(_object_spread({}, baseUrl ? {
|
|
307
310
|
baseUrl: baseUrl
|
|
308
311
|
} : {}, publicApiKey ? {
|
|
309
312
|
publicApiKey: publicApiKey
|
|
310
313
|
} : {}, variables ? {
|
|
311
314
|
variables: variables
|
|
312
|
-
} : {},
|
|
315
|
+
} : {}, merge({
|
|
316
|
+
defaultOptions: {
|
|
317
|
+
mutations: {
|
|
318
|
+
onError: function(error) {
|
|
319
|
+
return toast.error(error.message);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}, defaultOptions !== null && defaultOptions !== void 0 ? defaultOptions : {
|
|
313
324
|
defaultOptions: defaultOptions
|
|
314
|
-
}
|
|
315
|
-
|
|
325
|
+
})), {
|
|
326
|
+
isToasterRendered: true
|
|
327
|
+
}));
|
|
328
|
+
return /* @__PURE__ */ jsxs(SuperinterfaceContext.Provider, {
|
|
316
329
|
value: value,
|
|
317
|
-
children:
|
|
330
|
+
children: [
|
|
331
|
+
children,
|
|
332
|
+
!superinterfaceContext.isToasterRendered && /* @__PURE__ */ jsx(Toaster, {})
|
|
333
|
+
]
|
|
318
334
|
});
|
|
319
335
|
};
|
|
320
336
|
// src/components/threads/Thread/Messages/index.tsx
|
|
321
|
-
import { Flex as
|
|
337
|
+
import { Flex as Flex12 } from "@radix-ui/themes";
|
|
338
|
+
// src/components/threads/Thread/Messages/Content/index.tsx
|
|
339
|
+
import { useEffect } from "react";
|
|
340
|
+
import { toast as toast2 } from "sonner";
|
|
322
341
|
// src/hooks/messages/useMessages/index.tsx
|
|
323
342
|
import { useMemo } from "react";
|
|
324
343
|
import { useInfiniteQuery, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
@@ -329,7 +348,7 @@ var queryOptions = function(param) {
|
|
|
329
348
|
var queryKey = _to_consumable_array(queryKeyBase).concat([
|
|
330
349
|
threadContext.variables
|
|
331
350
|
]);
|
|
332
|
-
return infiniteQueryOptions(
|
|
351
|
+
return infiniteQueryOptions(_object_spread_props(_object_spread({
|
|
333
352
|
// @ts-ignore-next-line
|
|
334
353
|
queryFn: function() {
|
|
335
354
|
var _ref = _async_to_generator(function(param) {
|
|
@@ -401,9 +420,9 @@ var queryOptions = function(param) {
|
|
|
401
420
|
return lastPage.lastId;
|
|
402
421
|
},
|
|
403
422
|
limit: 10
|
|
404
|
-
}, queryClient.getQueryDefaults(queryKey)), {
|
|
423
|
+
}, threadContext.defaultOptions.queries, queryClient.getQueryDefaults(queryKey)), {
|
|
405
424
|
queryKey: queryKey
|
|
406
|
-
})
|
|
425
|
+
}));
|
|
407
426
|
};
|
|
408
427
|
// src/lib/messages/messagesQueryOptions.ts
|
|
409
428
|
var messagesQueryOptions = function(param) {
|
|
@@ -521,35 +540,18 @@ var useMessageGroups = function(param) {
|
|
|
521
540
|
};
|
|
522
541
|
// src/components/skeletons/MessagesSkeleton/index.tsx
|
|
523
542
|
import { forwardRef as forwardRef2 } from "react";
|
|
524
|
-
import { Flex as
|
|
525
|
-
// src/components/skeletons/Skeleton/index.tsx
|
|
526
|
-
import { Flex } from "@radix-ui/themes";
|
|
527
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
528
|
-
var Skeleton = function(_param) {
|
|
529
|
-
var height = _param.height, style = _param.style, rest = _object_without_properties(_param, [
|
|
530
|
-
"height",
|
|
531
|
-
"style"
|
|
532
|
-
]);
|
|
533
|
-
return /* @__PURE__ */ jsx2(Flex, _object_spread({
|
|
534
|
-
height: "var(--space-".concat(height, ")"),
|
|
535
|
-
style: _object_spread({
|
|
536
|
-
animation: "pulse 2s cubic-bezier(.4,0,.6,1) infinite",
|
|
537
|
-
borderRadius: "var(--radius-3)",
|
|
538
|
-
backgroundColor: "var(--gray-5)"
|
|
539
|
-
}, style)
|
|
540
|
-
}, rest));
|
|
541
|
-
};
|
|
543
|
+
import { Flex as Flex3, Avatar, Box, Skeleton } from "@radix-ui/themes";
|
|
542
544
|
// src/components/messageGroups/MessageGroupBase/index.tsx
|
|
543
545
|
import { forwardRef } from "react";
|
|
544
|
-
import { Flex
|
|
545
|
-
import { jsx as
|
|
546
|
+
import { Flex, Container } from "@radix-ui/themes";
|
|
547
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
546
548
|
var MessageGroupBase = forwardRef(function MessageGroupBase2(param, ref) {
|
|
547
549
|
var children = param.children;
|
|
548
|
-
return /* @__PURE__ */
|
|
550
|
+
return /* @__PURE__ */ jsx2(Container, {
|
|
549
551
|
ref: ref,
|
|
550
552
|
size: "2",
|
|
551
553
|
flexGrow: "0",
|
|
552
|
-
children: /* @__PURE__ */
|
|
554
|
+
children: /* @__PURE__ */ jsx2(Flex, {
|
|
553
555
|
flexShrink: "0",
|
|
554
556
|
gap: "3",
|
|
555
557
|
children: children
|
|
@@ -557,14 +559,14 @@ var MessageGroupBase = forwardRef(function MessageGroupBase2(param, ref) {
|
|
|
557
559
|
});
|
|
558
560
|
});
|
|
559
561
|
// src/components/messageGroups/MessageGroupBase/Name.tsx
|
|
560
|
-
import { Flex as
|
|
561
|
-
import { jsx as
|
|
562
|
+
import { Flex as Flex2, Text } from "@radix-ui/themes";
|
|
563
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
562
564
|
var Name = function(param) {
|
|
563
565
|
var children = param.children;
|
|
564
|
-
return /* @__PURE__ */
|
|
566
|
+
return /* @__PURE__ */ jsx3(Flex2, {
|
|
565
567
|
align: "center",
|
|
566
568
|
height: "var(--space-5)",
|
|
567
|
-
children: /* @__PURE__ */
|
|
569
|
+
children: /* @__PURE__ */ jsx3(Text, {
|
|
568
570
|
size: "2",
|
|
569
571
|
weight: "bold",
|
|
570
572
|
children: children
|
|
@@ -572,44 +574,44 @@ var Name = function(param) {
|
|
|
572
574
|
});
|
|
573
575
|
};
|
|
574
576
|
// src/components/skeletons/MessagesSkeleton/index.tsx
|
|
575
|
-
import { jsx as
|
|
577
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
576
578
|
var MessagesSkeleton = forwardRef2(function MessagesSkeleton2(_props, ref) {
|
|
577
|
-
return /* @__PURE__ */
|
|
579
|
+
return /* @__PURE__ */ jsxs2(MessageGroupBase, {
|
|
578
580
|
ref: ref,
|
|
579
581
|
children: [
|
|
580
|
-
/* @__PURE__ */
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
}
|
|
582
|
+
/* @__PURE__ */ jsx4(Skeleton, {
|
|
583
|
+
loading: true,
|
|
584
|
+
children: /* @__PURE__ */ jsx4(Avatar, {
|
|
585
|
+
fallback: /* @__PURE__ */ jsx4(Flex3, {}),
|
|
586
|
+
size: "1"
|
|
587
|
+
})
|
|
586
588
|
}),
|
|
587
|
-
/* @__PURE__ */
|
|
589
|
+
/* @__PURE__ */ jsxs2(Box, {
|
|
588
590
|
pb: "3",
|
|
589
591
|
children: [
|
|
590
|
-
/* @__PURE__ */
|
|
591
|
-
children: /* @__PURE__ */
|
|
592
|
-
|
|
592
|
+
/* @__PURE__ */ jsx4(Name, {
|
|
593
|
+
children: /* @__PURE__ */ jsx4(Skeleton, {
|
|
594
|
+
loading: true,
|
|
593
595
|
style: {
|
|
594
596
|
width: "128px"
|
|
595
597
|
}
|
|
596
598
|
})
|
|
597
599
|
}),
|
|
598
|
-
/* @__PURE__ */
|
|
599
|
-
|
|
600
|
+
/* @__PURE__ */ jsx4(Skeleton, {
|
|
601
|
+
loading: true,
|
|
600
602
|
style: {
|
|
601
603
|
width: "256px"
|
|
602
604
|
}
|
|
603
605
|
}),
|
|
604
|
-
/* @__PURE__ */
|
|
605
|
-
|
|
606
|
+
/* @__PURE__ */ jsx4(Skeleton, {
|
|
607
|
+
loading: true,
|
|
606
608
|
style: {
|
|
607
609
|
width: "256px",
|
|
608
610
|
marginTop: "var(--space-2)"
|
|
609
611
|
}
|
|
610
612
|
}),
|
|
611
|
-
/* @__PURE__ */
|
|
612
|
-
|
|
613
|
+
/* @__PURE__ */ jsx4(Skeleton, {
|
|
614
|
+
loading: true,
|
|
613
615
|
style: {
|
|
614
616
|
width: "256px",
|
|
615
617
|
marginTop: "var(--space-2)"
|
|
@@ -622,25 +624,25 @@ var MessagesSkeleton = forwardRef2(function MessagesSkeleton2(_props, ref) {
|
|
|
622
624
|
});
|
|
623
625
|
// src/components/threads/Thread/Messages/Content/MessageGroup/index.tsx
|
|
624
626
|
import { useContext as useContext5 } from "react";
|
|
625
|
-
import { Box as
|
|
627
|
+
import { Box as Box9, Avatar as Avatar3 } from "@radix-ui/themes";
|
|
626
628
|
import { PersonIcon } from "@radix-ui/react-icons";
|
|
627
629
|
// src/components/messageGroups/MessageGroupBase/AssistantAvatar.tsx
|
|
628
630
|
import { useContext as useContext2 } from "react";
|
|
629
|
-
import { Flex as
|
|
631
|
+
import { Flex as Flex4 } from "@radix-ui/themes";
|
|
630
632
|
// src/contexts/assistants/AssistantAvatarContext/index.tsx
|
|
631
633
|
import { createContext as createContext2 } from "react";
|
|
632
634
|
import { Avatar as Avatar2 } from "@radix-ui/themes";
|
|
633
635
|
import { LightningBoltIcon } from "@radix-ui/react-icons";
|
|
634
|
-
import { jsx as
|
|
635
|
-
var AssistantAvatarContext = createContext2(/* @__PURE__ */
|
|
636
|
-
fallback: /* @__PURE__ */
|
|
636
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
637
|
+
var AssistantAvatarContext = createContext2(/* @__PURE__ */ jsx5(Avatar2, {
|
|
638
|
+
fallback: /* @__PURE__ */ jsx5(LightningBoltIcon, {}),
|
|
637
639
|
size: "1"
|
|
638
640
|
}));
|
|
639
641
|
// src/components/messageGroups/MessageGroupBase/AssistantAvatar.tsx
|
|
640
|
-
import { jsx as
|
|
642
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
641
643
|
var AssistantAvatar = function() {
|
|
642
644
|
var AssistantAvatarContextValue = useContext2(AssistantAvatarContext);
|
|
643
|
-
return /* @__PURE__ */
|
|
645
|
+
return /* @__PURE__ */ jsx6(Flex4, {
|
|
644
646
|
flexShrink: "0",
|
|
645
647
|
height: "24px",
|
|
646
648
|
width: "24px",
|
|
@@ -655,16 +657,16 @@ var AssistantAvatar = function() {
|
|
|
655
657
|
import { createContext as createContext3 } from "react";
|
|
656
658
|
var AssistantNameContext = createContext3("Assistant");
|
|
657
659
|
// src/components/threads/Thread/Messages/Content/MessageGroup/Content/index.tsx
|
|
658
|
-
import { Flex as
|
|
660
|
+
import { Flex as Flex10 } from "@radix-ui/themes";
|
|
659
661
|
// src/components/threads/Thread/Message/index.tsx
|
|
660
662
|
import { useMemo as useMemo4 } from "react";
|
|
661
|
-
import { Box as
|
|
663
|
+
import { Box as Box8 } from "@radix-ui/themes";
|
|
662
664
|
// src/components/runSteps/RunSteps/index.tsx
|
|
663
|
-
import { Flex as Flex10 } from "@radix-ui/themes";
|
|
664
|
-
// src/components/runSteps/RunStep/ToolCalls/index.tsx
|
|
665
665
|
import { Flex as Flex9 } from "@radix-ui/themes";
|
|
666
|
-
// src/components/runSteps/RunStep/ToolCalls/
|
|
666
|
+
// src/components/runSteps/RunStep/ToolCalls/index.tsx
|
|
667
667
|
import { Flex as Flex8 } from "@radix-ui/themes";
|
|
668
|
+
// src/components/runSteps/RunStep/ToolCalls/ToolCall/index.tsx
|
|
669
|
+
import { Flex as Flex7 } from "@radix-ui/themes";
|
|
668
670
|
// src/components/runSteps/RunStep/ToolCalls/ToolCall/Fn/index.tsx
|
|
669
671
|
import { useContext as useContext3 } from "react";
|
|
670
672
|
// src/contexts/functions/FunctionComponentsContext/index.tsx
|
|
@@ -673,15 +675,15 @@ var FunctionComponentsContext = createContext4({});
|
|
|
673
675
|
// src/components/functions/FunctionBase/index.tsx
|
|
674
676
|
import { PopoverRoot, PopoverContent } from "@radix-ui/themes";
|
|
675
677
|
// src/components/toolCalls/ToolCallBase/index.tsx
|
|
676
|
-
import { Flex as
|
|
677
|
-
import { jsx as
|
|
678
|
+
import { Flex as Flex5, Button, PopoverTrigger } from "@radix-ui/themes";
|
|
679
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
678
680
|
var ToolCallBase = function(param) {
|
|
679
681
|
var children = param.children;
|
|
680
|
-
return /* @__PURE__ */
|
|
682
|
+
return /* @__PURE__ */ jsx7(Flex5, {
|
|
681
683
|
py: "1",
|
|
682
684
|
ml: "-2",
|
|
683
|
-
children: /* @__PURE__ */
|
|
684
|
-
children: /* @__PURE__ */
|
|
685
|
+
children: /* @__PURE__ */ jsx7(PopoverTrigger, {
|
|
686
|
+
children: /* @__PURE__ */ jsx7(Button, {
|
|
685
687
|
size: "1",
|
|
686
688
|
color: "gold",
|
|
687
689
|
variant: "outline",
|
|
@@ -695,31 +697,31 @@ var ToolCallBase = function(param) {
|
|
|
695
697
|
};
|
|
696
698
|
// src/components/toolCalls/ToolCallBase/ToolCallTitle.tsx
|
|
697
699
|
import { Text as Text2 } from "@radix-ui/themes";
|
|
698
|
-
import { jsx as
|
|
700
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
699
701
|
var ToolCallTitle = function(param) {
|
|
700
702
|
var children = param.children;
|
|
701
|
-
return /* @__PURE__ */
|
|
703
|
+
return /* @__PURE__ */ jsx8(Text2, {
|
|
702
704
|
weight: "regular",
|
|
703
705
|
children: children
|
|
704
706
|
});
|
|
705
707
|
};
|
|
706
708
|
// src/components/functions/FunctionBase/Icon.tsx
|
|
707
709
|
import { CircleIcon, CircleBackslashIcon, CheckCircledIcon } from "@radix-ui/react-icons";
|
|
708
|
-
import { jsx as
|
|
710
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
709
711
|
var Icon = function(param) {
|
|
710
712
|
var runStep = param.runStep;
|
|
711
713
|
if (runStep.completed_at) {
|
|
712
|
-
return /* @__PURE__ */
|
|
714
|
+
return /* @__PURE__ */ jsx9(CheckCircledIcon, {});
|
|
713
715
|
} else if (runStep.cancelled_at || runStep.failed_at || runStep.status === "expired") {
|
|
714
|
-
return /* @__PURE__ */
|
|
716
|
+
return /* @__PURE__ */ jsx9(CircleBackslashIcon, {});
|
|
715
717
|
} else {
|
|
716
|
-
return /* @__PURE__ */
|
|
718
|
+
return /* @__PURE__ */ jsx9(CircleIcon, {});
|
|
717
719
|
}
|
|
718
720
|
};
|
|
719
721
|
// src/components/functions/FunctionBase/Content.tsx
|
|
720
722
|
import { useMemo as useMemo3 } from "react";
|
|
721
723
|
import { Code, Box as Box2 } from "@radix-ui/themes";
|
|
722
|
-
import { jsx as
|
|
724
|
+
import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
723
725
|
var Content = function(param) {
|
|
724
726
|
var fn = param.fn;
|
|
725
727
|
var args = useMemo3(function() {
|
|
@@ -750,7 +752,7 @@ var Content = function(param) {
|
|
|
750
752
|
if (!args) {
|
|
751
753
|
return null;
|
|
752
754
|
}
|
|
753
|
-
return /* @__PURE__ */
|
|
755
|
+
return /* @__PURE__ */ jsxs3(Code, {
|
|
754
756
|
variant: "ghost",
|
|
755
757
|
color: "gold",
|
|
756
758
|
style: {
|
|
@@ -758,36 +760,36 @@ var Content = function(param) {
|
|
|
758
760
|
wordBreak: "break-word"
|
|
759
761
|
},
|
|
760
762
|
children: [
|
|
761
|
-
/* @__PURE__ */
|
|
763
|
+
/* @__PURE__ */ jsx10(Box2, {
|
|
762
764
|
children: args && JSON.stringify(args, null, 2)
|
|
763
765
|
}),
|
|
764
|
-
/* @__PURE__ */
|
|
766
|
+
/* @__PURE__ */ jsx10(Box2, {
|
|
765
767
|
children: output && JSON.stringify(output, null, 2)
|
|
766
768
|
})
|
|
767
769
|
]
|
|
768
770
|
});
|
|
769
771
|
};
|
|
770
772
|
// src/components/functions/FunctionBase/index.tsx
|
|
771
|
-
import { jsx as
|
|
773
|
+
import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
772
774
|
var FunctionBase = function(param) {
|
|
773
775
|
var fn = param.fn, runStep = param.runStep, title2 = param.title;
|
|
774
|
-
return /* @__PURE__ */
|
|
776
|
+
return /* @__PURE__ */ jsxs4(PopoverRoot, {
|
|
775
777
|
children: [
|
|
776
|
-
/* @__PURE__ */
|
|
778
|
+
/* @__PURE__ */ jsxs4(ToolCallBase, {
|
|
777
779
|
children: [
|
|
778
|
-
/* @__PURE__ */
|
|
780
|
+
/* @__PURE__ */ jsx11(Icon, {
|
|
779
781
|
runStep: runStep
|
|
780
782
|
}),
|
|
781
|
-
/* @__PURE__ */
|
|
783
|
+
/* @__PURE__ */ jsx11(ToolCallTitle, {
|
|
782
784
|
children: title2
|
|
783
785
|
})
|
|
784
786
|
]
|
|
785
787
|
}),
|
|
786
|
-
/* @__PURE__ */
|
|
788
|
+
/* @__PURE__ */ jsx11(PopoverContent, {
|
|
787
789
|
style: {
|
|
788
790
|
maxHeight: "500px"
|
|
789
791
|
},
|
|
790
|
-
children: /* @__PURE__ */
|
|
792
|
+
children: /* @__PURE__ */ jsx11(Content, {
|
|
791
793
|
fn: fn
|
|
792
794
|
})
|
|
793
795
|
})
|
|
@@ -806,10 +808,10 @@ var title = function(param) {
|
|
|
806
808
|
}
|
|
807
809
|
};
|
|
808
810
|
// src/components/runSteps/RunStep/ToolCalls/ToolCall/Fn/DefaultFunction/index.tsx
|
|
809
|
-
import { jsx as
|
|
811
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
810
812
|
var DefaultFunction = function(param) {
|
|
811
813
|
var fn = param.fn, runStep = param.runStep;
|
|
812
|
-
return /* @__PURE__ */
|
|
814
|
+
return /* @__PURE__ */ jsx12(FunctionBase, {
|
|
813
815
|
fn: fn,
|
|
814
816
|
runStep: runStep,
|
|
815
817
|
title: title({
|
|
@@ -819,66 +821,66 @@ var DefaultFunction = function(param) {
|
|
|
819
821
|
});
|
|
820
822
|
};
|
|
821
823
|
// src/components/runSteps/RunStep/ToolCalls/ToolCall/Fn/index.tsx
|
|
822
|
-
import { jsx as
|
|
824
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
823
825
|
var Fn = function(param) {
|
|
824
826
|
var fn = param.fn, runStep = param.runStep;
|
|
825
827
|
var functionComponentsContext = useContext3(FunctionComponentsContext);
|
|
826
828
|
var Component = functionComponentsContext[fn.name] || DefaultFunction;
|
|
827
829
|
return(// @ts-ignore-next-line
|
|
828
|
-
/* @__PURE__ */
|
|
830
|
+
/* @__PURE__ */ jsx13(Component, {
|
|
829
831
|
fn: fn,
|
|
830
832
|
runStep: runStep
|
|
831
833
|
}));
|
|
832
834
|
};
|
|
833
835
|
// src/components/runSteps/RunStep/ToolCalls/ToolCall/CodeInterpreter/index.tsx
|
|
834
|
-
import { Flex as
|
|
835
|
-
import { jsx as
|
|
836
|
+
import { Flex as Flex6 } from "@radix-ui/themes";
|
|
837
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
836
838
|
var CodeInterpreter = function(param) {
|
|
837
839
|
var codeInterpreter = param.codeInterpreter;
|
|
838
|
-
return /* @__PURE__ */
|
|
840
|
+
return /* @__PURE__ */ jsx14(Flex6, {
|
|
839
841
|
children: codeInterpreter.input
|
|
840
842
|
});
|
|
841
843
|
};
|
|
842
844
|
// src/components/runSteps/RunStep/ToolCalls/ToolCall/index.tsx
|
|
843
|
-
import { jsx as
|
|
845
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
844
846
|
var ToolCall = function(param) {
|
|
845
847
|
var toolCall = param.toolCall, runStep = param.runStep;
|
|
846
848
|
if (toolCall.type === "function") {
|
|
847
|
-
return /* @__PURE__ */
|
|
849
|
+
return /* @__PURE__ */ jsx15(Fn, {
|
|
848
850
|
fn: toolCall.function,
|
|
849
851
|
runStep: runStep
|
|
850
852
|
});
|
|
851
853
|
}
|
|
852
854
|
if (toolCall.type === "code_interpreter") {
|
|
853
|
-
return /* @__PURE__ */
|
|
855
|
+
return /* @__PURE__ */ jsx15(CodeInterpreter, {
|
|
854
856
|
codeInterpreter: toolCall.code_interpreter,
|
|
855
857
|
runStep: runStep
|
|
856
858
|
});
|
|
857
859
|
}
|
|
858
|
-
return /* @__PURE__ */
|
|
860
|
+
return /* @__PURE__ */ jsx15(Flex7, {
|
|
859
861
|
children: toolCall.type
|
|
860
862
|
});
|
|
861
863
|
};
|
|
862
864
|
// src/components/runSteps/RunStep/ToolCalls/Starting/index.tsx
|
|
863
865
|
import { PopoverRoot as PopoverRoot2, PopoverContent as PopoverContent2, Text as Text3 } from "@radix-ui/themes";
|
|
864
866
|
import { CircleIcon as CircleIcon2 } from "@radix-ui/react-icons";
|
|
865
|
-
import { jsx as
|
|
867
|
+
import { jsx as jsx16, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
866
868
|
var Starting = function() {
|
|
867
|
-
return /* @__PURE__ */
|
|
869
|
+
return /* @__PURE__ */ jsxs5(PopoverRoot2, {
|
|
868
870
|
children: [
|
|
869
|
-
/* @__PURE__ */
|
|
871
|
+
/* @__PURE__ */ jsxs5(ToolCallBase, {
|
|
870
872
|
children: [
|
|
871
|
-
/* @__PURE__ */
|
|
872
|
-
/* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ jsx16(CircleIcon2, {}),
|
|
874
|
+
/* @__PURE__ */ jsx16(ToolCallTitle, {
|
|
873
875
|
children: "Starting actions"
|
|
874
876
|
})
|
|
875
877
|
]
|
|
876
878
|
}),
|
|
877
|
-
/* @__PURE__ */
|
|
879
|
+
/* @__PURE__ */ jsx16(PopoverContent2, {
|
|
878
880
|
style: {
|
|
879
881
|
maxHeight: "500px"
|
|
880
882
|
},
|
|
881
|
-
children: /* @__PURE__ */
|
|
883
|
+
children: /* @__PURE__ */ jsx16(Text3, {
|
|
882
884
|
children: "Getting ready to connect to domain API"
|
|
883
885
|
})
|
|
884
886
|
})
|
|
@@ -886,15 +888,15 @@ var Starting = function() {
|
|
|
886
888
|
});
|
|
887
889
|
};
|
|
888
890
|
// src/components/runSteps/RunStep/ToolCalls/index.tsx
|
|
889
|
-
import { jsx as
|
|
891
|
+
import { jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
890
892
|
var ToolCalls = function(param) {
|
|
891
893
|
var stepDetails = param.stepDetails, runStep = param.runStep;
|
|
892
|
-
return /* @__PURE__ */
|
|
894
|
+
return /* @__PURE__ */ jsxs6(Flex8, {
|
|
893
895
|
direction: "column",
|
|
894
896
|
children: [
|
|
895
|
-
!stepDetails.tool_calls.length && /* @__PURE__ */
|
|
897
|
+
!stepDetails.tool_calls.length && /* @__PURE__ */ jsx17(Starting, {}),
|
|
896
898
|
stepDetails.tool_calls.map(function(toolCall) {
|
|
897
|
-
return /* @__PURE__ */
|
|
899
|
+
return /* @__PURE__ */ jsx17(ToolCall, {
|
|
898
900
|
toolCall: toolCall,
|
|
899
901
|
runStep: runStep
|
|
900
902
|
}, toolCall.id);
|
|
@@ -903,11 +905,11 @@ var ToolCalls = function(param) {
|
|
|
903
905
|
});
|
|
904
906
|
};
|
|
905
907
|
// src/components/runSteps/RunStep/index.tsx
|
|
906
|
-
import { jsx as
|
|
908
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
907
909
|
var RunStep = function(param) {
|
|
908
910
|
var runStep = param.runStep;
|
|
909
911
|
if (runStep.step_details.type === "tool_calls") {
|
|
910
|
-
return /* @__PURE__ */
|
|
912
|
+
return /* @__PURE__ */ jsx18(ToolCalls, {
|
|
911
913
|
stepDetails: runStep.step_details,
|
|
912
914
|
runStep: runStep
|
|
913
915
|
});
|
|
@@ -915,31 +917,39 @@ var RunStep = function(param) {
|
|
|
915
917
|
return null;
|
|
916
918
|
};
|
|
917
919
|
// src/components/runSteps/RunSteps/index.tsx
|
|
918
|
-
import { jsx as
|
|
920
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
919
921
|
var RunSteps = function(param) {
|
|
920
922
|
var runSteps = param.runSteps;
|
|
921
|
-
return /* @__PURE__ */
|
|
923
|
+
return /* @__PURE__ */ jsx19(Flex9, {
|
|
922
924
|
direction: "column-reverse",
|
|
923
925
|
children: runSteps.map(function(runStep) {
|
|
924
|
-
return /* @__PURE__ */
|
|
926
|
+
return /* @__PURE__ */ jsx19(RunStep, {
|
|
925
927
|
runStep: runStep
|
|
926
928
|
}, runStep.id);
|
|
927
929
|
})
|
|
928
930
|
});
|
|
929
931
|
};
|
|
930
|
-
// src/
|
|
931
|
-
import {
|
|
932
|
+
// src/contexts/messages/MessageContext/index.ts
|
|
933
|
+
import { createContext as createContext5 } from "react";
|
|
934
|
+
var MessageContext = createContext5({
|
|
935
|
+
message: null
|
|
936
|
+
});
|
|
937
|
+
// src/components/threads/Thread/Message/Provider.tsx
|
|
938
|
+
var Provider = MessageContext.Provider;
|
|
939
|
+
// src/components/threads/Thread/Message/TextContent.tsx
|
|
932
940
|
import { useRemarkSync } from "react-remark";
|
|
941
|
+
// src/hooks/markdown/useMarkdownContext/index.ts
|
|
942
|
+
import { useContext as useContext4 } from "react";
|
|
933
943
|
// src/contexts/markdown/MarkdownContext/index.ts
|
|
934
|
-
import { createContext as
|
|
944
|
+
import { createContext as createContext6 } from "react";
|
|
935
945
|
// src/contexts/markdown/MarkdownContext/lib/components/Paragraph.tsx
|
|
936
946
|
import { Box as Box3, Text as Text4 } from "@radix-ui/themes";
|
|
937
|
-
import { jsx as
|
|
947
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
938
948
|
var Paragraph = function(param) {
|
|
939
949
|
var children = param.children;
|
|
940
|
-
return /* @__PURE__ */
|
|
950
|
+
return /* @__PURE__ */ jsx20(Box3, {
|
|
941
951
|
pb: "3",
|
|
942
|
-
children: /* @__PURE__ */
|
|
952
|
+
children: /* @__PURE__ */ jsx20(Text4, {
|
|
943
953
|
size: "3",
|
|
944
954
|
style: {
|
|
945
955
|
whiteSpace: "pre-line",
|
|
@@ -951,23 +961,23 @@ var Paragraph = function(param) {
|
|
|
951
961
|
};
|
|
952
962
|
// src/contexts/markdown/MarkdownContext/lib/components/Link.tsx
|
|
953
963
|
import { Link as RadixLink } from "@radix-ui/themes";
|
|
954
|
-
import { jsx as
|
|
964
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
955
965
|
var Link = function(param) {
|
|
956
966
|
var children = param.children, href = param.href;
|
|
957
|
-
return /* @__PURE__ */
|
|
967
|
+
return /* @__PURE__ */ jsx21(RadixLink, {
|
|
958
968
|
href: href,
|
|
959
969
|
children: children
|
|
960
970
|
});
|
|
961
971
|
};
|
|
962
972
|
// src/contexts/markdown/MarkdownContext/lib/components/UnorderedList.tsx
|
|
963
973
|
import { Box as Box4 } from "@radix-ui/themes";
|
|
964
|
-
import { jsx as
|
|
974
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
965
975
|
var UnorderedList = function(param) {
|
|
966
976
|
var children = param.children;
|
|
967
|
-
return /* @__PURE__ */
|
|
977
|
+
return /* @__PURE__ */ jsx22(Box4, {
|
|
968
978
|
pb: "3",
|
|
969
979
|
asChild: true,
|
|
970
|
-
children: /* @__PURE__ */
|
|
980
|
+
children: /* @__PURE__ */ jsx22("ul", {
|
|
971
981
|
style: {
|
|
972
982
|
listStylePosition: "inside"
|
|
973
983
|
},
|
|
@@ -977,13 +987,13 @@ var UnorderedList = function(param) {
|
|
|
977
987
|
};
|
|
978
988
|
// src/contexts/markdown/MarkdownContext/lib/components/OrderedList.tsx
|
|
979
989
|
import { Box as Box5 } from "@radix-ui/themes";
|
|
980
|
-
import { jsx as
|
|
990
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
981
991
|
var OrderedList = function(param) {
|
|
982
992
|
var children = param.children;
|
|
983
|
-
return /* @__PURE__ */
|
|
993
|
+
return /* @__PURE__ */ jsx23(Box5, {
|
|
984
994
|
pb: "3",
|
|
985
995
|
asChild: true,
|
|
986
|
-
children: /* @__PURE__ */
|
|
996
|
+
children: /* @__PURE__ */ jsx23("ol", {
|
|
987
997
|
style: {
|
|
988
998
|
listStylePosition: "inside"
|
|
989
999
|
},
|
|
@@ -993,22 +1003,44 @@ var OrderedList = function(param) {
|
|
|
993
1003
|
};
|
|
994
1004
|
// src/contexts/markdown/MarkdownContext/lib/components/ListItem.tsx
|
|
995
1005
|
import { Box as Box6 } from "@radix-ui/themes";
|
|
996
|
-
import { jsx as
|
|
1006
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
997
1007
|
var ListItem = function(param) {
|
|
998
1008
|
var children = param.children;
|
|
999
|
-
return /* @__PURE__ */
|
|
1009
|
+
return /* @__PURE__ */ jsx24(Box6, {
|
|
1000
1010
|
pb: "1",
|
|
1001
|
-
children: /* @__PURE__ */
|
|
1011
|
+
children: /* @__PURE__ */ jsx24("li", {
|
|
1002
1012
|
children: children
|
|
1003
1013
|
})
|
|
1004
1014
|
});
|
|
1005
1015
|
};
|
|
1006
1016
|
// src/contexts/markdown/MarkdownContext/lib/components/Strong.tsx
|
|
1007
1017
|
import { Strong as RadixStrong } from "@radix-ui/themes";
|
|
1008
|
-
import { jsx as
|
|
1018
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1009
1019
|
var Strong = function(param) {
|
|
1010
1020
|
var children = param.children;
|
|
1011
|
-
return /* @__PURE__ */
|
|
1021
|
+
return /* @__PURE__ */ jsx25(RadixStrong, {
|
|
1022
|
+
children: children
|
|
1023
|
+
});
|
|
1024
|
+
};
|
|
1025
|
+
// src/contexts/markdown/MarkdownContext/lib/components/Pre.tsx
|
|
1026
|
+
import { Box as Box7 } from "@radix-ui/themes";
|
|
1027
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1028
|
+
var Pre = function(param) {
|
|
1029
|
+
var children = param.children;
|
|
1030
|
+
return /* @__PURE__ */ jsx26(Box7, {
|
|
1031
|
+
style: {
|
|
1032
|
+
whiteSpace: "pre-wrap",
|
|
1033
|
+
wordBreak: "break-word"
|
|
1034
|
+
},
|
|
1035
|
+
children: children
|
|
1036
|
+
});
|
|
1037
|
+
};
|
|
1038
|
+
// src/contexts/markdown/MarkdownContext/lib/components/Code.tsx
|
|
1039
|
+
import { Code as RadixCode } from "@radix-ui/themes";
|
|
1040
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1041
|
+
var Code2 = function(param) {
|
|
1042
|
+
var children = param.children;
|
|
1043
|
+
return /* @__PURE__ */ jsx27(RadixCode, {
|
|
1012
1044
|
children: children
|
|
1013
1045
|
});
|
|
1014
1046
|
};
|
|
@@ -1019,23 +1051,29 @@ var components = {
|
|
|
1019
1051
|
strong: Strong,
|
|
1020
1052
|
ul: UnorderedList,
|
|
1021
1053
|
ol: OrderedList,
|
|
1022
|
-
li: ListItem
|
|
1054
|
+
li: ListItem,
|
|
1055
|
+
pre: Pre,
|
|
1056
|
+
code: Code2
|
|
1023
1057
|
};
|
|
1024
1058
|
// src/contexts/markdown/MarkdownContext/index.ts
|
|
1025
|
-
var MarkdownContext =
|
|
1059
|
+
var MarkdownContext = createContext6({
|
|
1026
1060
|
remarkPlugins: [],
|
|
1027
1061
|
rehypeReactOptions: {
|
|
1028
1062
|
components: components
|
|
1029
1063
|
}
|
|
1030
1064
|
});
|
|
1031
|
-
// src/
|
|
1065
|
+
// src/hooks/markdown/useMarkdownContext/index.ts
|
|
1066
|
+
var useMarkdownContext = function() {
|
|
1067
|
+
return useContext4(MarkdownContext);
|
|
1068
|
+
};
|
|
1069
|
+
// src/components/threads/Thread/Message/TextContent.tsx
|
|
1032
1070
|
var TextContent = function(param) {
|
|
1033
1071
|
var content = param.content;
|
|
1034
|
-
var markdownContext =
|
|
1072
|
+
var markdownContext = useMarkdownContext();
|
|
1035
1073
|
return useRemarkSync(content.text.value, markdownContext);
|
|
1036
1074
|
};
|
|
1037
1075
|
// src/components/threads/Thread/Message/index.tsx
|
|
1038
|
-
import { jsx as
|
|
1076
|
+
import { jsx as jsx28, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1039
1077
|
var Message = function(param) {
|
|
1040
1078
|
var message = param.message;
|
|
1041
1079
|
var _useMemo4 = _sliced_to_array(useMemo4(function() {
|
|
@@ -1070,55 +1108,60 @@ var Message = function(param) {
|
|
|
1070
1108
|
}, [
|
|
1071
1109
|
message
|
|
1072
1110
|
]), 2), olderRunSteps = _useMemo4[0], laterRunSteps = _useMemo4[1];
|
|
1073
|
-
return /* @__PURE__ */
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1111
|
+
return /* @__PURE__ */ jsx28(Provider, {
|
|
1112
|
+
value: {
|
|
1113
|
+
message: message
|
|
1114
|
+
},
|
|
1115
|
+
children: /* @__PURE__ */ jsxs7(Box8, {
|
|
1116
|
+
children: [
|
|
1117
|
+
/* @__PURE__ */ jsx28(RunSteps, {
|
|
1118
|
+
runSteps: olderRunSteps
|
|
1119
|
+
}),
|
|
1120
|
+
message.content.map(function(content, index) {
|
|
1121
|
+
return /* @__PURE__ */ jsx28(Box8, {
|
|
1122
|
+
children: content.type === "text" && /* @__PURE__ */ jsx28(TextContent, {
|
|
1123
|
+
content: content
|
|
1124
|
+
})
|
|
1125
|
+
}, index);
|
|
1126
|
+
}),
|
|
1127
|
+
/* @__PURE__ */ jsx28(RunSteps, {
|
|
1128
|
+
runSteps: laterRunSteps
|
|
1129
|
+
})
|
|
1130
|
+
]
|
|
1131
|
+
})
|
|
1089
1132
|
});
|
|
1090
1133
|
};
|
|
1091
1134
|
// src/components/threads/Thread/Messages/Content/MessageGroup/Content/index.tsx
|
|
1092
|
-
import { jsx as
|
|
1135
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
1093
1136
|
var Content2 = function(param) {
|
|
1094
1137
|
var messageGroup = param.messageGroup;
|
|
1095
|
-
return /* @__PURE__ */
|
|
1138
|
+
return /* @__PURE__ */ jsx29(Flex10, {
|
|
1096
1139
|
direction: "column-reverse",
|
|
1097
1140
|
children: messageGroup.messages.map(function(message) {
|
|
1098
|
-
return /* @__PURE__ */
|
|
1141
|
+
return /* @__PURE__ */ jsx29(Message, {
|
|
1099
1142
|
message: message
|
|
1100
1143
|
}, message.id);
|
|
1101
1144
|
})
|
|
1102
1145
|
});
|
|
1103
1146
|
};
|
|
1104
1147
|
// src/components/threads/Thread/Messages/Content/MessageGroup/index.tsx
|
|
1105
|
-
import { jsx as
|
|
1148
|
+
import { jsx as jsx30, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1106
1149
|
var MessageGroup = function(param) {
|
|
1107
1150
|
var messageGroup = param.messageGroup;
|
|
1108
1151
|
var assistantNameContext = useContext5(AssistantNameContext);
|
|
1109
|
-
return /* @__PURE__ */
|
|
1152
|
+
return /* @__PURE__ */ jsxs8(MessageGroupBase, {
|
|
1110
1153
|
children: [
|
|
1111
|
-
messageGroup.role === "user" ? /* @__PURE__ */
|
|
1112
|
-
fallback: /* @__PURE__ */
|
|
1154
|
+
messageGroup.role === "user" ? /* @__PURE__ */ jsx30(Avatar3, {
|
|
1155
|
+
fallback: /* @__PURE__ */ jsx30(PersonIcon, {}),
|
|
1113
1156
|
size: "1"
|
|
1114
|
-
}) : /* @__PURE__ */
|
|
1115
|
-
/* @__PURE__ */
|
|
1157
|
+
}) : /* @__PURE__ */ jsx30(AssistantAvatar, {}),
|
|
1158
|
+
/* @__PURE__ */ jsxs8(Box9, {
|
|
1116
1159
|
flexGrow: "1",
|
|
1117
1160
|
children: [
|
|
1118
|
-
/* @__PURE__ */
|
|
1161
|
+
/* @__PURE__ */ jsx30(Name, {
|
|
1119
1162
|
children: messageGroup.role === "user" ? "You" : assistantNameContext
|
|
1120
1163
|
}),
|
|
1121
|
-
/* @__PURE__ */
|
|
1164
|
+
/* @__PURE__ */ jsx30(Content2, {
|
|
1122
1165
|
messageGroup: messageGroup
|
|
1123
1166
|
})
|
|
1124
1167
|
]
|
|
@@ -1127,18 +1170,25 @@ var MessageGroup = function(param) {
|
|
|
1127
1170
|
});
|
|
1128
1171
|
};
|
|
1129
1172
|
// src/components/threads/Thread/Messages/Content/index.tsx
|
|
1130
|
-
import { Fragment, jsx as
|
|
1173
|
+
import { Fragment, jsx as jsx31 } from "react/jsx-runtime";
|
|
1131
1174
|
var Content3 = function() {
|
|
1132
1175
|
var _useMessages = useMessages(), messages2 = _useMessages.messages, isLoading = _useMessages.isLoading, isLoadingError = _useMessages.isLoadingError;
|
|
1133
1176
|
var _useMessageGroups = useMessageGroups({
|
|
1134
1177
|
messages: messages2
|
|
1135
1178
|
}), messageGroups2 = _useMessageGroups.messageGroups;
|
|
1179
|
+
useEffect(function() {
|
|
1180
|
+
if (isLoadingError) {
|
|
1181
|
+
toast2.error("Could not load messages. Please try again.");
|
|
1182
|
+
}
|
|
1183
|
+
}, [
|
|
1184
|
+
isLoadingError
|
|
1185
|
+
]);
|
|
1136
1186
|
if (isLoading || isLoadingError) {
|
|
1137
|
-
return /* @__PURE__ */
|
|
1187
|
+
return /* @__PURE__ */ jsx31(MessagesSkeleton, {});
|
|
1138
1188
|
}
|
|
1139
|
-
return /* @__PURE__ */
|
|
1189
|
+
return /* @__PURE__ */ jsx31(Fragment, {
|
|
1140
1190
|
children: messageGroups2.map(function(messageGroup) {
|
|
1141
|
-
return /* @__PURE__ */
|
|
1191
|
+
return /* @__PURE__ */ jsx31(MessageGroup, {
|
|
1142
1192
|
messageGroup: messageGroup
|
|
1143
1193
|
}, messageGroup.id);
|
|
1144
1194
|
})
|
|
@@ -1147,38 +1197,37 @@ var Content3 = function() {
|
|
|
1147
1197
|
// src/components/threads/Thread/Messages/Progress/index.tsx
|
|
1148
1198
|
import { Box as Box11 } from "@radix-ui/themes";
|
|
1149
1199
|
// src/components/skeletons/StartingContentSkeleton/index.tsx
|
|
1150
|
-
import {
|
|
1151
|
-
import { jsx as
|
|
1200
|
+
import { Skeleton as Skeleton2 } from "@radix-ui/themes";
|
|
1201
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
1152
1202
|
var StartingContentSkeleton = function() {
|
|
1153
|
-
return /* @__PURE__ */
|
|
1154
|
-
|
|
1203
|
+
return /* @__PURE__ */ jsx32(Skeleton2, {
|
|
1204
|
+
loading: true,
|
|
1155
1205
|
mt: "1",
|
|
1156
1206
|
height: "var(--space-4)",
|
|
1157
1207
|
width: "var(--space-4)",
|
|
1158
1208
|
style: {
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
backgroundColor: "var(--gray-12)"
|
|
1209
|
+
borderRadius: "var(--radius-6)",
|
|
1210
|
+
flexShrink: 0
|
|
1162
1211
|
}
|
|
1163
1212
|
});
|
|
1164
1213
|
};
|
|
1165
1214
|
// src/components/skeletons/StartingSkeleton/index.tsx
|
|
1166
1215
|
import { useContext as useContext6 } from "react";
|
|
1167
1216
|
import { Box as Box10 } from "@radix-ui/themes";
|
|
1168
|
-
import { jsx as
|
|
1217
|
+
import { jsx as jsx33, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1169
1218
|
var StartingSkeleton = function(param) {
|
|
1170
1219
|
var children = param.children;
|
|
1171
1220
|
var assistantNameContext = useContext6(AssistantNameContext);
|
|
1172
|
-
return /* @__PURE__ */
|
|
1221
|
+
return /* @__PURE__ */ jsxs9(MessageGroupBase, {
|
|
1173
1222
|
children: [
|
|
1174
|
-
/* @__PURE__ */
|
|
1175
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ jsx33(AssistantAvatar, {}),
|
|
1224
|
+
/* @__PURE__ */ jsxs9(Box10, {
|
|
1176
1225
|
children: [
|
|
1177
|
-
/* @__PURE__ */
|
|
1226
|
+
/* @__PURE__ */ jsx33(Name, {
|
|
1178
1227
|
children: assistantNameContext
|
|
1179
1228
|
}),
|
|
1180
1229
|
children,
|
|
1181
|
-
/* @__PURE__ */
|
|
1230
|
+
/* @__PURE__ */ jsx33(StartingContentSkeleton, {})
|
|
1182
1231
|
]
|
|
1183
1232
|
})
|
|
1184
1233
|
]
|
|
@@ -1270,6 +1319,18 @@ var isRunEditingMessage = function(param) {
|
|
|
1270
1319
|
});
|
|
1271
1320
|
return !hasContent;
|
|
1272
1321
|
};
|
|
1322
|
+
// src/hooks/runs/usePollingContext/index.ts
|
|
1323
|
+
import { useContext as useContext7 } from "react";
|
|
1324
|
+
// src/contexts/runs/PollingContext/index.tsx
|
|
1325
|
+
import { createContext as createContext7 } from "react";
|
|
1326
|
+
var PollingContext = createContext7({
|
|
1327
|
+
isPollRefetching: false,
|
|
1328
|
+
setIsPollRefetching: function() {}
|
|
1329
|
+
});
|
|
1330
|
+
// src/hooks/runs/usePollingContext/index.ts
|
|
1331
|
+
var usePollingContext = function() {
|
|
1332
|
+
return useContext7(PollingContext);
|
|
1333
|
+
};
|
|
1273
1334
|
// src/hooks/runs/useIsRunActive/index.tsx
|
|
1274
1335
|
var progressStatuses = [
|
|
1275
1336
|
"queued",
|
|
@@ -1283,8 +1344,9 @@ var stoppedStatuses = [
|
|
|
1283
1344
|
"failed"
|
|
1284
1345
|
];
|
|
1285
1346
|
var isRunActive = function(param) {
|
|
1286
|
-
var latestRunProps = param.latestRunProps, latestMessageProps = param.latestMessageProps, isMutating = param.isMutating;
|
|
1347
|
+
var pollingContext = param.pollingContext, latestRunProps = param.latestRunProps, latestMessageProps = param.latestMessageProps, isMutating = param.isMutating;
|
|
1287
1348
|
var _latestMessageProps_latestMessage_metadata, _latestMessageProps_latestMessage;
|
|
1349
|
+
if (pollingContext.isPollRefetching) return true;
|
|
1288
1350
|
if ((_latestMessageProps_latestMessage = latestMessageProps.latestMessage) === null || _latestMessageProps_latestMessage === void 0 ? void 0 : (_latestMessageProps_latestMessage_metadata = _latestMessageProps_latestMessage.metadata) === null || _latestMessageProps_latestMessage_metadata === void 0 ? void 0 : _latestMessageProps_latestMessage_metadata.isBlocking) return false;
|
|
1289
1351
|
if (isMutating) return true;
|
|
1290
1352
|
if (!latestRunProps.latestRun) return false;
|
|
@@ -1298,6 +1360,7 @@ var useIsRunActive = function() {
|
|
|
1298
1360
|
var latestRunProps = useLatestRun();
|
|
1299
1361
|
var latestMessageProps = useLatestMessage();
|
|
1300
1362
|
var threadContext = useSuperinterfaceContext();
|
|
1363
|
+
var pollingContext = usePollingContext();
|
|
1301
1364
|
var isMutatingCreateRun = useIsMutating({
|
|
1302
1365
|
mutationKey: [
|
|
1303
1366
|
"createRun",
|
|
@@ -1319,6 +1382,7 @@ var useIsRunActive = function() {
|
|
|
1319
1382
|
return useMemo8(function() {
|
|
1320
1383
|
return _object_spread_props(_object_spread({}, latestRunProps), {
|
|
1321
1384
|
isRunActive: isRunActive({
|
|
1385
|
+
pollingContext: pollingContext,
|
|
1322
1386
|
latestRunProps: latestRunProps,
|
|
1323
1387
|
latestMessageProps: latestMessageProps,
|
|
1324
1388
|
isMutating: isMutatingCreateRun > 0 || isMutatingCreateMessage > 0 || isMutatingCreateHandleAction > 0
|
|
@@ -1327,38 +1391,39 @@ var useIsRunActive = function() {
|
|
|
1327
1391
|
}, [
|
|
1328
1392
|
latestRunProps,
|
|
1329
1393
|
latestMessageProps,
|
|
1394
|
+
pollingContext,
|
|
1330
1395
|
isMutatingCreateRun,
|
|
1331
1396
|
isMutatingCreateMessage,
|
|
1332
1397
|
isMutatingCreateHandleAction
|
|
1333
1398
|
]);
|
|
1334
1399
|
};
|
|
1335
1400
|
// src/components/threads/Thread/Messages/Progress/index.tsx
|
|
1336
|
-
import { jsx as
|
|
1401
|
+
import { jsx as jsx34, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1337
1402
|
var Progress = function() {
|
|
1338
1403
|
var _useIsRunActive = useIsRunActive(), isRunActive2 = _useIsRunActive.isRunActive;
|
|
1339
1404
|
var latestMessage = useLatestMessage().latestMessage;
|
|
1340
1405
|
if (!latestMessage) return null;
|
|
1341
1406
|
if (!isRunActive2) return null;
|
|
1342
1407
|
if (latestMessage.role === "user") {
|
|
1343
|
-
return /* @__PURE__ */
|
|
1408
|
+
return /* @__PURE__ */ jsx34(StartingSkeleton, {});
|
|
1344
1409
|
}
|
|
1345
|
-
return /* @__PURE__ */
|
|
1410
|
+
return /* @__PURE__ */ jsxs10(MessageGroupBase, {
|
|
1346
1411
|
children: [
|
|
1347
|
-
/* @__PURE__ */
|
|
1412
|
+
/* @__PURE__ */ jsx34(Box11, {
|
|
1348
1413
|
pl: "5"
|
|
1349
1414
|
}),
|
|
1350
|
-
/* @__PURE__ */
|
|
1415
|
+
/* @__PURE__ */ jsx34(StartingContentSkeleton, {})
|
|
1351
1416
|
]
|
|
1352
1417
|
});
|
|
1353
1418
|
};
|
|
1354
1419
|
// src/components/threads/Thread/Messages/Root/index.tsx
|
|
1355
|
-
import { Flex as
|
|
1420
|
+
import { Flex as Flex11 } from "@radix-ui/themes";
|
|
1356
1421
|
// src/hooks/misc/useInfiniteScroll/index.tsx
|
|
1357
1422
|
import { useRef as useRef2 } from "react";
|
|
1358
1423
|
import { useInView } from "react-intersection-observer";
|
|
1359
1424
|
// src/hooks/misc/useThrottledEffect/index.tsx
|
|
1360
1425
|
import _5 from "lodash";
|
|
1361
|
-
import { useRef, useEffect, useCallback } from "react";
|
|
1426
|
+
import { useRef, useEffect as useEffect2, useCallback } from "react";
|
|
1362
1427
|
var useThrottledEffect = function(cb, delay, additionalDeps) {
|
|
1363
1428
|
var _cbRef;
|
|
1364
1429
|
var cbRef = useRef(cb);
|
|
@@ -1373,10 +1438,10 @@ var useThrottledEffect = function(cb, delay, additionalDeps) {
|
|
|
1373
1438
|
}), [
|
|
1374
1439
|
delay
|
|
1375
1440
|
]);
|
|
1376
|
-
|
|
1441
|
+
useEffect2(function() {
|
|
1377
1442
|
cbRef.current = cb;
|
|
1378
1443
|
});
|
|
1379
|
-
|
|
1444
|
+
useEffect2(throttledCb, [
|
|
1380
1445
|
throttledCb
|
|
1381
1446
|
].concat(_to_consumable_array(additionalDeps)));
|
|
1382
1447
|
};
|
|
@@ -1408,8 +1473,9 @@ var useInfiniteScroll = function(param) {
|
|
|
1408
1473
|
};
|
|
1409
1474
|
};
|
|
1410
1475
|
// src/hooks/runs/useManageRuns/index.tsx
|
|
1476
|
+
import { toast as toast3 } from "sonner";
|
|
1411
1477
|
import { useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
1412
|
-
import { useEffect as
|
|
1478
|
+
import { useEffect as useEffect3, useState } from "react";
|
|
1413
1479
|
// src/hooks/runs/useCreateRun/index.ts
|
|
1414
1480
|
import { partob } from "radash";
|
|
1415
1481
|
import { useMutation, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
@@ -1419,7 +1485,7 @@ var mutationOptions = function(param) {
|
|
|
1419
1485
|
var mutationKey = _to_consumable_array(mutationKeyBase).concat([
|
|
1420
1486
|
threadContext.variables
|
|
1421
1487
|
]);
|
|
1422
|
-
return
|
|
1488
|
+
return _object_spread_props(_object_spread({
|
|
1423
1489
|
mutationFn: function(variables) {
|
|
1424
1490
|
return fetch("".concat(superinterfaceContext.baseUrl).concat(path), _object_spread({
|
|
1425
1491
|
method: "POST",
|
|
@@ -1437,7 +1503,7 @@ var mutationOptions = function(param) {
|
|
|
1437
1503
|
case 0:
|
|
1438
1504
|
if (!(response.status !== 200)) return [
|
|
1439
1505
|
3,
|
|
1440
|
-
|
|
1506
|
+
5
|
|
1441
1507
|
];
|
|
1442
1508
|
_state.label = 1;
|
|
1443
1509
|
case 1:
|
|
@@ -1447,17 +1513,23 @@ var mutationOptions = function(param) {
|
|
|
1447
1513
|
,
|
|
1448
1514
|
4
|
|
1449
1515
|
]);
|
|
1516
|
+
console.log("response", response);
|
|
1450
1517
|
return [
|
|
1451
1518
|
4,
|
|
1452
1519
|
response.json()
|
|
1453
1520
|
];
|
|
1454
1521
|
case 2:
|
|
1455
1522
|
errorResponse = _state.sent();
|
|
1456
|
-
|
|
1523
|
+
return [
|
|
1524
|
+
3,
|
|
1525
|
+
4
|
|
1526
|
+
];
|
|
1457
1527
|
case 3:
|
|
1458
1528
|
error = _state.sent();
|
|
1459
1529
|
throw new Error("Failed to fetch");
|
|
1460
1530
|
case 4:
|
|
1531
|
+
throw new Error(errorResponse.error);
|
|
1532
|
+
case 5:
|
|
1461
1533
|
return [
|
|
1462
1534
|
2,
|
|
1463
1535
|
response.json()
|
|
@@ -1470,9 +1542,9 @@ var mutationOptions = function(param) {
|
|
|
1470
1542
|
};
|
|
1471
1543
|
}());
|
|
1472
1544
|
}
|
|
1473
|
-
}, queryClient.getMutationDefaults(mutationKey)), {
|
|
1545
|
+
}, threadContext.defaultOptions.mutations, queryClient.getMutationDefaults(mutationKey)), {
|
|
1474
1546
|
mutationKey: mutationKey
|
|
1475
|
-
})
|
|
1547
|
+
});
|
|
1476
1548
|
};
|
|
1477
1549
|
// src/hooks/runs/useCreateRun/lib/onSuccess.ts
|
|
1478
1550
|
var onSuccess = function(param) {
|
|
@@ -1691,7 +1763,22 @@ var useManageRuns = function() {
|
|
|
1691
1763
|
var latestMessageProps = useLatestMessage();
|
|
1692
1764
|
var createRunProps = useCreateRun();
|
|
1693
1765
|
var threadContext = useSuperinterfaceContext();
|
|
1694
|
-
|
|
1766
|
+
var _useState = _sliced_to_array(useState([]), 2), toastedErrorRunIds = _useState[0], setToastedErrorRunIds = _useState[1];
|
|
1767
|
+
useEffect3(function() {
|
|
1768
|
+
var _latestRunProps_latestRun;
|
|
1769
|
+
if (((_latestRunProps_latestRun = latestRunProps.latestRun) === null || _latestRunProps_latestRun === void 0 ? void 0 : _latestRunProps_latestRun.status) !== "failed") return;
|
|
1770
|
+
if (toastedErrorRunIds.includes(latestRunProps.latestRun.id)) return;
|
|
1771
|
+
setToastedErrorRunIds(function(prev) {
|
|
1772
|
+
return _to_consumable_array(prev).concat([
|
|
1773
|
+
latestRunProps.latestRun.id
|
|
1774
|
+
]);
|
|
1775
|
+
});
|
|
1776
|
+
toast3.error("AI run failed. Please try again.");
|
|
1777
|
+
}, [
|
|
1778
|
+
latestRunProps,
|
|
1779
|
+
toastedErrorRunIds
|
|
1780
|
+
]);
|
|
1781
|
+
useEffect3(function() {
|
|
1695
1782
|
if (createRunProps.isPending) return;
|
|
1696
1783
|
if (latestRunProps.isFetching) return;
|
|
1697
1784
|
if (latestMessageProps.isFetching) return;
|
|
@@ -1767,19 +1854,35 @@ var refetch = function() {
|
|
|
1767
1854
|
var usePolling = function() {
|
|
1768
1855
|
var threadContext = useSuperinterfaceContext();
|
|
1769
1856
|
var queryClient = useQueryClient6();
|
|
1857
|
+
var setIsPollRefetching = usePollingContext().setIsPollRefetching;
|
|
1770
1858
|
var isRunActiveProps = useIsRunActive();
|
|
1771
|
-
useInterval(function() {
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1859
|
+
useInterval(/*#__PURE__*/ _async_to_generator(function() {
|
|
1860
|
+
return _ts_generator(this, function(_state) {
|
|
1861
|
+
switch(_state.label){
|
|
1862
|
+
case 0:
|
|
1863
|
+
setIsPollRefetching(true);
|
|
1864
|
+
return [
|
|
1865
|
+
4,
|
|
1866
|
+
refetch({
|
|
1867
|
+
queryClient: queryClient,
|
|
1868
|
+
threadContext: threadContext
|
|
1869
|
+
})
|
|
1870
|
+
];
|
|
1871
|
+
case 1:
|
|
1872
|
+
_state.sent();
|
|
1873
|
+
setIsPollRefetching(false);
|
|
1874
|
+
console.log("Polling...");
|
|
1875
|
+
return [
|
|
1876
|
+
2
|
|
1877
|
+
];
|
|
1878
|
+
}
|
|
1775
1879
|
});
|
|
1776
|
-
|
|
1777
|
-
}, isRunActiveProps.isRunActive ? 3e3 : null);
|
|
1880
|
+
}), isRunActiveProps.isRunActive ? 3e3 : null);
|
|
1778
1881
|
return null;
|
|
1779
1882
|
};
|
|
1780
1883
|
// src/hooks/actions/useManageActions/index.tsx
|
|
1781
1884
|
import { useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
1782
|
-
import { useEffect as
|
|
1885
|
+
import { useEffect as useEffect4 } from "react";
|
|
1783
1886
|
// src/hooks/actions/useHandleAction/index.tsx
|
|
1784
1887
|
import { partob as partob2 } from "radash";
|
|
1785
1888
|
import { useMutation as useMutation2, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
@@ -1852,7 +1955,7 @@ var useManageActions = function() {
|
|
|
1852
1955
|
var threadContext = useSuperinterfaceContext();
|
|
1853
1956
|
var latestRunProps = useLatestRun();
|
|
1854
1957
|
var handleActionProps = useHandleAction();
|
|
1855
|
-
|
|
1958
|
+
useEffect4(function() {
|
|
1856
1959
|
if (handleActionProps.isPending) return;
|
|
1857
1960
|
if (latestRunProps.isFetching) return;
|
|
1858
1961
|
if (!latestRunProps.latestRun) return;
|
|
@@ -1884,7 +1987,7 @@ var useLifecycle = function() {
|
|
|
1884
1987
|
return null;
|
|
1885
1988
|
};
|
|
1886
1989
|
// src/components/threads/Thread/Messages/Root/index.tsx
|
|
1887
|
-
import { jsx as
|
|
1990
|
+
import { jsx as jsx35, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1888
1991
|
var Root = function(param) {
|
|
1889
1992
|
var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
|
|
1890
1993
|
var _useMessages = useMessages(), isFetchingNextPage = _useMessages.isFetchingNextPage, hasNextPage = _useMessages.hasNextPage, fetchNextPage = _useMessages.fetchNextPage;
|
|
@@ -1894,7 +1997,7 @@ var Root = function(param) {
|
|
|
1894
1997
|
hasNextPage: hasNextPage,
|
|
1895
1998
|
fetchNextPage: fetchNextPage
|
|
1896
1999
|
}), containerRef = _useInfiniteScroll.containerRef, loaderRef = _useInfiniteScroll.loaderRef;
|
|
1897
|
-
return /* @__PURE__ */
|
|
2000
|
+
return /* @__PURE__ */ jsxs11(Flex11, {
|
|
1898
2001
|
ref: containerRef,
|
|
1899
2002
|
direction: "column-reverse",
|
|
1900
2003
|
flexGrow: "1",
|
|
@@ -1903,10 +2006,10 @@ var Root = function(param) {
|
|
|
1903
2006
|
}),
|
|
1904
2007
|
children: [
|
|
1905
2008
|
children,
|
|
1906
|
-
hasNextPage && /* @__PURE__ */
|
|
2009
|
+
hasNextPage && /* @__PURE__ */ jsx35(Flex11, {
|
|
1907
2010
|
ref: loaderRef
|
|
1908
2011
|
}),
|
|
1909
|
-
/* @__PURE__ */
|
|
2012
|
+
/* @__PURE__ */ jsx35(Flex11, {
|
|
1910
2013
|
flexShrink: "0",
|
|
1911
2014
|
flexGrow: "1"
|
|
1912
2015
|
})
|
|
@@ -1914,30 +2017,30 @@ var Root = function(param) {
|
|
|
1914
2017
|
});
|
|
1915
2018
|
};
|
|
1916
2019
|
// src/components/threads/Thread/Messages/NextPageSkeleton.tsx
|
|
1917
|
-
import { jsx as
|
|
2020
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
1918
2021
|
var NextPageSkeleton = function() {
|
|
1919
2022
|
var hasNextPage = useMessages().hasNextPage;
|
|
1920
2023
|
if (!hasNextPage) {
|
|
1921
2024
|
return null;
|
|
1922
2025
|
}
|
|
1923
|
-
return /* @__PURE__ */
|
|
2026
|
+
return /* @__PURE__ */ jsx36(MessagesSkeleton, {});
|
|
1924
2027
|
};
|
|
1925
2028
|
// src/components/threads/Thread/Messages/index.tsx
|
|
1926
|
-
import { jsx as
|
|
2029
|
+
import { jsx as jsx37, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1927
2030
|
var Messages = function(param) {
|
|
1928
2031
|
var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
|
|
1929
|
-
return /* @__PURE__ */
|
|
2032
|
+
return /* @__PURE__ */ jsxs12(Root, {
|
|
1930
2033
|
style: style,
|
|
1931
2034
|
children: [
|
|
1932
|
-
/* @__PURE__ */
|
|
2035
|
+
/* @__PURE__ */ jsx37(Flex12, {
|
|
1933
2036
|
flexShrink: "0",
|
|
1934
2037
|
height: "var(--space-3)"
|
|
1935
2038
|
}),
|
|
1936
|
-
/* @__PURE__ */
|
|
2039
|
+
/* @__PURE__ */ jsx37(Progress, {}),
|
|
1937
2040
|
children,
|
|
1938
|
-
/* @__PURE__ */
|
|
1939
|
-
/* @__PURE__ */
|
|
1940
|
-
/* @__PURE__ */
|
|
2041
|
+
/* @__PURE__ */ jsx37(Content3, {}),
|
|
2042
|
+
/* @__PURE__ */ jsx37(NextPageSkeleton, {}),
|
|
2043
|
+
/* @__PURE__ */ jsx37(Flex12, {
|
|
1941
2044
|
flexShrink: "0",
|
|
1942
2045
|
flexGrow: "1"
|
|
1943
2046
|
})
|
|
@@ -1948,45 +2051,21 @@ Messages.Root = Root;
|
|
|
1948
2051
|
Messages.Message = Message;
|
|
1949
2052
|
Messages.NextPageSkeleton = NextPageSkeleton;
|
|
1950
2053
|
// src/components/threads/Thread/MessageForm/index.tsx
|
|
1951
|
-
import { Flex as
|
|
2054
|
+
import { Flex as Flex14, Text as Text5 } from "@radix-ui/themes";
|
|
1952
2055
|
// src/components/threads/Thread/MessageForm/Submit/index.tsx
|
|
1953
2056
|
import { ArrowUpIcon } from "@radix-ui/react-icons";
|
|
1954
|
-
import { Button as Button2 } from "@radix-ui/themes";
|
|
1955
|
-
// src/components/spinners/Spinner/index.tsx
|
|
1956
|
-
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
1957
|
-
var Spinner = function(props) {
|
|
1958
|
-
return /* @__PURE__ */ jsx37("svg", _object_spread_props(_object_spread({
|
|
1959
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1960
|
-
width: "24",
|
|
1961
|
-
height: "24",
|
|
1962
|
-
viewBox: "0 0 24 24",
|
|
1963
|
-
fill: "none",
|
|
1964
|
-
stroke: "currentColor",
|
|
1965
|
-
strokeWidth: "2",
|
|
1966
|
-
strokeLinecap: "round",
|
|
1967
|
-
strokeLinejoin: "round",
|
|
1968
|
-
style: {
|
|
1969
|
-
height: "var(--space-4)",
|
|
1970
|
-
width: "var(--space-4)",
|
|
1971
|
-
animation: "spin 1s linear infinite"
|
|
1972
|
-
}
|
|
1973
|
-
}, props), {
|
|
1974
|
-
children: /* @__PURE__ */ jsx37("path", {
|
|
1975
|
-
d: "M21 12a9 9 0 1 1-6.219-8.56"
|
|
1976
|
-
})
|
|
1977
|
-
}));
|
|
1978
|
-
};
|
|
2057
|
+
import { Button as Button2, Spinner } from "@radix-ui/themes";
|
|
1979
2058
|
// src/hooks/messages/useMessageFormContext/index.ts
|
|
1980
|
-
import { useContext as
|
|
2059
|
+
import { useContext as useContext8 } from "react";
|
|
1981
2060
|
// src/contexts/messages/MessageFormContext/index.ts
|
|
1982
|
-
import { createContext as
|
|
1983
|
-
var MessageFormContext =
|
|
2061
|
+
import { createContext as createContext8 } from "react";
|
|
2062
|
+
var MessageFormContext = createContext8({
|
|
1984
2063
|
isDisabled: false,
|
|
1985
2064
|
isLoading: false
|
|
1986
2065
|
});
|
|
1987
2066
|
// src/hooks/messages/useMessageFormContext/index.ts
|
|
1988
2067
|
var useMessageFormContext = function() {
|
|
1989
|
-
return
|
|
2068
|
+
return useContext8(MessageFormContext);
|
|
1990
2069
|
};
|
|
1991
2070
|
// src/components/threads/Thread/MessageForm/Submit/index.tsx
|
|
1992
2071
|
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
@@ -1995,8 +2074,11 @@ var Submit = function() {
|
|
|
1995
2074
|
return /* @__PURE__ */ jsx38(Button2, {
|
|
1996
2075
|
type: "submit",
|
|
1997
2076
|
radius: "large",
|
|
1998
|
-
disabled: isDisabled,
|
|
1999
|
-
children:
|
|
2077
|
+
disabled: isDisabled || isLoading,
|
|
2078
|
+
children: /* @__PURE__ */ jsx38(Spinner, {
|
|
2079
|
+
loading: isLoading,
|
|
2080
|
+
children: /* @__PURE__ */ jsx38(ArrowUpIcon, {})
|
|
2081
|
+
})
|
|
2000
2082
|
});
|
|
2001
2083
|
};
|
|
2002
2084
|
// src/components/threads/Thread/MessageForm/Root/index.tsx
|
|
@@ -2242,32 +2324,42 @@ var Root2 = function(param) {
|
|
|
2242
2324
|
};
|
|
2243
2325
|
// src/components/threads/Thread/MessageForm/Field/index.tsx
|
|
2244
2326
|
import { usePrevious } from "react-use";
|
|
2245
|
-
import { useContext as
|
|
2327
|
+
import { useContext as useContext9, useMemo as useMemo10, useRef as useRef3, useEffect as useEffect5 } from "react";
|
|
2246
2328
|
// src/components/textareas/TextareaBase/index.tsx
|
|
2247
2329
|
import { forwardRef as forwardRef3 } from "react";
|
|
2248
2330
|
import TextareaAutosize from "react-textarea-autosize";
|
|
2249
|
-
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
2331
|
+
import { Fragment as Fragment2, jsx as jsx40, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2250
2332
|
var UPSCALE_RATIO = 16 / 14;
|
|
2251
2333
|
var TextareaBase = forwardRef3(function TextareaBase2(props, ref) {
|
|
2252
|
-
return /* @__PURE__ */
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2334
|
+
return /* @__PURE__ */ jsxs13(Fragment2, {
|
|
2335
|
+
children: [
|
|
2336
|
+
/* @__PURE__ */ jsx40("style", {
|
|
2337
|
+
children: ".superinterface-textarea { min-height: inherit; height: 30px; }"
|
|
2338
|
+
}),
|
|
2339
|
+
/* @__PURE__ */ jsx40(TextareaAutosize, _object_spread({
|
|
2340
|
+
ref: ref,
|
|
2341
|
+
className: "rt-reset superinterface-textarea",
|
|
2342
|
+
style: {
|
|
2343
|
+
border: 0,
|
|
2344
|
+
outline: 0,
|
|
2345
|
+
boxSizing: "border-box",
|
|
2346
|
+
resize: "none",
|
|
2347
|
+
fontSize: "".concat(14 * UPSCALE_RATIO, "px"),
|
|
2348
|
+
lineHeight: "".concat(24 * UPSCALE_RATIO, "px"),
|
|
2349
|
+
transform: "scale(".concat(1 / UPSCALE_RATIO, ")"),
|
|
2350
|
+
margin: "0 ".concat((-100 * UPSCALE_RATIO + 100) / 2, "%"),
|
|
2351
|
+
width: "".concat(100 * UPSCALE_RATIO, "%"),
|
|
2352
|
+
maxWidth: "".concat(100 * UPSCALE_RATIO, "%"),
|
|
2353
|
+
flexGrow: 1,
|
|
2354
|
+
display: "flex"
|
|
2355
|
+
}
|
|
2356
|
+
}, props))
|
|
2357
|
+
]
|
|
2358
|
+
});
|
|
2267
2359
|
});
|
|
2268
2360
|
// src/components/threads/Thread/MessageForm/Field/index.tsx
|
|
2269
2361
|
import { useFormContext } from "react-hook-form";
|
|
2270
|
-
import { Container as Container2, Flex as
|
|
2362
|
+
import { Container as Container2, Flex as Flex13 } from "@radix-ui/themes";
|
|
2271
2363
|
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
2272
2364
|
var Root3 = function(param) {
|
|
2273
2365
|
var children = param.children;
|
|
@@ -2275,13 +2367,13 @@ var Root3 = function(param) {
|
|
|
2275
2367
|
return /* @__PURE__ */ jsx41(Container2, {
|
|
2276
2368
|
size: "2",
|
|
2277
2369
|
flexGrow: "0",
|
|
2278
|
-
children: /* @__PURE__ */ jsx41(
|
|
2370
|
+
children: /* @__PURE__ */ jsx41(Flex13, {
|
|
2279
2371
|
direction: "column",
|
|
2280
2372
|
flexShrink: "0",
|
|
2281
|
-
children: /* @__PURE__ */ jsx41(
|
|
2373
|
+
children: /* @__PURE__ */ jsx41(Flex13, {
|
|
2282
2374
|
direction: "column",
|
|
2283
2375
|
flexShrink: "0",
|
|
2284
|
-
children: /* @__PURE__ */ jsx41(
|
|
2376
|
+
children: /* @__PURE__ */ jsx41(Flex13, {
|
|
2285
2377
|
style: _object_spread({
|
|
2286
2378
|
borderRadius: "var(--radius-2)",
|
|
2287
2379
|
borderWidth: "1px",
|
|
@@ -2299,7 +2391,7 @@ var Root3 = function(param) {
|
|
|
2299
2391
|
});
|
|
2300
2392
|
};
|
|
2301
2393
|
var Control = function() {
|
|
2302
|
-
var assistantNameContext =
|
|
2394
|
+
var assistantNameContext = useContext9(AssistantNameContext);
|
|
2303
2395
|
var register = useFormContext().register;
|
|
2304
2396
|
var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading;
|
|
2305
2397
|
var isSubmitDisabled = useMemo10(function() {
|
|
@@ -2311,7 +2403,7 @@ var Control = function() {
|
|
|
2311
2403
|
var isDisabledPrevious = usePrevious(isDisabled);
|
|
2312
2404
|
var textareaRef = useRef3(null);
|
|
2313
2405
|
var textareaProps = register("content");
|
|
2314
|
-
|
|
2406
|
+
useEffect5(function() {
|
|
2315
2407
|
if (isDisabled) return;
|
|
2316
2408
|
if (!isDisabledPrevious) return;
|
|
2317
2409
|
if (!textareaRef.current) return;
|
|
@@ -2345,23 +2437,23 @@ var Field = {
|
|
|
2345
2437
|
Control: Control
|
|
2346
2438
|
};
|
|
2347
2439
|
// src/components/threads/Thread/MessageForm/index.tsx
|
|
2348
|
-
import { jsx as jsx42, jsxs as
|
|
2440
|
+
import { jsx as jsx42, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2349
2441
|
var MessageForm = function() {
|
|
2350
2442
|
return /* @__PURE__ */ jsx42(Root2, {
|
|
2351
|
-
children: /* @__PURE__ */
|
|
2443
|
+
children: /* @__PURE__ */ jsxs14(Field.Root, {
|
|
2352
2444
|
children: [
|
|
2353
2445
|
/* @__PURE__ */ jsx42(Text5, {
|
|
2354
2446
|
size: "2",
|
|
2355
2447
|
style: {
|
|
2356
2448
|
flexGrow: 1
|
|
2357
2449
|
},
|
|
2358
|
-
children: /* @__PURE__ */ jsx42(
|
|
2450
|
+
children: /* @__PURE__ */ jsx42(Flex14, {
|
|
2359
2451
|
flexGrow: "1",
|
|
2360
2452
|
direction: "column",
|
|
2361
2453
|
children: /* @__PURE__ */ jsx42(Field.Control, {})
|
|
2362
2454
|
})
|
|
2363
2455
|
}),
|
|
2364
|
-
/* @__PURE__ */ jsx42(
|
|
2456
|
+
/* @__PURE__ */ jsx42(Flex14, {
|
|
2365
2457
|
flexShrink: "0",
|
|
2366
2458
|
align: "end",
|
|
2367
2459
|
children: /* @__PURE__ */ jsx42(Submit, {})
|
|
@@ -2374,14 +2466,36 @@ MessageForm.Root = Root2;
|
|
|
2374
2466
|
MessageForm.Field = Field;
|
|
2375
2467
|
MessageForm.Submit = Submit;
|
|
2376
2468
|
// src/components/threads/Thread/Root/index.tsx
|
|
2377
|
-
import { Flex as
|
|
2469
|
+
import { Flex as Flex15 } from "@radix-ui/themes";
|
|
2470
|
+
// src/components/runs/PollingProvider/index.tsx
|
|
2471
|
+
import { useState as useState2 } from "react";
|
|
2378
2472
|
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
2473
|
+
var PollingProvider = function(param) {
|
|
2474
|
+
var children = param.children;
|
|
2475
|
+
var _useState2 = _sliced_to_array(useState2(false), 2), isPollRefetching = _useState2[0], setIsPollRefetching = _useState2[1];
|
|
2476
|
+
return /* @__PURE__ */ jsx43(PollingContext.Provider, {
|
|
2477
|
+
value: {
|
|
2478
|
+
isPollRefetching: isPollRefetching,
|
|
2479
|
+
setIsPollRefetching: setIsPollRefetching
|
|
2480
|
+
},
|
|
2481
|
+
children: children
|
|
2482
|
+
});
|
|
2483
|
+
};
|
|
2484
|
+
// src/components/threads/Thread/Provider/index.tsx
|
|
2485
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
2486
|
+
var Provider2 = function(args) {
|
|
2487
|
+
return /* @__PURE__ */ jsx44(PollingProvider, {
|
|
2488
|
+
children: /* @__PURE__ */ jsx44(SuperinterfaceProvider, _object_spread({}, args))
|
|
2489
|
+
});
|
|
2490
|
+
};
|
|
2491
|
+
// src/components/threads/Thread/Root/index.tsx
|
|
2492
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
2379
2493
|
var Root4 = function(_param) {
|
|
2380
2494
|
var children = _param.children, rest = _object_without_properties(_param, [
|
|
2381
2495
|
"children"
|
|
2382
2496
|
]);
|
|
2383
|
-
return /* @__PURE__ */
|
|
2384
|
-
children: /* @__PURE__ */
|
|
2497
|
+
return /* @__PURE__ */ jsx45(Provider2, _object_spread_props(_object_spread({}, rest), {
|
|
2498
|
+
children: /* @__PURE__ */ jsx45(Flex15, {
|
|
2385
2499
|
direction: "column",
|
|
2386
2500
|
flexGrow: "1",
|
|
2387
2501
|
children: children
|
|
@@ -2389,40 +2503,45 @@ var Root4 = function(_param) {
|
|
|
2389
2503
|
}));
|
|
2390
2504
|
};
|
|
2391
2505
|
// src/components/threads/Thread/index.tsx
|
|
2392
|
-
import { jsx as
|
|
2506
|
+
import { jsx as jsx46, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2393
2507
|
var Thread = function(props) {
|
|
2394
|
-
return /* @__PURE__ */
|
|
2508
|
+
return /* @__PURE__ */ jsxs15(Root4, _object_spread_props(_object_spread({}, props), {
|
|
2395
2509
|
children: [
|
|
2396
|
-
/* @__PURE__ */
|
|
2397
|
-
/* @__PURE__ */
|
|
2510
|
+
/* @__PURE__ */ jsx46(Messages, {}),
|
|
2511
|
+
/* @__PURE__ */ jsx46(MessageForm, {})
|
|
2398
2512
|
]
|
|
2399
2513
|
}));
|
|
2400
2514
|
};
|
|
2401
2515
|
Thread.Root = Root4;
|
|
2402
2516
|
Thread.Messages = Messages;
|
|
2403
2517
|
Thread.MessageForm = MessageForm;
|
|
2518
|
+
// src/hooks/messages/useMessageContext/index.ts
|
|
2519
|
+
import { useContext as useContext10 } from "react";
|
|
2520
|
+
var useMessageContext = function() {
|
|
2521
|
+
return useContext10(MessageContext);
|
|
2522
|
+
};
|
|
2404
2523
|
// src/components/threads/ThreadDialog/Root/index.tsx
|
|
2405
|
-
import { Flex as
|
|
2524
|
+
import { Flex as Flex16 } from "@radix-ui/themes";
|
|
2406
2525
|
// src/components/threads/ThreadDialog/Provider/index.tsx
|
|
2407
|
-
import { useState } from "react";
|
|
2526
|
+
import { useState as useState3 } from "react";
|
|
2408
2527
|
// src/contexts/threads/ThreadDialogContext/index.ts
|
|
2409
|
-
import { createContext as
|
|
2410
|
-
var ThreadDialogContext =
|
|
2528
|
+
import { createContext as createContext9 } from "react";
|
|
2529
|
+
var ThreadDialogContext = createContext9({
|
|
2411
2530
|
isOpen: false,
|
|
2412
2531
|
setIsOpen: function() {}
|
|
2413
2532
|
});
|
|
2414
2533
|
// src/hooks/threads/useThreadDialogContext/index.ts
|
|
2415
|
-
import { useContext as
|
|
2534
|
+
import { useContext as useContext11 } from "react";
|
|
2416
2535
|
var useThreadDialogContext = function() {
|
|
2417
|
-
return
|
|
2536
|
+
return useContext11(ThreadDialogContext);
|
|
2418
2537
|
};
|
|
2419
2538
|
// src/components/threads/ThreadDialog/Provider/index.tsx
|
|
2420
|
-
import { jsx as
|
|
2421
|
-
var
|
|
2539
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
2540
|
+
var Provider3 = function(param) {
|
|
2422
2541
|
var children = param.children;
|
|
2423
2542
|
var threadDialogContext = useThreadDialogContext();
|
|
2424
|
-
var
|
|
2425
|
-
return /* @__PURE__ */
|
|
2543
|
+
var _useState3 = _sliced_to_array(useState3(threadDialogContext.isOpen), 2), isOpen = _useState3[0], setIsOpen = _useState3[1];
|
|
2544
|
+
return /* @__PURE__ */ jsx47(ThreadDialogContext.Provider, {
|
|
2426
2545
|
value: {
|
|
2427
2546
|
isOpen: isOpen,
|
|
2428
2547
|
setIsOpen: setIsOpen
|
|
@@ -2431,11 +2550,11 @@ var Provider = function(param) {
|
|
|
2431
2550
|
});
|
|
2432
2551
|
};
|
|
2433
2552
|
// src/components/threads/ThreadDialog/Root/index.tsx
|
|
2434
|
-
import { jsx as
|
|
2553
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
2435
2554
|
var Root5 = function(param) {
|
|
2436
2555
|
var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
|
|
2437
|
-
return /* @__PURE__ */
|
|
2438
|
-
children: /* @__PURE__ */
|
|
2556
|
+
return /* @__PURE__ */ jsx48(Provider3, {
|
|
2557
|
+
children: /* @__PURE__ */ jsx48(Flex16, {
|
|
2439
2558
|
direction: "column",
|
|
2440
2559
|
justify: "end",
|
|
2441
2560
|
align: "end",
|
|
@@ -2451,12 +2570,12 @@ var Root5 = function(param) {
|
|
|
2451
2570
|
});
|
|
2452
2571
|
};
|
|
2453
2572
|
// src/components/threads/ThreadDialog/Trigger/index.tsx
|
|
2454
|
-
import { Flex as
|
|
2455
|
-
import { jsx as
|
|
2573
|
+
import { Flex as Flex17 } from "@radix-ui/themes";
|
|
2574
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
2456
2575
|
var Trigger = function(param) {
|
|
2457
2576
|
var children = param.children;
|
|
2458
2577
|
var setIsOpen = useThreadDialogContext().setIsOpen;
|
|
2459
|
-
return /* @__PURE__ */
|
|
2578
|
+
return /* @__PURE__ */ jsx49(Flex17, {
|
|
2460
2579
|
onClick: function() {
|
|
2461
2580
|
return setIsOpen(function(prev) {
|
|
2462
2581
|
return !prev;
|
|
@@ -2470,22 +2589,22 @@ var Trigger = function(param) {
|
|
|
2470
2589
|
// src/components/threads/ThreadDialog/Button/index.tsx
|
|
2471
2590
|
import { IconButton } from "@radix-ui/themes";
|
|
2472
2591
|
import { ChatBubbleIcon } from "@radix-ui/react-icons";
|
|
2473
|
-
import { jsx as
|
|
2592
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
2474
2593
|
var Button3 = function() {
|
|
2475
|
-
return /* @__PURE__ */
|
|
2594
|
+
return /* @__PURE__ */ jsx50(IconButton, {
|
|
2476
2595
|
size: "4",
|
|
2477
2596
|
radius: "full",
|
|
2478
|
-
children: /* @__PURE__ */
|
|
2597
|
+
children: /* @__PURE__ */ jsx50(ChatBubbleIcon, {})
|
|
2479
2598
|
});
|
|
2480
2599
|
};
|
|
2481
2600
|
// src/components/threads/ThreadDialog/Content/index.tsx
|
|
2482
|
-
import { Card, Inset, Flex as
|
|
2483
|
-
import { jsx as
|
|
2601
|
+
import { Card, Inset, Flex as Flex18 } from "@radix-ui/themes";
|
|
2602
|
+
import { jsx as jsx51, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2484
2603
|
var Root6 = function(param) {
|
|
2485
2604
|
var children = param.children;
|
|
2486
2605
|
var isOpen = useThreadDialogContext().isOpen;
|
|
2487
2606
|
if (!isOpen) return null;
|
|
2488
|
-
return /* @__PURE__ */
|
|
2607
|
+
return /* @__PURE__ */ jsx51(Card, {
|
|
2489
2608
|
mb: "3",
|
|
2490
2609
|
style: {
|
|
2491
2610
|
display: "flex",
|
|
@@ -2494,7 +2613,7 @@ var Root6 = function(param) {
|
|
|
2494
2613
|
maxWidth: "400px",
|
|
2495
2614
|
maxHeight: "720px"
|
|
2496
2615
|
},
|
|
2497
|
-
children: /* @__PURE__ */
|
|
2616
|
+
children: /* @__PURE__ */ jsx51(Inset, {
|
|
2498
2617
|
clip: "padding-box",
|
|
2499
2618
|
side: "all",
|
|
2500
2619
|
pb: "current",
|
|
@@ -2507,21 +2626,23 @@ var Root6 = function(param) {
|
|
|
2507
2626
|
});
|
|
2508
2627
|
};
|
|
2509
2628
|
var Content4 = function() {
|
|
2510
|
-
return /* @__PURE__ */
|
|
2511
|
-
children: /* @__PURE__ */
|
|
2629
|
+
return /* @__PURE__ */ jsx51(Root6, {
|
|
2630
|
+
children: /* @__PURE__ */ jsxs16(Thread.Root, {
|
|
2512
2631
|
children: [
|
|
2513
|
-
/* @__PURE__ */
|
|
2632
|
+
/* @__PURE__ */ jsx51(Thread.Messages, {
|
|
2514
2633
|
style: {
|
|
2515
|
-
|
|
2634
|
+
paddingTop: "var(--space-5)",
|
|
2635
|
+
paddingRight: "var(--space-5)",
|
|
2636
|
+
paddingLeft: "var(--space-5)"
|
|
2516
2637
|
}
|
|
2517
2638
|
}),
|
|
2518
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ jsx51(Flex18, {
|
|
2519
2640
|
direction: "column",
|
|
2520
2641
|
pl: "5",
|
|
2521
2642
|
pr: "5",
|
|
2522
2643
|
pb: "3",
|
|
2523
2644
|
flexShrink: "0",
|
|
2524
|
-
children: /* @__PURE__ */
|
|
2645
|
+
children: /* @__PURE__ */ jsx51(Thread.MessageForm, {})
|
|
2525
2646
|
})
|
|
2526
2647
|
]
|
|
2527
2648
|
})
|
|
@@ -2529,13 +2650,13 @@ var Content4 = function() {
|
|
|
2529
2650
|
};
|
|
2530
2651
|
Content4.Root = Root6;
|
|
2531
2652
|
// src/components/threads/ThreadDialog/index.tsx
|
|
2532
|
-
import { jsx as
|
|
2653
|
+
import { jsx as jsx52, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2533
2654
|
var ThreadDialog = function() {
|
|
2534
|
-
return /* @__PURE__ */
|
|
2655
|
+
return /* @__PURE__ */ jsxs17(Root5, {
|
|
2535
2656
|
children: [
|
|
2536
|
-
/* @__PURE__ */
|
|
2537
|
-
/* @__PURE__ */
|
|
2538
|
-
children: /* @__PURE__ */
|
|
2657
|
+
/* @__PURE__ */ jsx52(Content4, {}),
|
|
2658
|
+
/* @__PURE__ */ jsx52(Trigger, {
|
|
2659
|
+
children: /* @__PURE__ */ jsx52(Button3, {})
|
|
2539
2660
|
})
|
|
2540
2661
|
]
|
|
2541
2662
|
});
|
|
@@ -2546,12 +2667,10 @@ ThreadDialog.Button = Button3;
|
|
|
2546
2667
|
ThreadDialog.Content = Content4;
|
|
2547
2668
|
// src/components/threads/AudioThread/Root/index.tsx
|
|
2548
2669
|
import "regenerator-runtime/runtime";
|
|
2549
|
-
import {
|
|
2550
|
-
import { Flex as Flex20 } from "@radix-ui/themes";
|
|
2551
|
-
import SpeechRecognition, { useSpeechRecognition } from "react-speech-recognition";
|
|
2670
|
+
import { Flex as Flex19 } from "@radix-ui/themes";
|
|
2552
2671
|
// src/contexts/threads/AudioThreadContext/index.ts
|
|
2553
|
-
import { createContext as
|
|
2554
|
-
var AudioThreadContext =
|
|
2672
|
+
import { createContext as createContext10 } from "react";
|
|
2673
|
+
var AudioThreadContext = createContext10({
|
|
2555
2674
|
status: "idle",
|
|
2556
2675
|
recorderProps: {
|
|
2557
2676
|
status: "idle",
|
|
@@ -2608,6 +2727,16 @@ var AudioThreadContext = createContext8({
|
|
|
2608
2727
|
});
|
|
2609
2728
|
// src/components/threads/AudioThread/Root/index.tsx
|
|
2610
2729
|
import { usePermission } from "react-use";
|
|
2730
|
+
// src/components/threads/AudioThread/Root/lib/blobToData.ts
|
|
2731
|
+
var blobToData = function(blob) {
|
|
2732
|
+
return new Promise(function(resolve) {
|
|
2733
|
+
var reader = new FileReader();
|
|
2734
|
+
reader.onloadend = function() {
|
|
2735
|
+
return resolve(reader.result);
|
|
2736
|
+
};
|
|
2737
|
+
reader.readAsDataURL(blob);
|
|
2738
|
+
});
|
|
2739
|
+
};
|
|
2611
2740
|
// src/hooks/audioThreads/useStatus/index.ts
|
|
2612
2741
|
import { useMemo as useMemo11 } from "react";
|
|
2613
2742
|
var useStatus = function(param) {
|
|
@@ -2636,27 +2765,21 @@ var useStatus = function(param) {
|
|
|
2636
2765
|
// src/hooks/audioThreads/useRecorder/index.ts
|
|
2637
2766
|
import dayjs from "dayjs";
|
|
2638
2767
|
import { useAudioCapture } from "use-audio-capture";
|
|
2639
|
-
import { useMemo as useMemo12, useRef as useRef4, useState as
|
|
2768
|
+
import { useMemo as useMemo12, useRef as useRef4, useState as useState4, useCallback as useCallback2, useEffect as useEffect6 } from "react";
|
|
2640
2769
|
import { useAudioPlayer } from "react-use-audio-player";
|
|
2641
2770
|
import { useInterval as useInterval2 } from "react-use";
|
|
2642
2771
|
var useRecorder = function(param) {
|
|
2643
2772
|
var isStopOnSilence = param.isStopOnSilence, onStart = param.onStart, onStop = param.onStop;
|
|
2644
|
-
var
|
|
2645
|
-
var
|
|
2646
|
-
var
|
|
2647
|
-
var
|
|
2773
|
+
var _useState4 = _sliced_to_array(useState4(null), 2), silenceStart = _useState4[0], setSilenceStart = _useState4[1];
|
|
2774
|
+
var _useState41 = _sliced_to_array(useState4(null), 2), noiseStart = _useState41[0], setNoiseStart = _useState41[1];
|
|
2775
|
+
var _useState42 = _sliced_to_array(useState4(null), 2), mediaStream = _useState42[0], setMediaStream = _useState42[1];
|
|
2776
|
+
var _useState43 = _sliced_to_array(useState4("idle"), 2), status = _useState43[0], setStatus = _useState43[1];
|
|
2648
2777
|
var startAudioPlayer = useAudioPlayer();
|
|
2649
2778
|
var endAudioPlayer = useAudioPlayer();
|
|
2650
|
-
var
|
|
2651
|
-
|
|
2779
|
+
var _useState44 = _sliced_to_array(useState4(false), 2), isLoaded = _useState44[0], setIsLoaded = _useState44[1];
|
|
2780
|
+
useEffect6(function() {
|
|
2652
2781
|
if (isLoaded) return;
|
|
2653
2782
|
setIsLoaded(true);
|
|
2654
|
-
startAudioPlayer.load("/sounds/warning.wav", {
|
|
2655
|
-
html5: true
|
|
2656
|
-
});
|
|
2657
|
-
endAudioPlayer.load("/sounds/success.wav", {
|
|
2658
|
-
html5: true
|
|
2659
|
-
});
|
|
2660
2783
|
}, [
|
|
2661
2784
|
isLoaded,
|
|
2662
2785
|
startAudioPlayer,
|
|
@@ -2664,7 +2787,6 @@ var useRecorder = function(param) {
|
|
|
2664
2787
|
]);
|
|
2665
2788
|
var audioCaptureProps = useAudioCapture({
|
|
2666
2789
|
onStart: function(event, opts) {
|
|
2667
|
-
startAudioPlayer.play();
|
|
2668
2790
|
setStatus("recording");
|
|
2669
2791
|
setMediaStream(opts.mediaStream);
|
|
2670
2792
|
isInited.current = false;
|
|
@@ -2681,7 +2803,6 @@ var useRecorder = function(param) {
|
|
|
2681
2803
|
for(_len = _arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
2682
2804
|
args[_key] = _arguments[_key];
|
|
2683
2805
|
}
|
|
2684
|
-
endAudioPlayer.play();
|
|
2685
2806
|
setStatus("stopped");
|
|
2686
2807
|
if (!onStop) return [
|
|
2687
2808
|
3,
|
|
@@ -2714,9 +2835,9 @@ var useRecorder = function(param) {
|
|
|
2714
2835
|
setNoiseStart(null);
|
|
2715
2836
|
}
|
|
2716
2837
|
});
|
|
2717
|
-
var
|
|
2838
|
+
var _useState45 = _sliced_to_array(useState4(null), 2), audioEngine = _useState45[0], setAudioEngine = _useState45[1];
|
|
2718
2839
|
var isInited = useRef4(false);
|
|
2719
|
-
|
|
2840
|
+
useEffect6(function() {
|
|
2720
2841
|
if (!mediaStream) return;
|
|
2721
2842
|
if (isInited.current) return;
|
|
2722
2843
|
isInited.current = true;
|
|
@@ -2769,7 +2890,7 @@ var useRecorder = function(param) {
|
|
|
2769
2890
|
setNoiseStart,
|
|
2770
2891
|
setSilenceStart
|
|
2771
2892
|
]);
|
|
2772
|
-
|
|
2893
|
+
useEffect6(function() {
|
|
2773
2894
|
if (!isStopOnSilence) return;
|
|
2774
2895
|
requestAnimationFrame(function() {
|
|
2775
2896
|
return handleSilence();
|
|
@@ -2792,7 +2913,7 @@ var useRecorder = function(param) {
|
|
|
2792
2913
|
});
|
|
2793
2914
|
};
|
|
2794
2915
|
// src/hooks/audioThreads/useMessageAudio/index.ts
|
|
2795
|
-
import { useMemo as useMemo13, useRef as useRef5, useState as
|
|
2916
|
+
import { useMemo as useMemo13, useRef as useRef5, useState as useState5, useEffect as useEffect7 } from "react";
|
|
2796
2917
|
import { Howler } from "howler";
|
|
2797
2918
|
import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
|
|
2798
2919
|
// src/hooks/audioThreads/useMessageAudio/lib/input.ts
|
|
@@ -2818,11 +2939,11 @@ var isHtmlAudioSupported = !unsupportedNames.includes(((_detect = detect()) ===
|
|
|
2818
2939
|
// src/hooks/audioThreads/useMessageAudio/index.ts
|
|
2819
2940
|
var useMessageAudio = function(param) {
|
|
2820
2941
|
var onEnd = param.onEnd;
|
|
2821
|
-
var
|
|
2942
|
+
var _useState5 = _sliced_to_array(useState5([]), 2), playedMessageIds = _useState5[0], setPlayedMessageIds = _useState5[1];
|
|
2822
2943
|
var audioPlayer = useAudioPlayer2();
|
|
2823
2944
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
2824
2945
|
var latestMessageProps = useLatestMessage();
|
|
2825
|
-
|
|
2946
|
+
useEffect7(function() {
|
|
2826
2947
|
if (audioPlayer.playing) return;
|
|
2827
2948
|
if (!latestMessageProps.latestMessage) return;
|
|
2828
2949
|
if (latestMessageProps.latestMessage.role !== "assistant") return;
|
|
@@ -2840,7 +2961,14 @@ var useMessageAudio = function(param) {
|
|
|
2840
2961
|
format: "mp3",
|
|
2841
2962
|
autoplay: true,
|
|
2842
2963
|
html5: isHtmlAudioSupported,
|
|
2843
|
-
onend: onEnd
|
|
2964
|
+
onend: onEnd,
|
|
2965
|
+
xhr: _object_spread_props(_object_spread({}, superinterfaceContext.publicApiKey ? {
|
|
2966
|
+
headers: {
|
|
2967
|
+
Authorization: "Bearer ".concat(superinterfaceContext.publicApiKey)
|
|
2968
|
+
}
|
|
2969
|
+
} : {}), {
|
|
2970
|
+
withCredentials: true
|
|
2971
|
+
})
|
|
2844
2972
|
});
|
|
2845
2973
|
}, [
|
|
2846
2974
|
superinterfaceContext,
|
|
@@ -2850,8 +2978,8 @@ var useMessageAudio = function(param) {
|
|
|
2850
2978
|
onEnd
|
|
2851
2979
|
]);
|
|
2852
2980
|
var isInited = useRef5(false);
|
|
2853
|
-
var
|
|
2854
|
-
|
|
2981
|
+
var _useState51 = _sliced_to_array(useState5(null), 2), audioEngine = _useState51[0], setAudioEngine = _useState51[1];
|
|
2982
|
+
useEffect7(function() {
|
|
2855
2983
|
if (!audioPlayer.playing) return;
|
|
2856
2984
|
if (isInited.current) return;
|
|
2857
2985
|
isInited.current = true;
|
|
@@ -2886,48 +3014,47 @@ var useMessageAudio = function(param) {
|
|
|
2886
3014
|
});
|
|
2887
3015
|
};
|
|
2888
3016
|
// src/components/threads/AudioThread/Root/index.tsx
|
|
2889
|
-
import { jsx as
|
|
3017
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
2890
3018
|
var Root7 = function(param) {
|
|
2891
3019
|
var children = param.children;
|
|
2892
3020
|
useLifecycle();
|
|
2893
3021
|
var createMessageProps = useCreateMessage();
|
|
2894
|
-
var _useSpeechRecognition = useSpeechRecognition(), transcript = _useSpeechRecognition.transcript, resetTranscript = _useSpeechRecognition.resetTranscript;
|
|
2895
|
-
var transcriptRef = useRef6(transcript);
|
|
2896
|
-
useEffect7(function() {
|
|
2897
|
-
transcriptRef.current = transcript;
|
|
2898
|
-
}, [
|
|
2899
|
-
transcript
|
|
2900
|
-
]);
|
|
2901
3022
|
var recorderProps = useRecorder({
|
|
2902
3023
|
isStopOnSilence: true,
|
|
2903
3024
|
onStart: /*#__PURE__*/ _async_to_generator(function() {
|
|
2904
3025
|
return _ts_generator(this, function(_state) {
|
|
2905
3026
|
console.log("start");
|
|
2906
|
-
resetTranscript();
|
|
2907
|
-
SpeechRecognition.default.startListening({
|
|
2908
|
-
continuous: true
|
|
2909
|
-
});
|
|
2910
3027
|
return [
|
|
2911
3028
|
2
|
|
2912
3029
|
];
|
|
2913
3030
|
});
|
|
2914
3031
|
}),
|
|
2915
3032
|
onStop: function() {
|
|
2916
|
-
var _ref = _async_to_generator(function(_event,
|
|
3033
|
+
var _ref = _async_to_generator(function(_event, chunks) {
|
|
3034
|
+
var blob, audioContent;
|
|
2917
3035
|
return _ts_generator(this, function(_state) {
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
3036
|
+
switch(_state.label){
|
|
3037
|
+
case 0:
|
|
3038
|
+
blob = new Blob(chunks, {
|
|
3039
|
+
type: chunks[0].type
|
|
3040
|
+
});
|
|
3041
|
+
return [
|
|
3042
|
+
4,
|
|
3043
|
+
blobToData(blob)
|
|
3044
|
+
];
|
|
3045
|
+
case 1:
|
|
3046
|
+
audioContent = _state.sent();
|
|
3047
|
+
return [
|
|
3048
|
+
2,
|
|
3049
|
+
createMessageProps.createMessage({
|
|
3050
|
+
// @ts-ignore-next-line
|
|
3051
|
+
audioContent: audioContent
|
|
3052
|
+
})
|
|
3053
|
+
];
|
|
3054
|
+
}
|
|
2928
3055
|
});
|
|
2929
3056
|
});
|
|
2930
|
-
return function(_event,
|
|
3057
|
+
return function(_event, chunks) {
|
|
2931
3058
|
return _ref.apply(this, arguments);
|
|
2932
3059
|
};
|
|
2933
3060
|
}()
|
|
@@ -2947,13 +3074,13 @@ var Root7 = function(param) {
|
|
|
2947
3074
|
createMessageProps: createMessageProps,
|
|
2948
3075
|
messageAudioProps: messageAudioProps
|
|
2949
3076
|
}).status;
|
|
2950
|
-
return /* @__PURE__ */
|
|
3077
|
+
return /* @__PURE__ */ jsx53(AudioThreadContext.Provider, {
|
|
2951
3078
|
value: {
|
|
2952
3079
|
status: status,
|
|
2953
3080
|
recorderProps: recorderProps,
|
|
2954
3081
|
messageAudioProps: messageAudioProps
|
|
2955
3082
|
},
|
|
2956
|
-
children: /* @__PURE__ */
|
|
3083
|
+
children: /* @__PURE__ */ jsx53(Flex19, {
|
|
2957
3084
|
direction: "column",
|
|
2958
3085
|
flexGrow: "1",
|
|
2959
3086
|
p: "5",
|
|
@@ -2962,23 +3089,23 @@ var Root7 = function(param) {
|
|
|
2962
3089
|
});
|
|
2963
3090
|
};
|
|
2964
3091
|
// src/components/threads/AudioThread/Visualization/index.tsx
|
|
2965
|
-
import { Flex as
|
|
3092
|
+
import { Flex as Flex20 } from "@radix-ui/themes";
|
|
2966
3093
|
// src/hooks/threads/useAudioThreadContext/index.ts
|
|
2967
|
-
import { useContext as
|
|
3094
|
+
import { useContext as useContext12 } from "react";
|
|
2968
3095
|
var useAudioThreadContext = function() {
|
|
2969
|
-
return
|
|
3096
|
+
return useContext12(AudioThreadContext);
|
|
2970
3097
|
};
|
|
2971
3098
|
// src/components/threads/AudioThread/Visualization/index.tsx
|
|
2972
|
-
import { jsx as
|
|
3099
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
2973
3100
|
var Visualization = function() {
|
|
2974
3101
|
var audioThreadContext = useAudioThreadContext();
|
|
2975
|
-
return /* @__PURE__ */
|
|
3102
|
+
return /* @__PURE__ */ jsx54(Flex20, {
|
|
2976
3103
|
direction: "column",
|
|
2977
3104
|
align: "center",
|
|
2978
3105
|
justify: "center",
|
|
2979
3106
|
mb: "3",
|
|
2980
3107
|
flexGrow: "1",
|
|
2981
|
-
children: /* @__PURE__ */
|
|
3108
|
+
children: /* @__PURE__ */ jsx54(Flex20, {
|
|
2982
3109
|
align: "center",
|
|
2983
3110
|
justify: "center",
|
|
2984
3111
|
height: "200px",
|
|
@@ -2992,21 +3119,21 @@ var Visualization = function() {
|
|
|
2992
3119
|
};
|
|
2993
3120
|
// src/components/threads/AudioThread/Form/index.tsx
|
|
2994
3121
|
import { SpeakerModerateIcon } from "@radix-ui/react-icons";
|
|
2995
|
-
import { Flex as
|
|
3122
|
+
import { Flex as Flex23 } from "@radix-ui/themes";
|
|
2996
3123
|
// src/components/threads/AudioThread/Form/Visualizer/index.tsx
|
|
2997
3124
|
import _7 from "lodash";
|
|
2998
|
-
import { Flex as
|
|
2999
|
-
import { useState as
|
|
3125
|
+
import { Flex as Flex21, Grid } from "@radix-ui/themes";
|
|
3126
|
+
import { useState as useState6, useEffect as useEffect8, useCallback as useCallback3 } from "react";
|
|
3000
3127
|
import { cluster } from "radash";
|
|
3001
|
-
import { jsx as
|
|
3128
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
3002
3129
|
var barCount = 4;
|
|
3003
3130
|
var Visualizer = function() {
|
|
3004
3131
|
var audioThreadContext = useAudioThreadContext();
|
|
3005
3132
|
var visualizationAnalyser = audioThreadContext.recorderProps.visualizationAnalyser;
|
|
3006
|
-
var
|
|
3133
|
+
var _useState6 = _sliced_to_array(useState6(function() {
|
|
3007
3134
|
return new AudioContext().createAnalyser();
|
|
3008
|
-
}), 1), emptyVisualizer =
|
|
3009
|
-
var
|
|
3135
|
+
}), 1), emptyVisualizer = _useState6[0];
|
|
3136
|
+
var _useState61 = _sliced_to_array(useState6([]), 2), barHeights = _useState61[0], setBarHeights = _useState61[1];
|
|
3010
3137
|
var draw = useCallback3(function(param) {
|
|
3011
3138
|
var visualizationAnalyser2 = param.visualizationAnalyser;
|
|
3012
3139
|
var frequencyData = new Uint8Array(visualizationAnalyser2.frequencyBinCount / 15);
|
|
@@ -3030,7 +3157,7 @@ var Visualizer = function() {
|
|
|
3030
3157
|
visualizationAnalyser,
|
|
3031
3158
|
emptyVisualizer
|
|
3032
3159
|
]);
|
|
3033
|
-
return /* @__PURE__ */
|
|
3160
|
+
return /* @__PURE__ */ jsx55(Grid, {
|
|
3034
3161
|
columns: "".concat(barCount),
|
|
3035
3162
|
gap: "1",
|
|
3036
3163
|
width: "auto",
|
|
@@ -3039,12 +3166,12 @@ var Visualizer = function() {
|
|
|
3039
3166
|
gridTemplateColumns: "repeat(4, minmax(0, 1fr))"
|
|
3040
3167
|
},
|
|
3041
3168
|
children: barHeights.map(function(barHeight, index) {
|
|
3042
|
-
return /* @__PURE__ */
|
|
3169
|
+
return /* @__PURE__ */ jsx55(Flex21, {
|
|
3043
3170
|
direction: "column",
|
|
3044
3171
|
align: "center",
|
|
3045
3172
|
justify: "center",
|
|
3046
3173
|
height: "20px",
|
|
3047
|
-
children: /* @__PURE__ */
|
|
3174
|
+
children: /* @__PURE__ */ jsx55(Flex21, {
|
|
3048
3175
|
minHeight: "50%",
|
|
3049
3176
|
maxHeight: "100%",
|
|
3050
3177
|
height: "".concat(barHeight + 20, "%"),
|
|
@@ -3059,31 +3186,31 @@ var Visualizer = function() {
|
|
|
3059
3186
|
});
|
|
3060
3187
|
};
|
|
3061
3188
|
// src/components/threads/AudioThread/Form/ActionButton/index.tsx
|
|
3062
|
-
import { Flex as
|
|
3189
|
+
import { Flex as Flex22, IconButton as IconButton2, Tooltip } from "@radix-ui/themes";
|
|
3063
3190
|
import { PauseIcon, ArrowUpIcon as ArrowUpIcon2, ResumeIcon } from "@radix-ui/react-icons";
|
|
3064
|
-
import { jsx as
|
|
3191
|
+
import { jsx as jsx56, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3065
3192
|
var ActionButton = function() {
|
|
3066
3193
|
var audioThreadContext = useAudioThreadContext();
|
|
3067
3194
|
if (audioThreadContext.status === "recording") {
|
|
3068
|
-
return /* @__PURE__ */
|
|
3195
|
+
return /* @__PURE__ */ jsxs18(Flex22, {
|
|
3069
3196
|
align: "center",
|
|
3070
3197
|
children: [
|
|
3071
|
-
/* @__PURE__ */
|
|
3198
|
+
/* @__PURE__ */ jsx56(Flex22, {
|
|
3072
3199
|
mr: "3",
|
|
3073
3200
|
ml: "-7",
|
|
3074
|
-
children: /* @__PURE__ */
|
|
3201
|
+
children: /* @__PURE__ */ jsx56(IconButton2, {
|
|
3075
3202
|
onClick: audioThreadContext.recorderProps.pause,
|
|
3076
3203
|
color: "gray",
|
|
3077
3204
|
radius: "full",
|
|
3078
3205
|
size: "1",
|
|
3079
|
-
children: /* @__PURE__ */
|
|
3206
|
+
children: /* @__PURE__ */ jsx56(PauseIcon, {})
|
|
3080
3207
|
})
|
|
3081
3208
|
}),
|
|
3082
|
-
/* @__PURE__ */
|
|
3209
|
+
/* @__PURE__ */ jsx56(Tooltip, {
|
|
3083
3210
|
open: true,
|
|
3084
3211
|
content: "Send your message",
|
|
3085
3212
|
side: "bottom",
|
|
3086
|
-
children: /* @__PURE__ */
|
|
3213
|
+
children: /* @__PURE__ */ jsx56(IconButton2, {
|
|
3087
3214
|
onClick: audioThreadContext.recorderProps.stop,
|
|
3088
3215
|
color: "gray",
|
|
3089
3216
|
highContrast: true,
|
|
@@ -3092,14 +3219,14 @@ var ActionButton = function() {
|
|
|
3092
3219
|
style: {
|
|
3093
3220
|
border: "2px solid var(--gray-8)"
|
|
3094
3221
|
},
|
|
3095
|
-
children: /* @__PURE__ */
|
|
3222
|
+
children: /* @__PURE__ */ jsx56(ArrowUpIcon2, {})
|
|
3096
3223
|
})
|
|
3097
3224
|
})
|
|
3098
3225
|
]
|
|
3099
3226
|
});
|
|
3100
3227
|
}
|
|
3101
3228
|
if (audioThreadContext.status === "recorderPaused") {
|
|
3102
|
-
return /* @__PURE__ */
|
|
3229
|
+
return /* @__PURE__ */ jsx56(IconButton2, {
|
|
3103
3230
|
onClick: audioThreadContext.recorderProps.resume,
|
|
3104
3231
|
color: "red",
|
|
3105
3232
|
radius: "full",
|
|
@@ -3107,11 +3234,11 @@ var ActionButton = function() {
|
|
|
3107
3234
|
style: {
|
|
3108
3235
|
border: "2px solid var(--gray-8)"
|
|
3109
3236
|
},
|
|
3110
|
-
children: /* @__PURE__ */
|
|
3237
|
+
children: /* @__PURE__ */ jsx56(ResumeIcon, {})
|
|
3111
3238
|
});
|
|
3112
3239
|
}
|
|
3113
3240
|
if (audioThreadContext.status === "idle") {
|
|
3114
|
-
return /* @__PURE__ */
|
|
3241
|
+
return /* @__PURE__ */ jsx56(IconButton2, {
|
|
3115
3242
|
onClick: function() {
|
|
3116
3243
|
return audioThreadContext.recorderProps.start();
|
|
3117
3244
|
},
|
|
@@ -3124,7 +3251,7 @@ var ActionButton = function() {
|
|
|
3124
3251
|
});
|
|
3125
3252
|
}
|
|
3126
3253
|
if (audioThreadContext.status === "playing") {
|
|
3127
|
-
return /* @__PURE__ */
|
|
3254
|
+
return /* @__PURE__ */ jsx56(IconButton2, {
|
|
3128
3255
|
onClick: function() {
|
|
3129
3256
|
return audioThreadContext.messageAudioProps.pause();
|
|
3130
3257
|
},
|
|
@@ -3134,11 +3261,11 @@ var ActionButton = function() {
|
|
|
3134
3261
|
style: {
|
|
3135
3262
|
border: "2px solid var(--gray-8)"
|
|
3136
3263
|
},
|
|
3137
|
-
children: /* @__PURE__ */
|
|
3264
|
+
children: /* @__PURE__ */ jsx56(PauseIcon, {})
|
|
3138
3265
|
});
|
|
3139
3266
|
}
|
|
3140
3267
|
if (audioThreadContext.status === "playerPaused") {
|
|
3141
|
-
return /* @__PURE__ */
|
|
3268
|
+
return /* @__PURE__ */ jsx56(IconButton2, {
|
|
3142
3269
|
onClick: function() {
|
|
3143
3270
|
return audioThreadContext.messageAudioProps.play();
|
|
3144
3271
|
},
|
|
@@ -3148,10 +3275,10 @@ var ActionButton = function() {
|
|
|
3148
3275
|
style: {
|
|
3149
3276
|
border: "2px solid var(--gray-8)"
|
|
3150
3277
|
},
|
|
3151
|
-
children: /* @__PURE__ */
|
|
3278
|
+
children: /* @__PURE__ */ jsx56(ResumeIcon, {})
|
|
3152
3279
|
});
|
|
3153
3280
|
}
|
|
3154
|
-
return /* @__PURE__ */
|
|
3281
|
+
return /* @__PURE__ */ jsx56(IconButton2, {
|
|
3155
3282
|
size: "4",
|
|
3156
3283
|
color: "red",
|
|
3157
3284
|
radius: "full",
|
|
@@ -3162,49 +3289,49 @@ var ActionButton = function() {
|
|
|
3162
3289
|
});
|
|
3163
3290
|
};
|
|
3164
3291
|
// src/components/threads/AudioThread/Form/index.tsx
|
|
3165
|
-
import { jsx as
|
|
3292
|
+
import { jsx as jsx57, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3166
3293
|
var Form = function() {
|
|
3167
3294
|
var audioThreadContext = useAudioThreadContext();
|
|
3168
|
-
return /* @__PURE__ */
|
|
3295
|
+
return /* @__PURE__ */ jsxs19(Flex23, {
|
|
3169
3296
|
direction: "column",
|
|
3170
3297
|
align: "center",
|
|
3171
3298
|
children: [
|
|
3172
|
-
/* @__PURE__ */
|
|
3299
|
+
/* @__PURE__ */ jsxs19(Flex23, {
|
|
3173
3300
|
pb: "3",
|
|
3174
3301
|
align: "center",
|
|
3175
3302
|
children: [
|
|
3176
|
-
/* @__PURE__ */
|
|
3303
|
+
/* @__PURE__ */ jsx57(Flex23, {
|
|
3177
3304
|
ml: "-5",
|
|
3178
3305
|
mr: "2",
|
|
3179
3306
|
align: "center",
|
|
3180
|
-
children: /* @__PURE__ */
|
|
3307
|
+
children: /* @__PURE__ */ jsx57(SpeakerModerateIcon, {
|
|
3181
3308
|
style: {
|
|
3182
3309
|
color: "var(--".concat(audioThreadContext.status === "recording" ? "mint" : "gray", "-12)")
|
|
3183
3310
|
}
|
|
3184
3311
|
})
|
|
3185
3312
|
}),
|
|
3186
|
-
/* @__PURE__ */
|
|
3313
|
+
/* @__PURE__ */ jsx57(Flex23, {
|
|
3187
3314
|
px: "2",
|
|
3188
3315
|
py: "1",
|
|
3189
3316
|
style: {
|
|
3190
3317
|
backgroundColor: "var(--".concat(audioThreadContext.status === "recording" ? "mint" : "gray", "-4)"),
|
|
3191
3318
|
borderRadius: "var(--radius-6)"
|
|
3192
3319
|
},
|
|
3193
|
-
children: /* @__PURE__ */
|
|
3320
|
+
children: /* @__PURE__ */ jsx57(Visualizer, {})
|
|
3194
3321
|
})
|
|
3195
3322
|
]
|
|
3196
3323
|
}),
|
|
3197
|
-
/* @__PURE__ */
|
|
3324
|
+
/* @__PURE__ */ jsx57(ActionButton, {})
|
|
3198
3325
|
]
|
|
3199
3326
|
});
|
|
3200
3327
|
};
|
|
3201
3328
|
// src/components/threads/AudioThread/index.tsx
|
|
3202
|
-
import { jsx as
|
|
3329
|
+
import { jsx as jsx58, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3203
3330
|
var AudioThread = function(props) {
|
|
3204
|
-
return /* @__PURE__ */
|
|
3331
|
+
return /* @__PURE__ */ jsxs20(Root7, _object_spread_props(_object_spread({}, props), {
|
|
3205
3332
|
children: [
|
|
3206
|
-
/* @__PURE__ */
|
|
3207
|
-
/* @__PURE__ */
|
|
3333
|
+
/* @__PURE__ */ jsx58(Visualization, {}),
|
|
3334
|
+
/* @__PURE__ */ jsx58(Form, {})
|
|
3208
3335
|
]
|
|
3209
3336
|
}));
|
|
3210
3337
|
};
|
|
@@ -3212,15 +3339,15 @@ AudioThread.Root = Root7;
|
|
|
3212
3339
|
AudioThread.Visualization = Visualization;
|
|
3213
3340
|
AudioThread.Form = Form;
|
|
3214
3341
|
// src/components/threads/AudioThreadDialog/index.tsx
|
|
3215
|
-
import { jsx as
|
|
3342
|
+
import { jsx as jsx59, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3216
3343
|
var AudioThreadDialog = function() {
|
|
3217
|
-
return /* @__PURE__ */
|
|
3344
|
+
return /* @__PURE__ */ jsxs21(Root5, {
|
|
3218
3345
|
children: [
|
|
3219
|
-
/* @__PURE__ */
|
|
3220
|
-
children: /* @__PURE__ */
|
|
3346
|
+
/* @__PURE__ */ jsx59(Content4.Root, {
|
|
3347
|
+
children: /* @__PURE__ */ jsx59(AudioThread, {})
|
|
3221
3348
|
}),
|
|
3222
|
-
/* @__PURE__ */
|
|
3223
|
-
children: /* @__PURE__ */
|
|
3349
|
+
/* @__PURE__ */ jsx59(Trigger, {
|
|
3350
|
+
children: /* @__PURE__ */ jsx59(Button3, {})
|
|
3224
3351
|
})
|
|
3225
3352
|
]
|
|
3226
3353
|
});
|
|
@@ -3230,84 +3357,125 @@ AudioThreadDialog.Trigger = Trigger;
|
|
|
3230
3357
|
AudioThreadDialog.Button = Button3;
|
|
3231
3358
|
AudioThreadDialog.Content = Content4;
|
|
3232
3359
|
// src/components/suggestions/Suggestions/index.tsx
|
|
3360
|
+
import { useMemo as useMemo15 } from "react";
|
|
3361
|
+
// src/components/suggestions/Suggestions/Content.tsx
|
|
3233
3362
|
import { useMemo as useMemo14 } from "react";
|
|
3234
|
-
import {
|
|
3235
|
-
|
|
3363
|
+
import { isEmpty as isEmpty2 } from "radash";
|
|
3364
|
+
import { onlyText } from "react-children-utilities";
|
|
3365
|
+
import { Flex as Flex24 } from "@radix-ui/themes";
|
|
3366
|
+
// src/components/suggestions/Suggestions/Item.tsx
|
|
3236
3367
|
import { ArrowUpIcon as ArrowUpIcon3 } from "@radix-ui/react-icons";
|
|
3237
|
-
import { Text as Text6, Button as Button4 } from "@radix-ui/themes";
|
|
3238
|
-
import { jsx as
|
|
3239
|
-
var
|
|
3240
|
-
var suggestion = param.suggestion;
|
|
3241
|
-
var
|
|
3242
|
-
|
|
3243
|
-
return /* @__PURE__ */ jsxs20(Button4, {
|
|
3244
|
-
variant: "soft",
|
|
3245
|
-
style: {
|
|
3246
|
-
justifyContent: "space-between"
|
|
3247
|
-
},
|
|
3368
|
+
import { Text as Text6, Button as Button4, Spinner as Spinner2 } from "@radix-ui/themes";
|
|
3369
|
+
import { jsx as jsx60, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3370
|
+
var Item = function(param) {
|
|
3371
|
+
var suggestion = param.suggestion, isDisabled = param.isDisabled;
|
|
3372
|
+
var _useCreateMessage = useCreateMessage(), createMessage = _useCreateMessage.createMessage, isPending = _useCreateMessage.isPending;
|
|
3373
|
+
return /* @__PURE__ */ jsx60(Content5, {
|
|
3248
3374
|
onClick: function() {
|
|
3249
3375
|
createMessage({
|
|
3250
3376
|
// @ts-ignore-next-line
|
|
3251
3377
|
content: suggestion
|
|
3252
3378
|
});
|
|
3253
3379
|
},
|
|
3254
|
-
|
|
3380
|
+
isDisabled: isDisabled,
|
|
3381
|
+
isPending: isPending,
|
|
3382
|
+
children: suggestion
|
|
3383
|
+
});
|
|
3384
|
+
};
|
|
3385
|
+
var Content5 = function(param) {
|
|
3386
|
+
var onClick = param.onClick, isDisabled = param.isDisabled, isPending = param.isPending, children = param.children;
|
|
3387
|
+
return /* @__PURE__ */ jsxs22(Button4, {
|
|
3388
|
+
variant: "soft",
|
|
3389
|
+
onClick: onClick,
|
|
3390
|
+
disabled: isDisabled,
|
|
3255
3391
|
children: [
|
|
3256
|
-
/* @__PURE__ */
|
|
3392
|
+
/* @__PURE__ */ jsx60(Text6, {
|
|
3257
3393
|
size: "1",
|
|
3258
3394
|
weight: "regular",
|
|
3259
|
-
children:
|
|
3395
|
+
children: children
|
|
3260
3396
|
}),
|
|
3261
|
-
/* @__PURE__ */
|
|
3397
|
+
/* @__PURE__ */ jsx60(Spinner2, {
|
|
3398
|
+
loading: isPending,
|
|
3399
|
+
children: /* @__PURE__ */ jsx60(ArrowUpIcon3, {})
|
|
3400
|
+
})
|
|
3262
3401
|
]
|
|
3263
3402
|
});
|
|
3264
3403
|
};
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3404
|
+
Item.Content = Content5;
|
|
3405
|
+
// src/components/suggestions/Suggestions/Content.tsx
|
|
3406
|
+
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
3407
|
+
var Content6 = function(param) {
|
|
3408
|
+
var children = param.children;
|
|
3409
|
+
var messageContext = useMessageContext();
|
|
3269
3410
|
var latestMessageProps = useLatestMessage();
|
|
3270
3411
|
var isRunActiveProps = useIsRunActive();
|
|
3412
|
+
var suggestions = useMemo14(function() {
|
|
3413
|
+
return onlyText(children).split(/\r?\n/).filter(function(c) {
|
|
3414
|
+
return !isEmpty2(c);
|
|
3415
|
+
}).map(function(c) {
|
|
3416
|
+
return c.trim();
|
|
3417
|
+
});
|
|
3418
|
+
}, [
|
|
3419
|
+
children
|
|
3420
|
+
]);
|
|
3271
3421
|
var isDisabled = useMemo14(function() {
|
|
3272
|
-
var
|
|
3273
|
-
|
|
3274
|
-
return ((_latestMessageProps_latestMessage = latestMessageProps.latestMessage) === null || _latestMessageProps_latestMessage === void 0 ? void 0 : (_latestMessageProps_latestMessage_metadata = _latestMessageProps_latestMessage.metadata) === null || _latestMessageProps_latestMessage_metadata === void 0 ? void 0 : _latestMessageProps_latestMessage_metadata.isBlocking) || isRunActiveProps.isRunActive;
|
|
3422
|
+
var _messageContext_message;
|
|
3423
|
+
return ((_messageContext_message = messageContext.message) === null || _messageContext_message === void 0 ? void 0 : _messageContext_message.id) !== latestMessageProps.latestMessage.id || isRunActiveProps.isRunActive;
|
|
3275
3424
|
}, [
|
|
3425
|
+
messageContext,
|
|
3276
3426
|
latestMessageProps,
|
|
3277
3427
|
isRunActiveProps
|
|
3278
3428
|
]);
|
|
3429
|
+
if (isEmpty2(suggestions)) return null;
|
|
3430
|
+
return /* @__PURE__ */ jsx61(Flex24, {
|
|
3431
|
+
gap: "2",
|
|
3432
|
+
py: "2",
|
|
3433
|
+
wrap: "wrap",
|
|
3434
|
+
children: suggestions.map(function(suggestion) {
|
|
3435
|
+
return /* @__PURE__ */ jsx61(Item, {
|
|
3436
|
+
suggestion: suggestion,
|
|
3437
|
+
isDisabled: isDisabled
|
|
3438
|
+
}, suggestion);
|
|
3439
|
+
})
|
|
3440
|
+
});
|
|
3441
|
+
};
|
|
3442
|
+
// src/components/suggestions/Suggestions/index.tsx
|
|
3443
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
3444
|
+
var Suggestions = function(param) {
|
|
3445
|
+
var children = param.children;
|
|
3446
|
+
var latestMessageProps = useLatestMessage();
|
|
3447
|
+
var isDisabled = useMemo15(function() {
|
|
3448
|
+
var // @ts-ignore-next-line
|
|
3449
|
+
_latestMessageProps_latestMessage_metadata, _latestMessageProps_latestMessage;
|
|
3450
|
+
return (_latestMessageProps_latestMessage = latestMessageProps.latestMessage) === null || _latestMessageProps_latestMessage === void 0 ? void 0 : (_latestMessageProps_latestMessage_metadata = _latestMessageProps_latestMessage.metadata) === null || _latestMessageProps_latestMessage_metadata === void 0 ? void 0 : _latestMessageProps_latestMessage_metadata.isBlocking;
|
|
3451
|
+
}, [
|
|
3452
|
+
latestMessageProps
|
|
3453
|
+
]);
|
|
3279
3454
|
if (latestMessageProps.isLoading) return null;
|
|
3280
3455
|
if (isDisabled) return null;
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
py: "2",
|
|
3285
|
-
wrap: "wrap",
|
|
3286
|
-
children: emptyStateSuggestions.map(function(suggestion) {
|
|
3287
|
-
return /* @__PURE__ */ jsx59(Suggestion, {
|
|
3288
|
-
suggestion: suggestion
|
|
3289
|
-
}, suggestion);
|
|
3290
|
-
})
|
|
3291
|
-
});
|
|
3292
|
-
}
|
|
3293
|
-
if (latestMessageProps.latestMessage.role === "assistant") {
|
|
3294
|
-
return /* @__PURE__ */ jsx59(Flex25, {
|
|
3295
|
-
gap: "2",
|
|
3296
|
-
py: "2",
|
|
3297
|
-
wrap: "wrap",
|
|
3298
|
-
children: suggestions.map(function(suggestion) {
|
|
3299
|
-
return /* @__PURE__ */ jsx59(Suggestion, {
|
|
3300
|
-
suggestion: suggestion
|
|
3301
|
-
}, suggestion);
|
|
3302
|
-
})
|
|
3303
|
-
});
|
|
3304
|
-
}
|
|
3305
|
-
return null;
|
|
3456
|
+
return /* @__PURE__ */ jsx62(Content6, {
|
|
3457
|
+
children: children
|
|
3458
|
+
});
|
|
3306
3459
|
};
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3460
|
+
Suggestions.Item = Item;
|
|
3461
|
+
// src/components/markdown/MarkdownProvider/index.tsx
|
|
3462
|
+
import { useMemo as useMemo16 } from "react";
|
|
3463
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
3464
|
+
var MarkdownProvider = function(_param) {
|
|
3465
|
+
var children = _param.children, rest = _object_without_properties(_param, [
|
|
3466
|
+
"children"
|
|
3467
|
+
]);
|
|
3468
|
+
var prevMarkdownContext = useMarkdownContext();
|
|
3469
|
+
var value = useMemo16(function() {
|
|
3470
|
+
return merge(prevMarkdownContext, rest);
|
|
3471
|
+
}, [
|
|
3472
|
+
rest,
|
|
3473
|
+
prevMarkdownContext
|
|
3474
|
+
]);
|
|
3475
|
+
return /* @__PURE__ */ jsx63(MarkdownContext.Provider, {
|
|
3476
|
+
value: value,
|
|
3477
|
+
children: children
|
|
3478
|
+
});
|
|
3311
3479
|
};
|
|
3312
|
-
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, FunctionBase, FunctionComponentsContext, MarkdownContext,
|
|
3480
|
+
export { AssistantAvatarContext, AssistantNameContext, AudioThread, AudioThreadDialog, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, useCreateMessage, useCreateRun, useIsRunActive, useLatestMessage, useLatestRun, useLifecycle, useMarkdownContext, useMessageContext, useMessages, useRuns, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext };
|
|
3313
3481
|
//# sourceMappingURL=index.js.map
|