@assistant-ui/react 0.5.59 → 0.5.60
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/{chunk-33TPUWEZ.mjs → chunk-DC342I2Q.mjs} +16 -16
- package/dist/{chunk-33TPUWEZ.mjs.map → chunk-DC342I2Q.mjs.map} +1 -1
- package/dist/{chunk-CWAZOKEW.js → chunk-J2V7Y7JX.js} +14 -14
- package/dist/{chunk-CWAZOKEW.js.map → chunk-J2V7Y7JX.js.map} +1 -1
- package/dist/{edge-BJordJU0.d.mts → edge-eV0d_Sqj.d.mts} +101 -101
- package/dist/{edge-BJordJU0.d.ts → edge-eV0d_Sqj.d.ts} +101 -101
- package/dist/index.d.mts +129 -49
- package/dist/index.d.ts +129 -49
- package/dist/index.js +299 -98
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +494 -293
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css +118 -92
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/thread.css +9 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
@@ -10,7 +10,7 @@ import {
|
|
10
10
|
toLanguageModelMessages,
|
11
11
|
toLanguageModelTools,
|
12
12
|
toolResultStream
|
13
|
-
} from "./chunk-
|
13
|
+
} from "./chunk-DC342I2Q.mjs";
|
14
14
|
import {
|
15
15
|
__export
|
16
16
|
} from "./chunk-BJPOCE4O.mjs";
|
@@ -244,7 +244,9 @@ var makeThreadActionStore = (runtimeStore) => {
|
|
244
244
|
append: (message) => runtimeStore.getState().append(message),
|
245
245
|
cancelRun: () => runtimeStore.getState().cancelRun(),
|
246
246
|
addToolResult: (options) => runtimeStore.getState().addToolResult(options),
|
247
|
-
speak: (messageId) => runtimeStore.getState().speak(messageId)
|
247
|
+
speak: (messageId) => runtimeStore.getState().speak(messageId),
|
248
|
+
submitFeedback: ({ messageId, type }) => runtimeStore.getState().submitFeedback({ messageId, type }),
|
249
|
+
getModelConfig: () => runtimeStore.getState().getModelConfig()
|
248
250
|
})
|
249
251
|
);
|
250
252
|
};
|
@@ -1258,7 +1260,8 @@ var LocalThreadRuntime = class {
|
|
1258
1260
|
cancel: true,
|
1259
1261
|
unstable_copy: true,
|
1260
1262
|
speak: false,
|
1261
|
-
attachments: false
|
1263
|
+
attachments: false,
|
1264
|
+
feedback: false
|
1262
1265
|
};
|
1263
1266
|
threadId;
|
1264
1267
|
isDisabled = false;
|
@@ -1269,6 +1272,9 @@ var LocalThreadRuntime = class {
|
|
1269
1272
|
this,
|
1270
1273
|
this.notifySubscribers.bind(this)
|
1271
1274
|
);
|
1275
|
+
getModelConfig() {
|
1276
|
+
return this.configProvider.getModelConfig();
|
1277
|
+
}
|
1272
1278
|
_options;
|
1273
1279
|
get options() {
|
1274
1280
|
return this._options;
|
@@ -1287,6 +1293,11 @@ var LocalThreadRuntime = class {
|
|
1287
1293
|
this.capabilities.attachments = canAttach;
|
1288
1294
|
hasUpdates = true;
|
1289
1295
|
}
|
1296
|
+
const canFeedback = options.adapters?.feedback !== void 0;
|
1297
|
+
if (this.capabilities.feedback !== canFeedback) {
|
1298
|
+
this.capabilities.feedback = canFeedback;
|
1299
|
+
hasUpdates = true;
|
1300
|
+
}
|
1290
1301
|
if (hasUpdates) this.notifySubscribers();
|
1291
1302
|
}
|
1292
1303
|
getBranches(messageId) {
|
@@ -1475,6 +1486,12 @@ var LocalThreadRuntime = class {
|
|
1475
1486
|
this._utterance = utterance;
|
1476
1487
|
return this._utterance;
|
1477
1488
|
}
|
1489
|
+
submitFeedback({ messageId, type }) {
|
1490
|
+
const adapter = this.options.adapters?.feedback;
|
1491
|
+
if (!adapter) throw new Error("Feedback adapter not configured");
|
1492
|
+
const { message } = this.repository.getMessage(messageId);
|
1493
|
+
adapter.submit({ message, type });
|
1494
|
+
}
|
1478
1495
|
export() {
|
1479
1496
|
return this.repository.export();
|
1480
1497
|
}
|
@@ -1655,6 +1672,10 @@ var hasUpcomingMessage = (isRunning, messages) => {
|
|
1655
1672
|
return isRunning && messages[messages.length - 1]?.role !== "assistant";
|
1656
1673
|
};
|
1657
1674
|
var ExternalStoreThreadRuntime = class {
|
1675
|
+
constructor(configProvider, store) {
|
1676
|
+
this.configProvider = configProvider;
|
1677
|
+
this.store = store;
|
1678
|
+
}
|
1658
1679
|
_subscriptions = /* @__PURE__ */ new Set();
|
1659
1680
|
repository = new MessageRepository();
|
1660
1681
|
assistantOptimisticId = null;
|
@@ -1665,7 +1686,8 @@ var ExternalStoreThreadRuntime = class {
|
|
1665
1686
|
cancel: false,
|
1666
1687
|
unstable_copy: false,
|
1667
1688
|
speak: false,
|
1668
|
-
attachments: false
|
1689
|
+
attachments: false,
|
1690
|
+
feedback: false
|
1669
1691
|
};
|
1670
1692
|
get capabilities() {
|
1671
1693
|
return this._capabilities;
|
@@ -1679,9 +1701,6 @@ var ExternalStoreThreadRuntime = class {
|
|
1679
1701
|
this,
|
1680
1702
|
this.notifySubscribers.bind(this)
|
1681
1703
|
);
|
1682
|
-
constructor(store) {
|
1683
|
-
this.store = store;
|
1684
|
-
}
|
1685
1704
|
get store() {
|
1686
1705
|
return this._store;
|
1687
1706
|
}
|
@@ -1700,7 +1719,8 @@ var ExternalStoreThreadRuntime = class {
|
|
1700
1719
|
speak: this._store.onSpeak !== void 0,
|
1701
1720
|
unstable_copy: this._store.unstable_capabilities?.copy !== false,
|
1702
1721
|
// default true
|
1703
|
-
attachments: !!this.store.adapters?.attachments
|
1722
|
+
attachments: !!this.store.adapters?.attachments,
|
1723
|
+
feedback: !!this.store.adapters?.feedback
|
1704
1724
|
};
|
1705
1725
|
this.composer.setAttachmentAdapter(this._store.adapters?.attachments);
|
1706
1726
|
if (oldStore) {
|
@@ -1749,6 +1769,9 @@ var ExternalStoreThreadRuntime = class {
|
|
1749
1769
|
this.messages = this.repository.getMessages();
|
1750
1770
|
this.notifySubscribers();
|
1751
1771
|
}
|
1772
|
+
getModelConfig() {
|
1773
|
+
return this.configProvider.getModelConfig();
|
1774
|
+
}
|
1752
1775
|
notifySubscribers() {
|
1753
1776
|
for (const callback of this._subscriptions) callback();
|
1754
1777
|
}
|
@@ -1809,6 +1832,12 @@ var ExternalStoreThreadRuntime = class {
|
|
1809
1832
|
const { message } = this.repository.getMessage(messageId);
|
1810
1833
|
return this._store.onSpeak(message);
|
1811
1834
|
}
|
1835
|
+
submitFeedback({ messageId, type }) {
|
1836
|
+
const adapter = this._store.adapters?.feedback;
|
1837
|
+
if (!adapter) throw new Error("Feedback adapter not configured");
|
1838
|
+
const { message } = this.repository.getMessage(messageId);
|
1839
|
+
adapter.submit({ message, type });
|
1840
|
+
}
|
1812
1841
|
subscribe(callback) {
|
1813
1842
|
this._subscriptions.add(callback);
|
1814
1843
|
return () => this._subscriptions.delete(callback);
|
@@ -1822,9 +1851,11 @@ var ExternalStoreThreadRuntime = class {
|
|
1822
1851
|
|
1823
1852
|
// src/runtimes/external-store/ExternalStoreRuntime.tsx
|
1824
1853
|
var ExternalStoreRuntime = class extends BaseAssistantRuntime {
|
1825
|
-
_proxyConfigProvider
|
1854
|
+
_proxyConfigProvider;
|
1826
1855
|
constructor(store) {
|
1827
|
-
|
1856
|
+
const provider = new ProxyConfigProvider();
|
1857
|
+
super(new ExternalStoreThreadRuntime(provider, store));
|
1858
|
+
this._proxyConfigProvider = provider;
|
1828
1859
|
}
|
1829
1860
|
get store() {
|
1830
1861
|
return this.thread.store;
|
@@ -1841,7 +1872,7 @@ var ExternalStoreRuntime = class extends BaseAssistantRuntime {
|
|
1841
1872
|
async switchToNewThread() {
|
1842
1873
|
if (!this.store.onSwitchToNewThread)
|
1843
1874
|
throw new Error("Runtime does not support switching to new threads.");
|
1844
|
-
this.thread = new ExternalStoreThreadRuntime({
|
1875
|
+
this.thread = new ExternalStoreThreadRuntime(this._proxyConfigProvider, {
|
1845
1876
|
...this.store,
|
1846
1877
|
messages: []
|
1847
1878
|
});
|
@@ -1851,7 +1882,7 @@ var ExternalStoreRuntime = class extends BaseAssistantRuntime {
|
|
1851
1882
|
if (threadId !== null) {
|
1852
1883
|
if (!this.store.onSwitchToThread)
|
1853
1884
|
throw new Error("Runtime does not support switching threads.");
|
1854
|
-
this.thread = new ExternalStoreThreadRuntime({
|
1885
|
+
this.thread = new ExternalStoreThreadRuntime(this._proxyConfigProvider, {
|
1855
1886
|
...this.store,
|
1856
1887
|
messages: []
|
1857
1888
|
// ignore messages until rerender
|
@@ -2671,6 +2702,38 @@ var useActionBarStopSpeaking = () => {
|
|
2671
2702
|
return callback;
|
2672
2703
|
};
|
2673
2704
|
|
2705
|
+
// src/primitive-hooks/actionBar/useActionBarFeedbackPositive.tsx
|
2706
|
+
import { useCallback as useCallback8 } from "react";
|
2707
|
+
var useActionBarFeedbackPositive = () => {
|
2708
|
+
const threadActions = useThreadActions();
|
2709
|
+
const messageStore = useMessageStore();
|
2710
|
+
const messageUtilsStore = useMessageUtilsStore();
|
2711
|
+
const callback = useCallback8(() => {
|
2712
|
+
threadActions.submitFeedback({
|
2713
|
+
messageId: messageStore.getState().message.id,
|
2714
|
+
type: "positive"
|
2715
|
+
});
|
2716
|
+
messageUtilsStore.getState().setSubmittedFeedback("positive");
|
2717
|
+
}, [messageStore, messageUtilsStore, threadActions]);
|
2718
|
+
return callback;
|
2719
|
+
};
|
2720
|
+
|
2721
|
+
// src/primitive-hooks/actionBar/useActionBarFeedbackNegative.tsx
|
2722
|
+
import { useCallback as useCallback9 } from "react";
|
2723
|
+
var useActionBarFeedbackNegative = () => {
|
2724
|
+
const threadActions = useThreadActions();
|
2725
|
+
const messageStore = useMessageStore();
|
2726
|
+
const messageUtilsStore = useMessageUtilsStore();
|
2727
|
+
const callback = useCallback9(() => {
|
2728
|
+
threadActions.submitFeedback({
|
2729
|
+
messageId: messageStore.getState().message.id,
|
2730
|
+
type: "negative"
|
2731
|
+
});
|
2732
|
+
messageUtilsStore.getState().setSubmittedFeedback("negative");
|
2733
|
+
}, [messageStore, messageUtilsStore, threadActions]);
|
2734
|
+
return callback;
|
2735
|
+
};
|
2736
|
+
|
2674
2737
|
// src/primitive-hooks/branchPicker/useBranchPickerCount.tsx
|
2675
2738
|
var useBranchPickerCount = () => {
|
2676
2739
|
const branchCount = useMessage((s) => s.branches.length);
|
@@ -2678,7 +2741,7 @@ var useBranchPickerCount = () => {
|
|
2678
2741
|
};
|
2679
2742
|
|
2680
2743
|
// src/primitive-hooks/branchPicker/useBranchPickerNext.tsx
|
2681
|
-
import { useCallback as
|
2744
|
+
import { useCallback as useCallback10 } from "react";
|
2682
2745
|
var useBranchPickerNext = () => {
|
2683
2746
|
const messageStore = useMessageStore();
|
2684
2747
|
const editComposerStore = useEditComposerStore();
|
@@ -2687,7 +2750,7 @@ var useBranchPickerNext = () => {
|
|
2687
2750
|
[messageStore, editComposerStore],
|
2688
2751
|
(m, c) => c.isEditing || m.branches.indexOf(m.message.id) + 1 >= m.branches.length
|
2689
2752
|
);
|
2690
|
-
const callback =
|
2753
|
+
const callback = useCallback10(() => {
|
2691
2754
|
const { message, branches } = messageStore.getState();
|
2692
2755
|
threadActionsStore.getState().switchToBranch(branches[branches.indexOf(message.id) + 1]);
|
2693
2756
|
}, [threadActionsStore, messageStore]);
|
@@ -2702,7 +2765,7 @@ var useBranchPickerNumber = () => {
|
|
2702
2765
|
};
|
2703
2766
|
|
2704
2767
|
// src/primitive-hooks/branchPicker/useBranchPickerPrevious.tsx
|
2705
|
-
import { useCallback as
|
2768
|
+
import { useCallback as useCallback11 } from "react";
|
2706
2769
|
var useBranchPickerPrevious = () => {
|
2707
2770
|
const messageStore = useMessageStore();
|
2708
2771
|
const editComposerStore = useEditComposerStore();
|
@@ -2711,7 +2774,7 @@ var useBranchPickerPrevious = () => {
|
|
2711
2774
|
[messageStore, editComposerStore],
|
2712
2775
|
(m, c) => c.isEditing || m.branches.indexOf(m.message.id) <= 0
|
2713
2776
|
);
|
2714
|
-
const callback =
|
2777
|
+
const callback = useCallback11(() => {
|
2715
2778
|
const { message, branches } = messageStore.getState();
|
2716
2779
|
threadActionsStore.getState().switchToBranch(branches[branches.indexOf(message.id) - 1]);
|
2717
2780
|
}, [threadActionsStore, messageStore]);
|
@@ -2720,11 +2783,11 @@ var useBranchPickerPrevious = () => {
|
|
2720
2783
|
};
|
2721
2784
|
|
2722
2785
|
// src/primitive-hooks/composer/useComposerCancel.tsx
|
2723
|
-
import { useCallback as
|
2786
|
+
import { useCallback as useCallback12 } from "react";
|
2724
2787
|
var useComposerCancel = () => {
|
2725
2788
|
const composerStore = useComposerStore();
|
2726
2789
|
const disabled = useComposer((c) => !c.canCancel);
|
2727
|
-
const callback =
|
2790
|
+
const callback = useCallback12(() => {
|
2728
2791
|
const { cancel } = composerStore.getState();
|
2729
2792
|
cancel();
|
2730
2793
|
}, [composerStore]);
|
@@ -2742,7 +2805,7 @@ var useComposerIf = (props) => {
|
|
2742
2805
|
};
|
2743
2806
|
|
2744
2807
|
// src/primitive-hooks/composer/useComposerSend.tsx
|
2745
|
-
import { useCallback as
|
2808
|
+
import { useCallback as useCallback13 } from "react";
|
2746
2809
|
var useComposerSend = () => {
|
2747
2810
|
const threadStore = useThreadStore();
|
2748
2811
|
const threadViewportStore = useThreadViewportStore();
|
@@ -2752,7 +2815,7 @@ var useComposerSend = () => {
|
|
2752
2815
|
[threadStore, composerStore],
|
2753
2816
|
(t, c) => t.isRunning || !c.isEditing || c.isEmpty
|
2754
2817
|
);
|
2755
|
-
const callback =
|
2818
|
+
const callback = useCallback13(() => {
|
2756
2819
|
const composerState = composerStore.getState();
|
2757
2820
|
if (!composerState.isEditing) return;
|
2758
2821
|
composerState.send();
|
@@ -2764,12 +2827,12 @@ var useComposerSend = () => {
|
|
2764
2827
|
};
|
2765
2828
|
|
2766
2829
|
// src/primitive-hooks/composer/useComposerAddAttachment.tsx
|
2767
|
-
import { useCallback as
|
2830
|
+
import { useCallback as useCallback14 } from "react";
|
2768
2831
|
var useComposerAddAttachment = () => {
|
2769
2832
|
const disabled = useComposer((c) => !c.isEditing);
|
2770
2833
|
const threadComposerStore = useThreadComposerStore();
|
2771
2834
|
const threadRuntimeStore = useThreadComposerStore();
|
2772
|
-
const callback =
|
2835
|
+
const callback = useCallback14(() => {
|
2773
2836
|
const { addAttachment } = threadComposerStore.getState();
|
2774
2837
|
const { attachmentAccept } = threadRuntimeStore.getState();
|
2775
2838
|
const input = document.createElement("input");
|
@@ -2830,7 +2893,7 @@ var useMessageIf = (props) => {
|
|
2830
2893
|
const messageUtilsStore = useMessageUtilsStore();
|
2831
2894
|
return useCombinedStore(
|
2832
2895
|
[messageStore, messageUtilsStore],
|
2833
|
-
({ message, branches, isLast }, { isCopied, isHovering, isSpeaking }) => {
|
2896
|
+
({ message, branches, isLast }, { isCopied, isHovering, isSpeaking, submittedFeedback }) => {
|
2834
2897
|
if (props.hasBranches === true && branches.length < 2) return false;
|
2835
2898
|
if (props.user && message.role !== "user") return false;
|
2836
2899
|
if (props.assistant && message.role !== "assistant") return false;
|
@@ -2844,6 +2907,8 @@ var useMessageIf = (props) => {
|
|
2844
2907
|
return false;
|
2845
2908
|
if (props.hasAttachments === false && message.role === "user" && !!message.attachments.length)
|
2846
2909
|
return false;
|
2910
|
+
if (props.submittedFeedback !== void 0 && submittedFeedback !== props.submittedFeedback)
|
2911
|
+
return false;
|
2847
2912
|
return true;
|
2848
2913
|
}
|
2849
2914
|
);
|
@@ -2873,12 +2938,12 @@ var useThreadEmpty = () => {
|
|
2873
2938
|
};
|
2874
2939
|
|
2875
2940
|
// src/primitive-hooks/thread/useThreadScrollToBottom.tsx
|
2876
|
-
import { useCallback as
|
2941
|
+
import { useCallback as useCallback15 } from "react";
|
2877
2942
|
var useThreadScrollToBottom = () => {
|
2878
2943
|
const isAtBottom = useThreadViewport((s) => s.isAtBottom);
|
2879
2944
|
const threadViewportStore = useThreadViewportStore();
|
2880
2945
|
const threadComposerStore = useThreadComposerStore();
|
2881
|
-
const handleScrollToBottom =
|
2946
|
+
const handleScrollToBottom = useCallback15(() => {
|
2882
2947
|
threadViewportStore.getState().scrollToBottom();
|
2883
2948
|
threadComposerStore.getState().focus();
|
2884
2949
|
}, [threadViewportStore, threadComposerStore]);
|
@@ -2887,7 +2952,7 @@ var useThreadScrollToBottom = () => {
|
|
2887
2952
|
};
|
2888
2953
|
|
2889
2954
|
// src/primitive-hooks/thread/useThreadSuggestion.tsx
|
2890
|
-
import { useCallback as
|
2955
|
+
import { useCallback as useCallback16 } from "react";
|
2891
2956
|
var useThreadSuggestion = ({
|
2892
2957
|
prompt,
|
2893
2958
|
autoSend
|
@@ -2896,7 +2961,7 @@ var useThreadSuggestion = ({
|
|
2896
2961
|
const composerStore = useThreadComposerStore();
|
2897
2962
|
const append = useAppendMessage();
|
2898
2963
|
const disabled = useThread((t) => t.isDisabled);
|
2899
|
-
const callback =
|
2964
|
+
const callback = useCallback16(() => {
|
2900
2965
|
const thread = threadStore.getState();
|
2901
2966
|
const composer = composerStore.getState();
|
2902
2967
|
if (autoSend && !thread.isRunning) {
|
@@ -2915,6 +2980,8 @@ var actionBar_exports = {};
|
|
2915
2980
|
__export(actionBar_exports, {
|
2916
2981
|
Copy: () => ActionBarPrimitiveCopy,
|
2917
2982
|
Edit: () => ActionBarPrimitiveEdit,
|
2983
|
+
FeedbackNegative: () => ActionBarPrimitiveFeedbackNegative,
|
2984
|
+
FeedbackPositive: () => ActionBarPrimitiveFeedbackPositive,
|
2918
2985
|
Reload: () => ActionBarPrimitiveReload,
|
2919
2986
|
Root: () => ActionBarPrimitiveRoot,
|
2920
2987
|
Speak: () => ActionBarPrimitiveSpeak,
|
@@ -2968,13 +3035,37 @@ var ActionBarPrimitiveRoot = forwardRef5(({ hideWhenRunning, autohide, autohideF
|
|
2968
3035
|
});
|
2969
3036
|
ActionBarPrimitiveRoot.displayName = "ActionBarPrimitive.Root";
|
2970
3037
|
|
2971
|
-
// src/
|
3038
|
+
// src/primitives/actionBar/ActionBarCopy.tsx
|
2972
3039
|
import { forwardRef as forwardRef6 } from "react";
|
2973
|
-
import { Primitive as Primitive3 } from "@radix-ui/react-primitive";
|
2974
3040
|
import { composeEventHandlers } from "@radix-ui/primitive";
|
3041
|
+
import { Primitive as Primitive3 } from "@radix-ui/react-primitive";
|
2975
3042
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
3043
|
+
var ActionBarPrimitiveCopy = forwardRef6(({ copiedDuration, onClick, disabled, ...props }, forwardedRef) => {
|
3044
|
+
const isCopied = useMessageUtils((u) => u.isCopied);
|
3045
|
+
const callback = useActionBarCopy({ copiedDuration });
|
3046
|
+
return /* @__PURE__ */ jsx11(
|
3047
|
+
Primitive3.button,
|
3048
|
+
{
|
3049
|
+
type: "button",
|
3050
|
+
...isCopied ? { "data-copied": "true" } : {},
|
3051
|
+
...props,
|
3052
|
+
ref: forwardedRef,
|
3053
|
+
disabled: disabled || !callback,
|
3054
|
+
onClick: composeEventHandlers(onClick, () => {
|
3055
|
+
callback?.();
|
3056
|
+
})
|
3057
|
+
}
|
3058
|
+
);
|
3059
|
+
});
|
3060
|
+
ActionBarPrimitiveCopy.displayName = "ActionBarPrimitive.Copy";
|
3061
|
+
|
3062
|
+
// src/utils/createActionButton.tsx
|
3063
|
+
import { forwardRef as forwardRef7 } from "react";
|
3064
|
+
import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
|
3065
|
+
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
3066
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
2976
3067
|
var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
2977
|
-
const ActionButton =
|
3068
|
+
const ActionButton = forwardRef7((props, forwardedRef) => {
|
2978
3069
|
const forwardedProps = {};
|
2979
3070
|
const primitiveProps = {};
|
2980
3071
|
Object.keys(props).forEach((key) => {
|
@@ -2985,14 +3076,14 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
|
2985
3076
|
}
|
2986
3077
|
});
|
2987
3078
|
const callback = useActionButton(forwardedProps);
|
2988
|
-
return /* @__PURE__ */
|
2989
|
-
|
3079
|
+
return /* @__PURE__ */ jsx12(
|
3080
|
+
Primitive4.button,
|
2990
3081
|
{
|
2991
3082
|
type: "button",
|
2992
3083
|
...primitiveProps,
|
2993
3084
|
ref: forwardedRef,
|
2994
3085
|
disabled: primitiveProps.disabled || !callback,
|
2995
|
-
onClick:
|
3086
|
+
onClick: composeEventHandlers2(primitiveProps.onClick, () => {
|
2996
3087
|
callback?.();
|
2997
3088
|
})
|
2998
3089
|
}
|
@@ -3002,13 +3093,6 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
|
3002
3093
|
return ActionButton;
|
3003
3094
|
};
|
3004
3095
|
|
3005
|
-
// src/primitives/actionBar/ActionBarCopy.tsx
|
3006
|
-
var ActionBarPrimitiveCopy = createActionButton(
|
3007
|
-
"ActionBarPrimitive.Copy",
|
3008
|
-
useActionBarCopy,
|
3009
|
-
["copiedDuration"]
|
3010
|
-
);
|
3011
|
-
|
3012
3096
|
// src/primitives/actionBar/ActionBarReload.tsx
|
3013
3097
|
var ActionBarPrimitiveReload = createActionButton(
|
3014
3098
|
"ActionBarPrimitive.Reload",
|
@@ -3028,12 +3112,12 @@ var ActionBarPrimitiveSpeak = createActionButton(
|
|
3028
3112
|
);
|
3029
3113
|
|
3030
3114
|
// src/primitives/actionBar/ActionBarStopSpeaking.tsx
|
3031
|
-
import { forwardRef as
|
3115
|
+
import { forwardRef as forwardRef8 } from "react";
|
3032
3116
|
import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
|
3033
|
-
import { Primitive as
|
3034
|
-
import { composeEventHandlers as
|
3035
|
-
import { jsx as
|
3036
|
-
var ActionBarPrimitiveStopSpeaking =
|
3117
|
+
import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
|
3118
|
+
import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
|
3119
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
3120
|
+
var ActionBarPrimitiveStopSpeaking = forwardRef8((props, ref) => {
|
3037
3121
|
const callback = useActionBarStopSpeaking();
|
3038
3122
|
useEscapeKeydown((e) => {
|
3039
3123
|
if (callback) {
|
@@ -3041,14 +3125,14 @@ var ActionBarPrimitiveStopSpeaking = forwardRef7((props, ref) => {
|
|
3041
3125
|
callback();
|
3042
3126
|
}
|
3043
3127
|
});
|
3044
|
-
return /* @__PURE__ */
|
3045
|
-
|
3128
|
+
return /* @__PURE__ */ jsx13(
|
3129
|
+
Primitive5.button,
|
3046
3130
|
{
|
3047
3131
|
type: "button",
|
3048
3132
|
disabled: !callback,
|
3049
3133
|
...props,
|
3050
3134
|
ref,
|
3051
|
-
onClick:
|
3135
|
+
onClick: composeEventHandlers3(props.onClick, () => {
|
3052
3136
|
callback?.();
|
3053
3137
|
})
|
3054
3138
|
}
|
@@ -3056,6 +3140,58 @@ var ActionBarPrimitiveStopSpeaking = forwardRef7((props, ref) => {
|
|
3056
3140
|
});
|
3057
3141
|
ActionBarPrimitiveStopSpeaking.displayName = "ActionBarPrimitive.StopSpeaking";
|
3058
3142
|
|
3143
|
+
// src/primitives/actionBar/ActionBarFeedbackPositive.tsx
|
3144
|
+
import { forwardRef as forwardRef9 } from "react";
|
3145
|
+
import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
|
3146
|
+
import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
|
3147
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
3148
|
+
var ActionBarPrimitiveFeedbackPositive = forwardRef9(({ onClick, disabled, ...props }, forwardedRef) => {
|
3149
|
+
const isSubmitted = useMessageUtils(
|
3150
|
+
(u) => u.submittedFeedback === "positive"
|
3151
|
+
);
|
3152
|
+
const callback = useActionBarFeedbackPositive();
|
3153
|
+
return /* @__PURE__ */ jsx14(
|
3154
|
+
Primitive6.button,
|
3155
|
+
{
|
3156
|
+
type: "button",
|
3157
|
+
...isSubmitted ? { "data-submitted": "true" } : {},
|
3158
|
+
...props,
|
3159
|
+
ref: forwardedRef,
|
3160
|
+
disabled: disabled || !callback,
|
3161
|
+
onClick: composeEventHandlers4(onClick, () => {
|
3162
|
+
callback?.();
|
3163
|
+
})
|
3164
|
+
}
|
3165
|
+
);
|
3166
|
+
});
|
3167
|
+
ActionBarPrimitiveFeedbackPositive.displayName = "ActionBarPrimitive.FeedbackPositive";
|
3168
|
+
|
3169
|
+
// src/primitives/actionBar/ActionBarFeedbackNegative.tsx
|
3170
|
+
import { forwardRef as forwardRef10 } from "react";
|
3171
|
+
import { composeEventHandlers as composeEventHandlers5 } from "@radix-ui/primitive";
|
3172
|
+
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
3173
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
3174
|
+
var ActionBarPrimitiveFeedbackNegative = forwardRef10(({ onClick, disabled, ...props }, forwardedRef) => {
|
3175
|
+
const isSubmitted = useMessageUtils(
|
3176
|
+
(u) => u.submittedFeedback === "negative"
|
3177
|
+
);
|
3178
|
+
const callback = useActionBarFeedbackNegative();
|
3179
|
+
return /* @__PURE__ */ jsx15(
|
3180
|
+
Primitive7.button,
|
3181
|
+
{
|
3182
|
+
type: "button",
|
3183
|
+
...isSubmitted ? { "data-submitted": "true" } : {},
|
3184
|
+
...props,
|
3185
|
+
ref: forwardedRef,
|
3186
|
+
disabled: disabled || !callback,
|
3187
|
+
onClick: composeEventHandlers5(onClick, () => {
|
3188
|
+
callback?.();
|
3189
|
+
})
|
3190
|
+
}
|
3191
|
+
);
|
3192
|
+
});
|
3193
|
+
ActionBarPrimitiveFeedbackNegative.displayName = "ActionBarPrimitive.FeedbackNegative";
|
3194
|
+
|
3059
3195
|
// src/primitives/assistantModal/index.ts
|
3060
3196
|
var assistantModal_exports = {};
|
3061
3197
|
__export(assistantModal_exports, {
|
@@ -3068,7 +3204,7 @@ __export(assistantModal_exports, {
|
|
3068
3204
|
// src/primitives/assistantModal/AssistantModalRoot.tsx
|
3069
3205
|
import { useState as useState10 } from "react";
|
3070
3206
|
import * as PopoverPrimitive2 from "@radix-ui/react-popover";
|
3071
|
-
import { composeEventHandlers as
|
3207
|
+
import { composeEventHandlers as composeEventHandlers6 } from "@radix-ui/primitive";
|
3072
3208
|
|
3073
3209
|
// src/utils/hooks/useOnComposerFocus.tsx
|
3074
3210
|
import { useCallbackRef as useCallbackRef2 } from "@radix-ui/react-use-callback-ref";
|
@@ -3088,7 +3224,7 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3088
3224
|
var usePopoverScope = PopoverPrimitive.createPopoverScope();
|
3089
3225
|
|
3090
3226
|
// src/primitives/assistantModal/AssistantModalRoot.tsx
|
3091
|
-
import { jsx as
|
3227
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
3092
3228
|
var useAssistantModalOpenState = (defaultOpen = false) => {
|
3093
3229
|
const state = useState10(defaultOpen);
|
3094
3230
|
const [, setOpen] = state;
|
@@ -3106,12 +3242,12 @@ var AssistantModalPrimitiveRoot = ({
|
|
3106
3242
|
}) => {
|
3107
3243
|
const scope = usePopoverScope(__scopeAssistantModal);
|
3108
3244
|
const [modalOpen, setOpen] = useAssistantModalOpenState(defaultOpen);
|
3109
|
-
return /* @__PURE__ */
|
3245
|
+
return /* @__PURE__ */ jsx16(
|
3110
3246
|
PopoverPrimitive2.Root,
|
3111
3247
|
{
|
3112
3248
|
...scope,
|
3113
3249
|
open: open === void 0 ? modalOpen : open,
|
3114
|
-
onOpenChange:
|
3250
|
+
onOpenChange: composeEventHandlers6(onOpenChange, setOpen),
|
3115
3251
|
...rest
|
3116
3252
|
}
|
3117
3253
|
);
|
@@ -3119,26 +3255,26 @@ var AssistantModalPrimitiveRoot = ({
|
|
3119
3255
|
AssistantModalPrimitiveRoot.displayName = "AssistantModalPrimitive.Root";
|
3120
3256
|
|
3121
3257
|
// src/primitives/assistantModal/AssistantModalTrigger.tsx
|
3122
|
-
import { forwardRef as
|
3258
|
+
import { forwardRef as forwardRef11 } from "react";
|
3123
3259
|
import * as PopoverPrimitive3 from "@radix-ui/react-popover";
|
3124
|
-
import { jsx as
|
3125
|
-
var AssistantModalPrimitiveTrigger =
|
3260
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
3261
|
+
var AssistantModalPrimitiveTrigger = forwardRef11(
|
3126
3262
|
({
|
3127
3263
|
__scopeAssistantModal,
|
3128
3264
|
...rest
|
3129
3265
|
}, ref) => {
|
3130
3266
|
const scope = usePopoverScope(__scopeAssistantModal);
|
3131
|
-
return /* @__PURE__ */
|
3267
|
+
return /* @__PURE__ */ jsx17(PopoverPrimitive3.Trigger, { ...scope, ...rest, ref });
|
3132
3268
|
}
|
3133
3269
|
);
|
3134
3270
|
AssistantModalPrimitiveTrigger.displayName = "AssistantModalPrimitive.Trigger";
|
3135
3271
|
|
3136
3272
|
// src/primitives/assistantModal/AssistantModalContent.tsx
|
3137
|
-
import { forwardRef as
|
3273
|
+
import { forwardRef as forwardRef12 } from "react";
|
3138
3274
|
import * as PopoverPrimitive4 from "@radix-ui/react-popover";
|
3139
|
-
import { composeEventHandlers as
|
3140
|
-
import { jsx as
|
3141
|
-
var AssistantModalPrimitiveContent =
|
3275
|
+
import { composeEventHandlers as composeEventHandlers7 } from "@radix-ui/primitive";
|
3276
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
3277
|
+
var AssistantModalPrimitiveContent = forwardRef12(
|
3142
3278
|
({
|
3143
3279
|
__scopeAssistantModal,
|
3144
3280
|
side,
|
@@ -3148,7 +3284,7 @@ var AssistantModalPrimitiveContent = forwardRef9(
|
|
3148
3284
|
...props
|
3149
3285
|
}, forwardedRef) => {
|
3150
3286
|
const scope = usePopoverScope(__scopeAssistantModal);
|
3151
|
-
return /* @__PURE__ */
|
3287
|
+
return /* @__PURE__ */ jsx18(PopoverPrimitive4.Portal, { ...scope, children: /* @__PURE__ */ jsx18(
|
3152
3288
|
PopoverPrimitive4.Content,
|
3153
3289
|
{
|
3154
3290
|
...scope,
|
@@ -3156,7 +3292,7 @@ var AssistantModalPrimitiveContent = forwardRef9(
|
|
3156
3292
|
ref: forwardedRef,
|
3157
3293
|
side: side ?? "top",
|
3158
3294
|
align: align ?? "end",
|
3159
|
-
onInteractOutside:
|
3295
|
+
onInteractOutside: composeEventHandlers7(
|
3160
3296
|
onInteractOutside,
|
3161
3297
|
dissmissOnInteractOutside ? void 0 : (e) => e.preventDefault()
|
3162
3298
|
)
|
@@ -3167,16 +3303,16 @@ var AssistantModalPrimitiveContent = forwardRef9(
|
|
3167
3303
|
AssistantModalPrimitiveContent.displayName = "AssistantModalPrimitive.Content";
|
3168
3304
|
|
3169
3305
|
// src/primitives/assistantModal/AssistantModalAnchor.tsx
|
3170
|
-
import { forwardRef as
|
3306
|
+
import { forwardRef as forwardRef13 } from "react";
|
3171
3307
|
import * as PopoverPrimitive5 from "@radix-ui/react-popover";
|
3172
|
-
import { jsx as
|
3173
|
-
var AssistantModalPrimitiveAnchor =
|
3308
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
3309
|
+
var AssistantModalPrimitiveAnchor = forwardRef13(
|
3174
3310
|
({
|
3175
3311
|
__scopeAssistantModal,
|
3176
3312
|
...rest
|
3177
3313
|
}, ref) => {
|
3178
3314
|
const scope = usePopoverScope(__scopeAssistantModal);
|
3179
|
-
return /* @__PURE__ */
|
3315
|
+
return /* @__PURE__ */ jsx19(PopoverPrimitive5.Anchor, { ...scope, ...rest, ref });
|
3180
3316
|
}
|
3181
3317
|
);
|
3182
3318
|
AssistantModalPrimitiveAnchor.displayName = "AssistantModalPrimitive.Anchor";
|
@@ -3204,24 +3340,24 @@ var BranchPickerPrevious = createActionButton(
|
|
3204
3340
|
);
|
3205
3341
|
|
3206
3342
|
// src/primitives/branchPicker/BranchPickerCount.tsx
|
3207
|
-
import { Fragment, jsx as
|
3343
|
+
import { Fragment, jsx as jsx20 } from "react/jsx-runtime";
|
3208
3344
|
var BranchPickerPrimitiveCount = () => {
|
3209
3345
|
const branchCount = useBranchPickerCount();
|
3210
|
-
return /* @__PURE__ */
|
3346
|
+
return /* @__PURE__ */ jsx20(Fragment, { children: branchCount });
|
3211
3347
|
};
|
3212
3348
|
BranchPickerPrimitiveCount.displayName = "BranchPickerPrimitive.Count";
|
3213
3349
|
|
3214
3350
|
// src/primitives/branchPicker/BranchPickerNumber.tsx
|
3215
|
-
import { Fragment as Fragment2, jsx as
|
3351
|
+
import { Fragment as Fragment2, jsx as jsx21 } from "react/jsx-runtime";
|
3216
3352
|
var BranchPickerPrimitiveNumber = () => {
|
3217
3353
|
const branchNumber = useBranchPickerNumber();
|
3218
|
-
return /* @__PURE__ */
|
3354
|
+
return /* @__PURE__ */ jsx21(Fragment2, { children: branchNumber });
|
3219
3355
|
};
|
3220
3356
|
BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
|
3221
3357
|
|
3222
3358
|
// src/primitives/branchPicker/BranchPickerRoot.tsx
|
3223
|
-
import { Primitive as
|
3224
|
-
import { forwardRef as
|
3359
|
+
import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
|
3360
|
+
import { forwardRef as forwardRef17 } from "react";
|
3225
3361
|
|
3226
3362
|
// src/primitives/message/index.ts
|
3227
3363
|
var message_exports = {};
|
@@ -3234,17 +3370,17 @@ __export(message_exports, {
|
|
3234
3370
|
});
|
3235
3371
|
|
3236
3372
|
// src/primitives/message/MessageRoot.tsx
|
3237
|
-
import { Primitive as
|
3373
|
+
import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
3238
3374
|
import {
|
3239
|
-
forwardRef as
|
3240
|
-
useCallback as
|
3375
|
+
forwardRef as forwardRef14,
|
3376
|
+
useCallback as useCallback18
|
3241
3377
|
} from "react";
|
3242
3378
|
|
3243
3379
|
// src/utils/hooks/useManagedRef.ts
|
3244
|
-
import { useCallback as
|
3380
|
+
import { useCallback as useCallback17, useRef as useRef3 } from "react";
|
3245
3381
|
var useManagedRef = (callback) => {
|
3246
3382
|
const cleanupRef = useRef3();
|
3247
|
-
const ref =
|
3383
|
+
const ref = useCallback17(
|
3248
3384
|
(el) => {
|
3249
3385
|
if (cleanupRef.current) {
|
3250
3386
|
cleanupRef.current();
|
@@ -3260,10 +3396,10 @@ var useManagedRef = (callback) => {
|
|
3260
3396
|
|
3261
3397
|
// src/primitives/message/MessageRoot.tsx
|
3262
3398
|
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
3263
|
-
import { jsx as
|
3399
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
3264
3400
|
var useIsHoveringRef = () => {
|
3265
3401
|
const messageUtilsStore = useMessageUtilsStore();
|
3266
|
-
const callbackRef =
|
3402
|
+
const callbackRef = useCallback18(
|
3267
3403
|
(el) => {
|
3268
3404
|
const setIsHovering = messageUtilsStore.getState().setIsHovering;
|
3269
3405
|
const handleMouseEnter = () => {
|
@@ -3284,10 +3420,10 @@ var useIsHoveringRef = () => {
|
|
3284
3420
|
);
|
3285
3421
|
return useManagedRef(callbackRef);
|
3286
3422
|
};
|
3287
|
-
var MessagePrimitiveRoot =
|
3423
|
+
var MessagePrimitiveRoot = forwardRef14((props, forwardRef33) => {
|
3288
3424
|
const isHoveringRef = useIsHoveringRef();
|
3289
|
-
const ref = useComposedRefs(
|
3290
|
-
return /* @__PURE__ */
|
3425
|
+
const ref = useComposedRefs(forwardRef33, isHoveringRef);
|
3426
|
+
return /* @__PURE__ */ jsx22(Primitive8.div, { ...props, ref });
|
3291
3427
|
});
|
3292
3428
|
MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
|
3293
3429
|
|
@@ -3307,7 +3443,7 @@ import { memo as memo2 } from "react";
|
|
3307
3443
|
// src/context/providers/ContentPartProvider.tsx
|
3308
3444
|
import { useEffect as useEffect10, useState as useState11 } from "react";
|
3309
3445
|
import { create as create12 } from "zustand";
|
3310
|
-
import { jsx as
|
3446
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
3311
3447
|
var COMPLETE_STATUS2 = {
|
3312
3448
|
type: "complete"
|
3313
3449
|
};
|
@@ -3372,32 +3508,32 @@ var ContentPartProvider = ({
|
|
3372
3508
|
children
|
3373
3509
|
}) => {
|
3374
3510
|
const context = useContentPartContext2(partIndex);
|
3375
|
-
return /* @__PURE__ */
|
3511
|
+
return /* @__PURE__ */ jsx23(ContentPartContext.Provider, { value: context, children });
|
3376
3512
|
};
|
3377
3513
|
|
3378
3514
|
// src/primitives/contentPart/ContentPartText.tsx
|
3379
3515
|
import {
|
3380
|
-
forwardRef as
|
3516
|
+
forwardRef as forwardRef15
|
3381
3517
|
} from "react";
|
3382
|
-
import { jsx as
|
3383
|
-
var ContentPartPrimitiveText =
|
3518
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
3519
|
+
var ContentPartPrimitiveText = forwardRef15(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
|
3384
3520
|
const {
|
3385
3521
|
part: { text },
|
3386
3522
|
status
|
3387
3523
|
} = useSmooth(useContentPartText(), smooth);
|
3388
|
-
return /* @__PURE__ */
|
3524
|
+
return /* @__PURE__ */ jsx24(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
|
3389
3525
|
});
|
3390
3526
|
ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
|
3391
3527
|
|
3392
3528
|
// src/primitives/contentPart/ContentPartImage.tsx
|
3393
|
-
import { Primitive as
|
3394
|
-
import { forwardRef as
|
3395
|
-
import { jsx as
|
3396
|
-
var ContentPartPrimitiveImage =
|
3529
|
+
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
3530
|
+
import { forwardRef as forwardRef16 } from "react";
|
3531
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
3532
|
+
var ContentPartPrimitiveImage = forwardRef16((props, forwardedRef) => {
|
3397
3533
|
const {
|
3398
3534
|
part: { image }
|
3399
3535
|
} = useContentPartImage();
|
3400
|
-
return /* @__PURE__ */
|
3536
|
+
return /* @__PURE__ */ jsx25(Primitive9.img, { src: image, ...props, ref: forwardedRef });
|
3401
3537
|
});
|
3402
3538
|
ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
|
3403
3539
|
|
@@ -3418,22 +3554,22 @@ var ContentPartPrimitiveInProgress = ({ children }) => {
|
|
3418
3554
|
ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
|
3419
3555
|
|
3420
3556
|
// src/primitives/message/MessageContent.tsx
|
3421
|
-
import { jsx as
|
3557
|
+
import { jsx as jsx26, jsxs as jsxs3 } from "react/jsx-runtime";
|
3422
3558
|
var ToolUIDisplay = ({
|
3423
3559
|
UI,
|
3424
3560
|
...props
|
3425
3561
|
}) => {
|
3426
3562
|
const Render = useToolUIs((s) => s.getToolUI(props.part.toolName)) ?? UI;
|
3427
3563
|
if (!Render) return null;
|
3428
|
-
return /* @__PURE__ */
|
3564
|
+
return /* @__PURE__ */ jsx26(Render, { ...props });
|
3429
3565
|
};
|
3430
3566
|
var defaultComponents = {
|
3431
3567
|
Text: () => /* @__PURE__ */ jsxs3("p", { style: { whiteSpace: "pre-line" }, children: [
|
3432
|
-
/* @__PURE__ */
|
3433
|
-
/* @__PURE__ */
|
3568
|
+
/* @__PURE__ */ jsx26(ContentPartPrimitiveText, {}),
|
3569
|
+
/* @__PURE__ */ jsx26(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx26("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
|
3434
3570
|
] }),
|
3435
|
-
Image: () => /* @__PURE__ */
|
3436
|
-
UI: () => /* @__PURE__ */
|
3571
|
+
Image: () => /* @__PURE__ */ jsx26(ContentPartPrimitiveImage, {}),
|
3572
|
+
UI: () => /* @__PURE__ */ jsx26(ContentPartPrimitiveDisplay, {})
|
3437
3573
|
};
|
3438
3574
|
var MessageContentPartComponent = ({
|
3439
3575
|
components: {
|
@@ -3453,17 +3589,17 @@ var MessageContentPartComponent = ({
|
|
3453
3589
|
if (status.type === "requires-action")
|
3454
3590
|
throw new Error("Encountered unexpected requires-action status");
|
3455
3591
|
if (part === EMPTY_CONTENT && !!Empty) {
|
3456
|
-
return /* @__PURE__ */
|
3592
|
+
return /* @__PURE__ */ jsx26(Empty, { status });
|
3457
3593
|
}
|
3458
|
-
return /* @__PURE__ */
|
3594
|
+
return /* @__PURE__ */ jsx26(Text2, { part, status });
|
3459
3595
|
case "image":
|
3460
3596
|
if (status.type === "requires-action")
|
3461
3597
|
throw new Error("Encountered unexpected requires-action status");
|
3462
|
-
return /* @__PURE__ */
|
3598
|
+
return /* @__PURE__ */ jsx26(Image2, { part, status });
|
3463
3599
|
case "ui":
|
3464
3600
|
if (status.type === "requires-action")
|
3465
3601
|
throw new Error("Encountered unexpected requires-action status");
|
3466
|
-
return /* @__PURE__ */
|
3602
|
+
return /* @__PURE__ */ jsx26(UI, { part, status });
|
3467
3603
|
case "tool-call": {
|
3468
3604
|
const Tool = by_name[part.toolName] || Fallback2;
|
3469
3605
|
const addResult = (result) => threadActionsStore.getState().addToolResult({
|
@@ -3472,7 +3608,7 @@ var MessageContentPartComponent = ({
|
|
3472
3608
|
toolCallId: part.toolCallId,
|
3473
3609
|
result
|
3474
3610
|
});
|
3475
|
-
return /* @__PURE__ */
|
3611
|
+
return /* @__PURE__ */ jsx26(
|
3476
3612
|
ToolUIDisplay,
|
3477
3613
|
{
|
3478
3614
|
UI: Tool,
|
@@ -3491,7 +3627,7 @@ var MessageContentPartImpl = ({
|
|
3491
3627
|
partIndex,
|
3492
3628
|
components
|
3493
3629
|
}) => {
|
3494
|
-
return /* @__PURE__ */
|
3630
|
+
return /* @__PURE__ */ jsx26(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx26(MessageContentPartComponent, { components }) });
|
3495
3631
|
};
|
3496
3632
|
var MessageContentPart = memo2(
|
3497
3633
|
MessageContentPartImpl,
|
@@ -3501,7 +3637,7 @@ var MessagePrimitiveContent = ({
|
|
3501
3637
|
components
|
3502
3638
|
}) => {
|
3503
3639
|
const contentLength = useMessage((s) => s.message.content.length) || 1;
|
3504
|
-
return Array.from({ length: contentLength }, (_, index) => /* @__PURE__ */
|
3640
|
+
return Array.from({ length: contentLength }, (_, index) => /* @__PURE__ */ jsx26(MessageContentPart, { partIndex: index, components }, index));
|
3505
3641
|
};
|
3506
3642
|
MessagePrimitiveContent.displayName = "MessagePrimitive.Content";
|
3507
3643
|
|
@@ -3561,7 +3697,7 @@ var {
|
|
3561
3697
|
// src/context/providers/MessageAttachmentProvider.tsx
|
3562
3698
|
import { useEffect as useEffect11, useState as useState12 } from "react";
|
3563
3699
|
import { create as create13 } from "zustand";
|
3564
|
-
import { jsx as
|
3700
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
3565
3701
|
var getAttachment = ({ message }, useAttachment2, partIndex) => {
|
3566
3702
|
if (message.role !== "user") return null;
|
3567
3703
|
const attachments = message.attachments;
|
@@ -3601,11 +3737,11 @@ var MessageAttachmentProvider = ({
|
|
3601
3737
|
children
|
3602
3738
|
}) => {
|
3603
3739
|
const context = useMessageAttachmentContext2(partIndex);
|
3604
|
-
return /* @__PURE__ */
|
3740
|
+
return /* @__PURE__ */ jsx27(AttachmentContext.Provider, { value: context, children });
|
3605
3741
|
};
|
3606
3742
|
|
3607
3743
|
// src/primitives/message/MessageAttachments.tsx
|
3608
|
-
import { jsx as
|
3744
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
3609
3745
|
var getComponent = (components, attachment) => {
|
3610
3746
|
const type = attachment.type;
|
3611
3747
|
switch (type) {
|
@@ -3625,10 +3761,10 @@ var AttachmentComponent = ({ components }) => {
|
|
3625
3761
|
(a) => getComponent(components, a.attachment)
|
3626
3762
|
);
|
3627
3763
|
if (!Component) return null;
|
3628
|
-
return /* @__PURE__ */
|
3764
|
+
return /* @__PURE__ */ jsx28(Component, {});
|
3629
3765
|
};
|
3630
3766
|
var MessageAttachmentImpl = ({ components, attachmentIndex }) => {
|
3631
|
-
return /* @__PURE__ */
|
3767
|
+
return /* @__PURE__ */ jsx28(MessageAttachmentProvider, { attachmentIndex, children: /* @__PURE__ */ jsx28(AttachmentComponent, { components }) });
|
3632
3768
|
};
|
3633
3769
|
var MessageAttachment = memo3(
|
3634
3770
|
MessageAttachmentImpl,
|
@@ -3639,7 +3775,7 @@ var MessagePrimitiveAttachments = ({ components }) => {
|
|
3639
3775
|
if (message.role !== "user") return 0;
|
3640
3776
|
return message.attachments.length;
|
3641
3777
|
});
|
3642
|
-
return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */
|
3778
|
+
return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx28(
|
3643
3779
|
MessageAttachment,
|
3644
3780
|
{
|
3645
3781
|
attachmentIndex: index,
|
@@ -3651,9 +3787,9 @@ var MessagePrimitiveAttachments = ({ components }) => {
|
|
3651
3787
|
MessagePrimitiveAttachments.displayName = "MessagePrimitive.Attachments";
|
3652
3788
|
|
3653
3789
|
// src/primitives/branchPicker/BranchPickerRoot.tsx
|
3654
|
-
import { jsx as
|
3655
|
-
var BranchPickerPrimitiveRoot =
|
3656
|
-
return /* @__PURE__ */
|
3790
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
3791
|
+
var BranchPickerPrimitiveRoot = forwardRef17(({ hideWhenSingleBranch, ...rest }, ref) => {
|
3792
|
+
return /* @__PURE__ */ jsx29(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx29(Primitive10.div, { ...rest, ref }) });
|
3657
3793
|
});
|
3658
3794
|
BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
|
3659
3795
|
|
@@ -3670,44 +3806,44 @@ __export(composer_exports, {
|
|
3670
3806
|
});
|
3671
3807
|
|
3672
3808
|
// src/primitives/composer/ComposerRoot.tsx
|
3673
|
-
import { composeEventHandlers as
|
3674
|
-
import { Primitive as
|
3809
|
+
import { composeEventHandlers as composeEventHandlers8 } from "@radix-ui/primitive";
|
3810
|
+
import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
|
3675
3811
|
import {
|
3676
|
-
forwardRef as
|
3812
|
+
forwardRef as forwardRef18
|
3677
3813
|
} from "react";
|
3678
|
-
import { jsx as
|
3679
|
-
var ComposerPrimitiveRoot =
|
3814
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
3815
|
+
var ComposerPrimitiveRoot = forwardRef18(({ onSubmit, ...rest }, forwardedRef) => {
|
3680
3816
|
const send = useComposerSend();
|
3681
3817
|
const handleSubmit = (e) => {
|
3682
3818
|
e.preventDefault();
|
3683
3819
|
if (!send) return;
|
3684
3820
|
send();
|
3685
3821
|
};
|
3686
|
-
return /* @__PURE__ */
|
3687
|
-
|
3822
|
+
return /* @__PURE__ */ jsx30(
|
3823
|
+
Primitive11.form,
|
3688
3824
|
{
|
3689
3825
|
...rest,
|
3690
3826
|
ref: forwardedRef,
|
3691
|
-
onSubmit:
|
3827
|
+
onSubmit: composeEventHandlers8(onSubmit, handleSubmit)
|
3692
3828
|
}
|
3693
3829
|
);
|
3694
3830
|
});
|
3695
3831
|
ComposerPrimitiveRoot.displayName = "ComposerPrimitive.Root";
|
3696
3832
|
|
3697
3833
|
// src/primitives/composer/ComposerInput.tsx
|
3698
|
-
import { composeEventHandlers as
|
3834
|
+
import { composeEventHandlers as composeEventHandlers9 } from "@radix-ui/primitive";
|
3699
3835
|
import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
|
3700
3836
|
import { Slot } from "@radix-ui/react-slot";
|
3701
3837
|
import {
|
3702
|
-
forwardRef as
|
3703
|
-
useCallback as
|
3838
|
+
forwardRef as forwardRef19,
|
3839
|
+
useCallback as useCallback19,
|
3704
3840
|
useEffect as useEffect12,
|
3705
3841
|
useRef as useRef4
|
3706
3842
|
} from "react";
|
3707
3843
|
import TextareaAutosize from "react-textarea-autosize";
|
3708
3844
|
import { useEscapeKeydown as useEscapeKeydown2 } from "@radix-ui/react-use-escape-keydown";
|
3709
|
-
import { jsx as
|
3710
|
-
var ComposerPrimitiveInput =
|
3845
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
3846
|
+
var ComposerPrimitiveInput = forwardRef19(
|
3711
3847
|
({
|
3712
3848
|
autoFocus = false,
|
3713
3849
|
asChild,
|
@@ -3745,7 +3881,7 @@ var ComposerPrimitiveInput = forwardRef16(
|
|
3745
3881
|
}
|
3746
3882
|
};
|
3747
3883
|
const autoFocusEnabled = autoFocus && !isDisabled;
|
3748
|
-
const focus =
|
3884
|
+
const focus = useCallback19(() => {
|
3749
3885
|
const textarea = textareaRef.current;
|
3750
3886
|
if (!textarea || !autoFocusEnabled) return;
|
3751
3887
|
textarea.focus({ preventScroll: true });
|
@@ -3760,7 +3896,7 @@ var ComposerPrimitiveInput = forwardRef16(
|
|
3760
3896
|
focus();
|
3761
3897
|
}
|
3762
3898
|
});
|
3763
|
-
return /* @__PURE__ */
|
3899
|
+
return /* @__PURE__ */ jsx31(
|
3764
3900
|
Component,
|
3765
3901
|
{
|
3766
3902
|
name: "input",
|
@@ -3768,12 +3904,12 @@ var ComposerPrimitiveInput = forwardRef16(
|
|
3768
3904
|
...rest,
|
3769
3905
|
ref,
|
3770
3906
|
disabled: isDisabled,
|
3771
|
-
onChange:
|
3907
|
+
onChange: composeEventHandlers9(onChange, (e) => {
|
3772
3908
|
const composerState = composerStore.getState();
|
3773
3909
|
if (!composerState.isEditing) return;
|
3774
3910
|
return composerState.setText(e.target.value);
|
3775
3911
|
}),
|
3776
|
-
onKeyDown:
|
3912
|
+
onKeyDown: composeEventHandlers9(onKeyDown, handleKeyPress)
|
3777
3913
|
}
|
3778
3914
|
);
|
3779
3915
|
}
|
@@ -3804,7 +3940,7 @@ import { memo as memo4 } from "react";
|
|
3804
3940
|
// src/context/providers/ComposerAttachmentProvider.tsx
|
3805
3941
|
import { useEffect as useEffect13, useState as useState13 } from "react";
|
3806
3942
|
import { create as create14 } from "zustand";
|
3807
|
-
import { jsx as
|
3943
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
3808
3944
|
var getAttachment2 = ({ attachments }, useAttachment2, partIndex) => {
|
3809
3945
|
const attachment = attachments[partIndex];
|
3810
3946
|
if (!attachment) return null;
|
@@ -3839,11 +3975,11 @@ var useComposerAttachmentContext2 = (partIndex) => {
|
|
3839
3975
|
};
|
3840
3976
|
var ComposerAttachmentProvider = ({ attachmentIndex: partIndex, children }) => {
|
3841
3977
|
const context = useComposerAttachmentContext2(partIndex);
|
3842
|
-
return /* @__PURE__ */
|
3978
|
+
return /* @__PURE__ */ jsx32(AttachmentContext.Provider, { value: context, children });
|
3843
3979
|
};
|
3844
3980
|
|
3845
3981
|
// src/primitives/composer/ComposerAttachments.tsx
|
3846
|
-
import { jsx as
|
3982
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
3847
3983
|
var getComponent2 = (components, attachment) => {
|
3848
3984
|
const type = attachment.type;
|
3849
3985
|
switch (type) {
|
@@ -3863,10 +3999,10 @@ var AttachmentComponent2 = ({ components }) => {
|
|
3863
3999
|
(a) => getComponent2(components, a.attachment)
|
3864
4000
|
);
|
3865
4001
|
if (!Component) return null;
|
3866
|
-
return /* @__PURE__ */
|
4002
|
+
return /* @__PURE__ */ jsx33(Component, {});
|
3867
4003
|
};
|
3868
4004
|
var ComposerAttachmentImpl = ({ components, attachmentIndex }) => {
|
3869
|
-
return /* @__PURE__ */
|
4005
|
+
return /* @__PURE__ */ jsx33(ComposerAttachmentProvider, { attachmentIndex, children: /* @__PURE__ */ jsx33(AttachmentComponent2, { components }) });
|
3870
4006
|
};
|
3871
4007
|
var ComposerAttachment = memo4(
|
3872
4008
|
ComposerAttachmentImpl,
|
@@ -3874,7 +4010,7 @@ var ComposerAttachment = memo4(
|
|
3874
4010
|
);
|
3875
4011
|
var ComposerPrimitiveAttachments = ({ components }) => {
|
3876
4012
|
const attachmentsCount = useThreadComposer((s) => s.attachments.length);
|
3877
|
-
return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */
|
4013
|
+
return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx33(
|
3878
4014
|
ComposerAttachment,
|
3879
4015
|
{
|
3880
4016
|
attachmentIndex: index,
|
@@ -3917,11 +4053,11 @@ __export(thread_exports, {
|
|
3917
4053
|
});
|
3918
4054
|
|
3919
4055
|
// src/primitives/thread/ThreadRoot.tsx
|
3920
|
-
import { Primitive as
|
3921
|
-
import { forwardRef as
|
3922
|
-
import { jsx as
|
3923
|
-
var ThreadPrimitiveRoot =
|
3924
|
-
return /* @__PURE__ */
|
4056
|
+
import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
|
4057
|
+
import { forwardRef as forwardRef20 } from "react";
|
4058
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
4059
|
+
var ThreadPrimitiveRoot = forwardRef20((props, ref) => {
|
4060
|
+
return /* @__PURE__ */ jsx34(Primitive12.div, { ...props, ref });
|
3925
4061
|
});
|
3926
4062
|
ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
|
3927
4063
|
|
@@ -3946,8 +4082,8 @@ ThreadPrimitiveIf.displayName = "ThreadPrimitive.If";
|
|
3946
4082
|
|
3947
4083
|
// src/primitives/thread/ThreadViewport.tsx
|
3948
4084
|
import { useComposedRefs as useComposedRefs4 } from "@radix-ui/react-compose-refs";
|
3949
|
-
import { Primitive as
|
3950
|
-
import { forwardRef as
|
4085
|
+
import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
|
4086
|
+
import { forwardRef as forwardRef21 } from "react";
|
3951
4087
|
|
3952
4088
|
// src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx
|
3953
4089
|
import { useComposedRefs as useComposedRefs3 } from "@radix-ui/react-compose-refs";
|
@@ -3955,10 +4091,10 @@ import { useRef as useRef5 } from "react";
|
|
3955
4091
|
|
3956
4092
|
// src/utils/hooks/useOnResizeContent.tsx
|
3957
4093
|
import { useCallbackRef as useCallbackRef3 } from "@radix-ui/react-use-callback-ref";
|
3958
|
-
import { useCallback as
|
4094
|
+
import { useCallback as useCallback20 } from "react";
|
3959
4095
|
var useOnResizeContent = (callback) => {
|
3960
4096
|
const callbackRef = useCallbackRef3(callback);
|
3961
|
-
const refCallback =
|
4097
|
+
const refCallback = useCallback20(
|
3962
4098
|
(el) => {
|
3963
4099
|
const resizeObserver = new ResizeObserver(() => {
|
3964
4100
|
callbackRef();
|
@@ -4058,13 +4194,13 @@ var useThreadViewportAutoScroll = ({
|
|
4058
4194
|
};
|
4059
4195
|
|
4060
4196
|
// src/primitives/thread/ThreadViewport.tsx
|
4061
|
-
import { jsx as
|
4062
|
-
var ThreadPrimitiveViewport =
|
4197
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
4198
|
+
var ThreadPrimitiveViewport = forwardRef21(({ autoScroll, children, ...rest }, forwardedRef) => {
|
4063
4199
|
const autoScrollRef = useThreadViewportAutoScroll({
|
4064
4200
|
autoScroll
|
4065
4201
|
});
|
4066
4202
|
const ref = useComposedRefs4(forwardedRef, autoScrollRef);
|
4067
|
-
return /* @__PURE__ */
|
4203
|
+
return /* @__PURE__ */ jsx35(Primitive13.div, { ...rest, ref, children });
|
4068
4204
|
});
|
4069
4205
|
ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
|
4070
4206
|
|
@@ -4137,12 +4273,16 @@ var makeMessageUtilsStore = () => create16((set) => {
|
|
4137
4273
|
utt.onEnd(() => {
|
4138
4274
|
set({ isSpeaking: false });
|
4139
4275
|
});
|
4276
|
+
},
|
4277
|
+
submittedFeedback: null,
|
4278
|
+
setSubmittedFeedback: (feedback) => {
|
4279
|
+
set({ submittedFeedback: feedback });
|
4140
4280
|
}
|
4141
4281
|
};
|
4142
4282
|
});
|
4143
4283
|
|
4144
4284
|
// src/context/providers/MessageProvider.tsx
|
4145
|
-
import { jsx as
|
4285
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
4146
4286
|
var getIsLast = (messages, message) => {
|
4147
4287
|
return messages[messages.length - 1]?.id === message.id;
|
4148
4288
|
};
|
@@ -4219,11 +4359,11 @@ var MessageProvider = ({
|
|
4219
4359
|
children
|
4220
4360
|
}) => {
|
4221
4361
|
const context = useMessageContext2(messageIndex);
|
4222
|
-
return /* @__PURE__ */
|
4362
|
+
return /* @__PURE__ */ jsx36(MessageContext.Provider, { value: context, children });
|
4223
4363
|
};
|
4224
4364
|
|
4225
4365
|
// src/primitives/thread/ThreadMessages.tsx
|
4226
|
-
import { jsx as
|
4366
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
4227
4367
|
var isComponentsSame = (prev, next) => {
|
4228
4368
|
return prev.Message === next.Message && prev.EditComposer === next.EditComposer && prev.UserEditComposer === next.UserEditComposer && prev.AssistantEditComposer === next.AssistantEditComposer && prev.SystemEditComposer === next.SystemEditComposer && prev.UserMessage === next.UserMessage && prev.AssistantMessage === next.AssistantMessage && prev.SystemMessage === next.SystemMessage;
|
4229
4369
|
};
|
@@ -4259,13 +4399,13 @@ var ThreadMessageComponent = ({
|
|
4259
4399
|
const role = useMessage((m) => m.message.role);
|
4260
4400
|
const isEditing = useEditComposer((c) => c.isEditing);
|
4261
4401
|
const Component = getComponent3(components, role, isEditing);
|
4262
|
-
return /* @__PURE__ */
|
4402
|
+
return /* @__PURE__ */ jsx37(Component, {});
|
4263
4403
|
};
|
4264
4404
|
var ThreadMessageImpl = ({
|
4265
4405
|
messageIndex,
|
4266
4406
|
components
|
4267
4407
|
}) => {
|
4268
|
-
return /* @__PURE__ */
|
4408
|
+
return /* @__PURE__ */ jsx37(MessageProvider, { messageIndex, children: /* @__PURE__ */ jsx37(ThreadMessageComponent, { components }) });
|
4269
4409
|
};
|
4270
4410
|
var ThreadMessage = memo5(
|
4271
4411
|
ThreadMessageImpl,
|
@@ -4276,7 +4416,7 @@ var ThreadPrimitiveMessagesImpl = ({
|
|
4276
4416
|
}) => {
|
4277
4417
|
const messagesLength = useThreadMessages((t) => t.length);
|
4278
4418
|
if (messagesLength === 0) return null;
|
4279
|
-
return Array.from({ length: messagesLength }, (_, index) => /* @__PURE__ */
|
4419
|
+
return Array.from({ length: messagesLength }, (_, index) => /* @__PURE__ */ jsx37(ThreadMessage, { messageIndex: index, components }, index));
|
4280
4420
|
};
|
4281
4421
|
ThreadPrimitiveMessagesImpl.displayName = "ThreadPrimitive.Messages";
|
4282
4422
|
var ThreadPrimitiveMessages = memo5(
|
@@ -4302,7 +4442,7 @@ import {
|
|
4302
4442
|
createContext as createContext7,
|
4303
4443
|
useContext as useContext4
|
4304
4444
|
} from "react";
|
4305
|
-
import { Fragment as Fragment3, jsx as
|
4445
|
+
import { Fragment as Fragment3, jsx as jsx38 } from "react/jsx-runtime";
|
4306
4446
|
var ThreadConfigContext = createContext7({});
|
4307
4447
|
var useThreadConfig = () => {
|
4308
4448
|
return useContext4(ThreadConfigContext);
|
@@ -4312,27 +4452,29 @@ var ThreadConfigProvider = ({
|
|
4312
4452
|
config
|
4313
4453
|
}) => {
|
4314
4454
|
const hasAssistant = !!useAssistantRuntimeStore({ optional: true });
|
4315
|
-
const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */
|
4455
|
+
const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx38(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx38(Fragment3, { children });
|
4316
4456
|
if (!config?.runtime) return configProvider;
|
4317
4457
|
if (hasAssistant) {
|
4318
4458
|
throw new Error(
|
4319
4459
|
"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
|
4320
4460
|
);
|
4321
4461
|
}
|
4322
|
-
return /* @__PURE__ */
|
4462
|
+
return /* @__PURE__ */ jsx38(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
|
4323
4463
|
};
|
4324
4464
|
ThreadConfigProvider.displayName = "ThreadConfigProvider";
|
4325
4465
|
|
4326
4466
|
// src/ui/assistant-action-bar.tsx
|
4327
|
-
import { forwardRef as
|
4467
|
+
import { forwardRef as forwardRef22 } from "react";
|
4328
4468
|
import {
|
4329
4469
|
AudioLinesIcon,
|
4330
4470
|
CheckIcon,
|
4331
4471
|
CopyIcon,
|
4332
4472
|
RefreshCwIcon,
|
4333
|
-
StopCircleIcon
|
4473
|
+
StopCircleIcon,
|
4474
|
+
ThumbsDownIcon,
|
4475
|
+
ThumbsUpIcon
|
4334
4476
|
} from "lucide-react";
|
4335
|
-
import { Fragment as Fragment4, jsx as
|
4477
|
+
import { Fragment as Fragment4, jsx as jsx39, jsxs as jsxs4 } from "react/jsx-runtime";
|
4336
4478
|
var useAllowCopy = (ensureCapability = false) => {
|
4337
4479
|
const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
|
4338
4480
|
const copySupported = useThread((t) => t.capabilities.unstable_copy);
|
@@ -4348,11 +4490,24 @@ var useAllowReload = (ensureCapability = false) => {
|
|
4348
4490
|
const reloadSupported = useThread((t) => t.capabilities.reload);
|
4349
4491
|
return allowReload && (!ensureCapability || reloadSupported);
|
4350
4492
|
};
|
4493
|
+
var useAllowFeedbackPositive = (ensureCapability = false) => {
|
4494
|
+
const { assistantMessage: { allowFeedbackPositive = true } = {} } = useThreadConfig();
|
4495
|
+
const feedbackSupported = useThread((t) => t.capabilities.feedback);
|
4496
|
+
return allowFeedbackPositive && (!ensureCapability || feedbackSupported);
|
4497
|
+
};
|
4498
|
+
var useAllowFeedbackNegative = (ensureCapability = false) => {
|
4499
|
+
const { assistantMessage: { allowFeedbackNegative = true } = {} } = useThreadConfig();
|
4500
|
+
const feedbackSupported = useThread((t) => t.capabilities.feedback);
|
4501
|
+
return allowFeedbackNegative && (!ensureCapability || feedbackSupported);
|
4502
|
+
};
|
4351
4503
|
var AssistantActionBar = () => {
|
4352
4504
|
const allowCopy = useAllowCopy(true);
|
4353
4505
|
const allowReload = useAllowReload(true);
|
4354
4506
|
const allowSpeak = useAllowSpeak(true);
|
4355
|
-
|
4507
|
+
const allowFeedbackPositive = useAllowFeedbackPositive(true);
|
4508
|
+
const allowFeedbackNegative = useAllowFeedbackNegative(true);
|
4509
|
+
if (!allowCopy && !allowReload && !allowSpeak && !allowFeedbackPositive && !allowFeedbackNegative)
|
4510
|
+
return null;
|
4356
4511
|
return /* @__PURE__ */ jsxs4(
|
4357
4512
|
AssistantActionBarRoot,
|
4358
4513
|
{
|
@@ -4360,9 +4515,11 @@ var AssistantActionBar = () => {
|
|
4360
4515
|
autohide: "not-last",
|
4361
4516
|
autohideFloat: "single-branch",
|
4362
4517
|
children: [
|
4363
|
-
allowSpeak && /* @__PURE__ */
|
4364
|
-
allowCopy && /* @__PURE__ */
|
4365
|
-
allowReload && /* @__PURE__ */
|
4518
|
+
allowSpeak && /* @__PURE__ */ jsx39(AssistantActionBarSpeechControl, {}),
|
4519
|
+
allowCopy && /* @__PURE__ */ jsx39(AssistantActionBarCopy, {}),
|
4520
|
+
allowReload && /* @__PURE__ */ jsx39(AssistantActionBarReload, {}),
|
4521
|
+
allowFeedbackPositive && /* @__PURE__ */ jsx39(AssistantActionBarFeedbackPositive, {}),
|
4522
|
+
allowFeedbackNegative && /* @__PURE__ */ jsx39(AssistantActionBarFeedbackNegative, {})
|
4366
4523
|
]
|
4367
4524
|
}
|
4368
4525
|
);
|
@@ -4372,35 +4529,35 @@ var AssistantActionBarRoot = withDefaults(actionBar_exports.Root, {
|
|
4372
4529
|
className: "aui-assistant-action-bar-root"
|
4373
4530
|
});
|
4374
4531
|
AssistantActionBarRoot.displayName = "AssistantActionBarRoot";
|
4375
|
-
var AssistantActionBarCopy =
|
4532
|
+
var AssistantActionBarCopy = forwardRef22((props, ref) => {
|
4376
4533
|
const {
|
4377
4534
|
strings: {
|
4378
4535
|
assistantMessage: { copy: { tooltip = "Copy" } = {} } = {}
|
4379
4536
|
} = {}
|
4380
4537
|
} = useThreadConfig();
|
4381
|
-
return /* @__PURE__ */
|
4382
|
-
/* @__PURE__ */
|
4383
|
-
/* @__PURE__ */
|
4538
|
+
return /* @__PURE__ */ jsx39(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
4539
|
+
/* @__PURE__ */ jsx39(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx39(CheckIcon, {}) }),
|
4540
|
+
/* @__PURE__ */ jsx39(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx39(CopyIcon, {}) })
|
4384
4541
|
] }) }) });
|
4385
4542
|
});
|
4386
4543
|
AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
|
4387
4544
|
var AssistantActionBarSpeechControl = () => {
|
4388
4545
|
return /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
4389
|
-
/* @__PURE__ */
|
4390
|
-
/* @__PURE__ */
|
4546
|
+
/* @__PURE__ */ jsx39(message_exports.If, { speaking: false, children: /* @__PURE__ */ jsx39(AssistantActionBarSpeak, {}) }),
|
4547
|
+
/* @__PURE__ */ jsx39(message_exports.If, { speaking: true, children: /* @__PURE__ */ jsx39(AssistantActionBarStopSpeaking, {}) })
|
4391
4548
|
] });
|
4392
4549
|
};
|
4393
|
-
var AssistantActionBarSpeak =
|
4550
|
+
var AssistantActionBarSpeak = forwardRef22((props, ref) => {
|
4394
4551
|
const {
|
4395
4552
|
strings: {
|
4396
4553
|
assistantMessage: { speak: { tooltip = "Read aloud" } = {} } = {}
|
4397
4554
|
} = {}
|
4398
4555
|
} = useThreadConfig();
|
4399
4556
|
const allowSpeak = useAllowSpeak();
|
4400
|
-
return /* @__PURE__ */
|
4557
|
+
return /* @__PURE__ */ jsx39(actionBar_exports.Speak, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(AudioLinesIcon, {}) }) });
|
4401
4558
|
});
|
4402
4559
|
AssistantActionBarSpeak.displayName = "AssistantActionBarSpeak";
|
4403
|
-
var AssistantActionBarStopSpeaking =
|
4560
|
+
var AssistantActionBarStopSpeaking = forwardRef22((props, ref) => {
|
4404
4561
|
const {
|
4405
4562
|
strings: {
|
4406
4563
|
assistantMessage: {
|
@@ -4409,26 +4566,68 @@ var AssistantActionBarStopSpeaking = forwardRef19((props, ref) => {
|
|
4409
4566
|
} = {}
|
4410
4567
|
} = useThreadConfig();
|
4411
4568
|
const allowSpeak = useAllowSpeak();
|
4412
|
-
return /* @__PURE__ */
|
4569
|
+
return /* @__PURE__ */ jsx39(actionBar_exports.StopSpeaking, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip: stopTooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(StopCircleIcon, {}) }) });
|
4413
4570
|
});
|
4414
4571
|
AssistantActionBarStopSpeaking.displayName = "AssistantActionBarStopSpeaking";
|
4415
|
-
var AssistantActionBarReload =
|
4572
|
+
var AssistantActionBarReload = forwardRef22((props, ref) => {
|
4416
4573
|
const {
|
4417
4574
|
strings: {
|
4418
4575
|
assistantMessage: { reload: { tooltip = "Refresh" } = {} } = {}
|
4419
4576
|
} = {}
|
4420
4577
|
} = useThreadConfig();
|
4421
4578
|
const allowReload = useAllowReload();
|
4422
|
-
return /* @__PURE__ */
|
4579
|
+
return /* @__PURE__ */ jsx39(actionBar_exports.Reload, { disabled: !allowReload, asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(RefreshCwIcon, {}) }) });
|
4423
4580
|
});
|
4424
4581
|
AssistantActionBarReload.displayName = "AssistantActionBarReload";
|
4582
|
+
var AssistantActionBarFeedbackPositive = forwardRef22((props, ref) => {
|
4583
|
+
const {
|
4584
|
+
strings: {
|
4585
|
+
assistantMessage: {
|
4586
|
+
feedback: { positive: { tooltip = "Good response" } = {} } = {}
|
4587
|
+
} = {}
|
4588
|
+
} = {}
|
4589
|
+
} = useThreadConfig();
|
4590
|
+
const allowFeedbackPositive = useAllowFeedbackPositive();
|
4591
|
+
return /* @__PURE__ */ jsx39(
|
4592
|
+
actionBar_exports.FeedbackPositive,
|
4593
|
+
{
|
4594
|
+
disabled: !allowFeedbackPositive,
|
4595
|
+
className: "aui-assistant-action-bar-feedback-positive",
|
4596
|
+
asChild: true,
|
4597
|
+
children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(ThumbsUpIcon, {}) })
|
4598
|
+
}
|
4599
|
+
);
|
4600
|
+
});
|
4601
|
+
AssistantActionBarFeedbackPositive.displayName = "AssistantActionBarFeedbackPositive";
|
4602
|
+
var AssistantActionBarFeedbackNegative = forwardRef22((props, ref) => {
|
4603
|
+
const {
|
4604
|
+
strings: {
|
4605
|
+
assistantMessage: {
|
4606
|
+
feedback: { negative: { tooltip = "Bad response" } = {} } = {}
|
4607
|
+
} = {}
|
4608
|
+
} = {}
|
4609
|
+
} = useThreadConfig();
|
4610
|
+
const allowFeedbackNegative = useAllowFeedbackNegative();
|
4611
|
+
return /* @__PURE__ */ jsx39(
|
4612
|
+
actionBar_exports.FeedbackNegative,
|
4613
|
+
{
|
4614
|
+
disabled: !allowFeedbackNegative,
|
4615
|
+
className: "aui-assistant-action-bar-feedback-negative",
|
4616
|
+
asChild: true,
|
4617
|
+
children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(ThumbsDownIcon, {}) })
|
4618
|
+
}
|
4619
|
+
);
|
4620
|
+
});
|
4621
|
+
AssistantActionBarFeedbackNegative.displayName = "AssistantActionBarFeedbackNegative";
|
4425
4622
|
var exports = {
|
4426
4623
|
Root: AssistantActionBarRoot,
|
4427
4624
|
Reload: AssistantActionBarReload,
|
4428
4625
|
Copy: AssistantActionBarCopy,
|
4429
4626
|
Speak: AssistantActionBarSpeak,
|
4430
4627
|
StopSpeaking: AssistantActionBarStopSpeaking,
|
4431
|
-
SpeechControl: AssistantActionBarSpeechControl
|
4628
|
+
SpeechControl: AssistantActionBarSpeechControl,
|
4629
|
+
FeedbackPositive: AssistantActionBarFeedbackPositive,
|
4630
|
+
FeedbackNegative: AssistantActionBarFeedbackNegative
|
4432
4631
|
};
|
4433
4632
|
var assistant_action_bar_default = Object.assign(
|
4434
4633
|
AssistantActionBar,
|
@@ -4436,12 +4635,12 @@ var assistant_action_bar_default = Object.assign(
|
|
4436
4635
|
);
|
4437
4636
|
|
4438
4637
|
// src/ui/assistant-message.tsx
|
4439
|
-
import { forwardRef as
|
4638
|
+
import { forwardRef as forwardRef24, useMemo as useMemo5 } from "react";
|
4440
4639
|
|
4441
4640
|
// src/ui/branch-picker.tsx
|
4442
|
-
import { forwardRef as
|
4641
|
+
import { forwardRef as forwardRef23 } from "react";
|
4443
4642
|
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
4444
|
-
import { jsx as
|
4643
|
+
import { jsx as jsx40, jsxs as jsxs5 } from "react/jsx-runtime";
|
4445
4644
|
var useAllowBranchPicker = (ensureCapability = false) => {
|
4446
4645
|
const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
|
4447
4646
|
const branchPickerSupported = useThread((t) => t.capabilities.edit);
|
@@ -4451,9 +4650,9 @@ var BranchPicker = () => {
|
|
4451
4650
|
const allowBranchPicker = useAllowBranchPicker();
|
4452
4651
|
if (!allowBranchPicker) return null;
|
4453
4652
|
return /* @__PURE__ */ jsxs5(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
|
4454
|
-
/* @__PURE__ */
|
4455
|
-
/* @__PURE__ */
|
4456
|
-
/* @__PURE__ */
|
4653
|
+
/* @__PURE__ */ jsx40(BranchPickerPrevious2, {}),
|
4654
|
+
/* @__PURE__ */ jsx40(BranchPickerState, {}),
|
4655
|
+
/* @__PURE__ */ jsx40(BranchPickerNext, {})
|
4457
4656
|
] });
|
4458
4657
|
};
|
4459
4658
|
BranchPicker.displayName = "BranchPicker";
|
@@ -4461,33 +4660,33 @@ var BranchPickerRoot = withDefaults(branchPicker_exports.Root, {
|
|
4461
4660
|
className: "aui-branch-picker-root"
|
4462
4661
|
});
|
4463
4662
|
BranchPickerRoot.displayName = "BranchPickerRoot";
|
4464
|
-
var BranchPickerPrevious2 =
|
4663
|
+
var BranchPickerPrevious2 = forwardRef23((props, ref) => {
|
4465
4664
|
const {
|
4466
4665
|
strings: {
|
4467
4666
|
branchPicker: { previous: { tooltip = "Previous" } = {} } = {}
|
4468
4667
|
} = {}
|
4469
4668
|
} = useThreadConfig();
|
4470
4669
|
const allowBranchPicker = useAllowBranchPicker();
|
4471
|
-
return /* @__PURE__ */
|
4670
|
+
return /* @__PURE__ */ jsx40(branchPicker_exports.Previous, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx40(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx40(ChevronLeftIcon, {}) }) });
|
4472
4671
|
});
|
4473
4672
|
BranchPickerPrevious2.displayName = "BranchPickerPrevious";
|
4474
4673
|
var BranchPickerStateWrapper = withDefaults("span", {
|
4475
4674
|
className: "aui-branch-picker-state"
|
4476
4675
|
});
|
4477
|
-
var BranchPickerState =
|
4676
|
+
var BranchPickerState = forwardRef23((props, ref) => {
|
4478
4677
|
return /* @__PURE__ */ jsxs5(BranchPickerStateWrapper, { ...props, ref, children: [
|
4479
|
-
/* @__PURE__ */
|
4678
|
+
/* @__PURE__ */ jsx40(branchPicker_exports.Number, {}),
|
4480
4679
|
" / ",
|
4481
|
-
/* @__PURE__ */
|
4680
|
+
/* @__PURE__ */ jsx40(branchPicker_exports.Count, {})
|
4482
4681
|
] });
|
4483
4682
|
});
|
4484
4683
|
BranchPickerState.displayName = "BranchPickerState";
|
4485
|
-
var BranchPickerNext =
|
4684
|
+
var BranchPickerNext = forwardRef23((props, ref) => {
|
4486
4685
|
const {
|
4487
4686
|
strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
|
4488
4687
|
} = useThreadConfig();
|
4489
4688
|
const allowBranchPicker = useAllowBranchPicker();
|
4490
|
-
return /* @__PURE__ */
|
4689
|
+
return /* @__PURE__ */ jsx40(branchPicker_exports.Next, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx40(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx40(ChevronRightIcon, {}) }) });
|
4491
4690
|
});
|
4492
4691
|
BranchPickerNext.displayName = "BranchPickerNext";
|
4493
4692
|
var exports2 = {
|
@@ -4499,12 +4698,12 @@ var branch_picker_default = Object.assign(BranchPicker, exports2);
|
|
4499
4698
|
|
4500
4699
|
// src/ui/base/avatar.tsx
|
4501
4700
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
4502
|
-
import { jsx as
|
4701
|
+
import { jsx as jsx41, jsxs as jsxs6 } from "react/jsx-runtime";
|
4503
4702
|
var Avatar = ({ src, alt, fallback }) => {
|
4504
4703
|
if (src == null && fallback == null) return null;
|
4505
4704
|
return /* @__PURE__ */ jsxs6(AvatarRoot, { children: [
|
4506
|
-
src != null && /* @__PURE__ */
|
4507
|
-
fallback != null && /* @__PURE__ */
|
4705
|
+
src != null && /* @__PURE__ */ jsx41(AvatarImage, { src, alt }),
|
4706
|
+
fallback != null && /* @__PURE__ */ jsx41(AvatarFallback, { children: fallback })
|
4508
4707
|
] });
|
4509
4708
|
};
|
4510
4709
|
Avatar.displayName = "Avatar";
|
@@ -4523,10 +4722,10 @@ AvatarFallback.displayName = "AvatarFallback";
|
|
4523
4722
|
|
4524
4723
|
// src/ui/content-part.tsx
|
4525
4724
|
import classNames2 from "classnames";
|
4526
|
-
import { jsx as
|
4725
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
4527
4726
|
var Text = () => {
|
4528
4727
|
const status = useSmoothStatus();
|
4529
|
-
return /* @__PURE__ */
|
4728
|
+
return /* @__PURE__ */ jsx42(
|
4530
4729
|
contentPart_exports.Text,
|
4531
4730
|
{
|
4532
4731
|
className: classNames2(
|
@@ -4541,19 +4740,19 @@ var exports3 = { Text: withSmoothContextProvider(Text) };
|
|
4541
4740
|
var content_part_default = exports3;
|
4542
4741
|
|
4543
4742
|
// src/ui/assistant-message.tsx
|
4544
|
-
import { jsx as
|
4743
|
+
import { jsx as jsx43, jsxs as jsxs7 } from "react/jsx-runtime";
|
4545
4744
|
var AssistantMessage = () => {
|
4546
4745
|
return /* @__PURE__ */ jsxs7(AssistantMessageRoot, { children: [
|
4547
|
-
/* @__PURE__ */
|
4548
|
-
/* @__PURE__ */
|
4549
|
-
/* @__PURE__ */
|
4550
|
-
/* @__PURE__ */
|
4746
|
+
/* @__PURE__ */ jsx43(AssistantMessageAvatar, {}),
|
4747
|
+
/* @__PURE__ */ jsx43(AssistantMessageContent, {}),
|
4748
|
+
/* @__PURE__ */ jsx43(branch_picker_default, {}),
|
4749
|
+
/* @__PURE__ */ jsx43(assistant_action_bar_default, {})
|
4551
4750
|
] });
|
4552
4751
|
};
|
4553
4752
|
AssistantMessage.displayName = "AssistantMessage";
|
4554
4753
|
var AssistantMessageAvatar = () => {
|
4555
4754
|
const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
|
4556
|
-
return /* @__PURE__ */
|
4755
|
+
return /* @__PURE__ */ jsx43(Avatar, { ...avatar });
|
4557
4756
|
};
|
4558
4757
|
var AssistantMessageRoot = withDefaults(message_exports.Root, {
|
4559
4758
|
className: "aui-assistant-message-root"
|
@@ -4562,7 +4761,7 @@ AssistantMessageRoot.displayName = "AssistantMessageRoot";
|
|
4562
4761
|
var AssistantMessageContentWrapper = withDefaults("div", {
|
4563
4762
|
className: "aui-assistant-message-content"
|
4564
4763
|
});
|
4565
|
-
var AssistantMessageContent =
|
4764
|
+
var AssistantMessageContent = forwardRef24(({ components: componentsProp, ...rest }, ref) => {
|
4566
4765
|
const { tools, assistantMessage: { components = {} } = {} } = useThreadConfig();
|
4567
4766
|
const toolsComponents = useMemo5(
|
4568
4767
|
() => ({
|
@@ -4577,7 +4776,7 @@ var AssistantMessageContent = forwardRef21(({ components: componentsProp, ...res
|
|
4577
4776
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
4578
4777
|
[...tools ?? [], components.ToolFallback]
|
4579
4778
|
);
|
4580
|
-
return /* @__PURE__ */
|
4779
|
+
return /* @__PURE__ */ jsx43(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx43(
|
4581
4780
|
message_exports.Content,
|
4582
4781
|
{
|
4583
4782
|
components: {
|
@@ -4600,21 +4799,21 @@ var assistant_message_default = Object.assign(
|
|
4600
4799
|
);
|
4601
4800
|
|
4602
4801
|
// src/ui/assistant-modal.tsx
|
4603
|
-
import { forwardRef as
|
4802
|
+
import { forwardRef as forwardRef32 } from "react";
|
4604
4803
|
import { BotIcon, ChevronDownIcon } from "lucide-react";
|
4605
4804
|
|
4606
4805
|
// src/ui/thread.tsx
|
4607
|
-
import { forwardRef as
|
4806
|
+
import { forwardRef as forwardRef31 } from "react";
|
4608
4807
|
import { ArrowDownIcon } from "lucide-react";
|
4609
4808
|
|
4610
4809
|
// src/ui/composer.tsx
|
4611
|
-
import { forwardRef as
|
4810
|
+
import { forwardRef as forwardRef26 } from "react";
|
4612
4811
|
import { PaperclipIcon, SendHorizontalIcon } from "lucide-react";
|
4613
4812
|
|
4614
4813
|
// src/ui/base/CircleStopIcon.tsx
|
4615
|
-
import { jsx as
|
4814
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
4616
4815
|
var CircleStopIcon = () => {
|
4617
|
-
return /* @__PURE__ */
|
4816
|
+
return /* @__PURE__ */ jsx44(
|
4618
4817
|
"svg",
|
4619
4818
|
{
|
4620
4819
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -4622,16 +4821,16 @@ var CircleStopIcon = () => {
|
|
4622
4821
|
fill: "currentColor",
|
4623
4822
|
width: "16",
|
4624
4823
|
height: "16",
|
4625
|
-
children: /* @__PURE__ */
|
4824
|
+
children: /* @__PURE__ */ jsx44("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
|
4626
4825
|
}
|
4627
4826
|
);
|
4628
4827
|
};
|
4629
4828
|
CircleStopIcon.displayName = "CircleStopIcon";
|
4630
4829
|
|
4631
4830
|
// src/ui/composer-attachment.tsx
|
4632
|
-
import { forwardRef as
|
4831
|
+
import { forwardRef as forwardRef25 } from "react";
|
4633
4832
|
import { CircleXIcon } from "lucide-react";
|
4634
|
-
import { jsx as
|
4833
|
+
import { jsx as jsx45, jsxs as jsxs8 } from "react/jsx-runtime";
|
4635
4834
|
var ComposerAttachmentRoot = withDefaults("div", {
|
4636
4835
|
className: "aui-composer-attachment-root"
|
4637
4836
|
});
|
@@ -4641,11 +4840,11 @@ var ComposerAttachment2 = () => {
|
|
4641
4840
|
return /* @__PURE__ */ jsxs8(ComposerAttachmentRoot, { children: [
|
4642
4841
|
".",
|
4643
4842
|
attachment.name.split(".").pop(),
|
4644
|
-
/* @__PURE__ */
|
4843
|
+
/* @__PURE__ */ jsx45(ComposerAttachmentRemove, {})
|
4645
4844
|
] });
|
4646
4845
|
};
|
4647
4846
|
ComposerAttachment2.displayName = "ComposerAttachment";
|
4648
|
-
var ComposerAttachmentRemove =
|
4847
|
+
var ComposerAttachmentRemove = forwardRef25((props, ref) => {
|
4649
4848
|
const {
|
4650
4849
|
strings: {
|
4651
4850
|
composer: { removeAttachment: { tooltip = "Remove file" } = {} } = {}
|
@@ -4656,7 +4855,7 @@ var ComposerAttachmentRemove = forwardRef22((props, ref) => {
|
|
4656
4855
|
const handleRemoveAttachment = () => {
|
4657
4856
|
composerStore.getState().removeAttachment(attachmentStore.getState().attachment.id);
|
4658
4857
|
};
|
4659
|
-
return /* @__PURE__ */
|
4858
|
+
return /* @__PURE__ */ jsx45(
|
4660
4859
|
TooltipIconButton,
|
4661
4860
|
{
|
4662
4861
|
tooltip,
|
@@ -4665,7 +4864,7 @@ var ComposerAttachmentRemove = forwardRef22((props, ref) => {
|
|
4665
4864
|
...props,
|
4666
4865
|
onClick: handleRemoveAttachment,
|
4667
4866
|
ref,
|
4668
|
-
children: props.children ?? /* @__PURE__ */
|
4867
|
+
children: props.children ?? /* @__PURE__ */ jsx45(CircleXIcon, {})
|
4669
4868
|
}
|
4670
4869
|
);
|
4671
4870
|
});
|
@@ -4680,7 +4879,7 @@ var composer_attachment_default = Object.assign(
|
|
4680
4879
|
);
|
4681
4880
|
|
4682
4881
|
// src/ui/composer.tsx
|
4683
|
-
import { Fragment as Fragment5, jsx as
|
4882
|
+
import { Fragment as Fragment5, jsx as jsx46, jsxs as jsxs9 } from "react/jsx-runtime";
|
4684
4883
|
var useAllowAttachments = (ensureCapability = false) => {
|
4685
4884
|
const { composer: { allowAttachments = true } = {} } = useThreadConfig();
|
4686
4885
|
const attachmentsSupported = useThread((t) => t.capabilities.attachments);
|
@@ -4689,10 +4888,10 @@ var useAllowAttachments = (ensureCapability = false) => {
|
|
4689
4888
|
var Composer = () => {
|
4690
4889
|
const allowAttachments = useAllowAttachments(true);
|
4691
4890
|
return /* @__PURE__ */ jsxs9(ComposerRoot, { children: [
|
4692
|
-
allowAttachments && /* @__PURE__ */
|
4693
|
-
allowAttachments && /* @__PURE__ */
|
4694
|
-
/* @__PURE__ */
|
4695
|
-
/* @__PURE__ */
|
4891
|
+
allowAttachments && /* @__PURE__ */ jsx46(ComposerAttachments, {}),
|
4892
|
+
allowAttachments && /* @__PURE__ */ jsx46(ComposerAddAttachment, {}),
|
4893
|
+
/* @__PURE__ */ jsx46(ComposerInput, { autoFocus: true }),
|
4894
|
+
/* @__PURE__ */ jsx46(ComposerAction, {})
|
4696
4895
|
] });
|
4697
4896
|
};
|
4698
4897
|
Composer.displayName = "Composer";
|
@@ -4705,14 +4904,14 @@ var ComposerInputStyled = withDefaults(composer_exports.Input, {
|
|
4705
4904
|
autoFocus: true,
|
4706
4905
|
className: "aui-composer-input"
|
4707
4906
|
});
|
4708
|
-
var ComposerInput =
|
4907
|
+
var ComposerInput = forwardRef26(
|
4709
4908
|
(props, ref) => {
|
4710
4909
|
const {
|
4711
4910
|
strings: {
|
4712
4911
|
composer: { input: { placeholder = "Write a message..." } = {} } = {}
|
4713
4912
|
} = {}
|
4714
4913
|
} = useThreadConfig();
|
4715
|
-
return /* @__PURE__ */
|
4914
|
+
return /* @__PURE__ */ jsx46(ComposerInputStyled, { placeholder, ...props, ref });
|
4716
4915
|
}
|
4717
4916
|
);
|
4718
4917
|
ComposerInput.displayName = "ComposerInput";
|
@@ -4720,7 +4919,7 @@ var ComposerAttachmentsContainer = withDefaults("div", {
|
|
4720
4919
|
className: "aui-composer-attachments"
|
4721
4920
|
});
|
4722
4921
|
var ComposerAttachments = ({ components }) => {
|
4723
|
-
return /* @__PURE__ */
|
4922
|
+
return /* @__PURE__ */ jsx46(ComposerAttachmentsContainer, { children: /* @__PURE__ */ jsx46(
|
4724
4923
|
composer_exports.Attachments,
|
4725
4924
|
{
|
4726
4925
|
components: {
|
@@ -4734,21 +4933,21 @@ var ComposerAttachButton = withDefaults(TooltipIconButton, {
|
|
4734
4933
|
variant: "default",
|
4735
4934
|
className: "aui-composer-attach"
|
4736
4935
|
});
|
4737
|
-
var ComposerAddAttachment =
|
4936
|
+
var ComposerAddAttachment = forwardRef26((props, ref) => {
|
4738
4937
|
const {
|
4739
4938
|
strings: {
|
4740
4939
|
composer: { addAttachment: { tooltip = "Attach file" } = {} } = {}
|
4741
4940
|
} = {}
|
4742
4941
|
} = useThreadConfig();
|
4743
4942
|
const allowAttachments = useAllowAttachments();
|
4744
|
-
return /* @__PURE__ */
|
4943
|
+
return /* @__PURE__ */ jsx46(composer_exports.AddAttachment, { disabled: !allowAttachments, asChild: true, children: /* @__PURE__ */ jsx46(
|
4745
4944
|
ComposerAttachButton,
|
4746
4945
|
{
|
4747
4946
|
tooltip,
|
4748
4947
|
variant: "ghost",
|
4749
4948
|
...props,
|
4750
4949
|
ref,
|
4751
|
-
children: props.children ?? /* @__PURE__ */
|
4950
|
+
children: props.children ?? /* @__PURE__ */ jsx46(PaperclipIcon, {})
|
4752
4951
|
}
|
4753
4952
|
) });
|
4754
4953
|
});
|
@@ -4759,10 +4958,10 @@ var useAllowCancel = () => {
|
|
4759
4958
|
};
|
4760
4959
|
var ComposerAction = () => {
|
4761
4960
|
const allowCancel = useAllowCancel();
|
4762
|
-
if (!allowCancel) return /* @__PURE__ */
|
4961
|
+
if (!allowCancel) return /* @__PURE__ */ jsx46(ComposerSend, {});
|
4763
4962
|
return /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
4764
|
-
/* @__PURE__ */
|
4765
|
-
/* @__PURE__ */
|
4963
|
+
/* @__PURE__ */ jsx46(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx46(ComposerSend, {}) }),
|
4964
|
+
/* @__PURE__ */ jsx46(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx46(ComposerCancel, {}) })
|
4766
4965
|
] });
|
4767
4966
|
};
|
4768
4967
|
ComposerAction.displayName = "ComposerAction";
|
@@ -4770,22 +4969,22 @@ var ComposerSendButton = withDefaults(TooltipIconButton, {
|
|
4770
4969
|
variant: "default",
|
4771
4970
|
className: "aui-composer-send"
|
4772
4971
|
});
|
4773
|
-
var ComposerSend =
|
4972
|
+
var ComposerSend = forwardRef26((props, ref) => {
|
4774
4973
|
const {
|
4775
4974
|
strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
|
4776
4975
|
} = useThreadConfig();
|
4777
|
-
return /* @__PURE__ */
|
4976
|
+
return /* @__PURE__ */ jsx46(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx46(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx46(SendHorizontalIcon, {}) }) });
|
4778
4977
|
});
|
4779
4978
|
ComposerSend.displayName = "ComposerSend";
|
4780
4979
|
var ComposerCancelButton = withDefaults(TooltipIconButton, {
|
4781
4980
|
variant: "default",
|
4782
4981
|
className: "aui-composer-cancel"
|
4783
4982
|
});
|
4784
|
-
var ComposerCancel =
|
4983
|
+
var ComposerCancel = forwardRef26((props, ref) => {
|
4785
4984
|
const {
|
4786
4985
|
strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
|
4787
4986
|
} = useThreadConfig();
|
4788
|
-
return /* @__PURE__ */
|
4987
|
+
return /* @__PURE__ */ jsx46(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx46(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx46(CircleStopIcon, {}) }) });
|
4789
4988
|
});
|
4790
4989
|
ComposerCancel.displayName = "ComposerCancel";
|
4791
4990
|
var exports6 = {
|
@@ -4800,15 +4999,15 @@ var exports6 = {
|
|
4800
4999
|
var composer_default = Object.assign(Composer, exports6);
|
4801
5000
|
|
4802
5001
|
// src/ui/thread-welcome.tsx
|
4803
|
-
import { forwardRef as
|
4804
|
-
import { jsx as
|
5002
|
+
import { forwardRef as forwardRef27 } from "react";
|
5003
|
+
import { jsx as jsx47, jsxs as jsxs10 } from "react/jsx-runtime";
|
4805
5004
|
var ThreadWelcome = () => {
|
4806
5005
|
return /* @__PURE__ */ jsxs10(ThreadWelcomeRoot, { children: [
|
4807
5006
|
/* @__PURE__ */ jsxs10(ThreadWelcomeCenter, { children: [
|
4808
|
-
/* @__PURE__ */
|
4809
|
-
/* @__PURE__ */
|
5007
|
+
/* @__PURE__ */ jsx47(ThreadWelcomeAvatar, {}),
|
5008
|
+
/* @__PURE__ */ jsx47(ThreadWelcomeMessage, {})
|
4810
5009
|
] }),
|
4811
|
-
/* @__PURE__ */
|
5010
|
+
/* @__PURE__ */ jsx47(ThreadWelcomeSuggestions, {})
|
4812
5011
|
] });
|
4813
5012
|
};
|
4814
5013
|
ThreadWelcome.displayName = "ThreadWelcome";
|
@@ -4818,22 +5017,22 @@ var ThreadWelcomeRootStyled = withDefaults("div", {
|
|
4818
5017
|
var ThreadWelcomeCenter = withDefaults("div", {
|
4819
5018
|
className: "aui-thread-welcome-center"
|
4820
5019
|
});
|
4821
|
-
var ThreadWelcomeRoot =
|
5020
|
+
var ThreadWelcomeRoot = forwardRef27(
|
4822
5021
|
(props, ref) => {
|
4823
|
-
return /* @__PURE__ */
|
5022
|
+
return /* @__PURE__ */ jsx47(thread_exports.Empty, { children: /* @__PURE__ */ jsx47(ThreadWelcomeRootStyled, { ...props, ref }) });
|
4824
5023
|
}
|
4825
5024
|
);
|
4826
5025
|
ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
|
4827
5026
|
var ThreadWelcomeAvatar = () => {
|
4828
5027
|
const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
|
4829
|
-
return /* @__PURE__ */
|
5028
|
+
return /* @__PURE__ */ jsx47(Avatar, { ...avatar });
|
4830
5029
|
};
|
4831
5030
|
var ThreadWelcomeMessageStyled = withDefaults("p", {
|
4832
5031
|
className: "aui-thread-welcome-message"
|
4833
5032
|
});
|
4834
|
-
var ThreadWelcomeMessage =
|
5033
|
+
var ThreadWelcomeMessage = forwardRef27(({ message: messageProp, ...rest }, ref) => {
|
4835
5034
|
const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
|
4836
|
-
return /* @__PURE__ */
|
5035
|
+
return /* @__PURE__ */ jsx47(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
|
4837
5036
|
});
|
4838
5037
|
ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
|
4839
5038
|
var ThreadWelcomeSuggestionContainer = withDefaults("div", {
|
@@ -4845,21 +5044,21 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
|
|
4845
5044
|
var ThreadWelcomeSuggestion = ({
|
4846
5045
|
suggestion: { text, prompt }
|
4847
5046
|
}) => {
|
4848
|
-
return /* @__PURE__ */
|
5047
|
+
return /* @__PURE__ */ jsx47(
|
4849
5048
|
ThreadWelcomeSuggestionStyled,
|
4850
5049
|
{
|
4851
5050
|
prompt,
|
4852
5051
|
method: "replace",
|
4853
5052
|
autoSend: true,
|
4854
|
-
children: /* @__PURE__ */
|
5053
|
+
children: /* @__PURE__ */ jsx47("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
|
4855
5054
|
}
|
4856
5055
|
);
|
4857
5056
|
};
|
4858
5057
|
var ThreadWelcomeSuggestions = () => {
|
4859
5058
|
const { welcome: { suggestions } = {} } = useThreadConfig();
|
4860
|
-
return /* @__PURE__ */
|
5059
|
+
return /* @__PURE__ */ jsx47(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
|
4861
5060
|
const key = `${suggestion.prompt}-${idx}`;
|
4862
|
-
return /* @__PURE__ */
|
5061
|
+
return /* @__PURE__ */ jsx47(ThreadWelcomeSuggestion, { suggestion }, key);
|
4863
5062
|
}) });
|
4864
5063
|
};
|
4865
5064
|
ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
|
@@ -4874,12 +5073,12 @@ var exports7 = {
|
|
4874
5073
|
var thread_welcome_default = Object.assign(ThreadWelcome, exports7);
|
4875
5074
|
|
4876
5075
|
// src/ui/user-message.tsx
|
4877
|
-
import { forwardRef as
|
5076
|
+
import { forwardRef as forwardRef29 } from "react";
|
4878
5077
|
|
4879
5078
|
// src/ui/user-action-bar.tsx
|
4880
|
-
import { forwardRef as
|
5079
|
+
import { forwardRef as forwardRef28 } from "react";
|
4881
5080
|
import { PencilIcon } from "lucide-react";
|
4882
|
-
import { jsx as
|
5081
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
4883
5082
|
var useAllowEdit = (ensureCapability = false) => {
|
4884
5083
|
const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
|
4885
5084
|
const editSupported = useThread((t) => t.capabilities.edit);
|
@@ -4888,19 +5087,19 @@ var useAllowEdit = (ensureCapability = false) => {
|
|
4888
5087
|
var UserActionBar = () => {
|
4889
5088
|
const allowEdit = useAllowEdit(true);
|
4890
5089
|
if (!allowEdit) return null;
|
4891
|
-
return /* @__PURE__ */
|
5090
|
+
return /* @__PURE__ */ jsx48(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx48(UserActionBarEdit, {}) });
|
4892
5091
|
};
|
4893
5092
|
UserActionBar.displayName = "UserActionBar";
|
4894
5093
|
var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
|
4895
5094
|
className: "aui-user-action-bar-root"
|
4896
5095
|
});
|
4897
5096
|
UserActionBarRoot.displayName = "UserActionBarRoot";
|
4898
|
-
var UserActionBarEdit =
|
5097
|
+
var UserActionBarEdit = forwardRef28((props, ref) => {
|
4899
5098
|
const {
|
4900
5099
|
strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
|
4901
5100
|
} = useThreadConfig();
|
4902
5101
|
const allowEdit = useAllowEdit();
|
4903
|
-
return /* @__PURE__ */
|
5102
|
+
return /* @__PURE__ */ jsx48(actionBar_exports.Edit, { disabled: !allowEdit, asChild: true, children: /* @__PURE__ */ jsx48(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx48(PencilIcon, {}) }) });
|
4904
5103
|
});
|
4905
5104
|
UserActionBarEdit.displayName = "UserActionBarEdit";
|
4906
5105
|
var exports8 = {
|
@@ -4932,13 +5131,13 @@ var user_message_attachment_default = Object.assign(
|
|
4932
5131
|
);
|
4933
5132
|
|
4934
5133
|
// src/ui/user-message.tsx
|
4935
|
-
import { jsx as
|
5134
|
+
import { jsx as jsx49, jsxs as jsxs12 } from "react/jsx-runtime";
|
4936
5135
|
var UserMessage = () => {
|
4937
5136
|
return /* @__PURE__ */ jsxs12(UserMessageRoot, { children: [
|
4938
|
-
/* @__PURE__ */
|
4939
|
-
/* @__PURE__ */
|
4940
|
-
/* @__PURE__ */
|
4941
|
-
/* @__PURE__ */
|
5137
|
+
/* @__PURE__ */ jsx49(UserMessageAttachments, {}),
|
5138
|
+
/* @__PURE__ */ jsx49(user_action_bar_default, {}),
|
5139
|
+
/* @__PURE__ */ jsx49(UserMessageContent, {}),
|
5140
|
+
/* @__PURE__ */ jsx49(branch_picker_default, {})
|
4942
5141
|
] });
|
4943
5142
|
};
|
4944
5143
|
UserMessage.displayName = "UserMessage";
|
@@ -4949,9 +5148,9 @@ UserMessageRoot.displayName = "UserMessageRoot";
|
|
4949
5148
|
var UserMessageContentWrapper = withDefaults("div", {
|
4950
5149
|
className: "aui-user-message-content"
|
4951
5150
|
});
|
4952
|
-
var UserMessageContent =
|
5151
|
+
var UserMessageContent = forwardRef29(
|
4953
5152
|
({ components, ...props }, ref) => {
|
4954
|
-
return /* @__PURE__ */
|
5153
|
+
return /* @__PURE__ */ jsx49(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx49(
|
4955
5154
|
message_exports.Content,
|
4956
5155
|
{
|
4957
5156
|
components: {
|
@@ -4969,7 +5168,7 @@ var UserMessageAttachmentsContainer = withDefaults("div", {
|
|
4969
5168
|
var UserMessageAttachments = ({
|
4970
5169
|
components
|
4971
5170
|
}) => {
|
4972
|
-
return /* @__PURE__ */
|
5171
|
+
return /* @__PURE__ */ jsx49(message_exports.If, { hasAttachments: true, children: /* @__PURE__ */ jsx49(UserMessageAttachmentsContainer, { children: /* @__PURE__ */ jsx49(
|
4973
5172
|
message_exports.Attachments,
|
4974
5173
|
{
|
4975
5174
|
components: {
|
@@ -4987,14 +5186,14 @@ var exports10 = {
|
|
4987
5186
|
var user_message_default = Object.assign(UserMessage, exports10);
|
4988
5187
|
|
4989
5188
|
// src/ui/edit-composer.tsx
|
4990
|
-
import { forwardRef as
|
4991
|
-
import { jsx as
|
5189
|
+
import { forwardRef as forwardRef30 } from "react";
|
5190
|
+
import { jsx as jsx50, jsxs as jsxs13 } from "react/jsx-runtime";
|
4992
5191
|
var EditComposer = () => {
|
4993
5192
|
return /* @__PURE__ */ jsxs13(EditComposerRoot, { children: [
|
4994
|
-
/* @__PURE__ */
|
5193
|
+
/* @__PURE__ */ jsx50(EditComposerInput, {}),
|
4995
5194
|
/* @__PURE__ */ jsxs13(EditComposerFooter, { children: [
|
4996
|
-
/* @__PURE__ */
|
4997
|
-
/* @__PURE__ */
|
5195
|
+
/* @__PURE__ */ jsx50(EditComposerCancel, {}),
|
5196
|
+
/* @__PURE__ */ jsx50(EditComposerSend, {})
|
4998
5197
|
] })
|
4999
5198
|
] });
|
5000
5199
|
};
|
@@ -5011,23 +5210,23 @@ var EditComposerFooter = withDefaults("div", {
|
|
5011
5210
|
className: "aui-edit-composer-footer"
|
5012
5211
|
});
|
5013
5212
|
EditComposerFooter.displayName = "EditComposerFooter";
|
5014
|
-
var EditComposerCancel =
|
5213
|
+
var EditComposerCancel = forwardRef30(
|
5015
5214
|
(props, ref) => {
|
5016
5215
|
const {
|
5017
5216
|
strings: {
|
5018
5217
|
editComposer: { cancel: { label = "Cancel" } = {} } = {}
|
5019
5218
|
} = {}
|
5020
5219
|
} = useThreadConfig();
|
5021
|
-
return /* @__PURE__ */
|
5220
|
+
return /* @__PURE__ */ jsx50(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx50(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
|
5022
5221
|
}
|
5023
5222
|
);
|
5024
5223
|
EditComposerCancel.displayName = "EditComposerCancel";
|
5025
|
-
var EditComposerSend =
|
5224
|
+
var EditComposerSend = forwardRef30(
|
5026
5225
|
(props, ref) => {
|
5027
5226
|
const {
|
5028
5227
|
strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
|
5029
5228
|
} = useThreadConfig();
|
5030
|
-
return /* @__PURE__ */
|
5229
|
+
return /* @__PURE__ */ jsx50(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx50(Button, { ...props, ref, children: props.children ?? label }) });
|
5031
5230
|
}
|
5032
5231
|
);
|
5033
5232
|
EditComposerSend.displayName = "EditComposerSend";
|
@@ -5041,23 +5240,23 @@ var exports11 = {
|
|
5041
5240
|
var edit_composer_default = Object.assign(EditComposer, exports11);
|
5042
5241
|
|
5043
5242
|
// src/ui/thread.tsx
|
5044
|
-
import { jsx as
|
5243
|
+
import { jsx as jsx51, jsxs as jsxs14 } from "react/jsx-runtime";
|
5045
5244
|
var Thread = (config) => {
|
5046
|
-
return /* @__PURE__ */
|
5047
|
-
/* @__PURE__ */
|
5048
|
-
/* @__PURE__ */
|
5245
|
+
return /* @__PURE__ */ jsx51(ThreadRoot, { config, children: /* @__PURE__ */ jsxs14(ThreadViewport, { children: [
|
5246
|
+
/* @__PURE__ */ jsx51(thread_welcome_default, {}),
|
5247
|
+
/* @__PURE__ */ jsx51(ThreadMessages, {}),
|
5049
5248
|
/* @__PURE__ */ jsxs14(ThreadViewportFooter, { children: [
|
5050
|
-
/* @__PURE__ */
|
5051
|
-
/* @__PURE__ */
|
5249
|
+
/* @__PURE__ */ jsx51(ThreadScrollToBottom, {}),
|
5250
|
+
/* @__PURE__ */ jsx51(composer_default, {})
|
5052
5251
|
] })
|
5053
5252
|
] }) });
|
5054
5253
|
};
|
5055
5254
|
var ThreadRootStyled = withDefaults(thread_exports.Root, {
|
5056
5255
|
className: "aui-root aui-thread-root"
|
5057
5256
|
});
|
5058
|
-
var ThreadRoot =
|
5257
|
+
var ThreadRoot = forwardRef31(
|
5059
5258
|
({ config, ...props }, ref) => {
|
5060
|
-
return /* @__PURE__ */
|
5259
|
+
return /* @__PURE__ */ jsx51(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx51(ThreadRootStyled, { ...props, ref }) });
|
5061
5260
|
}
|
5062
5261
|
);
|
5063
5262
|
ThreadRoot.displayName = "ThreadRoot";
|
@@ -5071,7 +5270,7 @@ var ThreadViewportFooter = withDefaults("div", {
|
|
5071
5270
|
ThreadViewportFooter.displayName = "ThreadViewportFooter";
|
5072
5271
|
var SystemMessage = () => null;
|
5073
5272
|
var ThreadMessages = ({ components, ...rest }) => {
|
5074
|
-
return /* @__PURE__ */
|
5273
|
+
return /* @__PURE__ */ jsx51(
|
5075
5274
|
thread_exports.Messages,
|
5076
5275
|
{
|
5077
5276
|
components: {
|
@@ -5089,13 +5288,13 @@ var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
|
|
5089
5288
|
variant: "outline",
|
5090
5289
|
className: "aui-thread-scroll-to-bottom"
|
5091
5290
|
});
|
5092
|
-
var ThreadScrollToBottom =
|
5291
|
+
var ThreadScrollToBottom = forwardRef31((props, ref) => {
|
5093
5292
|
const {
|
5094
5293
|
strings: {
|
5095
5294
|
thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
|
5096
5295
|
} = {}
|
5097
5296
|
} = useThreadConfig();
|
5098
|
-
return /* @__PURE__ */
|
5297
|
+
return /* @__PURE__ */ jsx51(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx51(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx51(ArrowDownIcon, {}) }) });
|
5099
5298
|
});
|
5100
5299
|
ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
|
5101
5300
|
var exports12 = {
|
@@ -5108,20 +5307,20 @@ var exports12 = {
|
|
5108
5307
|
var thread_default = Object.assign(Thread, exports12);
|
5109
5308
|
|
5110
5309
|
// src/ui/assistant-modal.tsx
|
5111
|
-
import { Fragment as Fragment6, jsx as
|
5310
|
+
import { Fragment as Fragment6, jsx as jsx52, jsxs as jsxs15 } from "react/jsx-runtime";
|
5112
5311
|
var AssistantModal = (config) => {
|
5113
5312
|
return /* @__PURE__ */ jsxs15(AssistantModalRoot, { config, children: [
|
5114
|
-
/* @__PURE__ */
|
5115
|
-
/* @__PURE__ */
|
5313
|
+
/* @__PURE__ */ jsx52(AssistantModalTrigger, {}),
|
5314
|
+
/* @__PURE__ */ jsx52(AssistantModalContent, { children: /* @__PURE__ */ jsx52(thread_default, {}) })
|
5116
5315
|
] });
|
5117
5316
|
};
|
5118
5317
|
AssistantModal.displayName = "AssistantModal";
|
5119
5318
|
var AssistantModalRoot = ({ config, ...props }) => {
|
5120
|
-
return /* @__PURE__ */
|
5319
|
+
return /* @__PURE__ */ jsx52(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx52(assistantModal_exports.Root, { ...props }) });
|
5121
5320
|
};
|
5122
5321
|
AssistantModalRoot.displayName = "AssistantModalRoot";
|
5123
|
-
var AssistantModalTrigger =
|
5124
|
-
return /* @__PURE__ */
|
5322
|
+
var AssistantModalTrigger = forwardRef32((props, ref) => {
|
5323
|
+
return /* @__PURE__ */ jsx52(AssistantModalAnchor, { children: /* @__PURE__ */ jsx52(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx52(AssistantModalButton, { ...props, ref }) }) });
|
5125
5324
|
});
|
5126
5325
|
AssistantModalTrigger.displayName = "AssistantModalTrigger";
|
5127
5326
|
var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
|
@@ -5132,7 +5331,7 @@ var ModalButtonStyled = withDefaults(TooltipIconButton, {
|
|
5132
5331
|
variant: "default",
|
5133
5332
|
className: "aui-modal-button"
|
5134
5333
|
});
|
5135
|
-
var AssistantModalButton =
|
5334
|
+
var AssistantModalButton = forwardRef32(({ "data-state": state, ...rest }, ref) => {
|
5136
5335
|
const {
|
5137
5336
|
strings: {
|
5138
5337
|
assistantModal: {
|
@@ -5146,7 +5345,7 @@ var AssistantModalButton = forwardRef29(({ "data-state": state, ...rest }, ref)
|
|
5146
5345
|
} = {}
|
5147
5346
|
} = useThreadConfig();
|
5148
5347
|
const tooltip = state === "open" ? openTooltip : closedTooltip;
|
5149
|
-
return /* @__PURE__ */
|
5348
|
+
return /* @__PURE__ */ jsx52(
|
5150
5349
|
ModalButtonStyled,
|
5151
5350
|
{
|
5152
5351
|
side: "left",
|
@@ -5155,14 +5354,14 @@ var AssistantModalButton = forwardRef29(({ "data-state": state, ...rest }, ref)
|
|
5155
5354
|
...rest,
|
5156
5355
|
ref,
|
5157
5356
|
children: rest.children ?? /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
5158
|
-
/* @__PURE__ */
|
5357
|
+
/* @__PURE__ */ jsx52(
|
5159
5358
|
BotIcon,
|
5160
5359
|
{
|
5161
5360
|
"data-state": state,
|
5162
5361
|
className: "aui-modal-button-closed-icon"
|
5163
5362
|
}
|
5164
5363
|
),
|
5165
|
-
/* @__PURE__ */
|
5364
|
+
/* @__PURE__ */ jsx52(
|
5166
5365
|
ChevronDownIcon,
|
5167
5366
|
{
|
5168
5367
|
"data-state": state,
|
@@ -5233,6 +5432,8 @@ export {
|
|
5233
5432
|
toLanguageModelTools,
|
5234
5433
|
useActionBarCopy,
|
5235
5434
|
useActionBarEdit,
|
5435
|
+
useActionBarFeedbackNegative,
|
5436
|
+
useActionBarFeedbackPositive,
|
5236
5437
|
useActionBarReload,
|
5237
5438
|
useActionBarSpeak,
|
5238
5439
|
useActionBarStopSpeaking,
|