@assistant-ui/react 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +118 -102
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -871,6 +871,7 @@ var ActionBarPrimitiveEdit = createActionButton(
|
|
871
871
|
// src/primitives/assistantModal/index.ts
|
872
872
|
var assistantModal_exports = {};
|
873
873
|
__export(assistantModal_exports, {
|
874
|
+
Anchor: () => AssistantModalPrimitiveAnchor,
|
874
875
|
Content: () => AssistantModalPrimitiveContent,
|
875
876
|
Root: () => AssistantModalPrimitiveRoot,
|
876
877
|
Trigger: () => AssistantModalPrimitiveTrigger
|
@@ -977,6 +978,21 @@ var AssistantModalPrimitiveContent = forwardRef4(
|
|
977
978
|
);
|
978
979
|
AssistantModalPrimitiveContent.displayName = "AssistantModalPrimitive.Content";
|
979
980
|
|
981
|
+
// src/primitives/assistantModal/AssistantModalAnchor.tsx
|
982
|
+
import { forwardRef as forwardRef5 } from "react";
|
983
|
+
import * as PopoverPrimitive5 from "@radix-ui/react-popover";
|
984
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
985
|
+
var AssistantModalPrimitiveAnchor = forwardRef5(
|
986
|
+
({
|
987
|
+
__scopeAssistantModal,
|
988
|
+
...rest
|
989
|
+
}, ref) => {
|
990
|
+
const scope = usePopoverScope(__scopeAssistantModal);
|
991
|
+
return /* @__PURE__ */ jsx9(PopoverPrimitive5.Anchor, { ...scope, ...rest, ref });
|
992
|
+
}
|
993
|
+
);
|
994
|
+
AssistantModalPrimitiveAnchor.displayName = "AssistantModalPrimitive.Anchor";
|
995
|
+
|
980
996
|
// src/primitives/branchPicker/index.ts
|
981
997
|
var branchPicker_exports = {};
|
982
998
|
__export(branchPicker_exports, {
|
@@ -1000,24 +1016,24 @@ var BranchPickerPrevious = createActionButton(
|
|
1000
1016
|
);
|
1001
1017
|
|
1002
1018
|
// src/primitives/branchPicker/BranchPickerCount.tsx
|
1003
|
-
import { Fragment, jsx as
|
1019
|
+
import { Fragment, jsx as jsx10 } from "react/jsx-runtime";
|
1004
1020
|
var BranchPickerPrimitiveCount = () => {
|
1005
1021
|
const branchCount = useBranchPickerCount();
|
1006
|
-
return /* @__PURE__ */
|
1022
|
+
return /* @__PURE__ */ jsx10(Fragment, { children: branchCount });
|
1007
1023
|
};
|
1008
1024
|
BranchPickerPrimitiveCount.displayName = "BranchPickerPrimitive.Count";
|
1009
1025
|
|
1010
1026
|
// src/primitives/branchPicker/BranchPickerNumber.tsx
|
1011
|
-
import { Fragment as Fragment2, jsx as
|
1027
|
+
import { Fragment as Fragment2, jsx as jsx11 } from "react/jsx-runtime";
|
1012
1028
|
var BranchPickerPrimitiveNumber = () => {
|
1013
1029
|
const branchNumber = useBranchPickerNumber();
|
1014
|
-
return /* @__PURE__ */
|
1030
|
+
return /* @__PURE__ */ jsx11(Fragment2, { children: branchNumber });
|
1015
1031
|
};
|
1016
1032
|
BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
|
1017
1033
|
|
1018
1034
|
// src/primitives/branchPicker/BranchPickerRoot.tsx
|
1019
1035
|
import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
|
1020
|
-
import { forwardRef as
|
1036
|
+
import { forwardRef as forwardRef9 } from "react";
|
1021
1037
|
|
1022
1038
|
// src/primitives/message/index.ts
|
1023
1039
|
var message_exports = {};
|
@@ -1031,9 +1047,9 @@ __export(message_exports, {
|
|
1031
1047
|
// src/primitives/message/MessageRoot.tsx
|
1032
1048
|
import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
|
1033
1049
|
import { Primitive as Primitive3 } from "@radix-ui/react-primitive";
|
1034
|
-
import { forwardRef as
|
1035
|
-
import { jsx as
|
1036
|
-
var MessagePrimitiveRoot =
|
1050
|
+
import { forwardRef as forwardRef6 } from "react";
|
1051
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
1052
|
+
var MessagePrimitiveRoot = forwardRef6(({ onMouseEnter, onMouseLeave, ...rest }, ref) => {
|
1037
1053
|
const { useMessageUtils } = useMessageContext();
|
1038
1054
|
const setIsHovering = useMessageUtils((s) => s.setIsHovering);
|
1039
1055
|
const handleMouseEnter = () => {
|
@@ -1042,7 +1058,7 @@ var MessagePrimitiveRoot = forwardRef5(({ onMouseEnter, onMouseLeave, ...rest },
|
|
1042
1058
|
const handleMouseLeave = () => {
|
1043
1059
|
setIsHovering(false);
|
1044
1060
|
};
|
1045
|
-
return /* @__PURE__ */
|
1061
|
+
return /* @__PURE__ */ jsx12(
|
1046
1062
|
Primitive3.div,
|
1047
1063
|
{
|
1048
1064
|
...rest,
|
@@ -1070,7 +1086,7 @@ import { memo as memo2 } from "react";
|
|
1070
1086
|
// src/context/providers/ContentPartProvider.tsx
|
1071
1087
|
import { useEffect as useEffect7, useState as useState4 } from "react";
|
1072
1088
|
import { create as create9 } from "zustand";
|
1073
|
-
import { jsx as
|
1089
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
1074
1090
|
var syncContentPart = ({ message }, useContentPart, partIndex) => {
|
1075
1091
|
const part = message.content[partIndex];
|
1076
1092
|
if (!part) return;
|
@@ -1107,7 +1123,7 @@ var ContentPartProvider = ({
|
|
1107
1123
|
children
|
1108
1124
|
}) => {
|
1109
1125
|
const context = useContentPartContext2(partIndex);
|
1110
|
-
return /* @__PURE__ */
|
1126
|
+
return /* @__PURE__ */ jsx13(ContentPartContext.Provider, { value: context, children });
|
1111
1127
|
};
|
1112
1128
|
|
1113
1129
|
// src/primitives/contentPart/ContentPartDisplay.tsx
|
@@ -1119,7 +1135,7 @@ ContentPartPrimitiveDisplay.displayName = "ContentPartPrimitive.Display";
|
|
1119
1135
|
|
1120
1136
|
// src/utils/OutPortal.tsx
|
1121
1137
|
import { useLayoutEffect, useRef as useRef3 } from "react";
|
1122
|
-
import { jsx as
|
1138
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
1123
1139
|
var OutPortal = ({ node }) => {
|
1124
1140
|
const parentRef = useRef3(null);
|
1125
1141
|
useLayoutEffect(() => {
|
@@ -1131,11 +1147,11 @@ var OutPortal = ({ node }) => {
|
|
1131
1147
|
};
|
1132
1148
|
}, [node]);
|
1133
1149
|
if (!node) return null;
|
1134
|
-
return /* @__PURE__ */
|
1150
|
+
return /* @__PURE__ */ jsx14("span", { ref: parentRef });
|
1135
1151
|
};
|
1136
1152
|
|
1137
1153
|
// src/primitives/contentPart/ContentPartInProgressIndicator.tsx
|
1138
|
-
import { jsx as
|
1154
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
1139
1155
|
var ContentPartPrimitiveInProgressIndicator = () => {
|
1140
1156
|
const { useMessageUtils } = useMessageContext();
|
1141
1157
|
const { useContentPart } = useContentPartContext();
|
@@ -1143,35 +1159,35 @@ var ContentPartPrimitiveInProgressIndicator = () => {
|
|
1143
1159
|
[useMessageUtils, useContentPart],
|
1144
1160
|
(m, c) => c.status === "in_progress" ? m.inProgressIndicator : null
|
1145
1161
|
);
|
1146
|
-
return /* @__PURE__ */
|
1162
|
+
return /* @__PURE__ */ jsx15(OutPortal, { node: indicator });
|
1147
1163
|
};
|
1148
1164
|
ContentPartPrimitiveInProgressIndicator.displayName = "ContentPartPrimitive.InProgressIndicator";
|
1149
1165
|
|
1150
1166
|
// src/primitives/contentPart/ContentPartText.tsx
|
1151
1167
|
import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
|
1152
|
-
import { forwardRef as
|
1153
|
-
import { jsx as
|
1154
|
-
var ContentPartPrimitiveText =
|
1168
|
+
import { forwardRef as forwardRef7 } from "react";
|
1169
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
1170
|
+
var ContentPartPrimitiveText = forwardRef7((props, forwardedRef) => {
|
1155
1171
|
const text = useContentPartText();
|
1156
|
-
return /* @__PURE__ */
|
1172
|
+
return /* @__PURE__ */ jsx16(Primitive4.span, { ...props, ref: forwardedRef, children: text });
|
1157
1173
|
});
|
1158
1174
|
ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
|
1159
1175
|
|
1160
1176
|
// src/primitives/message/MessageContent.tsx
|
1161
|
-
import { jsx as
|
1177
|
+
import { jsx as jsx17, jsxs as jsxs2 } from "react/jsx-runtime";
|
1162
1178
|
var defaultComponents = {
|
1163
1179
|
Text: () => /* @__PURE__ */ jsxs2("p", { style: { whiteSpace: "pre-line" }, children: [
|
1164
|
-
/* @__PURE__ */
|
1165
|
-
/* @__PURE__ */
|
1180
|
+
/* @__PURE__ */ jsx17(ContentPartPrimitiveText, {}),
|
1181
|
+
/* @__PURE__ */ jsx17(ContentPartPrimitiveInProgressIndicator, {})
|
1166
1182
|
] }),
|
1167
1183
|
Image: () => null,
|
1168
|
-
UI: () => /* @__PURE__ */
|
1184
|
+
UI: () => /* @__PURE__ */ jsx17(ContentPartPrimitiveDisplay, {}),
|
1169
1185
|
tools: {
|
1170
1186
|
Fallback: (props) => {
|
1171
1187
|
const { useToolUIs } = useAssistantContext();
|
1172
1188
|
const Render = useToolUIs((s) => s.getToolUI(props.part.toolName));
|
1173
1189
|
if (!Render) return null;
|
1174
|
-
return /* @__PURE__ */
|
1190
|
+
return /* @__PURE__ */ jsx17(Render, { ...props });
|
1175
1191
|
}
|
1176
1192
|
}
|
1177
1193
|
};
|
@@ -1190,15 +1206,15 @@ var MessageContentPartComponent = ({
|
|
1190
1206
|
const type = part.type;
|
1191
1207
|
switch (type) {
|
1192
1208
|
case "text":
|
1193
|
-
return /* @__PURE__ */
|
1209
|
+
return /* @__PURE__ */ jsx17(Text, { part, status });
|
1194
1210
|
case "image":
|
1195
|
-
return /* @__PURE__ */
|
1211
|
+
return /* @__PURE__ */ jsx17(Image, { part, status });
|
1196
1212
|
case "ui":
|
1197
|
-
return /* @__PURE__ */
|
1213
|
+
return /* @__PURE__ */ jsx17(UI, { part, status });
|
1198
1214
|
case "tool-call": {
|
1199
1215
|
const Tool = by_name[part.toolName] || Fallback;
|
1200
1216
|
const addResult = (result) => addToolResult(part.toolCallId, result);
|
1201
|
-
return /* @__PURE__ */
|
1217
|
+
return /* @__PURE__ */ jsx17(Tool, { part, status, addResult });
|
1202
1218
|
}
|
1203
1219
|
default:
|
1204
1220
|
throw new Error(`Unknown content part type: ${type}`);
|
@@ -1208,7 +1224,7 @@ var MessageContentPartImpl = ({
|
|
1208
1224
|
partIndex,
|
1209
1225
|
components
|
1210
1226
|
}) => {
|
1211
|
-
return /* @__PURE__ */
|
1227
|
+
return /* @__PURE__ */ jsx17(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx17(MessageContentPartComponent, { components }) });
|
1212
1228
|
};
|
1213
1229
|
var MessageContentPart = memo2(
|
1214
1230
|
MessageContentPartImpl,
|
@@ -1221,7 +1237,7 @@ var MessagePrimitiveContent = ({
|
|
1221
1237
|
const contentLength = useMessage((s) => s.message.content.length);
|
1222
1238
|
return new Array(contentLength).fill(null).map((_, idx) => {
|
1223
1239
|
const partIndex = idx;
|
1224
|
-
return /* @__PURE__ */
|
1240
|
+
return /* @__PURE__ */ jsx17(
|
1225
1241
|
MessageContentPart,
|
1226
1242
|
{
|
1227
1243
|
partIndex,
|
@@ -1236,19 +1252,19 @@ MessagePrimitiveContent.displayName = "MessagePrimitive.Content";
|
|
1236
1252
|
// src/primitives/message/MessageInProgress.tsx
|
1237
1253
|
import { createPortal } from "react-dom";
|
1238
1254
|
import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
|
1239
|
-
import { forwardRef as
|
1240
|
-
import { jsx as
|
1241
|
-
var MessagePrimitiveInProgress =
|
1255
|
+
import { forwardRef as forwardRef8 } from "react";
|
1256
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
1257
|
+
var MessagePrimitiveInProgress = forwardRef8((props, ref) => {
|
1242
1258
|
const { useMessageUtils } = useMessageContext();
|
1243
1259
|
const portalNode = useMessageUtils((s) => s.inProgressIndicator);
|
1244
|
-
return createPortal(/* @__PURE__ */
|
1260
|
+
return createPortal(/* @__PURE__ */ jsx18(Primitive5.span, { ...props, ref }), portalNode);
|
1245
1261
|
});
|
1246
1262
|
MessagePrimitiveInProgress.displayName = "MessagePrimitive.InProgress";
|
1247
1263
|
|
1248
1264
|
// src/primitives/branchPicker/BranchPickerRoot.tsx
|
1249
|
-
import { jsx as
|
1250
|
-
var BranchPickerPrimitiveRoot =
|
1251
|
-
return /* @__PURE__ */
|
1265
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
1266
|
+
var BranchPickerPrimitiveRoot = forwardRef9(({ hideWhenSingleBranch, ...rest }, ref) => {
|
1267
|
+
return /* @__PURE__ */ jsx19(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx19(Primitive6.div, { ...rest, ref }) });
|
1252
1268
|
});
|
1253
1269
|
BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
|
1254
1270
|
|
@@ -1266,17 +1282,17 @@ __export(composer_exports, {
|
|
1266
1282
|
import { composeEventHandlers as composeEventHandlers5 } from "@radix-ui/primitive";
|
1267
1283
|
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
1268
1284
|
import {
|
1269
|
-
forwardRef as
|
1285
|
+
forwardRef as forwardRef10
|
1270
1286
|
} from "react";
|
1271
|
-
import { jsx as
|
1272
|
-
var ComposerPrimitiveRoot =
|
1287
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
1288
|
+
var ComposerPrimitiveRoot = forwardRef10(({ onSubmit, ...rest }, forwardedRef) => {
|
1273
1289
|
const send = useComposerSend();
|
1274
1290
|
const handleSubmit = (e) => {
|
1275
1291
|
e.preventDefault();
|
1276
1292
|
if (!send) return;
|
1277
1293
|
send();
|
1278
1294
|
};
|
1279
|
-
return /* @__PURE__ */
|
1295
|
+
return /* @__PURE__ */ jsx20(
|
1280
1296
|
Primitive7.form,
|
1281
1297
|
{
|
1282
1298
|
...rest,
|
@@ -1292,15 +1308,15 @@ import { composeEventHandlers as composeEventHandlers6 } from "@radix-ui/primiti
|
|
1292
1308
|
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
1293
1309
|
import { Slot } from "@radix-ui/react-slot";
|
1294
1310
|
import {
|
1295
|
-
forwardRef as
|
1311
|
+
forwardRef as forwardRef11,
|
1296
1312
|
useCallback as useCallback13,
|
1297
1313
|
useEffect as useEffect8,
|
1298
1314
|
useRef as useRef4
|
1299
1315
|
} from "react";
|
1300
1316
|
import TextareaAutosize from "react-textarea-autosize";
|
1301
1317
|
import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
|
1302
|
-
import { jsx as
|
1303
|
-
var ComposerPrimitiveInput =
|
1318
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
1319
|
+
var ComposerPrimitiveInput = forwardRef11(
|
1304
1320
|
({ autoFocus = false, asChild, disabled, onChange, onKeyDown, ...rest }, forwardedRef) => {
|
1305
1321
|
const { useThread } = useThreadContext();
|
1306
1322
|
const { useComposer, type } = useComposerContext();
|
@@ -1343,7 +1359,7 @@ var ComposerPrimitiveInput = forwardRef10(
|
|
1343
1359
|
focus();
|
1344
1360
|
}
|
1345
1361
|
});
|
1346
|
-
return /* @__PURE__ */
|
1362
|
+
return /* @__PURE__ */ jsx21(
|
1347
1363
|
Component,
|
1348
1364
|
{
|
1349
1365
|
value,
|
@@ -1363,13 +1379,13 @@ var ComposerPrimitiveInput = forwardRef10(
|
|
1363
1379
|
ComposerPrimitiveInput.displayName = "ComposerPrimitive.Input";
|
1364
1380
|
|
1365
1381
|
// src/primitives/composer/ComposerSend.tsx
|
1366
|
-
import { forwardRef as
|
1382
|
+
import { forwardRef as forwardRef12 } from "react";
|
1367
1383
|
import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
1368
|
-
import { jsx as
|
1369
|
-
var ComposerPrimitiveSend =
|
1384
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
1385
|
+
var ComposerPrimitiveSend = forwardRef12(({ disabled, ...rest }, ref) => {
|
1370
1386
|
const { useComposer } = useComposerContext();
|
1371
1387
|
const hasValue = useComposer((c) => c.isEditing && c.value.length > 0);
|
1372
|
-
return /* @__PURE__ */
|
1388
|
+
return /* @__PURE__ */ jsx22(
|
1373
1389
|
Primitive8.button,
|
1374
1390
|
{
|
1375
1391
|
type: "submit",
|
@@ -1408,11 +1424,11 @@ __export(contentPart_exports, {
|
|
1408
1424
|
|
1409
1425
|
// src/primitives/contentPart/ContentPartImage.tsx
|
1410
1426
|
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
1411
|
-
import { forwardRef as
|
1412
|
-
import { jsx as
|
1413
|
-
var ContentPartPrimitiveImage =
|
1427
|
+
import { forwardRef as forwardRef13 } from "react";
|
1428
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
1429
|
+
var ContentPartPrimitiveImage = forwardRef13((props, forwardedRef) => {
|
1414
1430
|
const image = useContentPartImage();
|
1415
|
-
return /* @__PURE__ */
|
1431
|
+
return /* @__PURE__ */ jsx23(Primitive9.img, { src: image, ...props, ref: forwardedRef });
|
1416
1432
|
});
|
1417
1433
|
ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
|
1418
1434
|
|
@@ -1430,10 +1446,10 @@ __export(thread_exports, {
|
|
1430
1446
|
|
1431
1447
|
// src/primitives/thread/ThreadRoot.tsx
|
1432
1448
|
import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
|
1433
|
-
import { forwardRef as
|
1434
|
-
import { jsx as
|
1435
|
-
var ThreadPrimitiveRoot =
|
1436
|
-
return /* @__PURE__ */
|
1449
|
+
import { forwardRef as forwardRef14 } from "react";
|
1450
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
1451
|
+
var ThreadPrimitiveRoot = forwardRef14((props, ref) => {
|
1452
|
+
return /* @__PURE__ */ jsx24(Primitive10.div, { ...props, ref });
|
1437
1453
|
});
|
1438
1454
|
ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
|
1439
1455
|
|
@@ -1459,7 +1475,7 @@ ThreadPrimitiveIf.displayName = "ThreadPrimitive.If";
|
|
1459
1475
|
// src/primitives/thread/ThreadViewport.tsx
|
1460
1476
|
import { useComposedRefs as useComposedRefs3 } from "@radix-ui/react-compose-refs";
|
1461
1477
|
import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
|
1462
|
-
import { forwardRef as
|
1478
|
+
import { forwardRef as forwardRef15 } from "react";
|
1463
1479
|
|
1464
1480
|
// src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx
|
1465
1481
|
import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
|
@@ -1592,13 +1608,13 @@ var useThreadViewportAutoScroll = ({
|
|
1592
1608
|
};
|
1593
1609
|
|
1594
1610
|
// src/primitives/thread/ThreadViewport.tsx
|
1595
|
-
import { jsx as
|
1596
|
-
var ThreadPrimitiveViewport =
|
1611
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
1612
|
+
var ThreadPrimitiveViewport = forwardRef15(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
|
1597
1613
|
const autoScrollRef = useThreadViewportAutoScroll({
|
1598
1614
|
autoScroll
|
1599
1615
|
});
|
1600
1616
|
const ref = useComposedRefs3(forwardedRef, autoScrollRef);
|
1601
|
-
return /* @__PURE__ */
|
1617
|
+
return /* @__PURE__ */ jsx25(Primitive11.div, { ...rest, ref, children });
|
1602
1618
|
});
|
1603
1619
|
ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
|
1604
1620
|
|
@@ -1648,7 +1664,7 @@ var makeMessageUtilsStore = () => create11((set) => ({
|
|
1648
1664
|
}));
|
1649
1665
|
|
1650
1666
|
// src/context/providers/MessageProvider.tsx
|
1651
|
-
import { jsx as
|
1667
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
1652
1668
|
var getIsLast = (messages, message) => {
|
1653
1669
|
return messages[messages.length - 1]?.id === message.id;
|
1654
1670
|
};
|
@@ -1724,11 +1740,11 @@ var MessageProvider = ({
|
|
1724
1740
|
children
|
1725
1741
|
}) => {
|
1726
1742
|
const context = useMessageContext2(messageIndex);
|
1727
|
-
return /* @__PURE__ */
|
1743
|
+
return /* @__PURE__ */ jsx26(MessageContext.Provider, { value: context, children });
|
1728
1744
|
};
|
1729
1745
|
|
1730
1746
|
// src/primitives/thread/ThreadMessages.tsx
|
1731
|
-
import { jsx as
|
1747
|
+
import { jsx as jsx27, jsxs as jsxs3 } from "react/jsx-runtime";
|
1732
1748
|
var getComponents = (components) => {
|
1733
1749
|
return {
|
1734
1750
|
EditComposer: components.EditComposer ?? components.UserMessage ?? components.Message,
|
@@ -1743,10 +1759,10 @@ var ThreadMessageImpl = ({
|
|
1743
1759
|
const { UserMessage, EditComposer, AssistantMessage } = getComponents(components);
|
1744
1760
|
return /* @__PURE__ */ jsxs3(MessageProvider, { messageIndex, children: [
|
1745
1761
|
/* @__PURE__ */ jsxs3(MessagePrimitiveIf, { user: true, children: [
|
1746
|
-
/* @__PURE__ */
|
1747
|
-
/* @__PURE__ */
|
1762
|
+
/* @__PURE__ */ jsx27(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx27(UserMessage, {}) }),
|
1763
|
+
/* @__PURE__ */ jsx27(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx27(EditComposer, {}) })
|
1748
1764
|
] }),
|
1749
|
-
/* @__PURE__ */
|
1765
|
+
/* @__PURE__ */ jsx27(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx27(AssistantMessage, {}) })
|
1750
1766
|
] });
|
1751
1767
|
};
|
1752
1768
|
var ThreadMessage = memo3(
|
@@ -1761,7 +1777,7 @@ var ThreadPrimitiveMessages = ({
|
|
1761
1777
|
if (messagesLength === 0) return null;
|
1762
1778
|
return new Array(messagesLength).fill(null).map((_, idx) => {
|
1763
1779
|
const messageIndex = idx;
|
1764
|
-
return /* @__PURE__ */
|
1780
|
+
return /* @__PURE__ */ jsx27(
|
1765
1781
|
ThreadMessage,
|
1766
1782
|
{
|
1767
1783
|
messageIndex,
|