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