@nexface/chat 0.1.15-alpha.1 → 0.1.15-alpha.3
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/assistant-attachments.js +60 -17
- package/dist/assistant-components.d.ts +3 -3
- package/dist/assistant-components.js +77 -29
- package/dist/assistant-runtime.d.ts +1 -1
- package/dist/assistant-runtime.js +100 -43
- package/dist/attachments.js +36 -15
- package/dist/client.js +309 -77
- package/dist/config.js +4 -5
- package/dist/default-chat.d.ts +1 -1
- package/dist/default-chat.js +2102 -728
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +69 -18
- package/dist/index.js +0 -1
- package/dist/messages.js +0 -1
- package/dist/page-confirmation.js +3 -4
- package/dist/protocol-messages.js +290 -66
- package/dist/protocol-response.js +38 -18
- package/dist/react.d.ts +1 -1
- package/dist/react.js +147 -50
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.js +0 -1
- package/dist/shared/runtime-controller.d.ts +1 -0
- package/dist/shared/runtime-controller.js +0 -1
- package/dist/shared/runtime-execution.js +0 -1
- package/dist/shared/schema.js +45 -19
- package/dist/storage.js +130 -53
- package/dist/styles.css +99 -20
- package/dist/tool-result.js +7 -3
- package/dist/types.js +0 -1
- package/dist/ui/attachment.aui.d.ts +1 -1
- package/dist/ui/attachment.aui.js +16 -20
- package/dist/ui/avatar.js +0 -1
- package/dist/ui/button.js +0 -1
- package/dist/ui/code-block.js +2 -3
- package/dist/ui/collapsible.js +2 -3
- package/dist/ui/composer-voice.js +3 -2
- package/dist/ui/dialog.d.ts +1 -1
- package/dist/ui/dialog.js +9 -4
- package/dist/ui/dropdown-menu.js +2 -3
- package/dist/ui/home-demo/action-bar.js +0 -1
- package/dist/ui/home-demo/composer.js +7 -4
- package/dist/ui/home-demo/greeting.d.ts +1 -1
- package/dist/ui/home-demo/greeting.js +1 -2
- package/dist/ui/home-demo/messages.d.ts +1 -1
- package/dist/ui/home-demo/messages.js +4 -5
- package/dist/ui/home-demo/styles.js +0 -1
- package/dist/ui/home-demo/suggestions.d.ts +1 -1
- package/dist/ui/home-demo/suggestions.js +5 -3
- package/dist/ui/home-demo/surfaces.js +3 -2
- package/dist/ui/home-demo/thread.d.ts +1 -1
- package/dist/ui/home-demo/thread.js +1 -2
- package/dist/ui/home-demo/trace-line.d.ts +1 -1
- package/dist/ui/home-demo/trace-line.js +2 -3
- package/dist/ui/home-demo/trace.d.ts +1 -1
- package/dist/ui/home-demo/trace.js +28 -9
- package/dist/ui/home-demo/type.js +0 -1
- package/dist/ui/input.js +0 -1
- package/dist/ui/markdown-text.js +2 -3
- package/dist/ui/reasoning.aui.js +2 -3
- package/dist/ui/reasoning.d.ts +1 -1
- package/dist/ui/reasoning.js +6 -9
- package/dist/ui/surface.js +27 -8
- package/dist/ui/thread-list.aui.d.ts +2 -2
- package/dist/ui/thread-list.aui.js +18 -12
- package/dist/ui/tool-group.aui.js +2 -3
- package/dist/ui/tooltip-icon-button.js +1 -2
- package/dist/ui/tooltip.js +0 -1
- package/dist/ui/use-attachment-src.js +1 -2
- package/dist/ui/use-copy-to-clipboard.d.ts +1 -1
- package/dist/ui/use-copy-to-clipboard.js +1 -2
- package/dist/ui/utils.js +9 -3
- package/dist/use-next-message.js +7 -4
- package/dist/voice/types.js +0 -1
- package/dist/voice/use-voice.js +35 -13
- package/package.json +8 -4
- package/dist/assistant-attachments.js.map +0 -1
- package/dist/assistant-components.js.map +0 -1
- package/dist/assistant-runtime.js.map +0 -1
- package/dist/attachments.js.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/default-chat.js.map +0 -7
- package/dist/errors.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/messages.js.map +0 -1
- package/dist/page-confirmation.js.map +0 -1
- package/dist/protocol-messages.js.map +0 -1
- package/dist/protocol-response.js.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/shared/errors.js.map +0 -1
- package/dist/shared/runtime-controller.js.map +0 -1
- package/dist/shared/runtime-execution.js.map +0 -1
- package/dist/shared/schema.js.map +0 -1
- package/dist/storage.js.map +0 -1
- package/dist/tool-result.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/ui/attachment.aui.js.map +0 -1
- package/dist/ui/avatar.js.map +0 -1
- package/dist/ui/button.js.map +0 -1
- package/dist/ui/code-block.js.map +0 -1
- package/dist/ui/collapsible.js.map +0 -1
- package/dist/ui/composer-voice.js.map +0 -1
- package/dist/ui/dialog.js.map +0 -1
- package/dist/ui/dropdown-menu.js.map +0 -1
- package/dist/ui/home-demo/action-bar.js.map +0 -1
- package/dist/ui/home-demo/composer.js.map +0 -1
- package/dist/ui/home-demo/greeting.js.map +0 -1
- package/dist/ui/home-demo/messages.js.map +0 -1
- package/dist/ui/home-demo/styles.js.map +0 -1
- package/dist/ui/home-demo/suggestions.js.map +0 -1
- package/dist/ui/home-demo/surfaces.js.map +0 -1
- package/dist/ui/home-demo/thread.js.map +0 -1
- package/dist/ui/home-demo/trace-line.js.map +0 -1
- package/dist/ui/home-demo/trace.js.map +0 -1
- package/dist/ui/home-demo/type.js.map +0 -1
- package/dist/ui/input.js.map +0 -1
- package/dist/ui/markdown-text.js.map +0 -1
- package/dist/ui/reasoning.aui.js.map +0 -1
- package/dist/ui/reasoning.js.map +0 -1
- package/dist/ui/surface.js.map +0 -1
- package/dist/ui/thread-list.aui.js.map +0 -1
- package/dist/ui/tool-group.aui.js.map +0 -1
- package/dist/ui/tooltip-icon-button.js.map +0 -1
- package/dist/ui/tooltip.js.map +0 -1
- package/dist/ui/use-attachment-src.js.map +0 -1
- package/dist/ui/use-copy-to-clipboard.js.map +0 -1
- package/dist/ui/utils.js.map +0 -1
- package/dist/use-next-message.js.map +0 -1
- package/dist/voice/types.js.map +0 -1
- package/dist/voice/use-voice.js.map +0 -1
package/dist/default-chat.js
CHANGED
|
@@ -698,7 +698,9 @@ var useSyncExternalStore = modern.useSyncExternalStore ?? subscribe;
|
|
|
698
698
|
var useInsertionEffect = modern.useInsertionEffect ?? React.useLayoutEffect;
|
|
699
699
|
var useDeferredValue = modern.useDeferredValue ?? ((value) => value);
|
|
700
700
|
var useId = modern.useId ?? (() => {
|
|
701
|
-
const [id] = React.useState(
|
|
701
|
+
const [id] = React.useState(
|
|
702
|
+
() => `nxf-${globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`}`
|
|
703
|
+
);
|
|
702
704
|
return id;
|
|
703
705
|
});
|
|
704
706
|
var react_compat_default = { ...React, useSyncExternalStore, useInsertionEffect, useDeferredValue, useId };
|
|
@@ -28576,21 +28578,23 @@ function cn(...inputs) {
|
|
|
28576
28578
|
|
|
28577
28579
|
// src/ui/input.tsx
|
|
28578
28580
|
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
28579
|
-
var Input = React2.forwardRef(
|
|
28580
|
-
|
|
28581
|
-
|
|
28582
|
-
|
|
28583
|
-
|
|
28584
|
-
|
|
28585
|
-
|
|
28586
|
-
|
|
28587
|
-
|
|
28588
|
-
|
|
28589
|
-
|
|
28590
|
-
|
|
28591
|
-
|
|
28592
|
-
|
|
28593
|
-
|
|
28581
|
+
var Input = React2.forwardRef(
|
|
28582
|
+
function Input2({ className, type, ...props }, ref) {
|
|
28583
|
+
return /* @__PURE__ */ jsx63(
|
|
28584
|
+
"input",
|
|
28585
|
+
{
|
|
28586
|
+
ref,
|
|
28587
|
+
type,
|
|
28588
|
+
"data-slot": "input",
|
|
28589
|
+
className: cn(
|
|
28590
|
+
"file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 disabled:bg-input/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 bg-muted/60 focus-visible:bg-background h-9 w-full min-w-0 rounded-lg border border-transparent px-3 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-1 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-1 md:text-sm",
|
|
28591
|
+
className
|
|
28592
|
+
),
|
|
28593
|
+
...props
|
|
28594
|
+
}
|
|
28595
|
+
);
|
|
28596
|
+
}
|
|
28597
|
+
);
|
|
28594
28598
|
|
|
28595
28599
|
// src/ui/home-demo/styles.ts
|
|
28596
28600
|
var actionButtonClass = "text-muted-foreground/70 hover:text-foreground disabled:pointer-events-none disabled:opacity-40 p-1 transition-colors";
|
|
@@ -28598,11 +28602,26 @@ var menuContentClass = "bg-popover text-popover-foreground border-foreground/10
|
|
|
28598
28602
|
var menuItemClass = "hover:bg-muted focus:bg-muted flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-[13px] outline-none select-none";
|
|
28599
28603
|
|
|
28600
28604
|
// src/ui/surface.tsx
|
|
28601
|
-
import {
|
|
28605
|
+
import {
|
|
28606
|
+
createContext as createContext5,
|
|
28607
|
+
useContext as useContext6,
|
|
28608
|
+
useLayoutEffect as useLayoutEffect8,
|
|
28609
|
+
useRef as useRef25,
|
|
28610
|
+
useState as useState24
|
|
28611
|
+
} from "react";
|
|
28602
28612
|
import { jsx as jsx64, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
28603
28613
|
var PortalContext = createContext5({ container: null, acquire: () => () => {
|
|
28604
28614
|
} });
|
|
28605
|
-
var tokens = [
|
|
28615
|
+
var tokens = [
|
|
28616
|
+
"background",
|
|
28617
|
+
"foreground",
|
|
28618
|
+
"primary",
|
|
28619
|
+
"primary-foreground",
|
|
28620
|
+
"primary-hover",
|
|
28621
|
+
"muted",
|
|
28622
|
+
"muted-foreground",
|
|
28623
|
+
"border"
|
|
28624
|
+
];
|
|
28606
28625
|
var DialogContainerContext = createContext5(null);
|
|
28607
28626
|
function ChatSurface({ children, className, ...props }) {
|
|
28608
28627
|
const root4 = useRef25(null);
|
|
@@ -28625,8 +28644,7 @@ function ChatSurface({ children, className, ...props }) {
|
|
|
28625
28644
|
}, []);
|
|
28626
28645
|
useLayoutEffect8(() => {
|
|
28627
28646
|
const element2 = root4.current;
|
|
28628
|
-
if (!element2 || !container)
|
|
28629
|
-
return;
|
|
28647
|
+
if (!element2 || !container) return;
|
|
28630
28648
|
const sync = () => {
|
|
28631
28649
|
const style = getComputedStyle(element2);
|
|
28632
28650
|
for (const token of tokens)
|
|
@@ -28637,11 +28655,13 @@ function ChatSurface({ children, className, ...props }) {
|
|
|
28637
28655
|
container.classList.toggle("nexface-dark", Boolean(element2.closest(".dark, .nexface-dark")));
|
|
28638
28656
|
};
|
|
28639
28657
|
sync();
|
|
28640
|
-
if (!active)
|
|
28641
|
-
return;
|
|
28658
|
+
if (!active) return;
|
|
28642
28659
|
const observer = new MutationObserver(sync);
|
|
28643
28660
|
for (let node2 = element2; node2; node2 = node2.parentElement)
|
|
28644
|
-
observer.observe(node2, {
|
|
28661
|
+
observer.observe(node2, {
|
|
28662
|
+
attributes: true,
|
|
28663
|
+
attributeFilter: ["class", "style", "dir", "data-theme"]
|
|
28664
|
+
});
|
|
28645
28665
|
const media = window.matchMedia?.("(prefers-color-scheme: dark)");
|
|
28646
28666
|
media?.addEventListener("change", sync);
|
|
28647
28667
|
return () => {
|
|
@@ -28675,37 +28695,113 @@ function DropdownMenu2({ ...props }) {
|
|
|
28675
28695
|
var DropdownMenuTrigger3 = React3.forwardRef(function DropdownMenuTrigger4({ ...props }, ref) {
|
|
28676
28696
|
return /* @__PURE__ */ jsx65(dist_exports10.Trigger, { "data-slot": "dropdown-menu-trigger", ref, ...props });
|
|
28677
28697
|
});
|
|
28678
|
-
function DropdownMenuContent3({
|
|
28698
|
+
function DropdownMenuContent3({
|
|
28699
|
+
children,
|
|
28700
|
+
className,
|
|
28701
|
+
sideOffset = 4,
|
|
28702
|
+
...props
|
|
28703
|
+
}) {
|
|
28679
28704
|
const container = usePortalContainer();
|
|
28680
|
-
if (!container)
|
|
28681
|
-
|
|
28682
|
-
|
|
28683
|
-
|
|
28684
|
-
|
|
28685
|
-
|
|
28705
|
+
if (!container) return null;
|
|
28706
|
+
return /* @__PURE__ */ jsx65(dist_exports10.Portal, { container, children: /* @__PURE__ */ jsxs9(
|
|
28707
|
+
dist_exports10.Content,
|
|
28708
|
+
{
|
|
28709
|
+
"data-slot": "dropdown-menu-content",
|
|
28710
|
+
sideOffset,
|
|
28711
|
+
className: cn(menuContentClass, className),
|
|
28712
|
+
...props,
|
|
28713
|
+
children: [
|
|
28714
|
+
/* @__PURE__ */ jsx65(PortalThemeSync, {}),
|
|
28715
|
+
children
|
|
28716
|
+
]
|
|
28717
|
+
}
|
|
28718
|
+
) });
|
|
28686
28719
|
}
|
|
28687
|
-
function DropdownMenuItem3({
|
|
28688
|
-
|
|
28720
|
+
function DropdownMenuItem3({
|
|
28721
|
+
className,
|
|
28722
|
+
inset,
|
|
28723
|
+
variant = "default",
|
|
28724
|
+
...props
|
|
28725
|
+
}) {
|
|
28726
|
+
return /* @__PURE__ */ jsx65(
|
|
28727
|
+
dist_exports10.Item,
|
|
28728
|
+
{
|
|
28729
|
+
"data-slot": "dropdown-menu-item",
|
|
28730
|
+
"data-inset": inset,
|
|
28731
|
+
"data-variant": variant,
|
|
28732
|
+
className: cn(
|
|
28733
|
+
menuItemClass,
|
|
28734
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[variant=destructive]:text-destructive",
|
|
28735
|
+
className
|
|
28736
|
+
),
|
|
28737
|
+
...props
|
|
28738
|
+
}
|
|
28739
|
+
);
|
|
28689
28740
|
}
|
|
28690
28741
|
|
|
28691
28742
|
// src/ui/thread-list.aui.tsx
|
|
28692
28743
|
import { jsx as jsx66, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
28693
|
-
function ThreadListRoot({
|
|
28694
|
-
|
|
28744
|
+
function ThreadListRoot({
|
|
28745
|
+
className,
|
|
28746
|
+
...props
|
|
28747
|
+
}) {
|
|
28748
|
+
return /* @__PURE__ */ jsx66(
|
|
28749
|
+
ThreadListPrimitiveRoot,
|
|
28750
|
+
{
|
|
28751
|
+
"data-slot": "aui_thread-list-root",
|
|
28752
|
+
className: cn("flex flex-col gap-0.5", className),
|
|
28753
|
+
...props
|
|
28754
|
+
}
|
|
28755
|
+
);
|
|
28695
28756
|
}
|
|
28696
28757
|
function ThreadListNew(props) {
|
|
28697
|
-
return /* @__PURE__ */ jsx66(ThreadListPrimitiveNew, { asChild: true, children: /* @__PURE__ */ jsxs10(
|
|
28698
|
-
|
|
28699
|
-
|
|
28700
|
-
|
|
28758
|
+
return /* @__PURE__ */ jsx66(ThreadListPrimitiveNew, { asChild: true, children: /* @__PURE__ */ jsxs10(
|
|
28759
|
+
"button",
|
|
28760
|
+
{
|
|
28761
|
+
type: "button",
|
|
28762
|
+
"data-slot": "aui_thread-list-new",
|
|
28763
|
+
className: cn(
|
|
28764
|
+
"border-foreground/10 bg-background hover:border-foreground/25 rounded-control flex h-8 w-full shrink-0 items-center gap-2 border px-2.5 text-[13px] transition-colors"
|
|
28765
|
+
),
|
|
28766
|
+
...props,
|
|
28767
|
+
children: [
|
|
28768
|
+
/* @__PURE__ */ jsx66(Plus, { className: cn("size-4 shrink-0") }),
|
|
28769
|
+
"\u65B0\u5EFA\u4F1A\u8BDD"
|
|
28770
|
+
]
|
|
28771
|
+
}
|
|
28772
|
+
) });
|
|
28701
28773
|
}
|
|
28702
|
-
function ThreadListSearch({
|
|
28774
|
+
function ThreadListSearch({
|
|
28775
|
+
value,
|
|
28776
|
+
onValueChange
|
|
28777
|
+
}) {
|
|
28703
28778
|
return /* @__PURE__ */ jsxs10("div", { "data-slot": "aui_thread-list-search", className: cn("relative px-0.5 py-1"), children: [
|
|
28704
|
-
/* @__PURE__ */ jsx66(
|
|
28705
|
-
|
|
28779
|
+
/* @__PURE__ */ jsx66(
|
|
28780
|
+
Search,
|
|
28781
|
+
{
|
|
28782
|
+
"data-slot": "aui_thread-list-search-icon",
|
|
28783
|
+
className: cn(
|
|
28784
|
+
"text-muted-foreground pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2"
|
|
28785
|
+
)
|
|
28786
|
+
}
|
|
28787
|
+
),
|
|
28788
|
+
/* @__PURE__ */ jsx66(
|
|
28789
|
+
Input,
|
|
28790
|
+
{
|
|
28791
|
+
type: "search",
|
|
28792
|
+
value,
|
|
28793
|
+
onChange: (event) => onValueChange(event.target.value),
|
|
28794
|
+
"aria-label": "\u641C\u7D22\u4F1A\u8BDD",
|
|
28795
|
+
placeholder: "\u641C\u7D22\u4F1A\u8BDD",
|
|
28796
|
+
className: cn("border-foreground/10 bg-background h-8 ps-8 text-[13px] md:text-[13px]")
|
|
28797
|
+
}
|
|
28798
|
+
)
|
|
28706
28799
|
] });
|
|
28707
28800
|
}
|
|
28708
|
-
function ThreadListItem({
|
|
28801
|
+
function ThreadListItem({
|
|
28802
|
+
disabled,
|
|
28803
|
+
menu
|
|
28804
|
+
}) {
|
|
28709
28805
|
const isRunning = useAuiState((s) => s.threadListItem.isRunning);
|
|
28710
28806
|
const title = useAuiState((s) => s.threadListItem.title);
|
|
28711
28807
|
const [isRenaming, setIsRenaming] = useState25(false);
|
|
@@ -28717,19 +28813,60 @@ function ThreadListItem({ disabled, menu }) {
|
|
|
28717
28813
|
triggerRef.current?.focus();
|
|
28718
28814
|
}
|
|
28719
28815
|
}, [isRenaming]);
|
|
28720
|
-
return /* @__PURE__ */ jsxs10(
|
|
28721
|
-
|
|
28722
|
-
|
|
28723
|
-
|
|
28724
|
-
|
|
28725
|
-
|
|
28726
|
-
|
|
28727
|
-
|
|
28728
|
-
|
|
28729
|
-
|
|
28730
|
-
|
|
28731
|
-
|
|
28732
|
-
|
|
28816
|
+
return /* @__PURE__ */ jsxs10(
|
|
28817
|
+
ThreadListItemPrimitiveRoot,
|
|
28818
|
+
{
|
|
28819
|
+
"data-slot": "aui_thread-list-item",
|
|
28820
|
+
className: cn(
|
|
28821
|
+
"group data-active:bg-foreground/[0.06] hover:bg-foreground/[0.04] has-data-[state=open]:bg-foreground/[0.04] rounded-control relative flex h-8 shrink-0 items-center transition-colors"
|
|
28822
|
+
),
|
|
28823
|
+
children: [
|
|
28824
|
+
isRenaming ? /* @__PURE__ */ jsx66(
|
|
28825
|
+
ThreadListItemRename,
|
|
28826
|
+
{
|
|
28827
|
+
onDone: (focus2) => {
|
|
28828
|
+
restoreFocus.current = focus2;
|
|
28829
|
+
setIsRenaming(false);
|
|
28830
|
+
}
|
|
28831
|
+
}
|
|
28832
|
+
) : /* @__PURE__ */ jsxs10(
|
|
28833
|
+
ThreadListItemPrimitiveTrigger,
|
|
28834
|
+
{
|
|
28835
|
+
ref: triggerRef,
|
|
28836
|
+
disabled,
|
|
28837
|
+
"data-slot": "aui_thread-list-item-trigger",
|
|
28838
|
+
className: cn(
|
|
28839
|
+
"text-muted-foreground group-data-active:text-foreground hover:text-foreground flex h-full min-w-0 flex-1 items-center px-2 text-left text-[13px] transition-colors outline-none group-hover:pe-8 group-has-focus-visible:pe-8 group-has-data-[state=open]:pe-8 group-data-active:pe-8"
|
|
28840
|
+
),
|
|
28841
|
+
children: [
|
|
28842
|
+
isRunning && /* @__PURE__ */ jsx66(
|
|
28843
|
+
LoaderCircle,
|
|
28844
|
+
{
|
|
28845
|
+
"aria-hidden": true,
|
|
28846
|
+
className: cn("text-muted-foreground me-1.5 size-3.5 shrink-0 animate-spin")
|
|
28847
|
+
}
|
|
28848
|
+
),
|
|
28849
|
+
/* @__PURE__ */ jsx66("span", { className: cn("min-w-0 flex-1 truncate"), children: /* @__PURE__ */ jsx66(ThreadListItemPrimitiveTitle, { fallback: "\u65B0\u4F1A\u8BDD" }) })
|
|
28850
|
+
]
|
|
28851
|
+
}
|
|
28852
|
+
),
|
|
28853
|
+
/* @__PURE__ */ jsxs10(DropdownMenu2, { modal: false, children: [
|
|
28854
|
+
/* @__PURE__ */ jsx66(DropdownMenuTrigger3, { asChild: true, children: /* @__PURE__ */ jsx66(
|
|
28855
|
+
"button",
|
|
28856
|
+
{
|
|
28857
|
+
type: "button",
|
|
28858
|
+
"aria-label": `\u7BA1\u7406 ${title}`,
|
|
28859
|
+
className: cn(
|
|
28860
|
+
"text-muted-foreground hover:text-foreground absolute end-1 top-1/2 grid size-6 -translate-y-1/2 place-items-center rounded-sm opacity-0 transition-colors group-hover:opacity-100 group-has-focus-visible:opacity-100 group-data-active:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100"
|
|
28861
|
+
),
|
|
28862
|
+
children: /* @__PURE__ */ jsx66(Ellipsis, { className: cn("size-3.5") })
|
|
28863
|
+
}
|
|
28864
|
+
) }),
|
|
28865
|
+
/* @__PURE__ */ jsx66(DropdownMenuContent3, { side: "right", align: "start", sideOffset: 6, children: menu(() => setIsRenaming(true)) })
|
|
28866
|
+
] })
|
|
28867
|
+
]
|
|
28868
|
+
}
|
|
28869
|
+
);
|
|
28733
28870
|
}
|
|
28734
28871
|
function ThreadListItemRename({ onDone }) {
|
|
28735
28872
|
const aui = useAui();
|
|
@@ -28748,10 +28885,13 @@ function ThreadListItemRename({ onDone }) {
|
|
|
28748
28885
|
onDone(focus2);
|
|
28749
28886
|
return;
|
|
28750
28887
|
}
|
|
28751
|
-
void Promise.resolve().then(() => aui.threadListItem.rename(next)).then(
|
|
28752
|
-
|
|
28753
|
-
|
|
28754
|
-
|
|
28888
|
+
void Promise.resolve().then(() => aui.threadListItem.rename(next)).then(
|
|
28889
|
+
() => onDone(focus2),
|
|
28890
|
+
() => {
|
|
28891
|
+
settled.current = false;
|
|
28892
|
+
if (focus2) inputRef.current?.focus();
|
|
28893
|
+
}
|
|
28894
|
+
);
|
|
28755
28895
|
};
|
|
28756
28896
|
return /* @__PURE__ */ jsx66(
|
|
28757
28897
|
Input,
|
|
@@ -28830,35 +28970,48 @@ var cva = (base, config) => (props) => {
|
|
|
28830
28970
|
|
|
28831
28971
|
// src/ui/button.tsx
|
|
28832
28972
|
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
28833
|
-
var buttonVariants = cva(
|
|
28834
|
-
|
|
28835
|
-
|
|
28836
|
-
|
|
28837
|
-
|
|
28838
|
-
|
|
28839
|
-
|
|
28840
|
-
|
|
28841
|
-
|
|
28973
|
+
var buttonVariants = cva(
|
|
28974
|
+
"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
28975
|
+
{
|
|
28976
|
+
variants: {
|
|
28977
|
+
variant: {
|
|
28978
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
28979
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
|
|
28980
|
+
outline: "border border-border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
28981
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
28982
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
28983
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
28984
|
+
},
|
|
28985
|
+
size: {
|
|
28986
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
28987
|
+
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
28988
|
+
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
|
28989
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
28990
|
+
icon: "size-9",
|
|
28991
|
+
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
28992
|
+
"icon-sm": "size-8",
|
|
28993
|
+
"icon-lg": "size-10"
|
|
28994
|
+
}
|
|
28842
28995
|
},
|
|
28843
|
-
|
|
28844
|
-
|
|
28845
|
-
|
|
28846
|
-
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
|
28847
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
28848
|
-
icon: "size-9",
|
|
28849
|
-
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
28850
|
-
"icon-sm": "size-8",
|
|
28851
|
-
"icon-lg": "size-10"
|
|
28996
|
+
defaultVariants: {
|
|
28997
|
+
variant: "default",
|
|
28998
|
+
size: "default"
|
|
28852
28999
|
}
|
|
28853
|
-
},
|
|
28854
|
-
defaultVariants: {
|
|
28855
|
-
variant: "default",
|
|
28856
|
-
size: "default"
|
|
28857
29000
|
}
|
|
28858
|
-
|
|
29001
|
+
);
|
|
28859
29002
|
var Button = React4.forwardRef(function Button2({ className, variant = "default", size: size4 = "default", asChild = false, ...props }, ref) {
|
|
28860
29003
|
const Comp = asChild ? dist_exports.Root : "button";
|
|
28861
|
-
return /* @__PURE__ */ jsx67(
|
|
29004
|
+
return /* @__PURE__ */ jsx67(
|
|
29005
|
+
Comp,
|
|
29006
|
+
{
|
|
29007
|
+
ref,
|
|
29008
|
+
"data-slot": "button",
|
|
29009
|
+
"data-variant": variant,
|
|
29010
|
+
"data-size": size4,
|
|
29011
|
+
className: cn(buttonVariants({ variant, size: size4, className })),
|
|
29012
|
+
...props
|
|
29013
|
+
}
|
|
29014
|
+
);
|
|
28862
29015
|
});
|
|
28863
29016
|
|
|
28864
29017
|
// src/ui/dialog.tsx
|
|
@@ -28871,14 +29024,15 @@ var DialogTrigger3 = React5.forwardRef(function DialogTrigger4({ ...props }, ref
|
|
|
28871
29024
|
});
|
|
28872
29025
|
function DialogPortal2({ ...props }) {
|
|
28873
29026
|
const container = useDialogContainer();
|
|
28874
|
-
if (!container)
|
|
28875
|
-
return null;
|
|
29027
|
+
if (!container) return null;
|
|
28876
29028
|
return /* @__PURE__ */ jsx68(dist_exports8.Portal, { container, "data-slot": "dialog-portal", ...props });
|
|
28877
29029
|
}
|
|
28878
29030
|
function DialogBackgroundGuard() {
|
|
28879
29031
|
const container = useDialogContainer();
|
|
28880
29032
|
React5.useLayoutEffect(() => {
|
|
28881
|
-
const siblings = Array.from(container?.parentElement?.children ?? []).filter(
|
|
29033
|
+
const siblings = Array.from(container?.parentElement?.children ?? []).filter(
|
|
29034
|
+
(node2) => node2 instanceof HTMLElement && node2 !== container
|
|
29035
|
+
);
|
|
28882
29036
|
const previous3 = siblings.map((node2) => node2.inert);
|
|
28883
29037
|
siblings.forEach((node2) => {
|
|
28884
29038
|
node2.inert = true;
|
|
@@ -28891,73 +29045,53 @@ function DialogBackgroundGuard() {
|
|
|
28891
29045
|
}, [container]);
|
|
28892
29046
|
return null;
|
|
28893
29047
|
}
|
|
28894
|
-
function DialogContent3({
|
|
29048
|
+
function DialogContent3({
|
|
29049
|
+
className,
|
|
29050
|
+
children,
|
|
29051
|
+
showCloseButton = true,
|
|
29052
|
+
onEscapeKeyDown,
|
|
29053
|
+
...props
|
|
29054
|
+
}) {
|
|
28895
29055
|
const content3 = React5.useRef(null);
|
|
28896
|
-
return /* @__PURE__ */ jsx68(DialogPortal2, { "data-slot": "dialog-portal", children: /* @__PURE__ */ jsxs11(
|
|
28897
|
-
|
|
28898
|
-
event.preventDefault();
|
|
28899
|
-
return;
|
|
28900
|
-
}
|
|
28901
|
-
onEscapeKeyDown?.(event);
|
|
28902
|
-
}, ...props, children: [
|
|
28903
|
-
/* @__PURE__ */ jsx68(DialogBackgroundGuard, {}),
|
|
28904
|
-
/* @__PURE__ */ jsxs11("div", { className: cn("relative grid w-full min-h-0 max-w-lg gap-4 overflow-y-auto rounded-lg border-0 bg-background p-6 shadow-lg outline-none", className), children: [
|
|
28905
|
-
children,
|
|
28906
|
-
showCloseButton && /* @__PURE__ */ jsxs11(dist_exports8.Close, { "data-slot": "dialog-close", className: cn("absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"), children: [
|
|
28907
|
-
/* @__PURE__ */ jsx68(X, {}),
|
|
28908
|
-
/* @__PURE__ */ jsx68("span", { className: cn("sr-only"), children: "Close" })
|
|
28909
|
-
] })
|
|
28910
|
-
] })
|
|
28911
|
-
] }) });
|
|
28912
|
-
}
|
|
28913
|
-
function DialogFooter({ className, showCloseButton = false, children, ...props }) {
|
|
28914
|
-
return /* @__PURE__ */ jsxs11("div", { "data-slot": "dialog-footer", className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className), ...props, children: [
|
|
28915
|
-
children,
|
|
28916
|
-
showCloseButton && /* @__PURE__ */ jsx68(dist_exports8.Close, { asChild: true, children: /* @__PURE__ */ jsx68(Button, { variant: "outline", children: "Close" }) })
|
|
28917
|
-
] });
|
|
28918
|
-
}
|
|
28919
|
-
function DialogTitle3({ className, ...props }) {
|
|
28920
|
-
return /* @__PURE__ */ jsx68(dist_exports8.Title, { "data-slot": "dialog-title", className: cn("text-lg leading-none font-semibold", className), ...props });
|
|
28921
|
-
}
|
|
28922
|
-
function DialogDescription3({ className, ...props }) {
|
|
28923
|
-
return /* @__PURE__ */ jsx68(dist_exports8.Description, { "data-slot": "dialog-description", className: cn("text-sm text-muted-foreground", className), ...props });
|
|
28924
|
-
}
|
|
28925
|
-
|
|
28926
|
-
// src/ui/home-demo/thread.tsx
|
|
28927
|
-
import { jsx as jsx69, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
28928
|
-
function Thread({ empty: isEmpty, welcome, suggestions, composer, footer: footer2, children, renderMessage }) {
|
|
28929
|
-
return /* @__PURE__ */ jsx69(ThreadPrimitiveRoot, { className: cn("flex h-full min-h-0 min-w-0 flex-1 flex-col"), style: { ["--nxf-thread-max-width"]: "42rem" }, children: /* @__PURE__ */ jsxs12(
|
|
28930
|
-
ThreadPrimitiveViewport,
|
|
29056
|
+
return /* @__PURE__ */ jsx68(DialogPortal2, { "data-slot": "dialog-portal", children: /* @__PURE__ */ jsxs11(
|
|
29057
|
+
dist_exports8.Content,
|
|
28931
29058
|
{
|
|
28932
|
-
|
|
28933
|
-
"data-slot": "
|
|
28934
|
-
|
|
28935
|
-
|
|
28936
|
-
|
|
28937
|
-
|
|
28938
|
-
|
|
28939
|
-
|
|
28940
|
-
|
|
28941
|
-
|
|
28942
|
-
|
|
28943
|
-
|
|
29059
|
+
ref: content3,
|
|
29060
|
+
"data-slot": "dialog-content",
|
|
29061
|
+
className: "nexface-chat__dialog-layer",
|
|
29062
|
+
onInteractOutside: (event) => event.preventDefault(),
|
|
29063
|
+
onEscapeKeyDown: (event) => {
|
|
29064
|
+
if (!(event.target instanceof Node) || !content3.current?.contains(event.target)) {
|
|
29065
|
+
event.preventDefault();
|
|
29066
|
+
return;
|
|
29067
|
+
}
|
|
29068
|
+
onEscapeKeyDown?.(event);
|
|
29069
|
+
},
|
|
29070
|
+
...props,
|
|
28944
29071
|
children: [
|
|
28945
|
-
|
|
28946
|
-
/* @__PURE__ */
|
|
28947
|
-
|
|
28948
|
-
children
|
|
28949
|
-
] }),
|
|
28950
|
-
/* @__PURE__ */ jsxs12(
|
|
28951
|
-
ThreadPrimitiveViewportFooter,
|
|
29072
|
+
/* @__PURE__ */ jsx68(DialogBackgroundGuard, {}),
|
|
29073
|
+
/* @__PURE__ */ jsxs11(
|
|
29074
|
+
"div",
|
|
28952
29075
|
{
|
|
28953
29076
|
className: cn(
|
|
28954
|
-
"
|
|
28955
|
-
|
|
29077
|
+
"relative grid w-full min-h-0 max-w-lg gap-4 overflow-y-auto rounded-lg border-0 bg-background p-6 shadow-lg outline-none",
|
|
29078
|
+
className
|
|
28956
29079
|
),
|
|
28957
29080
|
children: [
|
|
28958
|
-
|
|
28959
|
-
|
|
28960
|
-
|
|
29081
|
+
children,
|
|
29082
|
+
showCloseButton && /* @__PURE__ */ jsxs11(
|
|
29083
|
+
dist_exports8.Close,
|
|
29084
|
+
{
|
|
29085
|
+
"data-slot": "dialog-close",
|
|
29086
|
+
className: cn(
|
|
29087
|
+
"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
29088
|
+
),
|
|
29089
|
+
children: [
|
|
29090
|
+
/* @__PURE__ */ jsx68(X, {}),
|
|
29091
|
+
/* @__PURE__ */ jsx68("span", { className: cn("sr-only"), children: "Close" })
|
|
29092
|
+
]
|
|
29093
|
+
}
|
|
29094
|
+
)
|
|
28961
29095
|
]
|
|
28962
29096
|
}
|
|
28963
29097
|
)
|
|
@@ -28965,6 +29099,114 @@ function Thread({ empty: isEmpty, welcome, suggestions, composer, footer: footer
|
|
|
28965
29099
|
}
|
|
28966
29100
|
) });
|
|
28967
29101
|
}
|
|
29102
|
+
function DialogFooter({
|
|
29103
|
+
className,
|
|
29104
|
+
showCloseButton = false,
|
|
29105
|
+
children,
|
|
29106
|
+
...props
|
|
29107
|
+
}) {
|
|
29108
|
+
return /* @__PURE__ */ jsxs11(
|
|
29109
|
+
"div",
|
|
29110
|
+
{
|
|
29111
|
+
"data-slot": "dialog-footer",
|
|
29112
|
+
className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
|
|
29113
|
+
...props,
|
|
29114
|
+
children: [
|
|
29115
|
+
children,
|
|
29116
|
+
showCloseButton && /* @__PURE__ */ jsx68(dist_exports8.Close, { asChild: true, children: /* @__PURE__ */ jsx68(Button, { variant: "outline", children: "Close" }) })
|
|
29117
|
+
]
|
|
29118
|
+
}
|
|
29119
|
+
);
|
|
29120
|
+
}
|
|
29121
|
+
function DialogTitle3({ className, ...props }) {
|
|
29122
|
+
return /* @__PURE__ */ jsx68(
|
|
29123
|
+
dist_exports8.Title,
|
|
29124
|
+
{
|
|
29125
|
+
"data-slot": "dialog-title",
|
|
29126
|
+
className: cn("text-lg leading-none font-semibold", className),
|
|
29127
|
+
...props
|
|
29128
|
+
}
|
|
29129
|
+
);
|
|
29130
|
+
}
|
|
29131
|
+
function DialogDescription3({
|
|
29132
|
+
className,
|
|
29133
|
+
...props
|
|
29134
|
+
}) {
|
|
29135
|
+
return /* @__PURE__ */ jsx68(
|
|
29136
|
+
dist_exports8.Description,
|
|
29137
|
+
{
|
|
29138
|
+
"data-slot": "dialog-description",
|
|
29139
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
29140
|
+
...props
|
|
29141
|
+
}
|
|
29142
|
+
);
|
|
29143
|
+
}
|
|
29144
|
+
|
|
29145
|
+
// src/ui/home-demo/thread.tsx
|
|
29146
|
+
import { jsx as jsx69, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
29147
|
+
function Thread({
|
|
29148
|
+
empty: isEmpty,
|
|
29149
|
+
welcome,
|
|
29150
|
+
suggestions,
|
|
29151
|
+
composer,
|
|
29152
|
+
footer: footer2,
|
|
29153
|
+
children,
|
|
29154
|
+
renderMessage
|
|
29155
|
+
}) {
|
|
29156
|
+
return /* @__PURE__ */ jsx69(
|
|
29157
|
+
ThreadPrimitiveRoot,
|
|
29158
|
+
{
|
|
29159
|
+
className: cn("flex h-full min-h-0 min-w-0 flex-1 flex-col"),
|
|
29160
|
+
style: { ["--nxf-thread-max-width"]: "42rem" },
|
|
29161
|
+
children: /* @__PURE__ */ jsxs12(
|
|
29162
|
+
ThreadPrimitiveViewport,
|
|
29163
|
+
{
|
|
29164
|
+
turnAnchor: "top",
|
|
29165
|
+
"data-slot": "aui_thread-viewport",
|
|
29166
|
+
role: "log",
|
|
29167
|
+
"aria-live": "polite",
|
|
29168
|
+
className: cn(
|
|
29169
|
+
// The gutter is reserved whether or not a scrollbar is showing, so the
|
|
29170
|
+
// thread and its composer do not shift sideways on the first reply
|
|
29171
|
+
// that overflows. Only classic scrollbars take layout space, so the
|
|
29172
|
+
// jump appears on Windows and on macOS set to always show them.
|
|
29173
|
+
"relative flex flex-1 [scrollbar-gutter:stable_both-edges] flex-col overflow-y-auto px-4 pt-6 md:px-6",
|
|
29174
|
+
isEmpty && "justify-center"
|
|
29175
|
+
),
|
|
29176
|
+
children: [
|
|
29177
|
+
isEmpty ? welcome : null,
|
|
29178
|
+
/* @__PURE__ */ jsxs12(
|
|
29179
|
+
"div",
|
|
29180
|
+
{
|
|
29181
|
+
className: cn(
|
|
29182
|
+
"mx-auto mb-12 flex w-full max-w-(--nxf-thread-max-width) flex-col gap-y-6 empty:hidden"
|
|
29183
|
+
),
|
|
29184
|
+
children: [
|
|
29185
|
+
/* @__PURE__ */ jsx69(ThreadPrimitiveMessages, { children: renderMessage }),
|
|
29186
|
+
children
|
|
29187
|
+
]
|
|
29188
|
+
}
|
|
29189
|
+
),
|
|
29190
|
+
/* @__PURE__ */ jsxs12(
|
|
29191
|
+
ThreadPrimitiveViewportFooter,
|
|
29192
|
+
{
|
|
29193
|
+
className: cn(
|
|
29194
|
+
"bg-background mx-auto flex w-full max-w-(--nxf-thread-max-width) flex-col gap-3 overflow-visible pb-5",
|
|
29195
|
+
!isEmpty && "sticky bottom-0 mt-auto"
|
|
29196
|
+
),
|
|
29197
|
+
children: [
|
|
29198
|
+
footer2,
|
|
29199
|
+
composer,
|
|
29200
|
+
isEmpty ? suggestions : null
|
|
29201
|
+
]
|
|
29202
|
+
}
|
|
29203
|
+
)
|
|
29204
|
+
]
|
|
29205
|
+
}
|
|
29206
|
+
)
|
|
29207
|
+
}
|
|
29208
|
+
);
|
|
29209
|
+
}
|
|
28968
29210
|
|
|
28969
29211
|
// src/ui/home-demo/type.ts
|
|
28970
29212
|
var typeSection = "font-display text-[1.5rem] leading-snug font-[550] tracking-[-0.01em] text-balance lg:text-[1.75rem]";
|
|
@@ -28972,17 +29214,32 @@ var typeDeck = "text-muted-foreground max-w-[40ch] text-[15px] leading-relaxed t
|
|
|
28972
29214
|
|
|
28973
29215
|
// src/ui/home-demo/greeting.tsx
|
|
28974
29216
|
import { jsx as jsx70, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
28975
|
-
function Greeting({
|
|
28976
|
-
|
|
28977
|
-
|
|
28978
|
-
|
|
28979
|
-
|
|
29217
|
+
function Greeting({
|
|
29218
|
+
title,
|
|
29219
|
+
description
|
|
29220
|
+
}) {
|
|
29221
|
+
return /* @__PURE__ */ jsxs13(
|
|
29222
|
+
"div",
|
|
29223
|
+
{
|
|
29224
|
+
className: cn(
|
|
29225
|
+
"animate-in fade-in slide-in-from-bottom-1 mx-auto mb-8 flex w-full max-w-(--nxf-thread-max-width) flex-col items-center text-center duration-200"
|
|
29226
|
+
),
|
|
29227
|
+
children: [
|
|
29228
|
+
/* @__PURE__ */ jsx70("p", { className: cn(typeSection), children: title }),
|
|
29229
|
+
description ? /* @__PURE__ */ jsx70("p", { className: cn(typeDeck), children: description }) : null
|
|
29230
|
+
]
|
|
29231
|
+
}
|
|
29232
|
+
);
|
|
28980
29233
|
}
|
|
28981
29234
|
|
|
28982
29235
|
// src/ui/home-demo/suggestions.tsx
|
|
28983
29236
|
import { jsx as jsx71 } from "react/jsx-runtime";
|
|
28984
29237
|
var suggestionChipClass = "border-foreground/10 bg-background text-muted-foreground hover:border-foreground/25 hover:text-foreground rounded-control h-8 border px-3 text-[13px] transition-colors";
|
|
28985
|
-
function Suggestions2({
|
|
29238
|
+
function Suggestions2({
|
|
29239
|
+
suggestions,
|
|
29240
|
+
disabled,
|
|
29241
|
+
onSend
|
|
29242
|
+
}) {
|
|
28986
29243
|
const isComposerEmpty = useAuiState((s) => s.composer.isEmpty);
|
|
28987
29244
|
const hidden = !isComposerEmpty || disabled;
|
|
28988
29245
|
return (
|
|
@@ -29022,7 +29279,9 @@ import { useEffect as useEffect25, useLayoutEffect as useLayoutEffect10, useRef
|
|
|
29022
29279
|
function suggestionMessages(messages) {
|
|
29023
29280
|
const result = [];
|
|
29024
29281
|
for (const message of messages) {
|
|
29025
|
-
const parts = message.parts.flatMap(
|
|
29282
|
+
const parts = message.parts.flatMap(
|
|
29283
|
+
(part) => part.type === "text" && part.text.trim() ? [{ type: "text", text: part.text }] : []
|
|
29284
|
+
);
|
|
29026
29285
|
if (message.role === "assistant" && !parts.length) continue;
|
|
29027
29286
|
const previous3 = result.at(-1);
|
|
29028
29287
|
if (message.role === "assistant" && previous3?.role === "assistant") {
|
|
@@ -29068,45 +29327,47 @@ function useNextMessage(chat, suggest, open) {
|
|
|
29068
29327
|
// src/ui/home-demo/action-bar.tsx
|
|
29069
29328
|
import { jsx as jsx72, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
29070
29329
|
function AssistantActionBar() {
|
|
29071
|
-
return /* @__PURE__ */ jsx72(
|
|
29072
|
-
|
|
29073
|
-
{
|
|
29074
|
-
|
|
29075
|
-
className: cn("flex items-center gap-1.5"),
|
|
29076
|
-
children: /* @__PURE__ */ jsxs14(
|
|
29077
|
-
ActionBarPrimitiveCopy,
|
|
29078
|
-
{
|
|
29079
|
-
"aria-label": "\u590D\u5236\u56DE\u590D",
|
|
29080
|
-
className: cn(actionButtonClass),
|
|
29081
|
-
children: [
|
|
29082
|
-
/* @__PURE__ */ jsx72(AuiIf, { condition: (s) => s.message.isCopied, children: /* @__PURE__ */ jsx72(Check, { className: cn("size-4") }) }),
|
|
29083
|
-
/* @__PURE__ */ jsx72(AuiIf, { condition: (s) => !s.message.isCopied, children: /* @__PURE__ */ jsx72(Copy, { className: cn("size-4") }) })
|
|
29084
|
-
]
|
|
29085
|
-
}
|
|
29086
|
-
)
|
|
29087
|
-
}
|
|
29088
|
-
);
|
|
29330
|
+
return /* @__PURE__ */ jsx72(ActionBarPrimitiveRoot, { autohide: "never", className: cn("flex items-center gap-1.5"), children: /* @__PURE__ */ jsxs14(ActionBarPrimitiveCopy, { "aria-label": "\u590D\u5236\u56DE\u590D", className: cn(actionButtonClass), children: [
|
|
29331
|
+
/* @__PURE__ */ jsx72(AuiIf, { condition: (s) => s.message.isCopied, children: /* @__PURE__ */ jsx72(Check, { className: cn("size-4") }) }),
|
|
29332
|
+
/* @__PURE__ */ jsx72(AuiIf, { condition: (s) => !s.message.isCopied, children: /* @__PURE__ */ jsx72(Copy, { className: cn("size-4") }) })
|
|
29333
|
+
] }) });
|
|
29089
29334
|
}
|
|
29090
29335
|
|
|
29091
29336
|
// src/ui/home-demo/messages.tsx
|
|
29092
29337
|
import { jsx as jsx73, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
29093
|
-
function UserMessage({
|
|
29338
|
+
function UserMessage({
|
|
29339
|
+
children,
|
|
29340
|
+
attachments,
|
|
29341
|
+
actions
|
|
29342
|
+
}) {
|
|
29094
29343
|
return /* @__PURE__ */ jsxs15(
|
|
29095
29344
|
MessagePrimitiveRoot,
|
|
29096
29345
|
{
|
|
29097
29346
|
"data-role": "user",
|
|
29098
29347
|
"data-slot": "aui_user-message-root",
|
|
29099
|
-
className: cn(
|
|
29348
|
+
className: cn(
|
|
29349
|
+
"animate-in fade-in slide-in-from-bottom-1 mx-auto flex w-full max-w-(--nxf-thread-max-width) flex-col items-end duration-150"
|
|
29350
|
+
),
|
|
29100
29351
|
children: [
|
|
29101
29352
|
/* @__PURE__ */ jsx73("div", { className: cn("w-full has-[.aui-attachment-root]:mb-2"), children: attachments }),
|
|
29102
29353
|
/* @__PURE__ */ jsxs15("div", { className: cn("relative max-w-[80%]"), children: [
|
|
29103
|
-
/* @__PURE__ */ jsx73(
|
|
29354
|
+
/* @__PURE__ */ jsx73(
|
|
29355
|
+
"div",
|
|
29356
|
+
{
|
|
29357
|
+
className: cn(
|
|
29358
|
+
"peer bg-muted rounded-thread px-4 py-2 text-[15px] wrap-break-word empty:hidden"
|
|
29359
|
+
),
|
|
29360
|
+
children
|
|
29361
|
+
}
|
|
29362
|
+
),
|
|
29104
29363
|
/* @__PURE__ */ jsx73(
|
|
29105
29364
|
ActionBarPrimitiveRoot,
|
|
29106
29365
|
{
|
|
29107
29366
|
hideWhenRunning: true,
|
|
29108
29367
|
autohide: "not-last",
|
|
29109
|
-
className: cn(
|
|
29368
|
+
className: cn(
|
|
29369
|
+
"absolute start-0 top-1/2 -translate-x-full -translate-y-1/2 pe-1.5 peer-empty:hidden"
|
|
29370
|
+
),
|
|
29110
29371
|
children: actions
|
|
29111
29372
|
}
|
|
29112
29373
|
)
|
|
@@ -29121,26 +29382,50 @@ function AssistantMessage({ children }) {
|
|
|
29121
29382
|
{
|
|
29122
29383
|
"data-role": "assistant",
|
|
29123
29384
|
"data-slot": "aui_assistant-message-root",
|
|
29124
|
-
className: cn(
|
|
29385
|
+
className: cn(
|
|
29386
|
+
"animate-in fade-in slide-in-from-bottom-1 mx-auto w-full max-w-(--nxf-thread-max-width) duration-150"
|
|
29387
|
+
),
|
|
29125
29388
|
children: [
|
|
29126
|
-
/* @__PURE__ */ jsxs15(
|
|
29127
|
-
|
|
29128
|
-
|
|
29129
|
-
|
|
29389
|
+
/* @__PURE__ */ jsxs15(
|
|
29390
|
+
"div",
|
|
29391
|
+
{
|
|
29392
|
+
"data-slot": "aui_assistant-message-content",
|
|
29393
|
+
className: cn("text-[15px] leading-relaxed wrap-break-word"),
|
|
29394
|
+
children: [
|
|
29395
|
+
children,
|
|
29396
|
+
/* @__PURE__ */ jsx73(MessageError, {})
|
|
29397
|
+
]
|
|
29398
|
+
}
|
|
29399
|
+
),
|
|
29130
29400
|
/* @__PURE__ */ jsx73("div", { className: cn("mt-2 flex items-center gap-1.5 empty:hidden"), children: /* @__PURE__ */ jsx73(AssistantActionBar, {}) })
|
|
29131
29401
|
]
|
|
29132
29402
|
}
|
|
29133
29403
|
);
|
|
29134
29404
|
}
|
|
29135
29405
|
function MessageError() {
|
|
29136
|
-
const cancelled = useAuiState(
|
|
29137
|
-
|
|
29138
|
-
|
|
29406
|
+
const cancelled = useAuiState(
|
|
29407
|
+
(s) => s.message.status?.type === "incomplete" && s.message.status.reason === "cancelled"
|
|
29408
|
+
);
|
|
29409
|
+
if (cancelled)
|
|
29410
|
+
return /* @__PURE__ */ jsx73("p", { role: "status", className: cn("mt-2 text-[13px] text-muted-foreground"), children: "Stopped" });
|
|
29411
|
+
return /* @__PURE__ */ jsx73(MessagePrimitiveError, { children: /* @__PURE__ */ jsx73(
|
|
29412
|
+
ErrorPrimitiveRoot,
|
|
29413
|
+
{
|
|
29414
|
+
role: "alert",
|
|
29415
|
+
className: cn("mt-2 border-l-2 pl-3 text-[13px] border-destructive/60 text-destructive"),
|
|
29416
|
+
children: /* @__PURE__ */ jsx73(ErrorPrimitiveMessage, { className: cn("line-clamp-2") })
|
|
29417
|
+
}
|
|
29418
|
+
) });
|
|
29139
29419
|
}
|
|
29140
29420
|
|
|
29141
29421
|
// src/ui/home-demo/composer.tsx
|
|
29142
29422
|
import { jsx as jsx74, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
29143
|
-
function Composer({
|
|
29423
|
+
function Composer({
|
|
29424
|
+
children,
|
|
29425
|
+
inputProps,
|
|
29426
|
+
actions,
|
|
29427
|
+
...props
|
|
29428
|
+
}) {
|
|
29144
29429
|
return /* @__PURE__ */ jsx74(ComposerPrimitiveRoot, { className: cn("relative w-full"), ...props, children: /* @__PURE__ */ jsx74(
|
|
29145
29430
|
ComposerPrimitiveAttachmentDropzone,
|
|
29146
29431
|
{
|
|
@@ -29152,52 +29437,91 @@ function Composer({ children, inputProps, actions, ...props }) {
|
|
|
29152
29437
|
onDragOverCapture: (event) => {
|
|
29153
29438
|
if (inputProps.disabled) event.preventDefault();
|
|
29154
29439
|
},
|
|
29155
|
-
children: /* @__PURE__ */ jsxs16(
|
|
29156
|
-
|
|
29157
|
-
|
|
29158
|
-
|
|
29159
|
-
|
|
29440
|
+
children: /* @__PURE__ */ jsxs16(
|
|
29441
|
+
"div",
|
|
29442
|
+
{
|
|
29443
|
+
"data-slot": "aui_composer-shell",
|
|
29444
|
+
className: cn(
|
|
29445
|
+
"border-foreground/10 bg-muted/30 focus-within:border-foreground/25 data-[dragging=true]:border-foreground/40 rounded-thread flex flex-col border transition-colors data-[dragging=true]:border-dashed"
|
|
29446
|
+
),
|
|
29447
|
+
children: [
|
|
29448
|
+
/* @__PURE__ */ jsx74("div", { className: cn("has-[.aui-attachment-root]:px-3 has-[.aui-attachment-root]:pt-3"), children }),
|
|
29449
|
+
/* @__PURE__ */ jsx74(ComposerPrimitiveInput, { asChild: true, ...inputProps, children: /* @__PURE__ */ jsx74(
|
|
29450
|
+
"textarea",
|
|
29451
|
+
{
|
|
29452
|
+
"data-composer-input": true,
|
|
29453
|
+
rows: 1,
|
|
29454
|
+
className: cn(
|
|
29455
|
+
"placeholder:text-muted-foreground field-sizing-content block max-h-48 w-full resize-none bg-transparent px-4 pt-3 pb-2 text-base leading-6 focus:outline-none"
|
|
29456
|
+
)
|
|
29457
|
+
}
|
|
29458
|
+
) }),
|
|
29459
|
+
/* @__PURE__ */ jsx74("div", { className: cn("flex items-center justify-between gap-2 px-2 pb-2"), children: actions })
|
|
29460
|
+
]
|
|
29461
|
+
}
|
|
29462
|
+
)
|
|
29160
29463
|
}
|
|
29161
29464
|
) });
|
|
29162
29465
|
}
|
|
29163
|
-
function EditComposer({
|
|
29466
|
+
function EditComposer({
|
|
29467
|
+
children,
|
|
29468
|
+
inputProps,
|
|
29469
|
+
cancelProps,
|
|
29470
|
+
sendProps,
|
|
29471
|
+
...props
|
|
29472
|
+
}) {
|
|
29164
29473
|
return /* @__PURE__ */ jsx74(
|
|
29165
29474
|
MessagePrimitiveRoot,
|
|
29166
29475
|
{
|
|
29167
29476
|
"data-role": "user",
|
|
29168
29477
|
"data-slot": "aui_edit-composer-wrapper",
|
|
29169
29478
|
className: cn("mx-auto flex w-full max-w-(--nxf-thread-max-width) flex-col items-end"),
|
|
29170
|
-
children: /* @__PURE__ */ jsxs16(
|
|
29171
|
-
|
|
29172
|
-
|
|
29173
|
-
|
|
29174
|
-
|
|
29175
|
-
|
|
29176
|
-
|
|
29177
|
-
|
|
29178
|
-
|
|
29179
|
-
|
|
29180
|
-
|
|
29181
|
-
|
|
29182
|
-
|
|
29183
|
-
|
|
29184
|
-
|
|
29185
|
-
|
|
29186
|
-
|
|
29187
|
-
|
|
29188
|
-
|
|
29189
|
-
|
|
29190
|
-
|
|
29191
|
-
|
|
29192
|
-
|
|
29193
|
-
|
|
29194
|
-
|
|
29195
|
-
|
|
29196
|
-
|
|
29197
|
-
|
|
29198
|
-
|
|
29199
|
-
|
|
29200
|
-
|
|
29479
|
+
children: /* @__PURE__ */ jsxs16(
|
|
29480
|
+
ComposerPrimitiveRoot,
|
|
29481
|
+
{
|
|
29482
|
+
className: cn(
|
|
29483
|
+
"border-foreground/10 bg-muted/30 focus-within:border-foreground/25 rounded-thread flex w-full max-w-[85%] flex-col border transition-colors"
|
|
29484
|
+
),
|
|
29485
|
+
...props,
|
|
29486
|
+
children: [
|
|
29487
|
+
/* @__PURE__ */ jsx74(ComposerPrimitiveInput, { asChild: true, ...inputProps, children: /* @__PURE__ */ jsx74(
|
|
29488
|
+
"textarea",
|
|
29489
|
+
{
|
|
29490
|
+
autoFocus: true,
|
|
29491
|
+
rows: 1,
|
|
29492
|
+
className: cn(
|
|
29493
|
+
"field-sizing-content max-h-48 min-h-12 w-full resize-none bg-transparent px-4 pt-3.5 pb-1 text-[15px] leading-6 focus:outline-none"
|
|
29494
|
+
)
|
|
29495
|
+
}
|
|
29496
|
+
) }),
|
|
29497
|
+
children,
|
|
29498
|
+
/* @__PURE__ */ jsxs16("div", { className: cn("flex items-center justify-end gap-1.5 px-2.5 pb-2.5"), children: [
|
|
29499
|
+
/* @__PURE__ */ jsx74(ComposerPrimitiveCancel, { asChild: true, children: /* @__PURE__ */ jsx74(
|
|
29500
|
+
"button",
|
|
29501
|
+
{
|
|
29502
|
+
type: "button",
|
|
29503
|
+
...cancelProps,
|
|
29504
|
+
className: cn(
|
|
29505
|
+
"text-muted-foreground hover:text-foreground rounded-control h-8 px-3 text-[13px] transition-colors"
|
|
29506
|
+
),
|
|
29507
|
+
children: "\u53D6\u6D88"
|
|
29508
|
+
}
|
|
29509
|
+
) }),
|
|
29510
|
+
/* @__PURE__ */ jsx74(ComposerPrimitiveSend, { asChild: true, children: /* @__PURE__ */ jsx74(
|
|
29511
|
+
"button",
|
|
29512
|
+
{
|
|
29513
|
+
type: "button",
|
|
29514
|
+
...sendProps,
|
|
29515
|
+
className: cn(
|
|
29516
|
+
"bg-primary text-primary-foreground rounded-control h-8 px-3 text-[13px] font-medium transition-opacity disabled:opacity-40"
|
|
29517
|
+
),
|
|
29518
|
+
children: "\u4FDD\u5B58\u5E76\u91CD\u65B0\u53D1\u9001"
|
|
29519
|
+
}
|
|
29520
|
+
) })
|
|
29521
|
+
] })
|
|
29522
|
+
]
|
|
29523
|
+
}
|
|
29524
|
+
)
|
|
29201
29525
|
}
|
|
29202
29526
|
);
|
|
29203
29527
|
}
|
|
@@ -29208,8 +29532,18 @@ import { forwardRef as forwardRef29 } from "react";
|
|
|
29208
29532
|
// src/ui/tooltip.tsx
|
|
29209
29533
|
import * as React6 from "react";
|
|
29210
29534
|
import { jsx as jsx75, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
29211
|
-
function TooltipProvider2({
|
|
29212
|
-
|
|
29535
|
+
function TooltipProvider2({
|
|
29536
|
+
delayDuration = 0,
|
|
29537
|
+
...props
|
|
29538
|
+
}) {
|
|
29539
|
+
return /* @__PURE__ */ jsx75(
|
|
29540
|
+
dist_exports12.Provider,
|
|
29541
|
+
{
|
|
29542
|
+
"data-slot": "tooltip-provider",
|
|
29543
|
+
delayDuration,
|
|
29544
|
+
...props
|
|
29545
|
+
}
|
|
29546
|
+
);
|
|
29213
29547
|
}
|
|
29214
29548
|
function Tooltip2({ ...props }) {
|
|
29215
29549
|
return /* @__PURE__ */ jsx75(dist_exports12.Root, { "data-slot": "tooltip", ...props });
|
|
@@ -29217,51 +29551,132 @@ function Tooltip2({ ...props }) {
|
|
|
29217
29551
|
var TooltipTrigger3 = React6.forwardRef(function TooltipTrigger4({ ...props }, ref) {
|
|
29218
29552
|
return /* @__PURE__ */ jsx75(dist_exports12.Trigger, { "data-slot": "tooltip-trigger", ref, ...props });
|
|
29219
29553
|
});
|
|
29220
|
-
function TooltipContent3({
|
|
29554
|
+
function TooltipContent3({
|
|
29555
|
+
className,
|
|
29556
|
+
sideOffset = 0,
|
|
29557
|
+
children,
|
|
29558
|
+
...props
|
|
29559
|
+
}) {
|
|
29221
29560
|
const container = usePortalContainer();
|
|
29222
|
-
if (!container)
|
|
29223
|
-
|
|
29224
|
-
|
|
29225
|
-
|
|
29226
|
-
|
|
29227
|
-
|
|
29228
|
-
|
|
29561
|
+
if (!container) return null;
|
|
29562
|
+
return /* @__PURE__ */ jsx75(dist_exports12.Portal, { container, children: /* @__PURE__ */ jsxs17(
|
|
29563
|
+
dist_exports12.Content,
|
|
29564
|
+
{
|
|
29565
|
+
"data-slot": "tooltip-content",
|
|
29566
|
+
sideOffset,
|
|
29567
|
+
className: cn(
|
|
29568
|
+
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
29569
|
+
className
|
|
29570
|
+
),
|
|
29571
|
+
...props,
|
|
29572
|
+
children: [
|
|
29573
|
+
/* @__PURE__ */ jsx75(PortalThemeSync, {}),
|
|
29574
|
+
children,
|
|
29575
|
+
/* @__PURE__ */ jsx75(
|
|
29576
|
+
dist_exports12.Arrow,
|
|
29577
|
+
{
|
|
29578
|
+
className: cn(
|
|
29579
|
+
"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"
|
|
29580
|
+
)
|
|
29581
|
+
}
|
|
29582
|
+
)
|
|
29583
|
+
]
|
|
29584
|
+
}
|
|
29585
|
+
) });
|
|
29229
29586
|
}
|
|
29230
29587
|
|
|
29231
29588
|
// src/ui/tooltip-icon-button.tsx
|
|
29232
29589
|
import { jsx as jsx76, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
29233
|
-
var TooltipIconButton = forwardRef29(
|
|
29234
|
-
|
|
29235
|
-
/* @__PURE__ */ jsx76(
|
|
29236
|
-
/* @__PURE__ */ jsx76(
|
|
29237
|
-
|
|
29238
|
-
|
|
29239
|
-
|
|
29240
|
-
|
|
29241
|
-
|
|
29590
|
+
var TooltipIconButton = forwardRef29(
|
|
29591
|
+
({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
|
|
29592
|
+
return /* @__PURE__ */ jsx76(TooltipProvider2, { delayDuration: 0, children: /* @__PURE__ */ jsxs18(Tooltip2, { children: [
|
|
29593
|
+
/* @__PURE__ */ jsx76(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsxs18(
|
|
29594
|
+
Button,
|
|
29595
|
+
{
|
|
29596
|
+
variant: "ghost",
|
|
29597
|
+
size: "icon",
|
|
29598
|
+
...rest,
|
|
29599
|
+
className: cn("aui-button-icon size-6 p-1 active:scale-90", className),
|
|
29600
|
+
ref,
|
|
29601
|
+
children: [
|
|
29602
|
+
/* @__PURE__ */ jsx76(dist_exports.Slottable, { children }),
|
|
29603
|
+
/* @__PURE__ */ jsx76("span", { className: cn("aui-sr-only sr-only"), children: tooltip })
|
|
29604
|
+
]
|
|
29605
|
+
}
|
|
29606
|
+
) }),
|
|
29607
|
+
/* @__PURE__ */ jsx76(TooltipContent3, { side, children: tooltip })
|
|
29608
|
+
] }) });
|
|
29609
|
+
}
|
|
29610
|
+
);
|
|
29242
29611
|
TooltipIconButton.displayName = "TooltipIconButton";
|
|
29243
29612
|
|
|
29244
29613
|
// src/ui/avatar.tsx
|
|
29245
29614
|
import { jsx as jsx77 } from "react/jsx-runtime";
|
|
29246
|
-
function Avatar3({
|
|
29247
|
-
|
|
29615
|
+
function Avatar3({
|
|
29616
|
+
className,
|
|
29617
|
+
size: size4 = "default",
|
|
29618
|
+
...props
|
|
29619
|
+
}) {
|
|
29620
|
+
return /* @__PURE__ */ jsx77(
|
|
29621
|
+
dist_exports9.Root,
|
|
29622
|
+
{
|
|
29623
|
+
"data-slot": "avatar",
|
|
29624
|
+
"data-size": size4,
|
|
29625
|
+
className: cn(
|
|
29626
|
+
"group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6",
|
|
29627
|
+
className
|
|
29628
|
+
),
|
|
29629
|
+
...props
|
|
29630
|
+
}
|
|
29631
|
+
);
|
|
29248
29632
|
}
|
|
29249
29633
|
function AvatarImage3({ className, ...props }) {
|
|
29250
|
-
return /* @__PURE__ */ jsx77(
|
|
29634
|
+
return /* @__PURE__ */ jsx77(
|
|
29635
|
+
dist_exports9.Image,
|
|
29636
|
+
{
|
|
29637
|
+
"data-slot": "avatar-image",
|
|
29638
|
+
className: cn("aspect-square size-full", className),
|
|
29639
|
+
...props
|
|
29640
|
+
}
|
|
29641
|
+
);
|
|
29251
29642
|
}
|
|
29252
|
-
function AvatarFallback3({
|
|
29253
|
-
|
|
29643
|
+
function AvatarFallback3({
|
|
29644
|
+
className,
|
|
29645
|
+
...props
|
|
29646
|
+
}) {
|
|
29647
|
+
return /* @__PURE__ */ jsx77(
|
|
29648
|
+
dist_exports9.Fallback,
|
|
29649
|
+
{
|
|
29650
|
+
"data-slot": "avatar-fallback",
|
|
29651
|
+
className: cn(
|
|
29652
|
+
"flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",
|
|
29653
|
+
className
|
|
29654
|
+
),
|
|
29655
|
+
...props
|
|
29656
|
+
}
|
|
29657
|
+
);
|
|
29254
29658
|
}
|
|
29255
29659
|
|
|
29256
29660
|
// src/default-chat.tsx
|
|
29257
|
-
import {
|
|
29661
|
+
import {
|
|
29662
|
+
forwardRef as forwardRef33,
|
|
29663
|
+
useEffect as useEffect34,
|
|
29664
|
+
useLayoutEffect as useLayoutEffect14,
|
|
29665
|
+
useMemo as useMemo13,
|
|
29666
|
+
useRef as useRef39,
|
|
29667
|
+
useState as useState39
|
|
29668
|
+
} from "react";
|
|
29258
29669
|
|
|
29259
29670
|
// src/assistant-runtime.tsx
|
|
29260
29671
|
import { useEffect as useEffect26, useLayoutEffect as useLayoutEffect12, useReducer as useReducer5, useRef as useRef30, useState as useState28 } from "react";
|
|
29261
29672
|
|
|
29262
29673
|
// src/assistant-attachments.ts
|
|
29263
29674
|
import { ImageInputContentSchema, TextInputContentSchema } from "@ag-ui/core";
|
|
29264
|
-
import {
|
|
29675
|
+
import {
|
|
29676
|
+
attachmentContent,
|
|
29677
|
+
readAttachment,
|
|
29678
|
+
validateAttachment
|
|
29679
|
+
} from "./attachments.js";
|
|
29265
29680
|
var errorText = (error) => error instanceof Error ? error.message : String(error);
|
|
29266
29681
|
var durablePreview = (preview) => preview?.startsWith("data:image/") ? preview : void 0;
|
|
29267
29682
|
function abortable(signal, task) {
|
|
@@ -29275,9 +29690,18 @@ function abortable(signal, task) {
|
|
|
29275
29690
|
function toAssistantAttachment(attachment) {
|
|
29276
29691
|
const content3 = attachmentContent(attachment).map((part) => {
|
|
29277
29692
|
if (part.type === "text") return part;
|
|
29278
|
-
return {
|
|
29693
|
+
return {
|
|
29694
|
+
type: "image",
|
|
29695
|
+
image: part.source.type === "data" ? `data:${part.source.mimeType};base64,${part.source.value}` : part.source.value
|
|
29696
|
+
};
|
|
29279
29697
|
});
|
|
29280
|
-
return {
|
|
29698
|
+
return {
|
|
29699
|
+
id: attachment.id,
|
|
29700
|
+
name: attachment.name,
|
|
29701
|
+
type: attachment.preview ? "image" : "document",
|
|
29702
|
+
content: content3,
|
|
29703
|
+
status: { type: "complete" }
|
|
29704
|
+
};
|
|
29281
29705
|
}
|
|
29282
29706
|
var AssistantAttachments = class {
|
|
29283
29707
|
constructor(changed, notice) {
|
|
@@ -29308,15 +29732,30 @@ var AssistantAttachments = class {
|
|
|
29308
29732
|
this.notice("\u9644\u4EF6\u6570\u91CF\u8D85\u51FA\u9650\u5236\u3002");
|
|
29309
29733
|
throw new Error("\u9644\u4EF6\u6570\u91CF\u8D85\u51FA\u9650\u5236\u3002");
|
|
29310
29734
|
}
|
|
29311
|
-
const entry = {
|
|
29735
|
+
const entry = {
|
|
29736
|
+
id: crypto.randomUUID(),
|
|
29737
|
+
file,
|
|
29738
|
+
controller: new AbortController(),
|
|
29739
|
+
adapter: options2.adapter,
|
|
29740
|
+
adding: true
|
|
29741
|
+
};
|
|
29312
29742
|
this.entries.set(entry.id, entry);
|
|
29313
29743
|
this.changed();
|
|
29314
|
-
const base = {
|
|
29744
|
+
const base = {
|
|
29745
|
+
id: entry.id,
|
|
29746
|
+
file,
|
|
29747
|
+
name: file.name,
|
|
29748
|
+
contentType: file.type,
|
|
29749
|
+
type: file.type.startsWith("image/") ? "image" : "document"
|
|
29750
|
+
};
|
|
29315
29751
|
yield { ...base, status: { type: "running", reason: "uploading", progress: 0 } };
|
|
29316
29752
|
try {
|
|
29317
29753
|
if (entry.adapter) {
|
|
29318
29754
|
validateAttachment(file, options2);
|
|
29319
|
-
const result = await abortable(
|
|
29755
|
+
const result = await abortable(
|
|
29756
|
+
entry.controller.signal,
|
|
29757
|
+
entry.adapter.add({ id: entry.id, file, signal: entry.controller.signal })
|
|
29758
|
+
);
|
|
29320
29759
|
this.assertLive(entry);
|
|
29321
29760
|
entry.data = result.data;
|
|
29322
29761
|
entry.preview = result.preview;
|
|
@@ -29343,9 +29782,18 @@ var AssistantAttachments = class {
|
|
|
29343
29782
|
try {
|
|
29344
29783
|
let content3;
|
|
29345
29784
|
if (entry.adapter) {
|
|
29346
|
-
const result = await abortable(
|
|
29785
|
+
const result = await abortable(
|
|
29786
|
+
entry.controller.signal,
|
|
29787
|
+
entry.adapter.send({
|
|
29788
|
+
id: entry.id,
|
|
29789
|
+
file: entry.file,
|
|
29790
|
+
data: entry.data,
|
|
29791
|
+
signal: entry.controller.signal
|
|
29792
|
+
})
|
|
29793
|
+
);
|
|
29347
29794
|
this.assertLive(entry);
|
|
29348
|
-
if (!Array.isArray(result.content) || !result.content.length)
|
|
29795
|
+
if (!Array.isArray(result.content) || !result.content.length)
|
|
29796
|
+
throw new Error("\u9644\u4EF6\u5904\u7406\u5FC5\u987B\u8FD4\u56DE\u6587\u672C\u6216\u5185\u8054\u56FE\u7247\u3002");
|
|
29349
29797
|
content3 = result.content.map((part) => {
|
|
29350
29798
|
if (part.type === "text") return TextInputContentSchema.parse(part);
|
|
29351
29799
|
const image3 = ImageInputContentSchema.parse(part);
|
|
@@ -29355,7 +29803,12 @@ var AssistantAttachments = class {
|
|
|
29355
29803
|
} else content3 = attachmentContent(entry.local);
|
|
29356
29804
|
this.assertLive(entry);
|
|
29357
29805
|
const preview = durablePreview(entry.preview);
|
|
29358
|
-
entry.result = {
|
|
29806
|
+
entry.result = {
|
|
29807
|
+
id: entry.id,
|
|
29808
|
+
name: entry.file.name,
|
|
29809
|
+
content: content3,
|
|
29810
|
+
...preview ? { preview } : {}
|
|
29811
|
+
};
|
|
29359
29812
|
return toAssistantAttachment(entry.result);
|
|
29360
29813
|
} catch (error) {
|
|
29361
29814
|
if (this.live(entry)) this.notice(errorText(error));
|
|
@@ -29413,136 +29866,150 @@ function useVoiceInput(options2) {
|
|
|
29413
29866
|
owner.current?.();
|
|
29414
29867
|
generation.current++;
|
|
29415
29868
|
};
|
|
29416
|
-
const dictation = useMemo10(
|
|
29417
|
-
|
|
29418
|
-
|
|
29419
|
-
|
|
29420
|
-
|
|
29421
|
-
|
|
29422
|
-
|
|
29423
|
-
|
|
29424
|
-
|
|
29425
|
-
|
|
29426
|
-
|
|
29427
|
-
|
|
29428
|
-
|
|
29429
|
-
|
|
29430
|
-
|
|
29431
|
-
|
|
29432
|
-
|
|
29433
|
-
|
|
29434
|
-
|
|
29435
|
-
|
|
29436
|
-
|
|
29437
|
-
|
|
29438
|
-
|
|
29439
|
-
|
|
29440
|
-
|
|
29441
|
-
} catch {
|
|
29442
|
-
}
|
|
29443
|
-
};
|
|
29444
|
-
const finish = (reason) => {
|
|
29445
|
-
if (!valid2()) return;
|
|
29446
|
-
ended = true;
|
|
29447
|
-
status2 = { type: "ended", reason };
|
|
29448
|
-
owner.current = void 0;
|
|
29449
|
-
for (const unsubscribe of subscriptions.splice(0)) unsubscribe();
|
|
29450
|
-
if (reason !== "stopped" || !hasConfirmed) restore();
|
|
29451
|
-
else composer.setText(confirmed);
|
|
29452
|
-
emit(ends, { transcript: "", isFinal: true });
|
|
29453
|
-
if (reason === "stopped" && !hasConfirmed) latest.current.notice("\u672A\u8BC6\u522B\u5230\u8BED\u97F3\uFF0C\u8BF7\u91CD\u8BD5\u3002");
|
|
29454
|
-
setStatus("idle");
|
|
29455
|
-
};
|
|
29456
|
-
const terminate = () => {
|
|
29457
|
-
if (ended) return;
|
|
29458
|
-
if (valid2()) {
|
|
29459
|
-
finish("cancelled");
|
|
29460
|
-
generation.current++;
|
|
29461
|
-
}
|
|
29462
|
-
try {
|
|
29463
|
-
input?.cancel();
|
|
29464
|
-
} catch {
|
|
29465
|
-
}
|
|
29466
|
-
};
|
|
29467
|
-
const session = {
|
|
29468
|
-
get status() {
|
|
29469
|
-
if (!ended && input?.status.type === "ended") queueMicrotask(complete);
|
|
29470
|
-
return ended ? status2 : input?.status ?? status2;
|
|
29471
|
-
},
|
|
29472
|
-
stop: async () => {
|
|
29473
|
-
if (!valid2()) return;
|
|
29474
|
-
setStatus("transcribing");
|
|
29869
|
+
const dictation = useMemo10(
|
|
29870
|
+
() => ({
|
|
29871
|
+
disableInputDuringDictation: true,
|
|
29872
|
+
listen() {
|
|
29873
|
+
const config = latest.current;
|
|
29874
|
+
if (!config.active || !config.open || config.blocked || !config.dictation || !source)
|
|
29875
|
+
throw new Error("\u5F53\u524D\u65E0\u6CD5\u5F00\u59CB\u8BED\u97F3\u8F93\u5165\u3002");
|
|
29876
|
+
cancel();
|
|
29877
|
+
const token = ++generation.current;
|
|
29878
|
+
const composer = config.composer();
|
|
29879
|
+
const original = composer.getState().text;
|
|
29880
|
+
const starts = /* @__PURE__ */ new Set();
|
|
29881
|
+
const speeches = /* @__PURE__ */ new Set();
|
|
29882
|
+
const ends = /* @__PURE__ */ new Set();
|
|
29883
|
+
let input;
|
|
29884
|
+
const subscriptions = [];
|
|
29885
|
+
let confirmed = original;
|
|
29886
|
+
let hasConfirmed = false;
|
|
29887
|
+
let ended = false;
|
|
29888
|
+
let status2 = { type: "starting" };
|
|
29889
|
+
const emit = (listeners, value) => {
|
|
29890
|
+
for (const callback of [...listeners]) callback(value);
|
|
29891
|
+
};
|
|
29892
|
+
const valid2 = () => !ended && generation.current === token;
|
|
29893
|
+
const restore = () => {
|
|
29475
29894
|
try {
|
|
29476
|
-
|
|
29477
|
-
|
|
29478
|
-
} catch (error) {
|
|
29479
|
-
failure(error);
|
|
29895
|
+
composer.setText(original);
|
|
29896
|
+
} catch {
|
|
29480
29897
|
}
|
|
29481
|
-
}
|
|
29482
|
-
|
|
29483
|
-
onSpeechStart(callback) {
|
|
29484
|
-
starts.add(callback);
|
|
29485
|
-
return () => starts.delete(callback);
|
|
29486
|
-
},
|
|
29487
|
-
onSpeech(callback) {
|
|
29488
|
-
speeches.add(callback);
|
|
29489
|
-
return () => speeches.delete(callback);
|
|
29490
|
-
},
|
|
29491
|
-
onSpeechEnd(callback) {
|
|
29492
|
-
ends.add(callback);
|
|
29493
|
-
return () => ends.delete(callback);
|
|
29494
|
-
}
|
|
29495
|
-
};
|
|
29496
|
-
owner.current = terminate;
|
|
29497
|
-
config.notice("");
|
|
29498
|
-
setStatus("starting");
|
|
29499
|
-
const failure = (error) => {
|
|
29500
|
-
if (!valid2()) return;
|
|
29501
|
-
const cancelled = error instanceof DOMException && error.name === "AbortError";
|
|
29502
|
-
finish(cancelled ? "cancelled" : "error");
|
|
29503
|
-
try {
|
|
29504
|
-
input?.cancel();
|
|
29505
|
-
} catch {
|
|
29506
|
-
}
|
|
29507
|
-
if (!cancelled) latest.current.notice(error instanceof Error ? error.message : "\u8BED\u97F3\u8F93\u5165\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002");
|
|
29508
|
-
};
|
|
29509
|
-
const complete = () => {
|
|
29510
|
-
if (!valid2()) return;
|
|
29511
|
-
const reason = input?.status.type === "ended" ? input.status.reason : "stopped";
|
|
29512
|
-
if (reason === "error") failure(new Error("\u8BED\u97F3\u8F93\u5165\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6388\u6743\u3001\u9EA6\u514B\u98CE\u6743\u9650\u548C\u7F51\u7EDC\u3002"));
|
|
29513
|
-
else finish(reason);
|
|
29514
|
-
};
|
|
29515
|
-
try {
|
|
29516
|
-
input = source.listen();
|
|
29517
|
-
const started = () => {
|
|
29898
|
+
};
|
|
29899
|
+
const finish = (reason) => {
|
|
29518
29900
|
if (!valid2()) return;
|
|
29519
|
-
|
|
29520
|
-
|
|
29521
|
-
|
|
29901
|
+
ended = true;
|
|
29902
|
+
status2 = { type: "ended", reason };
|
|
29903
|
+
owner.current = void 0;
|
|
29904
|
+
for (const unsubscribe of subscriptions.splice(0)) unsubscribe();
|
|
29905
|
+
if (reason !== "stopped" || !hasConfirmed) restore();
|
|
29906
|
+
else composer.setText(confirmed);
|
|
29907
|
+
emit(ends, { transcript: "", isFinal: true });
|
|
29908
|
+
if (reason === "stopped" && !hasConfirmed)
|
|
29909
|
+
latest.current.notice("\u672A\u8BC6\u522B\u5230\u8BED\u97F3\uFF0C\u8BF7\u91CD\u8BD5\u3002");
|
|
29910
|
+
setStatus("idle");
|
|
29911
|
+
};
|
|
29912
|
+
const terminate = () => {
|
|
29913
|
+
if (ended) return;
|
|
29914
|
+
if (valid2()) {
|
|
29915
|
+
finish("cancelled");
|
|
29916
|
+
generation.current++;
|
|
29917
|
+
}
|
|
29918
|
+
try {
|
|
29919
|
+
input?.cancel();
|
|
29920
|
+
} catch {
|
|
29921
|
+
}
|
|
29922
|
+
};
|
|
29923
|
+
const session = {
|
|
29924
|
+
get status() {
|
|
29925
|
+
if (!ended && input?.status.type === "ended") queueMicrotask(complete);
|
|
29926
|
+
return ended ? status2 : input?.status ?? status2;
|
|
29927
|
+
},
|
|
29928
|
+
stop: async () => {
|
|
29929
|
+
if (!valid2()) return;
|
|
29930
|
+
setStatus("transcribing");
|
|
29931
|
+
try {
|
|
29932
|
+
await input?.stop();
|
|
29933
|
+
if (valid2()) complete();
|
|
29934
|
+
} catch (error) {
|
|
29935
|
+
failure(error);
|
|
29936
|
+
}
|
|
29937
|
+
},
|
|
29938
|
+
cancel: terminate,
|
|
29939
|
+
onSpeechStart(callback) {
|
|
29940
|
+
starts.add(callback);
|
|
29941
|
+
return () => starts.delete(callback);
|
|
29942
|
+
},
|
|
29943
|
+
onSpeech(callback) {
|
|
29944
|
+
speeches.add(callback);
|
|
29945
|
+
return () => speeches.delete(callback);
|
|
29946
|
+
},
|
|
29947
|
+
onSpeechEnd(callback) {
|
|
29948
|
+
ends.add(callback);
|
|
29949
|
+
return () => ends.delete(callback);
|
|
29950
|
+
}
|
|
29522
29951
|
};
|
|
29523
|
-
|
|
29524
|
-
|
|
29952
|
+
owner.current = terminate;
|
|
29953
|
+
config.notice("");
|
|
29954
|
+
setStatus("starting");
|
|
29955
|
+
const failure = (error) => {
|
|
29525
29956
|
if (!valid2()) return;
|
|
29526
|
-
|
|
29527
|
-
|
|
29528
|
-
|
|
29529
|
-
|
|
29957
|
+
const cancelled = error instanceof DOMException && error.name === "AbortError";
|
|
29958
|
+
finish(cancelled ? "cancelled" : "error");
|
|
29959
|
+
try {
|
|
29960
|
+
input?.cancel();
|
|
29961
|
+
} catch {
|
|
29530
29962
|
}
|
|
29531
|
-
|
|
29532
|
-
|
|
29533
|
-
|
|
29534
|
-
|
|
29535
|
-
|
|
29536
|
-
|
|
29963
|
+
if (!cancelled)
|
|
29964
|
+
latest.current.notice(
|
|
29965
|
+
error instanceof Error ? error.message : "\u8BED\u97F3\u8F93\u5165\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002"
|
|
29966
|
+
);
|
|
29967
|
+
};
|
|
29968
|
+
const complete = () => {
|
|
29969
|
+
if (!valid2()) return;
|
|
29970
|
+
const reason = input?.status.type === "ended" ? input.status.reason : "stopped";
|
|
29971
|
+
if (reason === "error")
|
|
29972
|
+
failure(new Error("\u8BED\u97F3\u8F93\u5165\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6388\u6743\u3001\u9EA6\u514B\u98CE\u6743\u9650\u548C\u7F51\u7EDC\u3002"));
|
|
29973
|
+
else finish(reason);
|
|
29974
|
+
};
|
|
29975
|
+
try {
|
|
29976
|
+
input = source.listen();
|
|
29977
|
+
const started = () => {
|
|
29978
|
+
if (!valid2()) return;
|
|
29979
|
+
status2 = { type: "running" };
|
|
29980
|
+
setStatus("recording");
|
|
29981
|
+
for (const callback of [...starts]) callback();
|
|
29982
|
+
};
|
|
29983
|
+
subscriptions.push(input.onSpeechStart(started));
|
|
29984
|
+
subscriptions.push(
|
|
29985
|
+
input.onSpeech((result) => {
|
|
29986
|
+
if (!valid2()) return;
|
|
29987
|
+
emit(speeches, result);
|
|
29988
|
+
if (result.isFinal !== false) {
|
|
29989
|
+
confirmed = composer.getState().text;
|
|
29990
|
+
hasConfirmed ||= Boolean(result.transcript.trim());
|
|
29991
|
+
}
|
|
29992
|
+
})
|
|
29993
|
+
);
|
|
29994
|
+
subscriptions.push(input.onSpeechEnd(complete));
|
|
29995
|
+
if (input.status.type === "running") queueMicrotask(started);
|
|
29996
|
+
if (input.status.type === "ended") queueMicrotask(complete);
|
|
29997
|
+
} catch (error) {
|
|
29998
|
+
queueMicrotask(() => failure(error));
|
|
29999
|
+
}
|
|
30000
|
+
return session;
|
|
29537
30001
|
}
|
|
29538
|
-
|
|
29539
|
-
|
|
29540
|
-
|
|
30002
|
+
}),
|
|
30003
|
+
[source]
|
|
30004
|
+
);
|
|
29541
30005
|
useLayoutEffect11(() => {
|
|
29542
30006
|
if (!options2.active || !options2.open || options2.blocked || !enabled) cancel();
|
|
29543
30007
|
}, [options2.active, options2.open, options2.blocked, enabled]);
|
|
29544
30008
|
useLayoutEffect11(() => () => cancel(), [source, options2.sessionId]);
|
|
29545
|
-
return {
|
|
30009
|
+
return {
|
|
30010
|
+
dictation: enabled ? dictation : void 0,
|
|
30011
|
+
state: { status, supported: enabled, cancel }
|
|
30012
|
+
};
|
|
29546
30013
|
}
|
|
29547
30014
|
|
|
29548
30015
|
// src/assistant-runtime.tsx
|
|
@@ -29556,29 +30023,57 @@ function parseToolArgs(text7) {
|
|
|
29556
30023
|
}
|
|
29557
30024
|
}
|
|
29558
30025
|
function convertMessage(message) {
|
|
29559
|
-
const content3 = message.parts.map(
|
|
29560
|
-
type
|
|
29561
|
-
|
|
29562
|
-
|
|
29563
|
-
|
|
29564
|
-
|
|
29565
|
-
|
|
29566
|
-
|
|
29567
|
-
|
|
29568
|
-
|
|
29569
|
-
|
|
30026
|
+
const content3 = message.parts.map(
|
|
30027
|
+
(part) => part.type !== "tool" ? part : {
|
|
30028
|
+
type: "tool-call",
|
|
30029
|
+
toolCallId: part.toolCallId,
|
|
30030
|
+
toolName: part.name,
|
|
30031
|
+
args: parseToolArgs(part.arguments),
|
|
30032
|
+
argsText: part.arguments,
|
|
30033
|
+
result: part.result,
|
|
30034
|
+
isError: part.isError
|
|
30035
|
+
}
|
|
30036
|
+
);
|
|
30037
|
+
if (message.role === "user")
|
|
30038
|
+
return {
|
|
30039
|
+
id: message.id,
|
|
30040
|
+
role: "user",
|
|
30041
|
+
content: content3,
|
|
30042
|
+
attachments: message.attachments?.map(toAssistantAttachment)
|
|
30043
|
+
};
|
|
30044
|
+
return {
|
|
30045
|
+
id: message.id,
|
|
30046
|
+
role: "assistant",
|
|
30047
|
+
content: content3,
|
|
30048
|
+
status: message.error ? { type: "incomplete", reason: "error", error: message.error.userMessage } : message.state === "cancelled" ? { type: "incomplete", reason: "cancelled" } : message.state === "running" ? { type: "running" } : { type: "complete", reason: "stop" }
|
|
30049
|
+
};
|
|
29570
30050
|
}
|
|
29571
30051
|
function projectMessages(messages) {
|
|
29572
30052
|
const projected = [];
|
|
29573
30053
|
for (const message of messages) {
|
|
29574
30054
|
const previous3 = projected.at(-1);
|
|
29575
30055
|
if (message.role === "assistant" && previous3?.role === "assistant") {
|
|
29576
|
-
projected[projected.length - 1] = {
|
|
30056
|
+
projected[projected.length - 1] = {
|
|
30057
|
+
...previous3,
|
|
30058
|
+
parts: [...previous3.parts, ...message.parts],
|
|
30059
|
+
...message.state ? { state: message.state } : {},
|
|
30060
|
+
...message.error ? { error: message.error } : {}
|
|
30061
|
+
};
|
|
29577
30062
|
} else projected.push(message);
|
|
29578
30063
|
}
|
|
29579
30064
|
return projected;
|
|
29580
30065
|
}
|
|
29581
|
-
function SessionRuntime({
|
|
30066
|
+
function SessionRuntime({
|
|
30067
|
+
id,
|
|
30068
|
+
chat,
|
|
30069
|
+
options: options2,
|
|
30070
|
+
dictation,
|
|
30071
|
+
open = true,
|
|
30072
|
+
blocked,
|
|
30073
|
+
active,
|
|
30074
|
+
onEdit,
|
|
30075
|
+
children
|
|
30076
|
+
}) {
|
|
29582
30077
|
const latest = useRef30(chat);
|
|
29583
30078
|
useLayoutEffect12(() => {
|
|
29584
30079
|
latest.current = chat;
|
|
@@ -29616,7 +30111,8 @@ function SessionRuntime({ id, chat, options: options2, dictation, open = true, b
|
|
|
29616
30111
|
isRunning: active && chat.status !== "idle" && chat.status !== "error" && chat.status !== "waiting",
|
|
29617
30112
|
isSendDisabled: !active || blocked || attachments.blocked || voice.state.status !== "idle",
|
|
29618
30113
|
onNew: async (message) => {
|
|
29619
|
-
if (!alive.current || latest.current.activeSessionId !== id)
|
|
30114
|
+
if (!alive.current || latest.current.activeSessionId !== id)
|
|
30115
|
+
throw new MessageNotSentError("\u4F1A\u8BDD\u5DF2\u5207\u6362\uFF0C\u8BF7\u8FD4\u56DE\u539F\u4F1A\u8BDD\u91CD\u65B0\u53D1\u9001\u3002");
|
|
29620
30116
|
const files = attachments.take(message.attachments ?? []);
|
|
29621
30117
|
const text7 = message.content.flatMap((part) => part.type === "text" ? [part.text] : []).join("");
|
|
29622
30118
|
attachments.commit(message.attachments ?? []);
|
|
@@ -29646,7 +30142,11 @@ function SessionRuntime({ id, chat, options: options2, dictation, open = true, b
|
|
|
29646
30142
|
attachments: options2 === false ? void 0 : attachments,
|
|
29647
30143
|
threadList: {
|
|
29648
30144
|
threadId: id,
|
|
29649
|
-
threads: chat.sessions.map((session) => ({
|
|
30145
|
+
threads: chat.sessions.map((session) => ({
|
|
30146
|
+
id: session.id,
|
|
30147
|
+
title: session.title,
|
|
30148
|
+
status: "regular"
|
|
30149
|
+
})),
|
|
29650
30150
|
onSwitchToNewThread: () => {
|
|
29651
30151
|
latest.current.createSession();
|
|
29652
30152
|
},
|
|
@@ -29658,24 +30158,31 @@ function SessionRuntime({ id, chat, options: options2, dictation, open = true, b
|
|
|
29658
30158
|
});
|
|
29659
30159
|
const send = async () => {
|
|
29660
30160
|
const draft = runtime.thread.composer.getState();
|
|
29661
|
-
if (!active || blocked || attachments.blocked || sendLock.current || voice.state.status !== "idle" || draft.isEmpty)
|
|
30161
|
+
if (!active || blocked || attachments.blocked || sendLock.current || voice.state.status !== "idle" || draft.isEmpty)
|
|
30162
|
+
return;
|
|
29662
30163
|
sendLock.current = true;
|
|
29663
30164
|
setSending(true);
|
|
29664
30165
|
setNotice("");
|
|
29665
30166
|
try {
|
|
29666
|
-
const results = await Promise.allSettled(
|
|
30167
|
+
const results = await Promise.allSettled(
|
|
30168
|
+
draft.attachments.map((attachment) => attachments.send(attachment))
|
|
30169
|
+
);
|
|
29667
30170
|
const failed = results.find((result) => result.status === "rejected");
|
|
29668
30171
|
if (failed?.status === "rejected") throw failed.reason;
|
|
29669
30172
|
if (!alive.current) return;
|
|
29670
|
-
if (latest.current.activeSessionId !== id)
|
|
30173
|
+
if (latest.current.activeSessionId !== id)
|
|
30174
|
+
throw new Error("\u4F1A\u8BDD\u5DF2\u5207\u6362\uFF0C\u8BF7\u8FD4\u56DE\u539F\u4F1A\u8BDD\u91CD\u65B0\u53D1\u9001\u3002");
|
|
29671
30175
|
assertChatSendable(latest.current, id);
|
|
29672
|
-
const completed = results.flatMap(
|
|
30176
|
+
const completed = results.flatMap(
|
|
30177
|
+
(result) => result.status === "fulfilled" ? [result.value] : []
|
|
30178
|
+
);
|
|
29673
30179
|
const files = attachments.take(completed);
|
|
29674
30180
|
attachments.commit(completed);
|
|
29675
30181
|
runtime.thread.composer.reset();
|
|
29676
30182
|
void latest.current.sendMessage(draft.text, files).catch(() => void 0);
|
|
29677
30183
|
} catch (error) {
|
|
29678
|
-
if (alive.current && !(error instanceof DOMException && error.name === "AbortError"))
|
|
30184
|
+
if (alive.current && !(error instanceof DOMException && error.name === "AbortError"))
|
|
30185
|
+
setNotice(error instanceof Error ? error.message : String(error));
|
|
29679
30186
|
} finally {
|
|
29680
30187
|
sendLock.current = false;
|
|
29681
30188
|
if (alive.current) setSending(false);
|
|
@@ -29685,7 +30192,12 @@ function SessionRuntime({ id, chat, options: options2, dictation, open = true, b
|
|
|
29685
30192
|
}
|
|
29686
30193
|
|
|
29687
30194
|
// src/ui/attachment.aui.tsx
|
|
29688
|
-
import {
|
|
30195
|
+
import {
|
|
30196
|
+
useState as useState30,
|
|
30197
|
+
isValidElement as isValidElement3,
|
|
30198
|
+
createContext as createContext6,
|
|
30199
|
+
useContext as useContext7
|
|
30200
|
+
} from "react";
|
|
29689
30201
|
|
|
29690
30202
|
// src/ui/use-attachment-src.ts
|
|
29691
30203
|
import { useEffect as useEffect27, useState as useState29 } from "react";
|
|
@@ -29706,7 +30218,9 @@ var useFileSrc = (file) => {
|
|
|
29706
30218
|
};
|
|
29707
30219
|
var useAttachmentSrc = () => {
|
|
29708
30220
|
const file = useAuiState((s) => s.attachment.type === "image" ? s.attachment.file : void 0);
|
|
29709
|
-
const src = useAuiState(
|
|
30221
|
+
const src = useAuiState(
|
|
30222
|
+
(s) => s.attachment.content?.find((part) => part.type === "image")?.image
|
|
30223
|
+
);
|
|
29710
30224
|
return useFileSrc(file) ?? src;
|
|
29711
30225
|
};
|
|
29712
30226
|
|
|
@@ -29719,26 +30233,69 @@ var usePreview = () => {
|
|
|
29719
30233
|
};
|
|
29720
30234
|
var AttachmentPreview = ({ src }) => {
|
|
29721
30235
|
const [isLoaded, setIsLoaded] = useState30(false);
|
|
29722
|
-
return /* @__PURE__ */ jsx79(
|
|
30236
|
+
return /* @__PURE__ */ jsx79(
|
|
30237
|
+
"img",
|
|
30238
|
+
{
|
|
30239
|
+
src,
|
|
30240
|
+
alt: "\u9644\u4EF6\u9884\u89C8",
|
|
30241
|
+
className: cn(
|
|
30242
|
+
"block h-auto max-h-[80vh] w-auto max-w-full rounded-sm object-contain transition-opacity duration-300 motion-reduce:transition-none",
|
|
30243
|
+
isLoaded ? "aui-attachment-preview-image-loaded opacity-100" : "aui-attachment-preview-image-loading opacity-0"
|
|
30244
|
+
),
|
|
30245
|
+
onLoad: () => setIsLoaded(true)
|
|
30246
|
+
}
|
|
30247
|
+
);
|
|
29723
30248
|
};
|
|
29724
30249
|
var AttachmentPreviewDialog = ({ children }) => {
|
|
29725
30250
|
const src = usePreview();
|
|
29726
|
-
if (!src)
|
|
29727
|
-
return /* @__PURE__ */ jsx79(Fragment9, { children });
|
|
30251
|
+
if (!src) return /* @__PURE__ */ jsx79(Fragment9, { children });
|
|
29728
30252
|
return /* @__PURE__ */ jsxs19(Dialog2, { children: [
|
|
29729
30253
|
/* @__PURE__ */ jsx79(DialogTrigger3, { className: cn("aui-attachment-preview-trigger cursor-zoom-in"), asChild: true, children: isValidElement3(children) ? children : /* @__PURE__ */ jsx79("button", { type: "button", children }) }),
|
|
29730
|
-
/* @__PURE__ */ jsxs19(
|
|
29731
|
-
|
|
29732
|
-
|
|
29733
|
-
|
|
30254
|
+
/* @__PURE__ */ jsxs19(
|
|
30255
|
+
DialogContent3,
|
|
30256
|
+
{
|
|
30257
|
+
className: cn(
|
|
30258
|
+
"aui-attachment-preview-dialog-content [&>button]:bg-foreground/60 [&>button]:hover:bg-foreground/80 [&_svg]:text-background p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0!"
|
|
30259
|
+
),
|
|
30260
|
+
children: [
|
|
30261
|
+
/* @__PURE__ */ jsx79(DialogTitle3, { className: cn("aui-sr-only sr-only"), children: "\u56FE\u7247\u9644\u4EF6\u9884\u89C8" }),
|
|
30262
|
+
/* @__PURE__ */ jsx79(
|
|
30263
|
+
"div",
|
|
30264
|
+
{
|
|
30265
|
+
className: cn(
|
|
30266
|
+
"aui-attachment-preview bg-background relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden rounded-sm"
|
|
30267
|
+
),
|
|
30268
|
+
children: /* @__PURE__ */ jsx79(AttachmentPreview, { src })
|
|
30269
|
+
}
|
|
30270
|
+
)
|
|
30271
|
+
]
|
|
30272
|
+
}
|
|
30273
|
+
)
|
|
29734
30274
|
] });
|
|
29735
30275
|
};
|
|
29736
30276
|
var AttachmentThumb = () => {
|
|
29737
30277
|
const src = usePreview();
|
|
29738
30278
|
const name2 = useAuiState((s) => s.attachment.name);
|
|
29739
|
-
return /* @__PURE__ */ jsx79(Avatar3, { className: cn("aui-attachment-tile-avatar h-full w-full rounded-none"), children: src ? /* @__PURE__ */ jsx79(
|
|
30279
|
+
return /* @__PURE__ */ jsx79(Avatar3, { className: cn("aui-attachment-tile-avatar h-full w-full rounded-none"), children: src ? /* @__PURE__ */ jsx79(
|
|
30280
|
+
"img",
|
|
30281
|
+
{
|
|
30282
|
+
src,
|
|
30283
|
+
alt: name2,
|
|
30284
|
+
className: cn("aui-attachment-tile-image h-full w-full rounded-none object-cover")
|
|
30285
|
+
}
|
|
30286
|
+
) : /* @__PURE__ */ jsx79(AvatarFallback3, { children: /* @__PURE__ */ jsx79(
|
|
30287
|
+
FileText,
|
|
30288
|
+
{
|
|
30289
|
+
className: cn(
|
|
30290
|
+
"aui-attachment-tile-fallback-icon text-muted-foreground/80 size-6 stroke-[1.5]"
|
|
30291
|
+
)
|
|
30292
|
+
}
|
|
30293
|
+
) }) });
|
|
29740
30294
|
};
|
|
29741
|
-
function AttachmentUI({
|
|
30295
|
+
function AttachmentUI({
|
|
30296
|
+
preview,
|
|
30297
|
+
children
|
|
30298
|
+
}) {
|
|
29742
30299
|
return /* @__PURE__ */ jsx79(PreviewContext.Provider, { value: preview, children: /* @__PURE__ */ jsx79(AttachmentContent, { children }) });
|
|
29743
30300
|
}
|
|
29744
30301
|
var AttachmentContent = ({ children }) => {
|
|
@@ -29758,30 +30315,75 @@ var AttachmentContent = ({ children }) => {
|
|
|
29758
30315
|
return type;
|
|
29759
30316
|
}
|
|
29760
30317
|
});
|
|
29761
|
-
const uploadState = useAuiState(
|
|
30318
|
+
const uploadState = useAuiState(
|
|
30319
|
+
(s) => s.attachment.status.type === "running" ? "uploading" : s.attachment.status.type === "incomplete" && s.attachment.status.reason === "error" ? "error" : void 0
|
|
30320
|
+
);
|
|
29762
30321
|
const isUploading = uploadState === "uploading";
|
|
29763
30322
|
const isError = uploadState === "error";
|
|
29764
|
-
const errorMessage = useAuiState(
|
|
30323
|
+
const errorMessage = useAuiState(
|
|
30324
|
+
(s) => s.attachment.status.type === "incomplete" && s.attachment.status.reason === "error" ? s.attachment.status.message ?? "\u9644\u4EF6\u5904\u7406\u5931\u8D25" : void 0
|
|
30325
|
+
);
|
|
29765
30326
|
return /* @__PURE__ */ jsx79(TooltipProvider2, { children: /* @__PURE__ */ jsxs19(Tooltip2, { children: [
|
|
29766
|
-
/* @__PURE__ */ jsxs19(
|
|
29767
|
-
|
|
29768
|
-
|
|
29769
|
-
|
|
29770
|
-
|
|
29771
|
-
|
|
29772
|
-
|
|
29773
|
-
|
|
29774
|
-
|
|
29775
|
-
|
|
29776
|
-
|
|
29777
|
-
|
|
29778
|
-
|
|
29779
|
-
|
|
29780
|
-
|
|
29781
|
-
|
|
29782
|
-
|
|
29783
|
-
|
|
29784
|
-
|
|
30327
|
+
/* @__PURE__ */ jsxs19(
|
|
30328
|
+
AttachmentPrimitiveRoot,
|
|
30329
|
+
{
|
|
30330
|
+
className: cn(
|
|
30331
|
+
"aui-attachment-root relative",
|
|
30332
|
+
isComposer && "animate-in fade-in-0 zoom-in-95 duration-200 motion-reduce:animate-none",
|
|
30333
|
+
isImage2 && !isComposer && "aui-attachment-root-message only:*:first:size-24"
|
|
30334
|
+
),
|
|
30335
|
+
children: [
|
|
30336
|
+
/* @__PURE__ */ jsx79(AttachmentPreviewDialog, { children: /* @__PURE__ */ jsx79(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsxs19(
|
|
30337
|
+
"div",
|
|
30338
|
+
{
|
|
30339
|
+
className: cn(
|
|
30340
|
+
"aui-attachment-tile bg-muted hover:after:bg-foreground/10 focus-visible:ring-ring/50 relative size-14 cursor-pointer overflow-hidden rounded-[calc(var(--nxf-composer-radius,1rem)-var(--nxf-composer-padding,8px))] transition-transform outline-none after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-1 after:ring-black/10 after:transition-colors after:ring-inset focus-visible:ring-1 active:scale-[0.96] motion-reduce:transition-none dark:after:ring-white/10",
|
|
30341
|
+
isError && "after:ring-destructive/60 dark:after:ring-destructive/60"
|
|
30342
|
+
),
|
|
30343
|
+
role: "button",
|
|
30344
|
+
tabIndex: 0,
|
|
30345
|
+
onKeyDown: (e) => {
|
|
30346
|
+
if (e.key === "Enter") {
|
|
30347
|
+
e.preventDefault();
|
|
30348
|
+
e.currentTarget.click();
|
|
30349
|
+
} else if (e.key === " ") {
|
|
30350
|
+
e.preventDefault();
|
|
30351
|
+
}
|
|
30352
|
+
},
|
|
30353
|
+
onKeyUp: (e) => {
|
|
30354
|
+
if (e.key === " ") e.currentTarget.click();
|
|
30355
|
+
},
|
|
30356
|
+
"aria-label": `${typeLabel}\u9644\u4EF6${isError ? "\uFF0C\u5904\u7406\u5931\u8D25" : isUploading ? "\uFF0C\u6B63\u5728\u5904\u7406" : ""}`,
|
|
30357
|
+
children: [
|
|
30358
|
+
/* @__PURE__ */ jsx79(AttachmentThumb, {}),
|
|
30359
|
+
isUploading && /* @__PURE__ */ jsx79(
|
|
30360
|
+
"div",
|
|
30361
|
+
{
|
|
30362
|
+
"aria-hidden": "true",
|
|
30363
|
+
className: cn(
|
|
30364
|
+
"aui-attachment-tile-uploading bg-background/60 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"
|
|
30365
|
+
),
|
|
30366
|
+
children: /* @__PURE__ */ jsx79(LoaderCircle, { className: cn("text-muted-foreground size-4 animate-spin") })
|
|
30367
|
+
}
|
|
30368
|
+
),
|
|
30369
|
+
isError && /* @__PURE__ */ jsx79(
|
|
30370
|
+
"div",
|
|
30371
|
+
{
|
|
30372
|
+
"aria-hidden": "true",
|
|
30373
|
+
className: cn(
|
|
30374
|
+
"aui-attachment-tile-error bg-background/70 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"
|
|
30375
|
+
),
|
|
30376
|
+
children: /* @__PURE__ */ jsx79(CircleAlert, { className: cn("text-destructive size-4") })
|
|
30377
|
+
}
|
|
30378
|
+
)
|
|
30379
|
+
]
|
|
30380
|
+
}
|
|
30381
|
+
) }) }),
|
|
30382
|
+
isComposer && /* @__PURE__ */ jsx79(AttachmentRemove, {}),
|
|
30383
|
+
children
|
|
30384
|
+
]
|
|
30385
|
+
}
|
|
30386
|
+
),
|
|
29785
30387
|
/* @__PURE__ */ jsxs19(TooltipContent3, { side: "top", children: [
|
|
29786
30388
|
/* @__PURE__ */ jsx79(AttachmentPrimitiveName, {}),
|
|
29787
30389
|
errorMessage && /* @__PURE__ */ jsx79("p", { className: cn("aui-attachment-error-message"), children: errorMessage })
|
|
@@ -29790,7 +30392,18 @@ var AttachmentContent = ({ children }) => {
|
|
|
29790
30392
|
};
|
|
29791
30393
|
var AttachmentRemove = () => {
|
|
29792
30394
|
const name2 = useAuiState((s) => s.attachment.name);
|
|
29793
|
-
return /* @__PURE__ */ jsx79(AttachmentPrimitiveRemove, { asChild: true, children: /* @__PURE__ */ jsx79(
|
|
30395
|
+
return /* @__PURE__ */ jsx79(AttachmentPrimitiveRemove, { asChild: true, children: /* @__PURE__ */ jsx79(
|
|
30396
|
+
TooltipIconButton,
|
|
30397
|
+
{
|
|
30398
|
+
tooltip: "\u79FB\u9664\u9644\u4EF6",
|
|
30399
|
+
"aria-label": `\u79FB\u9664 ${name2}`,
|
|
30400
|
+
className: cn(
|
|
30401
|
+
"aui-attachment-tile-remove absolute end-1 top-1 size-5 rounded-full bg-black/50! text-white after:absolute after:-inset-1.5 hover:bg-black/70! hover:text-white! active:scale-[0.96] motion-reduce:transition-none"
|
|
30402
|
+
),
|
|
30403
|
+
side: "top",
|
|
30404
|
+
children: /* @__PURE__ */ jsx79(X, { className: cn("aui-attachment-remove-icon size-3 stroke-[2.5]") })
|
|
30405
|
+
}
|
|
30406
|
+
) });
|
|
29794
30407
|
};
|
|
29795
30408
|
|
|
29796
30409
|
// src/assistant-components.tsx
|
|
@@ -44862,11 +45475,7 @@ function remarkGfm(options2) {
|
|
|
44862
45475
|
import { memo as memo6, useRef as useRef33 } from "react";
|
|
44863
45476
|
|
|
44864
45477
|
// src/ui/code-block.tsx
|
|
44865
|
-
import {
|
|
44866
|
-
useEffect as useEffect29,
|
|
44867
|
-
useRef as useRef32,
|
|
44868
|
-
useState as useState32
|
|
44869
|
-
} from "react";
|
|
45478
|
+
import { useEffect as useEffect29, useRef as useRef32, useState as useState32 } from "react";
|
|
44870
45479
|
import { jsx as jsx87, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
44871
45480
|
function CopyButton({
|
|
44872
45481
|
getText,
|
|
@@ -44874,9 +45483,7 @@ function CopyButton({
|
|
|
44874
45483
|
className
|
|
44875
45484
|
}) {
|
|
44876
45485
|
const [copied, setCopied] = useState32(false);
|
|
44877
|
-
const copyTimer = useRef32(
|
|
44878
|
-
void 0
|
|
44879
|
-
);
|
|
45486
|
+
const copyTimer = useRef32(void 0);
|
|
44880
45487
|
const unmounted = useRef32(false);
|
|
44881
45488
|
useEffect29(() => {
|
|
44882
45489
|
unmounted.current = false;
|
|
@@ -44932,15 +45539,33 @@ function CodeBlock({
|
|
|
44932
45539
|
),
|
|
44933
45540
|
...props,
|
|
44934
45541
|
children: [
|
|
44935
|
-
title ? /* @__PURE__ */ jsxs23(
|
|
44936
|
-
|
|
44937
|
-
|
|
44938
|
-
|
|
45542
|
+
title ? /* @__PURE__ */ jsxs23(
|
|
45543
|
+
"figcaption",
|
|
45544
|
+
{
|
|
45545
|
+
className: cn(
|
|
45546
|
+
"border-foreground/10 flex h-9 shrink-0 items-center justify-between gap-2 border-b py-0 ps-3.5 pe-2"
|
|
45547
|
+
),
|
|
45548
|
+
children: [
|
|
45549
|
+
/* @__PURE__ */ jsx87(
|
|
45550
|
+
"span",
|
|
45551
|
+
{
|
|
45552
|
+
className: cn(
|
|
45553
|
+
"text-muted-foreground min-w-0 truncate font-mono text-[11px] font-medium tracking-wide"
|
|
45554
|
+
),
|
|
45555
|
+
children: title
|
|
45556
|
+
}
|
|
45557
|
+
),
|
|
45558
|
+
/* @__PURE__ */ jsx87(CopyButton, { getText, onCopied })
|
|
45559
|
+
]
|
|
45560
|
+
}
|
|
45561
|
+
) : /* @__PURE__ */ jsx87(
|
|
44939
45562
|
CopyButton,
|
|
44940
45563
|
{
|
|
44941
45564
|
getText,
|
|
44942
45565
|
onCopied,
|
|
44943
|
-
className: cn(
|
|
45566
|
+
className: cn(
|
|
45567
|
+
"bg-background/80 absolute top-2 right-2 z-10 opacity-0 backdrop-blur-sm transition-opacity group-hover/code:opacity-100 focus-visible:opacity-100 [@media(pointer:coarse)]:opacity-100"
|
|
45568
|
+
)
|
|
44944
45569
|
}
|
|
44945
45570
|
),
|
|
44946
45571
|
/* @__PURE__ */ jsx87(
|
|
@@ -44979,24 +45604,32 @@ var useCopyToClipboard = ({ copiedDuration = 3e3 } = {}) => {
|
|
|
44979
45604
|
if (!value || typeof navigator === "undefined" || !navigator.clipboard) {
|
|
44980
45605
|
return;
|
|
44981
45606
|
}
|
|
44982
|
-
navigator.clipboard.writeText(value).then(
|
|
44983
|
-
|
|
44984
|
-
|
|
44985
|
-
|
|
44986
|
-
|
|
45607
|
+
navigator.clipboard.writeText(value).then(
|
|
45608
|
+
() => {
|
|
45609
|
+
setIsCopied(true);
|
|
45610
|
+
setTimeout(() => setIsCopied(false), copiedDuration);
|
|
45611
|
+
},
|
|
45612
|
+
() => {
|
|
45613
|
+
}
|
|
45614
|
+
);
|
|
44987
45615
|
};
|
|
44988
45616
|
return { isCopied, copyToClipboard };
|
|
44989
45617
|
};
|
|
44990
45618
|
|
|
44991
45619
|
// src/ui/markdown-text.tsx
|
|
44992
45620
|
import { jsx as jsx88, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
44993
|
-
var MarkdownTextImpl = () => /* @__PURE__ */ jsx88(
|
|
45621
|
+
var MarkdownTextImpl = () => /* @__PURE__ */ jsx88(
|
|
45622
|
+
MarkdownTextPrimitive,
|
|
45623
|
+
{
|
|
45624
|
+
remarkPlugins: [remarkGfm],
|
|
45625
|
+
skipHtml: true,
|
|
45626
|
+
className: cn("aui-md"),
|
|
45627
|
+
components: defaultComponents2,
|
|
45628
|
+
defer: true
|
|
45629
|
+
}
|
|
45630
|
+
);
|
|
44994
45631
|
var MarkdownText = memo6(MarkdownTextImpl);
|
|
44995
|
-
function MarkdownTable({
|
|
44996
|
-
className,
|
|
44997
|
-
children,
|
|
44998
|
-
...props
|
|
44999
|
-
}) {
|
|
45632
|
+
function MarkdownTable({ className, children, ...props }) {
|
|
45000
45633
|
const ref = useRef33(null);
|
|
45001
45634
|
const { isCopied, copyToClipboard } = useCopyToClipboard();
|
|
45002
45635
|
const copy = () => {
|
|
@@ -45020,19 +45653,37 @@ function MarkdownTable({
|
|
|
45020
45653
|
);
|
|
45021
45654
|
};
|
|
45022
45655
|
return /* @__PURE__ */ jsxs24("figure", { className: cn("border-foreground/10 rounded-document my-3 border"), children: [
|
|
45023
|
-
/* @__PURE__ */ jsxs24(
|
|
45024
|
-
|
|
45025
|
-
|
|
45026
|
-
|
|
45027
|
-
|
|
45028
|
-
|
|
45029
|
-
|
|
45030
|
-
|
|
45031
|
-
|
|
45032
|
-
|
|
45033
|
-
|
|
45034
|
-
|
|
45035
|
-
|
|
45656
|
+
/* @__PURE__ */ jsxs24(
|
|
45657
|
+
"div",
|
|
45658
|
+
{
|
|
45659
|
+
className: cn(
|
|
45660
|
+
"border-foreground/10 bg-foreground/[0.025] dark:bg-foreground/[0.04] rounded-t-document flex h-9 items-center justify-between border-b px-3"
|
|
45661
|
+
),
|
|
45662
|
+
children: [
|
|
45663
|
+
/* @__PURE__ */ jsx88(
|
|
45664
|
+
"span",
|
|
45665
|
+
{
|
|
45666
|
+
className: cn(
|
|
45667
|
+
"text-muted-foreground font-mono text-[11px] [font-variant-ligatures:none]"
|
|
45668
|
+
),
|
|
45669
|
+
children: "\u8868\u683C"
|
|
45670
|
+
}
|
|
45671
|
+
),
|
|
45672
|
+
/* @__PURE__ */ jsx88(
|
|
45673
|
+
"button",
|
|
45674
|
+
{
|
|
45675
|
+
type: "button",
|
|
45676
|
+
onClick: copy,
|
|
45677
|
+
"aria-label": "\u590D\u5236\u8868\u683C Markdown",
|
|
45678
|
+
className: cn(
|
|
45679
|
+
"text-muted-foreground hover:text-foreground rounded-control grid size-6 place-items-center transition-colors"
|
|
45680
|
+
),
|
|
45681
|
+
children: isCopied ? /* @__PURE__ */ jsx88(Check, { className: cn("size-3.5") }) : /* @__PURE__ */ jsx88(Copy, { className: cn("size-3.5") })
|
|
45682
|
+
}
|
|
45683
|
+
)
|
|
45684
|
+
]
|
|
45685
|
+
}
|
|
45686
|
+
),
|
|
45036
45687
|
/* @__PURE__ */ jsx88("div", { className: cn("overflow-x-auto"), children: /* @__PURE__ */ jsx88(
|
|
45037
45688
|
"table",
|
|
45038
45689
|
{
|
|
@@ -45050,29 +45701,149 @@ function MarkdownTable({
|
|
|
45050
45701
|
var SyntaxHighlighter = ({ language, code: code4 }) => /* @__PURE__ */ jsx88(CodeBlock, { title: language || void 0, copyText: code4, className: cn("my-3"), children: /* @__PURE__ */ jsx88("pre", { children: /* @__PURE__ */ jsx88("code", { children: code4 }) }) });
|
|
45051
45702
|
var NoCodeHeader = () => null;
|
|
45052
45703
|
var defaultComponents2 = memoizeMarkdownComponents({
|
|
45053
|
-
h1: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45054
|
-
|
|
45055
|
-
|
|
45056
|
-
|
|
45057
|
-
|
|
45058
|
-
|
|
45704
|
+
h1: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45705
|
+
"h1",
|
|
45706
|
+
{
|
|
45707
|
+
className: cn(
|
|
45708
|
+
"aui-md-h1 mt-5 mb-2 scroll-m-20 text-xl font-semibold first:mt-0 last:mb-0",
|
|
45709
|
+
className
|
|
45710
|
+
),
|
|
45711
|
+
...props
|
|
45712
|
+
}
|
|
45713
|
+
),
|
|
45714
|
+
h2: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45715
|
+
"h2",
|
|
45716
|
+
{
|
|
45717
|
+
className: cn(
|
|
45718
|
+
"aui-md-h2 mt-5 mb-2 scroll-m-20 text-lg font-semibold first:mt-0 last:mb-0",
|
|
45719
|
+
className
|
|
45720
|
+
),
|
|
45721
|
+
...props
|
|
45722
|
+
}
|
|
45723
|
+
),
|
|
45724
|
+
h3: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45725
|
+
"h3",
|
|
45726
|
+
{
|
|
45727
|
+
className: cn(
|
|
45728
|
+
"aui-md-h3 mt-4 mb-1.5 scroll-m-20 text-base font-semibold first:mt-0 last:mb-0",
|
|
45729
|
+
className
|
|
45730
|
+
),
|
|
45731
|
+
...props
|
|
45732
|
+
}
|
|
45733
|
+
),
|
|
45734
|
+
h4: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45735
|
+
"h4",
|
|
45736
|
+
{
|
|
45737
|
+
className: cn(
|
|
45738
|
+
"aui-md-h4 mt-3.5 mb-1 scroll-m-20 text-base font-medium first:mt-0 last:mb-0",
|
|
45739
|
+
className
|
|
45740
|
+
),
|
|
45741
|
+
...props
|
|
45742
|
+
}
|
|
45743
|
+
),
|
|
45744
|
+
h5: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45745
|
+
"h5",
|
|
45746
|
+
{
|
|
45747
|
+
className: cn("aui-md-h5 mt-3 mb-1 text-sm font-semibold first:mt-0 last:mb-0", className),
|
|
45748
|
+
...props
|
|
45749
|
+
}
|
|
45750
|
+
),
|
|
45751
|
+
h6: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45752
|
+
"h6",
|
|
45753
|
+
{
|
|
45754
|
+
className: cn("aui-md-h6 mt-3 mb-1 text-sm font-medium first:mt-0 last:mb-0", className),
|
|
45755
|
+
...props
|
|
45756
|
+
}
|
|
45757
|
+
),
|
|
45059
45758
|
p: ({ className, ...props }) => /* @__PURE__ */ jsx88("p", { className: cn("aui-md-p my-3 leading-relaxed first:mt-0 last:mb-0", className), ...props }),
|
|
45060
|
-
a: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45061
|
-
|
|
45062
|
-
|
|
45063
|
-
|
|
45759
|
+
a: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45760
|
+
"a",
|
|
45761
|
+
{
|
|
45762
|
+
className: cn(
|
|
45763
|
+
"aui-md-a text-primary hover:text-primary/80 underline underline-offset-2",
|
|
45764
|
+
className
|
|
45765
|
+
),
|
|
45766
|
+
...props
|
|
45767
|
+
}
|
|
45768
|
+
),
|
|
45769
|
+
blockquote: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45770
|
+
"blockquote",
|
|
45771
|
+
{
|
|
45772
|
+
className: cn(
|
|
45773
|
+
"aui-md-blockquote border-muted-foreground/30 text-muted-foreground my-3 border-s-2 ps-4",
|
|
45774
|
+
className
|
|
45775
|
+
),
|
|
45776
|
+
...props
|
|
45777
|
+
}
|
|
45778
|
+
),
|
|
45779
|
+
ul: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45780
|
+
"ul",
|
|
45781
|
+
{
|
|
45782
|
+
className: cn(
|
|
45783
|
+
"aui-md-ul marker:text-muted-foreground my-3 ms-5 list-disc [&>li]:mt-1",
|
|
45784
|
+
className
|
|
45785
|
+
),
|
|
45786
|
+
...props
|
|
45787
|
+
}
|
|
45788
|
+
),
|
|
45789
|
+
ol: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45790
|
+
"ol",
|
|
45791
|
+
{
|
|
45792
|
+
className: cn(
|
|
45793
|
+
"aui-md-ol marker:text-muted-foreground my-3 ms-5 list-decimal [&>li]:mt-1",
|
|
45794
|
+
className
|
|
45795
|
+
),
|
|
45796
|
+
...props
|
|
45797
|
+
}
|
|
45798
|
+
),
|
|
45064
45799
|
hr: ({ className, ...props }) => /* @__PURE__ */ jsx88("hr", { className: cn("aui-md-hr border-muted-foreground/20 my-3", className), ...props }),
|
|
45065
45800
|
table: ({ className, ...props }) => /* @__PURE__ */ jsx88(MarkdownTable, { className, ...props }),
|
|
45066
|
-
th: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45067
|
-
|
|
45801
|
+
th: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45802
|
+
"th",
|
|
45803
|
+
{
|
|
45804
|
+
className: cn(
|
|
45805
|
+
"aui-md-th border-foreground/10 border-b px-3 py-1.5 text-start font-medium [[align=center]]:text-center [[align=right]]:text-right",
|
|
45806
|
+
className
|
|
45807
|
+
),
|
|
45808
|
+
...props
|
|
45809
|
+
}
|
|
45810
|
+
),
|
|
45811
|
+
td: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45812
|
+
"td",
|
|
45813
|
+
{
|
|
45814
|
+
className: cn(
|
|
45815
|
+
"aui-md-td border-foreground/10 border-b px-3 py-1.5 text-start [[align=center]]:text-center [[align=right]]:text-right",
|
|
45816
|
+
className
|
|
45817
|
+
),
|
|
45818
|
+
...props
|
|
45819
|
+
}
|
|
45820
|
+
),
|
|
45068
45821
|
tr: ({ className, ...props }) => /* @__PURE__ */ jsx88("tr", { className: cn("aui-md-tr m-0 p-0", className), ...props }),
|
|
45069
45822
|
li: ({ className, ...props }) => /* @__PURE__ */ jsx88("li", { className: cn("aui-md-li leading-relaxed", className), ...props }),
|
|
45070
45823
|
strong: ({ className, ...props }) => /* @__PURE__ */ jsx88("strong", { className: cn("aui-md-strong font-semibold", className), ...props }),
|
|
45071
45824
|
sup: ({ className, ...props }) => /* @__PURE__ */ jsx88("sup", { className: cn("aui-md-sup [&>a]:text-xs [&>a]:no-underline", className), ...props }),
|
|
45072
|
-
pre: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45825
|
+
pre: ({ className, ...props }) => /* @__PURE__ */ jsx88(
|
|
45826
|
+
"pre",
|
|
45827
|
+
{
|
|
45828
|
+
className: cn(
|
|
45829
|
+
"aui-md-pre border-border/50 bg-muted/30 overflow-x-auto rounded-t-none rounded-b-xl border border-t-0 p-3.5 text-[13px] leading-relaxed",
|
|
45830
|
+
className
|
|
45831
|
+
),
|
|
45832
|
+
...props
|
|
45833
|
+
}
|
|
45834
|
+
),
|
|
45073
45835
|
code: function Code({ className, ...props }) {
|
|
45074
45836
|
const isCodeBlock = useIsMarkdownCodeBlock();
|
|
45075
|
-
return /* @__PURE__ */ jsx88(
|
|
45837
|
+
return /* @__PURE__ */ jsx88(
|
|
45838
|
+
"code",
|
|
45839
|
+
{
|
|
45840
|
+
className: cn(
|
|
45841
|
+
!isCodeBlock && "aui-md-inline-code bg-muted rounded-md px-1.5 py-0.5 font-mono text-[0.85em]",
|
|
45842
|
+
className
|
|
45843
|
+
),
|
|
45844
|
+
...props
|
|
45845
|
+
}
|
|
45846
|
+
);
|
|
45076
45847
|
},
|
|
45077
45848
|
CodeHeader: NoCodeHeader,
|
|
45078
45849
|
SyntaxHighlighter
|
|
@@ -45089,22 +45860,38 @@ function ComposerVoice({ recording }) {
|
|
|
45089
45860
|
const timer = setInterval(() => setTick((value) => value + 1), 100);
|
|
45090
45861
|
return () => clearInterval(timer);
|
|
45091
45862
|
}, [recording]);
|
|
45092
|
-
return /* @__PURE__ */ jsx89(
|
|
45093
|
-
"
|
|
45863
|
+
return /* @__PURE__ */ jsx89(
|
|
45864
|
+
"div",
|
|
45094
45865
|
{
|
|
45095
|
-
|
|
45096
|
-
|
|
45097
|
-
|
|
45098
|
-
|
|
45099
|
-
|
|
45866
|
+
"data-slot": "composer-voice",
|
|
45867
|
+
"data-recording": recording || void 0,
|
|
45868
|
+
className: cn("flex h-7 min-w-0 flex-1 items-center overflow-hidden px-2"),
|
|
45869
|
+
children: /* @__PURE__ */ jsx89(
|
|
45870
|
+
"div",
|
|
45871
|
+
{
|
|
45872
|
+
className: cn("flex h-6 w-full items-center justify-between overflow-hidden"),
|
|
45873
|
+
"aria-hidden": true,
|
|
45874
|
+
children: Array.from({ length: barCount }, (_, index5) => /* @__PURE__ */ jsx89(
|
|
45875
|
+
"span",
|
|
45876
|
+
{
|
|
45877
|
+
className: cn(
|
|
45878
|
+
"w-0.5 shrink-0 rounded-full transition-[height,background-color] duration-150 motion-reduce:transition-none",
|
|
45879
|
+
recording ? "bg-foreground/50" : "bg-foreground/25"
|
|
45880
|
+
),
|
|
45881
|
+
style: {
|
|
45882
|
+
height: recording ? 5 + Math.abs(Math.sin(index5 * 1.35 + tick * 0.55)) * 13 : 3
|
|
45883
|
+
}
|
|
45884
|
+
},
|
|
45885
|
+
index5
|
|
45886
|
+
))
|
|
45887
|
+
}
|
|
45888
|
+
)
|
|
45889
|
+
}
|
|
45890
|
+
);
|
|
45100
45891
|
}
|
|
45101
45892
|
|
|
45102
45893
|
// src/ui/tool-group.aui.tsx
|
|
45103
|
-
import {
|
|
45104
|
-
useCallback as useCallback19,
|
|
45105
|
-
useRef as useRef34,
|
|
45106
|
-
useState as useState35
|
|
45107
|
-
} from "react";
|
|
45894
|
+
import { useCallback as useCallback19, useRef as useRef34, useState as useState35 } from "react";
|
|
45108
45895
|
|
|
45109
45896
|
// src/ui/collapsible.tsx
|
|
45110
45897
|
import { forwardRef as forwardRef31 } from "react";
|
|
@@ -45164,11 +45951,7 @@ function ToolGroupRoot({
|
|
|
45164
45951
|
"data-variant": variant ?? "outline",
|
|
45165
45952
|
open: isOpen,
|
|
45166
45953
|
onOpenChange: handleOpenChange,
|
|
45167
|
-
className: cn(
|
|
45168
|
-
toolGroupVariants({ variant }),
|
|
45169
|
-
"group/tool-group-root",
|
|
45170
|
-
className
|
|
45171
|
-
),
|
|
45954
|
+
className: cn(toolGroupVariants({ variant }), "group/tool-group-root", className),
|
|
45172
45955
|
style: {
|
|
45173
45956
|
"--nxf-animation-duration": `${ANIMATION_DURATION}ms`
|
|
45174
45957
|
},
|
|
@@ -45221,17 +46004,18 @@ function ToolGroupContent({
|
|
|
45221
46004
|
|
|
45222
46005
|
// src/ui/home-demo/surfaces.tsx
|
|
45223
46006
|
import { jsx as jsx92 } from "react/jsx-runtime";
|
|
45224
|
-
function ShimmerLabel({
|
|
46007
|
+
function ShimmerLabel({
|
|
46008
|
+
active = true,
|
|
46009
|
+
className,
|
|
46010
|
+
...props
|
|
46011
|
+
}) {
|
|
45225
46012
|
return /* @__PURE__ */ jsx92("span", { className: cn(active && "shimmer motion-reduce:animate-none", className), ...props });
|
|
45226
46013
|
}
|
|
45227
46014
|
|
|
45228
46015
|
// src/ui/home-demo/trace-line.tsx
|
|
45229
46016
|
import { useEffect as useEffect31, useRef as useRef35, useState as useState36 } from "react";
|
|
45230
46017
|
import { Fragment as Fragment13, jsx as jsx93, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
45231
|
-
function TraceMarker({
|
|
45232
|
-
live,
|
|
45233
|
-
className
|
|
45234
|
-
}) {
|
|
46018
|
+
function TraceMarker({ live, className }) {
|
|
45235
46019
|
return /* @__PURE__ */ jsx93(
|
|
45236
46020
|
"span",
|
|
45237
46021
|
{
|
|
@@ -45269,17 +46053,25 @@ function TraceLine({
|
|
|
45269
46053
|
detail,
|
|
45270
46054
|
meta
|
|
45271
46055
|
}) {
|
|
45272
|
-
return /* @__PURE__ */ jsxs25(
|
|
45273
|
-
|
|
45274
|
-
|
|
45275
|
-
|
|
45276
|
-
|
|
45277
|
-
|
|
45278
|
-
|
|
45279
|
-
|
|
45280
|
-
|
|
45281
|
-
|
|
45282
|
-
|
|
46056
|
+
return /* @__PURE__ */ jsxs25(
|
|
46057
|
+
"div",
|
|
46058
|
+
{
|
|
46059
|
+
className: cn(
|
|
46060
|
+
"my-1 flex items-baseline gap-2 font-mono text-[12px] [font-variant-ligatures:none]"
|
|
46061
|
+
),
|
|
46062
|
+
children: [
|
|
46063
|
+
/* @__PURE__ */ jsx93(TraceMarker, { live }),
|
|
46064
|
+
/* @__PURE__ */ jsx93("span", { className: cn("text-muted-foreground min-w-0 flex-1 truncate"), children: live ? /* @__PURE__ */ jsxs25(ShimmerLabel, { children: [
|
|
46065
|
+
label,
|
|
46066
|
+
detail ? ` ${detail}` : null
|
|
46067
|
+
] }) : /* @__PURE__ */ jsxs25(Fragment13, { children: [
|
|
46068
|
+
label,
|
|
46069
|
+
detail ? ` ${detail}` : null
|
|
46070
|
+
] }) }),
|
|
46071
|
+
meta ? /* @__PURE__ */ jsx93("span", { className: cn("text-muted-foreground/50 shrink-0"), children: meta }) : null
|
|
46072
|
+
]
|
|
46073
|
+
}
|
|
46074
|
+
);
|
|
45283
46075
|
}
|
|
45284
46076
|
|
|
45285
46077
|
// src/ui/home-demo/trace.tsx
|
|
@@ -45290,35 +46082,71 @@ function DisclosureTrigger({
|
|
|
45290
46082
|
label,
|
|
45291
46083
|
detail
|
|
45292
46084
|
}) {
|
|
45293
|
-
return /* @__PURE__ */ jsxs26(
|
|
45294
|
-
|
|
45295
|
-
|
|
45296
|
-
|
|
45297
|
-
|
|
45298
|
-
|
|
45299
|
-
|
|
45300
|
-
|
|
45301
|
-
|
|
45302
|
-
|
|
45303
|
-
|
|
45304
|
-
|
|
45305
|
-
|
|
45306
|
-
|
|
45307
|
-
|
|
45308
|
-
|
|
46085
|
+
return /* @__PURE__ */ jsxs26(
|
|
46086
|
+
CollapsibleTrigger3,
|
|
46087
|
+
{
|
|
46088
|
+
"data-slot": "tool-group-trigger",
|
|
46089
|
+
className: cn(
|
|
46090
|
+
"group/trigger my-1 flex max-w-full items-baseline gap-2 text-left font-mono text-[12px] outline-none [font-variant-ligatures:none] focus-visible:underline"
|
|
46091
|
+
),
|
|
46092
|
+
children: [
|
|
46093
|
+
/* @__PURE__ */ jsx94(TraceMarker, { live, className: cn("group-data-[state=open]/trigger:rotate-90") }),
|
|
46094
|
+
/* @__PURE__ */ jsx94(
|
|
46095
|
+
"span",
|
|
46096
|
+
{
|
|
46097
|
+
className: cn(
|
|
46098
|
+
"text-muted-foreground group-hover/trigger:text-foreground min-w-0 truncate transition-colors"
|
|
46099
|
+
),
|
|
46100
|
+
children: live ? /* @__PURE__ */ jsxs26(ShimmerLabel, { children: [
|
|
46101
|
+
label,
|
|
46102
|
+
detail ? ` ${detail}` : null
|
|
46103
|
+
] }) : /* @__PURE__ */ jsxs26(Fragment14, { children: [
|
|
46104
|
+
label,
|
|
46105
|
+
detail ? ` ${detail}` : null
|
|
46106
|
+
] })
|
|
46107
|
+
}
|
|
46108
|
+
)
|
|
46109
|
+
]
|
|
46110
|
+
}
|
|
46111
|
+
);
|
|
45309
46112
|
}
|
|
45310
|
-
function ToolCall({
|
|
46113
|
+
function ToolCall({
|
|
46114
|
+
toolName,
|
|
46115
|
+
args,
|
|
46116
|
+
argsText,
|
|
46117
|
+
result,
|
|
46118
|
+
status,
|
|
46119
|
+
isError,
|
|
46120
|
+
showDetails,
|
|
46121
|
+
presentation
|
|
46122
|
+
}) {
|
|
45311
46123
|
const tool2 = presentation?.type === "tool" ? presentation : void 0;
|
|
45312
46124
|
const error = tool2?.error;
|
|
45313
46125
|
const label = tool2?.toolState === "unknown" ? "Result unknown" : tool2?.toolState === "rejected" ? "Rejected" : tool2?.toolState === "cancelled" ? "Stopped" : tool2?.toolState === "not_started" ? "Not started" : tool2?.toolState === "failed" || isError ? "Failed" : void 0;
|
|
45314
46126
|
const live = !label && status?.type === "running";
|
|
45315
46127
|
const duration = useToolDuration(live);
|
|
45316
|
-
const line = /* @__PURE__ */ jsx94(
|
|
45317
|
-
|
|
45318
|
-
|
|
45319
|
-
|
|
45320
|
-
|
|
45321
|
-
|
|
46128
|
+
const line = /* @__PURE__ */ jsx94(
|
|
46129
|
+
TraceLine,
|
|
46130
|
+
{
|
|
46131
|
+
live,
|
|
46132
|
+
label: label ?? (live ? "running" : "ran"),
|
|
46133
|
+
detail: toolName,
|
|
46134
|
+
...duration === null ? {} : { meta: formatDuration(duration) }
|
|
46135
|
+
}
|
|
46136
|
+
);
|
|
46137
|
+
const reason = error && !error.parentErrorId && error.scope === "tool" && error.execution !== "unknown" ? /* @__PURE__ */ jsx94(
|
|
46138
|
+
"p",
|
|
46139
|
+
{
|
|
46140
|
+
role: "alert",
|
|
46141
|
+
className: cn("mt-2 border-l-2 pl-3 text-[13px] border-destructive/60 text-destructive"),
|
|
46142
|
+
children: error.userMessage
|
|
46143
|
+
}
|
|
46144
|
+
) : null;
|
|
46145
|
+
if (!showDetails)
|
|
46146
|
+
return /* @__PURE__ */ jsxs26(Fragment14, { children: [
|
|
46147
|
+
line,
|
|
46148
|
+
reason
|
|
46149
|
+
] });
|
|
45322
46150
|
return /* @__PURE__ */ jsxs26(Fragment14, { children: [
|
|
45323
46151
|
line,
|
|
45324
46152
|
reason,
|
|
@@ -45402,10 +46230,7 @@ var ReasoningRoot = forwardRef32(function ReasoningRoot2({
|
|
|
45402
46230
|
"data-variant": variant,
|
|
45403
46231
|
open: isOpen,
|
|
45404
46232
|
onOpenChange: handleOpenChange,
|
|
45405
|
-
className: cn(
|
|
45406
|
-
"group/reasoning-root",
|
|
45407
|
-
reasoningVariants({ variant, className })
|
|
45408
|
-
),
|
|
46233
|
+
className: cn("group/reasoning-root", reasoningVariants({ variant, className })),
|
|
45409
46234
|
style: {
|
|
45410
46235
|
"--nxf-animation-duration": `${ANIMATION_DURATION2}ms`
|
|
45411
46236
|
},
|
|
@@ -45482,11 +46307,7 @@ function ReasoningContent({
|
|
|
45482
46307
|
}
|
|
45483
46308
|
);
|
|
45484
46309
|
}
|
|
45485
|
-
function ReasoningText({
|
|
45486
|
-
className,
|
|
45487
|
-
children,
|
|
45488
|
-
...props
|
|
45489
|
-
}) {
|
|
46310
|
+
function ReasoningText({ className, children, ...props }) {
|
|
45490
46311
|
const isPreview = useContext10(ReasoningPreviewContext);
|
|
45491
46312
|
const scrollRef = useRef36(null);
|
|
45492
46313
|
const contentRef = useRef36(null);
|
|
@@ -45498,9 +46319,7 @@ function ReasoningText({
|
|
|
45498
46319
|
let pinned = true;
|
|
45499
46320
|
let lastScrollTop = scrollEl.scrollTop;
|
|
45500
46321
|
let lastScrollHeight = scrollEl.scrollHeight;
|
|
45501
|
-
const isAtBottom = () => Math.abs(
|
|
45502
|
-
scrollEl.scrollHeight - scrollEl.scrollTop - scrollEl.clientHeight
|
|
45503
|
-
) <= 1 || scrollEl.scrollHeight <= scrollEl.clientHeight;
|
|
46322
|
+
const isAtBottom = () => Math.abs(scrollEl.scrollHeight - scrollEl.scrollTop - scrollEl.clientHeight) <= 1 || scrollEl.scrollHeight <= scrollEl.clientHeight;
|
|
45504
46323
|
const pin = () => {
|
|
45505
46324
|
if (!pinned) return;
|
|
45506
46325
|
scrollEl.scrollTop = scrollEl.scrollHeight;
|
|
@@ -45552,11 +46371,7 @@ function ReasoningText({
|
|
|
45552
46371
|
|
|
45553
46372
|
// src/ui/reasoning.aui.tsx
|
|
45554
46373
|
import { jsx as jsx96 } from "react/jsx-runtime";
|
|
45555
|
-
function ReasoningRoot3({
|
|
45556
|
-
ref,
|
|
45557
|
-
onAnimationStart,
|
|
45558
|
-
...props
|
|
45559
|
-
}) {
|
|
46374
|
+
function ReasoningRoot3({ ref, onAnimationStart, ...props }) {
|
|
45560
46375
|
const collapsibleRef = useRef37(null);
|
|
45561
46376
|
const lockScroll = useScrollLock(collapsibleRef, ANIMATION_DURATION2);
|
|
45562
46377
|
const handleAnimationStart = useCallback21(() => {
|
|
@@ -45574,14 +46389,7 @@ function ReasoningRoot3({
|
|
|
45574
46389
|
},
|
|
45575
46390
|
[ref]
|
|
45576
46391
|
);
|
|
45577
|
-
return /* @__PURE__ */ jsx96(
|
|
45578
|
-
ReasoningRoot,
|
|
45579
|
-
{
|
|
45580
|
-
ref: composedRef,
|
|
45581
|
-
onAnimationStart: handleAnimationStart,
|
|
45582
|
-
...props
|
|
45583
|
-
}
|
|
45584
|
-
);
|
|
46392
|
+
return /* @__PURE__ */ jsx96(ReasoningRoot, { ref: composedRef, onAnimationStart: handleAnimationStart, ...props });
|
|
45585
46393
|
}
|
|
45586
46394
|
var ReasoningImpl = () => /* @__PURE__ */ jsx96(MarkdownText, {});
|
|
45587
46395
|
var Reasoning = memo7(ReasoningImpl);
|
|
@@ -45590,7 +46398,10 @@ Reasoning.displayName = "Reasoning";
|
|
|
45590
46398
|
// src/assistant-components.tsx
|
|
45591
46399
|
import { attachmentAccept } from "./attachments.js";
|
|
45592
46400
|
import { Fragment as Fragment15, jsx as jsx97, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
45593
|
-
function AttachmentTile({
|
|
46401
|
+
function AttachmentTile({
|
|
46402
|
+
binding,
|
|
46403
|
+
savedPreview
|
|
46404
|
+
}) {
|
|
45594
46405
|
const attachment = useAuiState((s) => s.attachment);
|
|
45595
46406
|
const preview = binding?.attachments.preview(attachment.id) ?? savedPreview ?? attachment.content?.find((part) => part.type === "image")?.image;
|
|
45596
46407
|
return /* @__PURE__ */ jsx97(AttachmentUI, { preview, children: /* @__PURE__ */ jsxs28("div", { className: cn("flex max-w-40 flex-col text-xs wrap-anywhere"), children: [
|
|
@@ -45600,7 +46411,15 @@ function AttachmentTile({ binding, savedPreview }) {
|
|
|
45600
46411
|
attachment.status.type === "incomplete" ? /* @__PURE__ */ jsx97("small", { className: cn("text-destructive"), role: "alert", children: attachment.status.message ?? "\u9644\u4EF6\u5904\u7406\u5931\u8D25" }) : null
|
|
45601
46412
|
] }) });
|
|
45602
46413
|
}
|
|
45603
|
-
function AssistantComposer({
|
|
46414
|
+
function AssistantComposer({
|
|
46415
|
+
binding,
|
|
46416
|
+
options: options2,
|
|
46417
|
+
placeholder,
|
|
46418
|
+
suggestion,
|
|
46419
|
+
busy,
|
|
46420
|
+
cancelling,
|
|
46421
|
+
cancel
|
|
46422
|
+
}) {
|
|
45604
46423
|
const input = useRef38(null);
|
|
45605
46424
|
const sending = binding.sending;
|
|
45606
46425
|
const voiceBusy = binding.voice.status !== "idle";
|
|
@@ -45608,9 +46427,14 @@ function AssistantComposer({ binding, options: options2, placeholder, suggestion
|
|
|
45608
46427
|
const voiceDisabledReason = busy ? "\u4EFB\u52A1\u6267\u884C\u4E2D\uFF0C\u6682\u4E0D\u80FD\u5F55\u97F3" : sending ? "\u6B63\u5728\u5904\u7406\u9644\u4EF6\uFF0C\u6682\u4E0D\u80FD\u5F55\u97F3" : void 0;
|
|
45609
46428
|
const empty3 = useAuiState((state) => state.composer.text.length === 0);
|
|
45610
46429
|
const nextMessage = !busy && !inputDisabled && empty3 ? suggestion : void 0;
|
|
45611
|
-
const showCancel = useAuiState(
|
|
46430
|
+
const showCancel = useAuiState(
|
|
46431
|
+
(state) => busy && (state.thread.isRunning || state.composer.isEmpty)
|
|
46432
|
+
);
|
|
45612
46433
|
const addFiles = (files) => {
|
|
45613
|
-
for (const file of files)
|
|
46434
|
+
for (const file of files)
|
|
46435
|
+
void binding.runtime.thread.composer.addAttachment(file).catch(
|
|
46436
|
+
(error) => binding.setNotice(error instanceof Error ? error.message : String(error))
|
|
46437
|
+
);
|
|
45614
46438
|
};
|
|
45615
46439
|
return /* @__PURE__ */ jsxs28(
|
|
45616
46440
|
Composer,
|
|
@@ -45638,7 +46462,16 @@ function AssistantComposer({ binding, options: options2, placeholder, suggestion
|
|
|
45638
46462
|
},
|
|
45639
46463
|
actions: /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
45640
46464
|
voiceBusy ? /* @__PURE__ */ jsx97("span", { role: "status", className: cn("sr-only"), children: binding.voice.status === "starting" ? "\u6B63\u5728\u51C6\u5907\u8BED\u97F3\u8F93\u5165\uFF0C\u8BF7\u786E\u8BA4\u9EA6\u514B\u98CE\u5DF2\u6388\u6743\u2026" : binding.voice.status === "transcribing" ? "\u6B63\u5728\u8BC6\u522B\uFF0C\u8BF7\u7A0D\u5019\u2026" : "\u6B63\u5728\u5F55\u97F3" }) : null,
|
|
45641
|
-
voiceBusy ? /* @__PURE__ */ jsx97(
|
|
46465
|
+
voiceBusy ? /* @__PURE__ */ jsx97(
|
|
46466
|
+
TooltipIconButton,
|
|
46467
|
+
{
|
|
46468
|
+
tooltip: "\u53D6\u6D88\u5F55\u97F3",
|
|
46469
|
+
"aria-label": "\u53D6\u6D88\u8BED\u97F3\u8F93\u5165",
|
|
46470
|
+
className: cn("size-7 shrink-0"),
|
|
46471
|
+
onClick: binding.voice.cancel,
|
|
46472
|
+
children: /* @__PURE__ */ jsx97(X, { className: cn("size-4") })
|
|
46473
|
+
}
|
|
46474
|
+
) : options2 !== false ? /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
45642
46475
|
/* @__PURE__ */ jsx97(
|
|
45643
46476
|
"input",
|
|
45644
46477
|
{
|
|
@@ -45654,33 +46487,118 @@ function AssistantComposer({ binding, options: options2, placeholder, suggestion
|
|
|
45654
46487
|
}
|
|
45655
46488
|
}
|
|
45656
46489
|
),
|
|
45657
|
-
/* @__PURE__ */ jsx97(
|
|
46490
|
+
/* @__PURE__ */ jsx97(
|
|
46491
|
+
"button",
|
|
46492
|
+
{
|
|
46493
|
+
type: "button",
|
|
46494
|
+
className: cn(
|
|
46495
|
+
"text-muted-foreground hover:text-foreground rounded-control grid size-7 shrink-0 place-items-center transition-colors"
|
|
46496
|
+
),
|
|
46497
|
+
"aria-label": "\u6DFB\u52A0\u9644\u4EF6",
|
|
46498
|
+
disabled: inputDisabled,
|
|
46499
|
+
onClick: () => input.current?.click(),
|
|
46500
|
+
children: /* @__PURE__ */ jsx97(Plus, { className: cn("size-4") })
|
|
46501
|
+
}
|
|
46502
|
+
)
|
|
45658
46503
|
] }) : /* @__PURE__ */ jsx97("span", {}),
|
|
45659
46504
|
voiceBusy ? /* @__PURE__ */ jsx97(ComposerVoice, { recording: binding.voice.status === "recording" }) : null,
|
|
45660
46505
|
/* @__PURE__ */ jsxs28("div", { className: cn("flex shrink-0 items-center gap-1"), children: [
|
|
45661
46506
|
/* @__PURE__ */ jsxs28(AuiIf, { condition: (state) => state.thread.capabilities.dictation, children: [
|
|
45662
46507
|
/* @__PURE__ */ jsx97(AuiIf, { condition: (state) => state.composer.dictation == null, children: /* @__PURE__ */ jsx97(TooltipProvider2, { delayDuration: 0, children: /* @__PURE__ */ jsxs28(Tooltip2, { children: [
|
|
45663
|
-
/* @__PURE__ */ jsx97(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx97(
|
|
46508
|
+
/* @__PURE__ */ jsx97(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx97(
|
|
46509
|
+
"span",
|
|
46510
|
+
{
|
|
46511
|
+
className: cn("inline-flex"),
|
|
46512
|
+
tabIndex: voiceDisabledReason ? 0 : void 0,
|
|
46513
|
+
"aria-label": voiceDisabledReason,
|
|
46514
|
+
children: /* @__PURE__ */ jsx97(ComposerPrimitiveDictate, { asChild: true, disabled: busy || sending, children: /* @__PURE__ */ jsx97(
|
|
46515
|
+
Button,
|
|
46516
|
+
{
|
|
46517
|
+
variant: "ghost",
|
|
46518
|
+
size: "icon",
|
|
46519
|
+
"aria-label": "\u5F00\u59CB\u8BED\u97F3\u8F93\u5165",
|
|
46520
|
+
"aria-description": voiceDisabledReason,
|
|
46521
|
+
className: cn("size-7 p-1"),
|
|
46522
|
+
children: /* @__PURE__ */ jsx97(Mic, { className: cn("size-4") })
|
|
46523
|
+
}
|
|
46524
|
+
) })
|
|
46525
|
+
}
|
|
46526
|
+
) }),
|
|
45664
46527
|
/* @__PURE__ */ jsx97(TooltipContent3, { children: voiceDisabledReason ?? "\u8BED\u97F3\u8F93\u5165" })
|
|
45665
46528
|
] }) }) }),
|
|
45666
|
-
/* @__PURE__ */ jsx97(AuiIf, { condition: (state) => state.composer.dictation != null, children: /* @__PURE__ */ jsx97(
|
|
46529
|
+
/* @__PURE__ */ jsx97(AuiIf, { condition: (state) => state.composer.dictation != null, children: /* @__PURE__ */ jsx97(
|
|
46530
|
+
ComposerPrimitiveStopDictation,
|
|
46531
|
+
{
|
|
46532
|
+
asChild: true,
|
|
46533
|
+
disabled: binding.voice.status !== "recording",
|
|
46534
|
+
children: /* @__PURE__ */ jsx97(
|
|
46535
|
+
"button",
|
|
46536
|
+
{
|
|
46537
|
+
type: "button",
|
|
46538
|
+
"aria-label": "\u7ED3\u675F\u8BED\u97F3\u8F93\u5165",
|
|
46539
|
+
title: "\u7ED3\u675F\u5F55\u97F3",
|
|
46540
|
+
className: cn(
|
|
46541
|
+
"text-destructive rounded-control grid size-7 place-items-center transition-colors disabled:opacity-50"
|
|
46542
|
+
),
|
|
46543
|
+
children: /* @__PURE__ */ jsx97(Square, { className: cn("size-3 animate-pulse fill-current") })
|
|
46544
|
+
}
|
|
46545
|
+
)
|
|
46546
|
+
}
|
|
46547
|
+
) })
|
|
45667
46548
|
] }),
|
|
45668
|
-
showCancel ? /* @__PURE__ */ jsx97(
|
|
45669
|
-
|
|
45670
|
-
|
|
45671
|
-
|
|
46549
|
+
showCancel ? /* @__PURE__ */ jsx97(
|
|
46550
|
+
"button",
|
|
46551
|
+
{
|
|
46552
|
+
type: "button",
|
|
46553
|
+
"aria-label": "\u53D6\u6D88\u4EFB\u52A1",
|
|
46554
|
+
className: cn(
|
|
46555
|
+
"bg-primary text-primary-foreground rounded-control grid size-7 place-items-center"
|
|
46556
|
+
),
|
|
46557
|
+
disabled: cancelling,
|
|
46558
|
+
onClick: cancel,
|
|
46559
|
+
children: /* @__PURE__ */ jsx97(Square, { className: cn("size-3 fill-current") })
|
|
46560
|
+
}
|
|
46561
|
+
) : /* @__PURE__ */ jsx97(ComposerPrimitiveSend, { asChild: true, disabled: inputDisabled, children: /* @__PURE__ */ jsx97(
|
|
46562
|
+
"button",
|
|
46563
|
+
{
|
|
46564
|
+
type: "button",
|
|
46565
|
+
onClick: (event) => {
|
|
46566
|
+
event.preventDefault();
|
|
46567
|
+
void binding.send();
|
|
46568
|
+
},
|
|
46569
|
+
"aria-label": "\u53D1\u9001\u4EFB\u52A1",
|
|
46570
|
+
className: cn(
|
|
46571
|
+
"bg-primary text-primary-foreground rounded-control grid size-7 place-items-center transition-opacity disabled:opacity-40"
|
|
46572
|
+
),
|
|
46573
|
+
children: /* @__PURE__ */ jsx97(ArrowUp, { className: cn("size-4") })
|
|
46574
|
+
}
|
|
46575
|
+
) })
|
|
45672
46576
|
] })
|
|
45673
46577
|
] }),
|
|
45674
46578
|
children: [
|
|
45675
|
-
/* @__PURE__ */ jsx97(
|
|
45676
|
-
|
|
45677
|
-
|
|
46579
|
+
/* @__PURE__ */ jsx97(
|
|
46580
|
+
"div",
|
|
46581
|
+
{
|
|
46582
|
+
ref: (element2) => {
|
|
46583
|
+
element2?.toggleAttribute("inert", inputDisabled);
|
|
46584
|
+
},
|
|
46585
|
+
className: cn(
|
|
46586
|
+
"aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden"
|
|
46587
|
+
),
|
|
46588
|
+
children: /* @__PURE__ */ jsx97(ComposerPrimitiveAttachments, { children: () => /* @__PURE__ */ jsx97(AttachmentTile, { binding }) })
|
|
46589
|
+
}
|
|
46590
|
+
),
|
|
45678
46591
|
sending ? /* @__PURE__ */ jsx97("small", { role: "status", children: "\u6B63\u5728\u5904\u7406\u9644\u4EF6\u2026" }) : null
|
|
45679
46592
|
]
|
|
45680
46593
|
}
|
|
45681
46594
|
);
|
|
45682
46595
|
}
|
|
45683
|
-
function ToolGroup({
|
|
46596
|
+
function ToolGroup({
|
|
46597
|
+
tools,
|
|
46598
|
+
running,
|
|
46599
|
+
count: count3,
|
|
46600
|
+
children
|
|
46601
|
+
}) {
|
|
45684
46602
|
const errors = tools.flatMap((tool2) => tool2.type === "tool" && tool2.error ? [tool2.error] : []);
|
|
45685
46603
|
const errorIds = JSON.stringify(errors.map((error) => error.id));
|
|
45686
46604
|
const hasErrors = errors.length > 0;
|
|
@@ -45690,13 +46608,28 @@ function ToolGroup({ tools, running, count: count3, children }) {
|
|
|
45690
46608
|
}, [errorIds]);
|
|
45691
46609
|
const unknown = hasErrors && errors.every((error) => error.scope === "tool" && error.execution === "unknown");
|
|
45692
46610
|
return /* @__PURE__ */ jsxs28(ToolGroupRoot, { variant: "ghost", className: cn("my-1"), open, onOpenChange: setOpen, children: [
|
|
45693
|
-
/* @__PURE__ */ jsx97(
|
|
46611
|
+
/* @__PURE__ */ jsx97(
|
|
46612
|
+
DisclosureTrigger,
|
|
46613
|
+
{
|
|
46614
|
+
live: running && !hasErrors,
|
|
46615
|
+
label: hasErrors ? unknown ? "Result unknown" : "Failed" : running ? "running" : "ran",
|
|
46616
|
+
detail: `${count3} tools`
|
|
46617
|
+
}
|
|
46618
|
+
),
|
|
45694
46619
|
/* @__PURE__ */ jsx97(ToolGroupContent, { className: cn(disclosureContentClass), children })
|
|
45695
46620
|
] });
|
|
45696
46621
|
}
|
|
45697
46622
|
var GroupedParts = MessagePrimitiveGroupedParts;
|
|
45698
|
-
var groupAssistantParts = groupPartByType({
|
|
45699
|
-
|
|
46623
|
+
var groupAssistantParts = groupPartByType({
|
|
46624
|
+
reasoning: ["group-chainOfThought", "group-reasoning"],
|
|
46625
|
+
source: ["group-chainOfThought", "group-source"],
|
|
46626
|
+
"tool-call": ["group-chainOfThought", "group-tool"],
|
|
46627
|
+
"standalone-tool-call": []
|
|
46628
|
+
});
|
|
46629
|
+
function AssistantParts({
|
|
46630
|
+
showDetails,
|
|
46631
|
+
tools = []
|
|
46632
|
+
}) {
|
|
45700
46633
|
return /* @__PURE__ */ jsx97(Fragment15, { children: /* @__PURE__ */ jsx97(GroupedParts, { groupBy: groupAssistantParts, children: ({ part, children }) => {
|
|
45701
46634
|
switch (part.type) {
|
|
45702
46635
|
case "group-chainOfThought":
|
|
@@ -45712,10 +46645,31 @@ function AssistantParts({ showDetails, tools = [] }) {
|
|
|
45712
46645
|
}
|
|
45713
46646
|
);
|
|
45714
46647
|
case "group-reasoning":
|
|
45715
|
-
return /* @__PURE__ */ jsxs28(
|
|
45716
|
-
|
|
45717
|
-
|
|
45718
|
-
|
|
46648
|
+
return /* @__PURE__ */ jsxs28(
|
|
46649
|
+
ReasoningRoot3,
|
|
46650
|
+
{
|
|
46651
|
+
variant: "ghost",
|
|
46652
|
+
streaming: part.status.type === "running",
|
|
46653
|
+
className: cn("my-1"),
|
|
46654
|
+
children: [
|
|
46655
|
+
/* @__PURE__ */ jsx97(
|
|
46656
|
+
DisclosureTrigger,
|
|
46657
|
+
{
|
|
46658
|
+
live: part.status.type === "running",
|
|
46659
|
+
label: part.status.type === "running" ? "thinking" : "reasoning"
|
|
46660
|
+
}
|
|
46661
|
+
),
|
|
46662
|
+
/* @__PURE__ */ jsx97(
|
|
46663
|
+
ReasoningContent,
|
|
46664
|
+
{
|
|
46665
|
+
"aria-busy": part.status.type === "running",
|
|
46666
|
+
className: cn(disclosureContentClass),
|
|
46667
|
+
children: /* @__PURE__ */ jsx97(ReasoningText, { className: cn("ps-0"), children })
|
|
46668
|
+
}
|
|
46669
|
+
)
|
|
46670
|
+
]
|
|
46671
|
+
}
|
|
46672
|
+
);
|
|
45719
46673
|
case "reasoning":
|
|
45720
46674
|
return /* @__PURE__ */ jsx97(Reasoning, { ...part });
|
|
45721
46675
|
case "group-source":
|
|
@@ -45726,7 +46680,16 @@ function AssistantParts({ showDetails, tools = [] }) {
|
|
|
45726
46680
|
case "text":
|
|
45727
46681
|
return part.text === "" && part.status?.type === "running" ? /* @__PURE__ */ jsx97(TraceLine, { live: true, label: "thinking" }) : /* @__PURE__ */ jsx97(MarkdownText, {});
|
|
45728
46682
|
case "tool-call":
|
|
45729
|
-
return part.toolUI ?? /* @__PURE__ */ jsx97(
|
|
46683
|
+
return part.toolUI ?? /* @__PURE__ */ jsx97(
|
|
46684
|
+
ToolCall,
|
|
46685
|
+
{
|
|
46686
|
+
...part,
|
|
46687
|
+
showDetails,
|
|
46688
|
+
presentation: tools.find(
|
|
46689
|
+
(tool2) => tool2.type === "tool" && tool2.toolCallId === part.toolCallId
|
|
46690
|
+
)
|
|
46691
|
+
}
|
|
46692
|
+
);
|
|
45730
46693
|
case "indicator":
|
|
45731
46694
|
return /* @__PURE__ */ jsx97(TraceLine, { live: true, label: "thinking" });
|
|
45732
46695
|
default:
|
|
@@ -45741,9 +46704,31 @@ import { sendErrorNotice } from "./errors.js";
|
|
|
45741
46704
|
import { Fragment as Fragment16, jsx as jsx98, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
45742
46705
|
var textOf = (message) => message.parts.flatMap((part) => part.type === "text" ? [part.text] : []).join("");
|
|
45743
46706
|
var Icon2 = forwardRef33(function Icon3({ label, children, className, ...props }, ref) {
|
|
45744
|
-
return /* @__PURE__ */ jsx98(
|
|
46707
|
+
return /* @__PURE__ */ jsx98(
|
|
46708
|
+
"button",
|
|
46709
|
+
{
|
|
46710
|
+
ref,
|
|
46711
|
+
type: "button",
|
|
46712
|
+
"aria-label": label,
|
|
46713
|
+
title: label,
|
|
46714
|
+
className: cn(
|
|
46715
|
+
"text-muted-foreground hover:text-foreground rounded-control grid size-7 place-items-center transition-colors [&>svg]:size-4",
|
|
46716
|
+
className
|
|
46717
|
+
),
|
|
46718
|
+
...props,
|
|
46719
|
+
children
|
|
46720
|
+
}
|
|
46721
|
+
);
|
|
45745
46722
|
});
|
|
45746
|
-
function Resize({
|
|
46723
|
+
function Resize({
|
|
46724
|
+
label,
|
|
46725
|
+
width,
|
|
46726
|
+
onResize,
|
|
46727
|
+
side = "left",
|
|
46728
|
+
edge = "left",
|
|
46729
|
+
min: min2,
|
|
46730
|
+
max: max2
|
|
46731
|
+
}) {
|
|
45747
46732
|
const handle2 = useRef39(null);
|
|
45748
46733
|
const drag = useRef39(null);
|
|
45749
46734
|
const readWidth = () => handle2.current?.parentElement?.getBoundingClientRect().width || width;
|
|
@@ -45768,7 +46753,10 @@ function Resize({ label, width, onResize, side = "left", edge = "left", min: min
|
|
|
45768
46753
|
"div",
|
|
45769
46754
|
{
|
|
45770
46755
|
ref: handle2,
|
|
45771
|
-
className: cn(
|
|
46756
|
+
className: cn(
|
|
46757
|
+
"absolute inset-y-0 z-3 w-1.5 cursor-col-resize touch-none max-sm:hidden",
|
|
46758
|
+
edge === "left" ? "left-0" : "right-0"
|
|
46759
|
+
),
|
|
45772
46760
|
role: "separator",
|
|
45773
46761
|
"aria-label": label,
|
|
45774
46762
|
"aria-orientation": "vertical",
|
|
@@ -45776,14 +46764,21 @@ function Resize({ label, width, onResize, side = "left", edge = "left", min: min
|
|
|
45776
46764
|
onKeyDown: (event) => {
|
|
45777
46765
|
if (!["ArrowLeft", "ArrowRight"].includes(event.key)) return;
|
|
45778
46766
|
event.preventDefault();
|
|
45779
|
-
onResize(
|
|
46767
|
+
onResize(
|
|
46768
|
+
clamp2(readWidth() + (event.key === "ArrowRight" ? 16 : -16) * (side === "left" ? 1 : -1))
|
|
46769
|
+
);
|
|
45780
46770
|
},
|
|
45781
46771
|
onPointerDown: (event) => {
|
|
45782
46772
|
drag.current = { x: event.clientX, width: readWidth() };
|
|
45783
46773
|
event.currentTarget.setPointerCapture(event.pointerId);
|
|
45784
46774
|
},
|
|
45785
46775
|
onPointerMove: (event) => {
|
|
45786
|
-
if (drag.current)
|
|
46776
|
+
if (drag.current)
|
|
46777
|
+
onResize(
|
|
46778
|
+
clamp2(
|
|
46779
|
+
drag.current.width + (event.clientX - drag.current.x) * (side === "left" ? 1 : -1)
|
|
46780
|
+
)
|
|
46781
|
+
);
|
|
45787
46782
|
},
|
|
45788
46783
|
onPointerUp: () => {
|
|
45789
46784
|
drag.current = null;
|
|
@@ -45868,13 +46863,17 @@ function Chat({
|
|
|
45868
46863
|
}
|
|
45869
46864
|
updateDialog(next);
|
|
45870
46865
|
};
|
|
45871
|
-
const byId = useMemo13(
|
|
46866
|
+
const byId = useMemo13(
|
|
46867
|
+
() => new Map(projectMessages(messages).map((message) => [message.id, message])),
|
|
46868
|
+
[messages]
|
|
46869
|
+
);
|
|
45872
46870
|
const visited = useRef39(/* @__PURE__ */ new Set());
|
|
45873
46871
|
visited.current.add(sessionId);
|
|
45874
46872
|
const activeTitle = messages.length ? chat.sessions.find((session) => session.id === sessionId)?.title || title : title;
|
|
45875
46873
|
const latestUser = [...messages].reverse().find((message) => message.role === "user");
|
|
45876
46874
|
useEffect34(() => {
|
|
45877
|
-
if (chat.completed && chat.consumeCompletion(chat.completed.id))
|
|
46875
|
+
if (chat.completed && chat.consumeCompletion(chat.completed.id))
|
|
46876
|
+
onRunResult?.(chat.completed.result);
|
|
45878
46877
|
}, [chat.completed, chat.consumeCompletion, onRunResult]);
|
|
45879
46878
|
useLayoutEffect14(() => {
|
|
45880
46879
|
dialog?.cancel?.();
|
|
@@ -45909,17 +46908,28 @@ function Chat({
|
|
|
45909
46908
|
const files = editing?.id === sourceId ? editing.files : messages.find((message) => message.id === sourceId)?.attachments ?? [];
|
|
45910
46909
|
const perform = () => {
|
|
45911
46910
|
setNotice("");
|
|
45912
|
-
void chat.sendMessage(text7, files, sourceId).then(
|
|
45913
|
-
|
|
45914
|
-
|
|
45915
|
-
|
|
45916
|
-
|
|
45917
|
-
|
|
45918
|
-
|
|
46911
|
+
void chat.sendMessage(text7, files, sourceId).then(
|
|
46912
|
+
() => {
|
|
46913
|
+
setEditing(void 0);
|
|
46914
|
+
resolve();
|
|
46915
|
+
},
|
|
46916
|
+
(error) => {
|
|
46917
|
+
setNotice(sendErrorNotice(error));
|
|
46918
|
+
reject(error);
|
|
46919
|
+
}
|
|
46920
|
+
);
|
|
45919
46921
|
};
|
|
45920
46922
|
const index5 = messages.findIndex((message) => message.id === sourceId);
|
|
45921
|
-
const hasOperations = messages.slice(index5 + 1).some(
|
|
45922
|
-
|
|
46923
|
+
const hasOperations = messages.slice(index5 + 1).some(
|
|
46924
|
+
(message) => message.parts.some((part) => part.type === "tool" && part.result !== void 0)
|
|
46925
|
+
);
|
|
46926
|
+
if (hasOperations)
|
|
46927
|
+
setDialog({
|
|
46928
|
+
title: "\u4FDD\u5B58\u5E76\u91CD\u65B0\u53D1\u9001\uFF1F",
|
|
46929
|
+
description: "\u4FEE\u6539\u540E\u5C06\u91CD\u65B0\u751F\u6210\u56DE\u7B54\u3002\u6B64\u524D\u5DF2\u6267\u884C\u7684\u4E1A\u52A1\u64CD\u4F5C\u4E0D\u4F1A\u64A4\u9500\uFF0C\u91CD\u65B0\u53D1\u9001\u53EF\u80FD\u91CD\u590D\u6267\u884C\u3002",
|
|
46930
|
+
action: perform,
|
|
46931
|
+
cancel: () => reject(new Error("\u5DF2\u53D6\u6D88\u91CD\u65B0\u53D1\u9001\u3002"))
|
|
46932
|
+
});
|
|
45923
46933
|
else perform();
|
|
45924
46934
|
});
|
|
45925
46935
|
return /* @__PURE__ */ jsx98(Fragment16, { children: chat.sessions.filter((session) => visited.current.has(session.id)).map((session) => /* @__PURE__ */ jsx98(
|
|
@@ -45934,38 +46944,145 @@ function Chat({
|
|
|
45934
46944
|
open,
|
|
45935
46945
|
onEdit: editThroughRuntime,
|
|
45936
46946
|
children: (binding) => {
|
|
45937
|
-
const history = sidebarOpen ? /* @__PURE__ */ jsxs29(
|
|
45938
|
-
|
|
45939
|
-
|
|
45940
|
-
|
|
46947
|
+
const history = sidebarOpen ? /* @__PURE__ */ jsxs29(
|
|
46948
|
+
"nav",
|
|
46949
|
+
{
|
|
46950
|
+
ref: sidebarNav,
|
|
46951
|
+
onKeyDown: (event) => {
|
|
46952
|
+
if (event.key === "Escape" && !event.nativeEvent.isComposing && !event.target.closest(
|
|
46953
|
+
'[data-slot="aui_thread-list-item-rename"]'
|
|
46954
|
+
)) {
|
|
46955
|
+
event.preventDefault();
|
|
46956
|
+
setSidebar(false);
|
|
46957
|
+
}
|
|
46958
|
+
},
|
|
46959
|
+
onClick: (event) => {
|
|
46960
|
+
if (event.target.closest(
|
|
46961
|
+
'[data-slot="aui_thread-list-item-trigger"], [data-slot="aui_thread-list-new"]'
|
|
46962
|
+
))
|
|
46963
|
+
setSidebar(false);
|
|
46964
|
+
},
|
|
46965
|
+
"data-slot": "nexface_session-sidebar",
|
|
46966
|
+
"data-layout": sidebarLayout,
|
|
46967
|
+
className: cn(
|
|
46968
|
+
"nexface-chat__session-sidebar absolute inset-y-0 z-5 flex flex-col overflow-auto border-r border-foreground/10 bg-background shadow-lg"
|
|
46969
|
+
),
|
|
46970
|
+
style: sidebarLayout === "overlay" && sidebarWidth !== void 0 ? { width: sidebarWidth } : void 0,
|
|
46971
|
+
"aria-label": "\u4F1A\u8BDD\u5386\u53F2",
|
|
46972
|
+
children: [
|
|
46973
|
+
sidebarLayout === "overlay" ? /* @__PURE__ */ jsx98(
|
|
46974
|
+
Resize,
|
|
46975
|
+
{
|
|
46976
|
+
label: "\u8C03\u6574\u4F1A\u8BDD\u5386\u53F2\u680F\u5BBD\u5EA6",
|
|
46977
|
+
width: sidebarWidth ?? 240,
|
|
46978
|
+
onResize: setSidebarWidth,
|
|
46979
|
+
edge: "right",
|
|
46980
|
+
min: 180,
|
|
46981
|
+
max: 400
|
|
46982
|
+
}
|
|
46983
|
+
) : null,
|
|
46984
|
+
/* @__PURE__ */ jsxs29(
|
|
46985
|
+
"div",
|
|
46986
|
+
{
|
|
46987
|
+
className: cn(
|
|
46988
|
+
"flex h-12 shrink-0 items-center gap-2 border-b border-foreground/10 px-4 md:px-5"
|
|
46989
|
+
),
|
|
46990
|
+
children: [
|
|
46991
|
+
sidebarLayout === "overlay" ? /* @__PURE__ */ jsx98(
|
|
46992
|
+
Icon2,
|
|
46993
|
+
{
|
|
46994
|
+
label: "\u6536\u8D77\u4F1A\u8BDD\u5386\u53F2",
|
|
46995
|
+
"aria-expanded": sidebarOpen,
|
|
46996
|
+
className: cn("size-7 shrink-0"),
|
|
46997
|
+
onClick: () => setSidebar(false),
|
|
46998
|
+
children: /* @__PURE__ */ jsx98(PanelLeft, { className: cn("size-4") })
|
|
46999
|
+
}
|
|
47000
|
+
) : null,
|
|
47001
|
+
/* @__PURE__ */ jsxs29(Avatar3, { children: [
|
|
47002
|
+
avatar ? /* @__PURE__ */ jsx98(AvatarImage3, { src: avatar, alt: "" }) : null,
|
|
47003
|
+
/* @__PURE__ */ jsx98(AvatarFallback3, { children: /* @__PURE__ */ jsx98(Bot, { size: 20 }) })
|
|
47004
|
+
] }),
|
|
47005
|
+
/* @__PURE__ */ jsx98("strong", { className: cn("min-w-0 flex-1 truncate text-[13px] font-medium"), children: title })
|
|
47006
|
+
]
|
|
47007
|
+
}
|
|
47008
|
+
),
|
|
47009
|
+
/* @__PURE__ */ jsxs29("div", { className: cn("flex min-h-0 flex-1 flex-col p-3"), children: [
|
|
47010
|
+
/* @__PURE__ */ jsx98(
|
|
47011
|
+
ThreadListNew,
|
|
47012
|
+
{
|
|
47013
|
+
disabled: sessionBusy || binding.sending,
|
|
47014
|
+
onClick: (event) => {
|
|
47015
|
+
event.preventDefault();
|
|
47016
|
+
safe(() => chat.createSession());
|
|
47017
|
+
}
|
|
47018
|
+
}
|
|
47019
|
+
),
|
|
47020
|
+
/* @__PURE__ */ jsx98(ThreadListSearch, { value: threadSearch, onValueChange: setThreadSearch }),
|
|
47021
|
+
/* @__PURE__ */ jsx98(
|
|
47022
|
+
"small",
|
|
47023
|
+
{
|
|
47024
|
+
className: cn("text-muted-foreground mt-5 mb-1 px-2 text-xs font-medium"),
|
|
47025
|
+
children: "\u6700\u8FD1\u4F1A\u8BDD"
|
|
47026
|
+
}
|
|
47027
|
+
),
|
|
47028
|
+
/* @__PURE__ */ jsx98(ThreadListRoot, { children: /* @__PURE__ */ jsx98(ThreadListPrimitiveItems, { children: ({ threadListItem: session2 }) => (session2.title ?? "\u65B0\u4F1A\u8BDD").toLocaleLowerCase().includes(threadSearch.trim().toLocaleLowerCase()) ? /* @__PURE__ */ jsx98(
|
|
47029
|
+
ThreadListItem,
|
|
47030
|
+
{
|
|
47031
|
+
disabled: sessionBusy || binding.sending,
|
|
47032
|
+
menu: (beginRename) => /* @__PURE__ */ jsxs29(Fragment16, { children: [
|
|
47033
|
+
/* @__PURE__ */ jsx98(
|
|
47034
|
+
DropdownMenuItem3,
|
|
47035
|
+
{
|
|
47036
|
+
disabled: sessionBusy || binding.sending,
|
|
47037
|
+
onSelect: beginRename,
|
|
47038
|
+
children: "\u91CD\u547D\u540D"
|
|
47039
|
+
}
|
|
47040
|
+
),
|
|
47041
|
+
/* @__PURE__ */ jsx98(
|
|
47042
|
+
DropdownMenuItem3,
|
|
47043
|
+
{
|
|
47044
|
+
variant: "destructive",
|
|
47045
|
+
disabled: busy || binding.sending,
|
|
47046
|
+
onSelect: () => setDialog({
|
|
47047
|
+
title: "\u6E05\u7A7A\u6D88\u606F\uFF1F",
|
|
47048
|
+
description: "\u8BE5\u4F1A\u8BDD\u6D88\u606F\u5C06\u88AB\u6E05\u9664\uFF0C\u4E1A\u52A1\u64CD\u4F5C\u4E0D\u4F1A\u56DE\u6EDA\u3002",
|
|
47049
|
+
dangerous: true,
|
|
47050
|
+
action: () => chat.clearSession(session2.id)
|
|
47051
|
+
}),
|
|
47052
|
+
children: "\u6E05\u7A7A\u6D88\u606F"
|
|
47053
|
+
}
|
|
47054
|
+
),
|
|
47055
|
+
/* @__PURE__ */ jsx98(
|
|
47056
|
+
DropdownMenuItem3,
|
|
47057
|
+
{
|
|
47058
|
+
variant: "destructive",
|
|
47059
|
+
disabled: busy || binding.sending,
|
|
47060
|
+
onSelect: () => setDialog({
|
|
47061
|
+
title: "\u5220\u9664\u4F1A\u8BDD\uFF1F",
|
|
47062
|
+
description: "\u804A\u5929\u8BB0\u5F55\u5C06\u88AB\u5220\u9664\uFF0C\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002",
|
|
47063
|
+
dangerous: true,
|
|
47064
|
+
action: () => chat.deleteSession(session2.id)
|
|
47065
|
+
}),
|
|
47066
|
+
children: "\u5220\u9664\u4F1A\u8BDD"
|
|
47067
|
+
}
|
|
47068
|
+
)
|
|
47069
|
+
] })
|
|
47070
|
+
}
|
|
47071
|
+
) : null }) }),
|
|
47072
|
+
threadSearch.trim() && !chat.sessions.some(
|
|
47073
|
+
(session2) => session2.title.toLocaleLowerCase().includes(threadSearch.trim().toLocaleLowerCase())
|
|
47074
|
+
) ? /* @__PURE__ */ jsx98(
|
|
47075
|
+
"div",
|
|
47076
|
+
{
|
|
47077
|
+
"data-slot": "aui_thread-list-empty",
|
|
47078
|
+
className: cn("text-muted-foreground px-2.5 py-4 text-sm"),
|
|
47079
|
+
children: "\u672A\u627E\u5230\u4F1A\u8BDD"
|
|
47080
|
+
}
|
|
47081
|
+
) : null
|
|
47082
|
+
] })
|
|
47083
|
+
]
|
|
45941
47084
|
}
|
|
45942
|
-
|
|
45943
|
-
if (event.target.closest('[data-slot="aui_thread-list-item-trigger"], [data-slot="aui_thread-list-new"]')) setSidebar(false);
|
|
45944
|
-
}, "data-slot": "nexface_session-sidebar", "data-layout": sidebarLayout, className: cn("nexface-chat__session-sidebar absolute inset-y-0 z-5 flex flex-col overflow-auto border-r border-foreground/10 bg-background shadow-lg"), style: sidebarLayout === "overlay" && sidebarWidth !== void 0 ? { width: sidebarWidth } : void 0, "aria-label": "\u4F1A\u8BDD\u5386\u53F2", children: [
|
|
45945
|
-
sidebarLayout === "overlay" ? /* @__PURE__ */ jsx98(Resize, { label: "\u8C03\u6574\u4F1A\u8BDD\u5386\u53F2\u680F\u5BBD\u5EA6", width: sidebarWidth ?? 240, onResize: setSidebarWidth, edge: "right", min: 180, max: 400 }) : null,
|
|
45946
|
-
/* @__PURE__ */ jsxs29("div", { className: cn("flex h-12 shrink-0 items-center gap-2 border-b border-foreground/10 px-4 md:px-5"), children: [
|
|
45947
|
-
sidebarLayout === "overlay" ? /* @__PURE__ */ jsx98(Icon2, { label: "\u6536\u8D77\u4F1A\u8BDD\u5386\u53F2", "aria-expanded": sidebarOpen, className: cn("size-7 shrink-0"), onClick: () => setSidebar(false), children: /* @__PURE__ */ jsx98(PanelLeft, { className: cn("size-4") }) }) : null,
|
|
45948
|
-
/* @__PURE__ */ jsxs29(Avatar3, { children: [
|
|
45949
|
-
avatar ? /* @__PURE__ */ jsx98(AvatarImage3, { src: avatar, alt: "" }) : null,
|
|
45950
|
-
/* @__PURE__ */ jsx98(AvatarFallback3, { children: /* @__PURE__ */ jsx98(Bot, { size: 20 }) })
|
|
45951
|
-
] }),
|
|
45952
|
-
/* @__PURE__ */ jsx98("strong", { className: cn("min-w-0 flex-1 truncate text-[13px] font-medium"), children: title })
|
|
45953
|
-
] }),
|
|
45954
|
-
/* @__PURE__ */ jsxs29("div", { className: cn("flex min-h-0 flex-1 flex-col p-3"), children: [
|
|
45955
|
-
/* @__PURE__ */ jsx98(ThreadListNew, { disabled: sessionBusy || binding.sending, onClick: (event) => {
|
|
45956
|
-
event.preventDefault();
|
|
45957
|
-
safe(() => chat.createSession());
|
|
45958
|
-
} }),
|
|
45959
|
-
/* @__PURE__ */ jsx98(ThreadListSearch, { value: threadSearch, onValueChange: setThreadSearch }),
|
|
45960
|
-
/* @__PURE__ */ jsx98("small", { className: cn("text-muted-foreground mt-5 mb-1 px-2 text-xs font-medium"), children: "\u6700\u8FD1\u4F1A\u8BDD" }),
|
|
45961
|
-
/* @__PURE__ */ jsx98(ThreadListRoot, { children: /* @__PURE__ */ jsx98(ThreadListPrimitiveItems, { children: ({ threadListItem: session2 }) => (session2.title ?? "\u65B0\u4F1A\u8BDD").toLocaleLowerCase().includes(threadSearch.trim().toLocaleLowerCase()) ? /* @__PURE__ */ jsx98(ThreadListItem, { disabled: sessionBusy || binding.sending, menu: (beginRename) => /* @__PURE__ */ jsxs29(Fragment16, { children: [
|
|
45962
|
-
/* @__PURE__ */ jsx98(DropdownMenuItem3, { disabled: sessionBusy || binding.sending, onSelect: beginRename, children: "\u91CD\u547D\u540D" }),
|
|
45963
|
-
/* @__PURE__ */ jsx98(DropdownMenuItem3, { variant: "destructive", disabled: busy || binding.sending, onSelect: () => setDialog({ title: "\u6E05\u7A7A\u6D88\u606F\uFF1F", description: "\u8BE5\u4F1A\u8BDD\u6D88\u606F\u5C06\u88AB\u6E05\u9664\uFF0C\u4E1A\u52A1\u64CD\u4F5C\u4E0D\u4F1A\u56DE\u6EDA\u3002", dangerous: true, action: () => chat.clearSession(session2.id) }), children: "\u6E05\u7A7A\u6D88\u606F" }),
|
|
45964
|
-
/* @__PURE__ */ jsx98(DropdownMenuItem3, { variant: "destructive", disabled: busy || binding.sending, onSelect: () => setDialog({ title: "\u5220\u9664\u4F1A\u8BDD\uFF1F", description: "\u804A\u5929\u8BB0\u5F55\u5C06\u88AB\u5220\u9664\uFF0C\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002", dangerous: true, action: () => chat.deleteSession(session2.id) }), children: "\u5220\u9664\u4F1A\u8BDD" })
|
|
45965
|
-
] }) }) : null }) }),
|
|
45966
|
-
threadSearch.trim() && !chat.sessions.some((session2) => session2.title.toLocaleLowerCase().includes(threadSearch.trim().toLocaleLowerCase())) ? /* @__PURE__ */ jsx98("div", { "data-slot": "aui_thread-list-empty", className: cn("text-muted-foreground px-2.5 py-4 text-sm"), children: "\u672A\u627E\u5230\u4F1A\u8BDD" }) : null
|
|
45967
|
-
] })
|
|
45968
|
-
] }) : null;
|
|
47085
|
+
) : null;
|
|
45969
47086
|
return open ? /* @__PURE__ */ jsxs29(
|
|
45970
47087
|
ChatSurface,
|
|
45971
47088
|
{
|
|
@@ -45976,108 +47093,366 @@ function Chat({
|
|
|
45976
47093
|
"data-fullscreen": fullscreen && open || void 0,
|
|
45977
47094
|
"data-session-sidebar-open": sidebarOpen || void 0,
|
|
45978
47095
|
"data-nexface-ignore": true,
|
|
45979
|
-
style: {
|
|
47096
|
+
style: {
|
|
47097
|
+
"--nexface-chat-panel-width": `${width}px`,
|
|
47098
|
+
...style,
|
|
47099
|
+
...fullscreen ? { border: 0, borderRadius: 0 } : {}
|
|
47100
|
+
},
|
|
45980
47101
|
children: [
|
|
45981
|
-
layout === "docked" && !fullscreen ? /* @__PURE__ */ jsx98(
|
|
47102
|
+
layout === "docked" && !fullscreen ? /* @__PURE__ */ jsx98(
|
|
47103
|
+
Resize,
|
|
47104
|
+
{
|
|
47105
|
+
label: "\u8C03\u6574\u804A\u5929\u5BBD\u5EA6",
|
|
47106
|
+
width,
|
|
47107
|
+
onResize: setWidth,
|
|
47108
|
+
side,
|
|
47109
|
+
edge: side === "left" ? "right" : "left",
|
|
47110
|
+
min: 320,
|
|
47111
|
+
max: 960
|
|
47112
|
+
}
|
|
47113
|
+
) : null,
|
|
45982
47114
|
sidebarLayout === "outside" ? history : null,
|
|
45983
|
-
/* @__PURE__ */ jsxs29(
|
|
45984
|
-
|
|
45985
|
-
|
|
45986
|
-
|
|
45987
|
-
|
|
45988
|
-
|
|
45989
|
-
|
|
45990
|
-
|
|
45991
|
-
|
|
45992
|
-
/* @__PURE__ */ jsxs29(
|
|
45993
|
-
|
|
45994
|
-
|
|
45995
|
-
|
|
45996
|
-
|
|
45997
|
-
|
|
45998
|
-
|
|
45999
|
-
|
|
46000
|
-
|
|
46001
|
-
|
|
46002
|
-
|
|
46003
|
-
|
|
46004
|
-
] })
|
|
46005
|
-
|
|
46006
|
-
|
|
46007
|
-
|
|
46008
|
-
|
|
46009
|
-
|
|
46010
|
-
|
|
46011
|
-
|
|
46012
|
-
|
|
46013
|
-
|
|
46014
|
-
|
|
46015
|
-
|
|
46016
|
-
/* @__PURE__ */
|
|
46017
|
-
|
|
46018
|
-
|
|
46019
|
-
|
|
46020
|
-
|
|
46021
|
-
|
|
46022
|
-
|
|
46023
|
-
|
|
46024
|
-
|
|
46025
|
-
|
|
46026
|
-
|
|
46027
|
-
|
|
47115
|
+
/* @__PURE__ */ jsxs29(
|
|
47116
|
+
"section",
|
|
47117
|
+
{
|
|
47118
|
+
ref: panel,
|
|
47119
|
+
className: cn(
|
|
47120
|
+
"nexface-chat__panel relative flex h-full min-h-0 overflow-hidden rounded-[inherit]"
|
|
47121
|
+
),
|
|
47122
|
+
"aria-label": `${title} chat`,
|
|
47123
|
+
children: [
|
|
47124
|
+
sidebarOpen && sidebarLayout === "overlay" ? /* @__PURE__ */ jsxs29(Fragment16, { children: [
|
|
47125
|
+
/* @__PURE__ */ jsx98(
|
|
47126
|
+
"button",
|
|
47127
|
+
{
|
|
47128
|
+
type: "button",
|
|
47129
|
+
tabIndex: -1,
|
|
47130
|
+
"aria-label": "\u5173\u95ED\u4F1A\u8BDD\u5386\u53F2\u6D6E\u5C42",
|
|
47131
|
+
className: cn("absolute inset-0 z-4 bg-black/10"),
|
|
47132
|
+
onClick: () => setSidebar(false)
|
|
47133
|
+
}
|
|
47134
|
+
),
|
|
47135
|
+
history
|
|
47136
|
+
] }) : null,
|
|
47137
|
+
/* @__PURE__ */ jsxs29(
|
|
47138
|
+
"div",
|
|
47139
|
+
{
|
|
47140
|
+
ref: (element2) => {
|
|
47141
|
+
element2?.toggleAttribute(
|
|
47142
|
+
"inert",
|
|
47143
|
+
sidebarOpen && sidebarLayout === "overlay"
|
|
47144
|
+
);
|
|
47145
|
+
},
|
|
47146
|
+
className: cn("flex min-h-0 min-w-0 flex-1 flex-col"),
|
|
47147
|
+
children: [
|
|
47148
|
+
/* @__PURE__ */ jsxs29(
|
|
47149
|
+
"header",
|
|
47150
|
+
{
|
|
47151
|
+
"data-slot": "nexface_chat_header",
|
|
47152
|
+
className: cn(
|
|
47153
|
+
"border-foreground/10 flex h-12 shrink-0 min-w-0 items-center gap-2 border-b px-4 md:px-5"
|
|
47154
|
+
),
|
|
47155
|
+
children: [
|
|
47156
|
+
/* @__PURE__ */ jsxs29(
|
|
47157
|
+
"div",
|
|
47158
|
+
{
|
|
47159
|
+
className: cn("flex min-w-0 flex-1 items-center gap-2 whitespace-nowrap"),
|
|
47160
|
+
children: [
|
|
47161
|
+
sidebarEnabled && (sidebarLayout === "outside" || !sidebarOpen) ? /* @__PURE__ */ jsx98(
|
|
47162
|
+
Icon2,
|
|
47163
|
+
{
|
|
47164
|
+
ref: sidebarTrigger,
|
|
47165
|
+
label: sidebarOpen ? "\u6536\u8D77\u4F1A\u8BDD\u5386\u53F2" : "\u67E5\u770B\u4F1A\u8BDD\u5386\u53F2",
|
|
47166
|
+
"aria-expanded": sidebarOpen,
|
|
47167
|
+
className: cn("size-7 shrink-0"),
|
|
47168
|
+
onClick: () => setSidebar((value) => !value),
|
|
47169
|
+
children: /* @__PURE__ */ jsx98(PanelLeft, { className: cn("size-4") })
|
|
47170
|
+
}
|
|
47171
|
+
) : null,
|
|
47172
|
+
/* @__PURE__ */ jsx98("strong", { className: cn("truncate text-[13px] font-medium"), children: activeTitle })
|
|
47173
|
+
]
|
|
47174
|
+
}
|
|
47175
|
+
),
|
|
47176
|
+
/* @__PURE__ */ jsxs29("div", { className: cn("-me-1.5 ml-auto flex shrink-0 items-center gap-1.5"), children: [
|
|
47177
|
+
/* @__PURE__ */ jsxs29(DropdownMenu2, { modal: false, children: [
|
|
47178
|
+
/* @__PURE__ */ jsx98(DropdownMenuTrigger3, { asChild: true, children: /* @__PURE__ */ jsx98(Icon2, { label: "\u66F4\u591A\u4F1A\u8BDD\u64CD\u4F5C", children: /* @__PURE__ */ jsx98(Ellipsis, {}) }) }),
|
|
47179
|
+
/* @__PURE__ */ jsx98(DropdownMenuContent3, { align: "end", children: /* @__PURE__ */ jsx98(
|
|
47180
|
+
DropdownMenuItem3,
|
|
47181
|
+
{
|
|
47182
|
+
variant: "destructive",
|
|
47183
|
+
disabled: busy || binding.sending,
|
|
47184
|
+
onSelect: () => setDialog({
|
|
47185
|
+
title: "\u6E05\u7A7A\u5168\u90E8\u5386\u53F2\uFF1F",
|
|
47186
|
+
description: "\u6240\u6709\u804A\u5929\u8BB0\u5F55\u5C06\u88AB\u6E05\u9664\uFF0C\u4E1A\u52A1\u64CD\u4F5C\u4E0D\u4F1A\u56DE\u6EDA\u3002",
|
|
47187
|
+
dangerous: true,
|
|
47188
|
+
action: chat.clearAllSessions
|
|
47189
|
+
}),
|
|
47190
|
+
children: "\u6E05\u7A7A\u5168\u90E8\u5386\u53F2"
|
|
47191
|
+
}
|
|
47192
|
+
) })
|
|
47193
|
+
] }),
|
|
47194
|
+
/* @__PURE__ */ jsx98(
|
|
47195
|
+
Icon2,
|
|
47196
|
+
{
|
|
47197
|
+
label: "\u65B0\u5EFA\u804A\u5929\u4F1A\u8BDD",
|
|
47198
|
+
disabled: sessionBusy || binding.sending,
|
|
47199
|
+
onClick: () => safe(() => chat.createSession()),
|
|
47200
|
+
children: /* @__PURE__ */ jsx98(Plus, {})
|
|
47201
|
+
}
|
|
47202
|
+
),
|
|
47203
|
+
/* @__PURE__ */ jsx98(
|
|
47204
|
+
Icon2,
|
|
47205
|
+
{
|
|
47206
|
+
ref: headerFocusButton,
|
|
47207
|
+
label: fullscreen ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F",
|
|
47208
|
+
onClick: () => changeFullscreen(!fullscreen),
|
|
47209
|
+
children: fullscreen ? /* @__PURE__ */ jsx98(Minimize2, {}) : /* @__PURE__ */ jsx98(Maximize2, {})
|
|
47210
|
+
}
|
|
47211
|
+
),
|
|
47212
|
+
onOpenChange ? /* @__PURE__ */ jsx98(Icon2, { label: "\u5173\u95ED Agent \u5BF9\u8BDD", onClick: () => onOpenChange(false), children: /* @__PURE__ */ jsx98(X, {}) }) : null
|
|
47213
|
+
] })
|
|
47214
|
+
]
|
|
47215
|
+
}
|
|
47216
|
+
),
|
|
47217
|
+
/* @__PURE__ */ jsx98(
|
|
47218
|
+
"div",
|
|
47219
|
+
{
|
|
47220
|
+
"data-slot": "nexface_chat_body",
|
|
47221
|
+
className: cn("relative flex min-h-0 flex-1"),
|
|
47222
|
+
children: /* @__PURE__ */ jsx98(
|
|
47223
|
+
Thread,
|
|
47224
|
+
{
|
|
47225
|
+
empty: !messages.length,
|
|
47226
|
+
welcome: /* @__PURE__ */ jsx98(Greeting, { title: welcomeMessage, description: welcomeDescription }),
|
|
47227
|
+
suggestions: /* @__PURE__ */ jsx98(
|
|
47228
|
+
Suggestions2,
|
|
47229
|
+
{
|
|
47230
|
+
suggestions,
|
|
47231
|
+
disabled: busy || binding.sending || binding.voice.status !== "idle",
|
|
47232
|
+
onSend: (prompt) => void execute(prompt)
|
|
47233
|
+
}
|
|
47234
|
+
),
|
|
47235
|
+
footer: /* @__PURE__ */ jsxs29(Fragment16, { children: [
|
|
47236
|
+
chat.storageWarning ? /* @__PURE__ */ jsx98("div", { role: "alert", className: cn("text-muted-foreground text-xs"), children: chat.storageWarning }) : null,
|
|
47237
|
+
notice ? /* @__PURE__ */ jsxs29("div", { role: "status", className: cn("text-muted-foreground text-xs"), children: [
|
|
47238
|
+
notice,
|
|
47239
|
+
/* @__PURE__ */ jsx98("button", { onClick: () => setNotice(""), children: "\xD7" })
|
|
47240
|
+
] }) : null,
|
|
47241
|
+
binding.notice ? /* @__PURE__ */ jsxs29(
|
|
47242
|
+
ErrorPrimitiveRoot,
|
|
47243
|
+
{
|
|
47244
|
+
className: cn(
|
|
47245
|
+
"border-destructive/60 text-destructive flex items-start gap-3 border-l-2 pl-3 text-[13px] leading-relaxed"
|
|
47246
|
+
),
|
|
47247
|
+
children: [
|
|
47248
|
+
/* @__PURE__ */ jsx98("span", { className: cn("min-w-0 flex-1 break-words"), children: binding.notice }),
|
|
47249
|
+
/* @__PURE__ */ jsx98(
|
|
47250
|
+
Icon2,
|
|
47251
|
+
{
|
|
47252
|
+
label: "\u5173\u95ED\u63D0\u793A",
|
|
47253
|
+
className: cn(
|
|
47254
|
+
"text-destructive hover:text-destructive -mt-1 -mr-1 shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive/30"
|
|
47255
|
+
),
|
|
47256
|
+
onClick: () => binding.setNotice(""),
|
|
47257
|
+
children: /* @__PURE__ */ jsx98(X, {})
|
|
47258
|
+
}
|
|
47259
|
+
)
|
|
47260
|
+
]
|
|
47261
|
+
}
|
|
47262
|
+
) : null
|
|
47263
|
+
] }),
|
|
47264
|
+
composer: /* @__PURE__ */ jsx98(
|
|
47265
|
+
AssistantComposer,
|
|
47266
|
+
{
|
|
47267
|
+
binding,
|
|
47268
|
+
options: attachments,
|
|
47269
|
+
placeholder,
|
|
47270
|
+
suggestion: nextMessage,
|
|
47271
|
+
busy: busy || Boolean(interrupt),
|
|
47272
|
+
cancelling: status === "cancelling",
|
|
47273
|
+
cancel: chat.cancel
|
|
47274
|
+
}
|
|
47275
|
+
),
|
|
47276
|
+
renderMessage: ({ message: rendered }) => {
|
|
47277
|
+
const message = byId.get(rendered.id);
|
|
47278
|
+
return message ? /* @__PURE__ */ jsx98(Fragment16, { children: editing?.id === message.id ? /* @__PURE__ */ jsx98(
|
|
47279
|
+
EditComposer,
|
|
47280
|
+
{
|
|
47281
|
+
onKeyDown: (event) => {
|
|
47282
|
+
if (event.key === "Escape" && !event.nativeEvent.isComposing)
|
|
47283
|
+
setEditing(void 0);
|
|
47284
|
+
},
|
|
47285
|
+
inputProps: {
|
|
47286
|
+
"aria-label": "\u7F16\u8F91\u6D88\u606F\u5185\u5BB9",
|
|
47287
|
+
value: editing.text,
|
|
47288
|
+
disabled: busy || binding.sending || binding.voice.status !== "idle",
|
|
47289
|
+
onChange: (event) => setEditing({ ...editing, text: event.target.value })
|
|
47290
|
+
},
|
|
47291
|
+
cancelProps: {
|
|
47292
|
+
type: "button",
|
|
47293
|
+
onClick: () => setEditing(void 0)
|
|
47294
|
+
},
|
|
47295
|
+
sendProps: {
|
|
47296
|
+
type: "button",
|
|
47297
|
+
disabled: busy || binding.sending || binding.voice.status !== "idle" || !editing.text.trim() && !editing.files.length
|
|
47298
|
+
},
|
|
47299
|
+
children: editing.files.map((file) => /* @__PURE__ */ jsxs29(
|
|
47300
|
+
"div",
|
|
47301
|
+
{
|
|
47302
|
+
className: cn(
|
|
47303
|
+
"bg-muted flex min-w-0 items-center gap-2 rounded-md px-3 py-2 text-sm"
|
|
47304
|
+
),
|
|
47305
|
+
children: [
|
|
47306
|
+
/* @__PURE__ */ jsx98(Paperclip, { className: cn("size-4 shrink-0") }),
|
|
47307
|
+
/* @__PURE__ */ jsx98("span", { className: cn("min-w-0 flex-1 truncate"), children: file.name }),
|
|
47308
|
+
/* @__PURE__ */ jsx98(
|
|
47309
|
+
TooltipIconButton,
|
|
47310
|
+
{
|
|
47311
|
+
tooltip: "\u79FB\u9664\u9644\u4EF6",
|
|
47312
|
+
type: "button",
|
|
47313
|
+
disabled: busy || binding.sending || binding.voice.status !== "idle",
|
|
47314
|
+
"aria-label": `\u79FB\u9664 ${file.name}`,
|
|
47315
|
+
onClick: () => setEditing({
|
|
47316
|
+
...editing,
|
|
47317
|
+
files: editing.files.filter(
|
|
47318
|
+
(item) => item.id !== file.id
|
|
47319
|
+
)
|
|
47320
|
+
}),
|
|
47321
|
+
children: /* @__PURE__ */ jsx98(X, {})
|
|
47322
|
+
}
|
|
47323
|
+
)
|
|
47324
|
+
]
|
|
47325
|
+
},
|
|
47326
|
+
file.id
|
|
47327
|
+
))
|
|
47328
|
+
}
|
|
47329
|
+
) : /* @__PURE__ */ jsx98(Fragment16, { children: message.role === "user" ? /* @__PURE__ */ jsx98(
|
|
47330
|
+
UserMessage,
|
|
47331
|
+
{
|
|
47332
|
+
attachments: /* @__PURE__ */ jsx98(
|
|
47333
|
+
"div",
|
|
47334
|
+
{
|
|
47335
|
+
className: cn(
|
|
47336
|
+
"aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row flex-wrap justify-end gap-2 empty:hidden"
|
|
47337
|
+
),
|
|
47338
|
+
children: /* @__PURE__ */ jsx98(MessagePrimitiveAttachments, { children: ({ attachment }) => /* @__PURE__ */ jsx98(
|
|
47339
|
+
AttachmentTile,
|
|
47340
|
+
{
|
|
47341
|
+
savedPreview: message.attachments?.find(
|
|
47342
|
+
(file) => file.id === attachment.id
|
|
47343
|
+
)?.preview
|
|
47344
|
+
}
|
|
47345
|
+
) })
|
|
47346
|
+
}
|
|
47347
|
+
),
|
|
47348
|
+
actions: message.id === latestUser?.id ? /* @__PURE__ */ jsx98(ActionBarPrimitiveEdit, { asChild: true, children: /* @__PURE__ */ jsx98(
|
|
47349
|
+
"button",
|
|
47350
|
+
{
|
|
47351
|
+
type: "button",
|
|
47352
|
+
"aria-label": "\u7F16\u8F91\u6D88\u606F",
|
|
47353
|
+
className: cn(actionButtonClass),
|
|
47354
|
+
disabled: busy || binding.sending || binding.voice.status !== "idle",
|
|
47355
|
+
onClick: () => setEditing({
|
|
47356
|
+
id: message.id,
|
|
47357
|
+
text: textOf(message),
|
|
47358
|
+
files: message.attachments ?? []
|
|
47359
|
+
}),
|
|
47360
|
+
children: /* @__PURE__ */ jsx98(Pencil, { className: cn("size-4") })
|
|
47361
|
+
}
|
|
47362
|
+
) }) : null,
|
|
47363
|
+
children: /* @__PURE__ */ jsx98(MessagePrimitiveParts2, {})
|
|
47364
|
+
}
|
|
47365
|
+
) : /* @__PURE__ */ jsx98(AssistantMessage, { children: /* @__PURE__ */ jsx98(
|
|
47366
|
+
AssistantParts,
|
|
47367
|
+
{
|
|
47368
|
+
showDetails: showToolDetails,
|
|
47369
|
+
tools: message.parts
|
|
47370
|
+
}
|
|
47371
|
+
) }) }) }) : /* @__PURE__ */ jsx98(AssistantMessage, { children: /* @__PURE__ */ jsx98(AssistantParts, { showDetails: showToolDetails }) });
|
|
47372
|
+
},
|
|
47373
|
+
children: interrupt ? /* @__PURE__ */ jsxs29(
|
|
47374
|
+
"section",
|
|
47375
|
+
{
|
|
47376
|
+
"aria-label": interrupt.title ?? `\u786E\u8BA4\u6267\u884C ${interrupt.toolName}\uFF1F`,
|
|
47377
|
+
className: cn("rounded-lg bg-muted p-4"),
|
|
47378
|
+
"data-mode": interrupt.mode,
|
|
47379
|
+
children: [
|
|
47380
|
+
/* @__PURE__ */ jsx98("strong", { children: interrupt.title ?? `\u786E\u8BA4\u6267\u884C ${interrupt.toolName}\uFF1F` }),
|
|
47381
|
+
interrupt.description ? /* @__PURE__ */ jsx98("p", { className: cn("mt-1 text-muted-foreground"), children: interrupt.description }) : null,
|
|
47382
|
+
interrupt.mode === "chat" ? /* @__PURE__ */ jsxs29("div", { className: cn("mt-3 flex gap-2"), children: [
|
|
47383
|
+
/* @__PURE__ */ jsx98(Button, { onClick: chat.confirmInterrupt, children: interrupt.confirmLabel ?? "\u786E\u8BA4" }),
|
|
47384
|
+
/* @__PURE__ */ jsx98(Button, { variant: "outline", onClick: chat.rejectInterrupt, children: interrupt.rejectLabel ?? "\u62D2\u7EDD" })
|
|
47385
|
+
] }) : /* @__PURE__ */ jsx98("p", { className: cn("mt-1 text-muted-foreground"), children: "\u8BF7\u5728\u4E1A\u52A1\u9875\u9762\u5B8C\u6210\u786E\u8BA4\u3002" })
|
|
47386
|
+
]
|
|
47387
|
+
}
|
|
47388
|
+
) : null
|
|
47389
|
+
}
|
|
47390
|
+
)
|
|
47391
|
+
}
|
|
47392
|
+
)
|
|
47393
|
+
]
|
|
47394
|
+
}
|
|
47395
|
+
),
|
|
47396
|
+
/* @__PURE__ */ jsx98(
|
|
47397
|
+
Dialog2,
|
|
47398
|
+
{
|
|
47399
|
+
open: Boolean(dialog),
|
|
47400
|
+
onOpenChange: (next) => {
|
|
47401
|
+
if (!next) {
|
|
47402
|
+
dialog?.cancel?.();
|
|
47403
|
+
setDialog(void 0);
|
|
47404
|
+
}
|
|
47405
|
+
},
|
|
47406
|
+
children: /* @__PURE__ */ jsxs29(
|
|
47407
|
+
DialogContent3,
|
|
46028
47408
|
{
|
|
46029
|
-
|
|
46030
|
-
|
|
47409
|
+
showCloseButton: false,
|
|
47410
|
+
onCloseAutoFocus: (event) => {
|
|
47411
|
+
event.preventDefault();
|
|
47412
|
+
queueMicrotask(() => {
|
|
47413
|
+
const target = dialogReturnFocus.current;
|
|
47414
|
+
if (target?.isConnected && !target.closest("[inert]")) target.focus();
|
|
47415
|
+
else
|
|
47416
|
+
panel.current?.querySelector("header button:not(:disabled)")?.focus();
|
|
47417
|
+
});
|
|
46031
47418
|
},
|
|
46032
|
-
|
|
46033
|
-
|
|
46034
|
-
|
|
46035
|
-
|
|
46036
|
-
|
|
46037
|
-
|
|
46038
|
-
|
|
46039
|
-
|
|
47419
|
+
children: [
|
|
47420
|
+
/* @__PURE__ */ jsx98(DialogTitle3, { children: dialog?.title }),
|
|
47421
|
+
/* @__PURE__ */ jsx98(DialogDescription3, { children: dialog?.description }),
|
|
47422
|
+
/* @__PURE__ */ jsxs29(DialogFooter, { children: [
|
|
47423
|
+
/* @__PURE__ */ jsx98(
|
|
47424
|
+
Button,
|
|
47425
|
+
{
|
|
47426
|
+
variant: "outline",
|
|
47427
|
+
autoFocus: true,
|
|
47428
|
+
onClick: () => {
|
|
47429
|
+
dialog?.cancel?.();
|
|
47430
|
+
setDialog(void 0);
|
|
47431
|
+
},
|
|
47432
|
+
children: "\u53D6\u6D88"
|
|
47433
|
+
}
|
|
47434
|
+
),
|
|
47435
|
+
/* @__PURE__ */ jsx98(
|
|
47436
|
+
Button,
|
|
47437
|
+
{
|
|
47438
|
+
variant: dialog?.dangerous ? "destructive" : "default",
|
|
47439
|
+
disabled: busy,
|
|
47440
|
+
onClick: () => {
|
|
47441
|
+
safe(() => dialog?.action());
|
|
47442
|
+
setDialog(void 0);
|
|
47443
|
+
},
|
|
47444
|
+
children: "\u786E\u5B9A"
|
|
47445
|
+
}
|
|
47446
|
+
)
|
|
47447
|
+
] })
|
|
47448
|
+
]
|
|
46040
47449
|
}
|
|
46041
|
-
)
|
|
46042
|
-
}
|
|
46043
|
-
|
|
46044
|
-
|
|
46045
|
-
|
|
46046
|
-
|
|
46047
|
-
/* @__PURE__ */ jsx98(Button, { onClick: chat.confirmInterrupt, children: interrupt.confirmLabel ?? "\u786E\u8BA4" }),
|
|
46048
|
-
/* @__PURE__ */ jsx98(Button, { variant: "outline", onClick: chat.rejectInterrupt, children: interrupt.rejectLabel ?? "\u62D2\u7EDD" })
|
|
46049
|
-
] }) : /* @__PURE__ */ jsx98("p", { className: cn("mt-1 text-muted-foreground"), children: "\u8BF7\u5728\u4E1A\u52A1\u9875\u9762\u5B8C\u6210\u786E\u8BA4\u3002" })
|
|
46050
|
-
] }) : null
|
|
46051
|
-
}
|
|
46052
|
-
) })
|
|
46053
|
-
] }),
|
|
46054
|
-
/* @__PURE__ */ jsx98(Dialog2, { open: Boolean(dialog), onOpenChange: (next) => {
|
|
46055
|
-
if (!next) {
|
|
46056
|
-
dialog?.cancel?.();
|
|
46057
|
-
setDialog(void 0);
|
|
46058
|
-
}
|
|
46059
|
-
}, children: /* @__PURE__ */ jsxs29(DialogContent3, { showCloseButton: false, onCloseAutoFocus: (event) => {
|
|
46060
|
-
event.preventDefault();
|
|
46061
|
-
queueMicrotask(() => {
|
|
46062
|
-
const target = dialogReturnFocus.current;
|
|
46063
|
-
if (target?.isConnected && !target.closest("[inert]")) target.focus();
|
|
46064
|
-
else panel.current?.querySelector("header button:not(:disabled)")?.focus();
|
|
46065
|
-
});
|
|
46066
|
-
}, children: [
|
|
46067
|
-
/* @__PURE__ */ jsx98(DialogTitle3, { children: dialog?.title }),
|
|
46068
|
-
/* @__PURE__ */ jsx98(DialogDescription3, { children: dialog?.description }),
|
|
46069
|
-
/* @__PURE__ */ jsxs29(DialogFooter, { children: [
|
|
46070
|
-
/* @__PURE__ */ jsx98(Button, { variant: "outline", autoFocus: true, onClick: () => {
|
|
46071
|
-
dialog?.cancel?.();
|
|
46072
|
-
setDialog(void 0);
|
|
46073
|
-
}, children: "\u53D6\u6D88" }),
|
|
46074
|
-
/* @__PURE__ */ jsx98(Button, { variant: dialog?.dangerous ? "destructive" : "default", disabled: busy, onClick: () => {
|
|
46075
|
-
safe(() => dialog?.action());
|
|
46076
|
-
setDialog(void 0);
|
|
46077
|
-
}, children: "\u786E\u5B9A" })
|
|
46078
|
-
] })
|
|
46079
|
-
] }) })
|
|
46080
|
-
] })
|
|
47450
|
+
)
|
|
47451
|
+
}
|
|
47452
|
+
)
|
|
47453
|
+
]
|
|
47454
|
+
}
|
|
47455
|
+
)
|
|
46081
47456
|
]
|
|
46082
47457
|
}
|
|
46083
47458
|
) : null;
|
|
@@ -46128,4 +47503,3 @@ lucide-react/dist/esm/lucide-react.js:
|
|
|
46128
47503
|
* See the LICENSE file in the root directory of this source tree.
|
|
46129
47504
|
*)
|
|
46130
47505
|
*/
|
|
46131
|
-
//# sourceMappingURL=default-chat.js.map
|