@assistant-ui/react 0.5.73 → 0.5.74
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +55 -7
- package/dist/index.d.ts +55 -7
- package/dist/index.js +160 -123
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +391 -354
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -673,12 +673,7 @@ var useBranchPickerCount = () => {
|
|
673
673
|
import { useCallback as useCallback10 } from "react";
|
674
674
|
var useBranchPickerNext = () => {
|
675
675
|
const messageRuntime = useMessageRuntime();
|
676
|
-
const
|
677
|
-
const editComposerStore = useEditComposerStore();
|
678
|
-
const disabled = useCombinedStore(
|
679
|
-
[messageStore, editComposerStore],
|
680
|
-
(m, c) => c.isEditing || m.branchNumber >= m.branchCount
|
681
|
-
);
|
676
|
+
const disabled = useMessage((m) => m.branchNumber >= m.branchCount);
|
682
677
|
const callback = useCallback10(() => {
|
683
678
|
messageRuntime.switchToBranch({ position: "next" });
|
684
679
|
}, [messageRuntime]);
|
@@ -696,12 +691,7 @@ var useBranchPickerNumber = () => {
|
|
696
691
|
import { useCallback as useCallback11 } from "react";
|
697
692
|
var useBranchPickerPrevious = () => {
|
698
693
|
const messageRuntime = useMessageRuntime();
|
699
|
-
const
|
700
|
-
const editComposerStore = useEditComposerStore();
|
701
|
-
const disabled = useCombinedStore(
|
702
|
-
[messageStore, editComposerStore],
|
703
|
-
(m, c) => c.isEditing || m.branchNumber <= 1
|
704
|
-
);
|
694
|
+
const disabled = useMessage((m) => m.branchNumber <= 1);
|
705
695
|
const callback = useCallback11(() => {
|
706
696
|
messageRuntime.switchToBranch({ position: "previous" });
|
707
697
|
}, [messageRuntime]);
|
@@ -1239,6 +1229,119 @@ var AssistantModalPrimitiveAnchor = forwardRef9(
|
|
1239
1229
|
);
|
1240
1230
|
AssistantModalPrimitiveAnchor.displayName = "AssistantModalPrimitive.Anchor";
|
1241
1231
|
|
1232
|
+
// src/primitives/attachment/index.ts
|
1233
|
+
var attachment_exports = {};
|
1234
|
+
__export(attachment_exports, {
|
1235
|
+
Name: () => AttachmentPrimitiveName,
|
1236
|
+
Remove: () => AttachmentPrimitiveRemove,
|
1237
|
+
Root: () => AttachmentPrimitiveRoot,
|
1238
|
+
unstable_Thumb: () => AttachmentPrimitiveThumb
|
1239
|
+
});
|
1240
|
+
|
1241
|
+
// src/primitives/attachment/AttachmentRoot.tsx
|
1242
|
+
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
1243
|
+
import { forwardRef as forwardRef10 } from "react";
|
1244
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
1245
|
+
var AttachmentPrimitiveRoot = forwardRef10((props, ref) => {
|
1246
|
+
return /* @__PURE__ */ jsx14(Primitive7.div, { ...props, ref });
|
1247
|
+
});
|
1248
|
+
AttachmentPrimitiveRoot.displayName = "AttachmentPrimitive.Root";
|
1249
|
+
|
1250
|
+
// src/primitives/attachment/AttachmentThumb.tsx
|
1251
|
+
import { forwardRef as forwardRef11 } from "react";
|
1252
|
+
|
1253
|
+
// src/context/react/AttachmentContext.ts
|
1254
|
+
import { createContext as createContext5, useContext as useContext2 } from "react";
|
1255
|
+
var AttachmentContext = createContext5(
|
1256
|
+
null
|
1257
|
+
);
|
1258
|
+
function useAttachmentContext(options) {
|
1259
|
+
const context = useContext2(AttachmentContext);
|
1260
|
+
if (!options?.optional && !context)
|
1261
|
+
throw new Error(
|
1262
|
+
"This component must be used within a ComposerPrimitive.Attachments or MessagePrimitive.Attachments component."
|
1263
|
+
);
|
1264
|
+
return context;
|
1265
|
+
}
|
1266
|
+
function useThreadComposerAttachmentContext(options) {
|
1267
|
+
const context = useAttachmentContext(options);
|
1268
|
+
if (!context) return null;
|
1269
|
+
if (context.source !== "thread-composer")
|
1270
|
+
throw new Error(
|
1271
|
+
"This component must be used within a thread's ComposerPrimitive.Attachments component."
|
1272
|
+
);
|
1273
|
+
return context;
|
1274
|
+
}
|
1275
|
+
function useEditComposerAttachmentContext(options) {
|
1276
|
+
const context = useAttachmentContext(options);
|
1277
|
+
if (!context) return null;
|
1278
|
+
if (context.source !== "edit-composer")
|
1279
|
+
throw new Error(
|
1280
|
+
"This component must be used within a messages's ComposerPrimitive.Attachments component."
|
1281
|
+
);
|
1282
|
+
return context;
|
1283
|
+
}
|
1284
|
+
function useMessageAttachmentContext(options) {
|
1285
|
+
const context = useAttachmentContext(options);
|
1286
|
+
if (!context) return null;
|
1287
|
+
if (context.source !== "message")
|
1288
|
+
throw new Error(
|
1289
|
+
"This component must be used within a MessagePrimitive.Attachments component."
|
1290
|
+
);
|
1291
|
+
return context;
|
1292
|
+
}
|
1293
|
+
function useAttachmentRuntime(options) {
|
1294
|
+
const attachmentRuntime = useAttachmentContext(options);
|
1295
|
+
if (!attachmentRuntime) return null;
|
1296
|
+
return attachmentRuntime.useAttachmentRuntime();
|
1297
|
+
}
|
1298
|
+
var { useAttachment } = createContextStoreHook(
|
1299
|
+
useAttachmentContext,
|
1300
|
+
"useAttachment"
|
1301
|
+
);
|
1302
|
+
var { useAttachment: useThreadComposerAttachment } = createContextStoreHook(useThreadComposerAttachmentContext, "useAttachment");
|
1303
|
+
var { useAttachment: useEditComposerAttachment } = createContextStoreHook(useEditComposerAttachmentContext, "useAttachment");
|
1304
|
+
var { useAttachment: useMessageAttachment } = createContextStoreHook(
|
1305
|
+
useMessageAttachmentContext,
|
1306
|
+
"useAttachment"
|
1307
|
+
);
|
1308
|
+
|
1309
|
+
// src/primitives/attachment/AttachmentThumb.tsx
|
1310
|
+
import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
1311
|
+
import { jsxs } from "react/jsx-runtime";
|
1312
|
+
var AttachmentPrimitiveThumb = forwardRef11(() => {
|
1313
|
+
const ext = useAttachment((a) => a.name.split(".").pop());
|
1314
|
+
return /* @__PURE__ */ jsxs(Primitive8.div, { children: [
|
1315
|
+
".",
|
1316
|
+
ext
|
1317
|
+
] });
|
1318
|
+
});
|
1319
|
+
AttachmentPrimitiveThumb.displayName = "AttachmentPrimitive.Thumb";
|
1320
|
+
|
1321
|
+
// src/primitives/attachment/AttachmentName.tsx
|
1322
|
+
import { Fragment, jsx as jsx15 } from "react/jsx-runtime";
|
1323
|
+
var AttachmentPrimitiveName = () => {
|
1324
|
+
const name = useAttachment((a) => a.name);
|
1325
|
+
return /* @__PURE__ */ jsx15(Fragment, { children: name });
|
1326
|
+
};
|
1327
|
+
AttachmentPrimitiveName.displayName = "AttachmentPrimitive.Name";
|
1328
|
+
|
1329
|
+
// src/primitive-hooks/attachment/useAttachmentRemove.ts
|
1330
|
+
import { useCallback as useCallback17 } from "react";
|
1331
|
+
var useAttachmentRemove = () => {
|
1332
|
+
const attachmentRuntime = useAttachmentRuntime();
|
1333
|
+
const handleRemoveAttachment = useCallback17(() => {
|
1334
|
+
attachmentRuntime.remove();
|
1335
|
+
}, [attachmentRuntime]);
|
1336
|
+
return handleRemoveAttachment;
|
1337
|
+
};
|
1338
|
+
|
1339
|
+
// src/primitives/attachment/AttachmentRemove.tsx
|
1340
|
+
var AttachmentPrimitiveRemove = createActionButton(
|
1341
|
+
"AttachmentPrimitive.Remove",
|
1342
|
+
useAttachmentRemove
|
1343
|
+
);
|
1344
|
+
|
1242
1345
|
// src/primitives/branchPicker/index.ts
|
1243
1346
|
var branchPicker_exports = {};
|
1244
1347
|
__export(branchPicker_exports, {
|
@@ -1262,24 +1365,24 @@ var BranchPickerPrevious = createActionButton(
|
|
1262
1365
|
);
|
1263
1366
|
|
1264
1367
|
// src/primitives/branchPicker/BranchPickerCount.tsx
|
1265
|
-
import { Fragment, jsx as
|
1368
|
+
import { Fragment as Fragment2, jsx as jsx16 } from "react/jsx-runtime";
|
1266
1369
|
var BranchPickerPrimitiveCount = () => {
|
1267
1370
|
const branchCount = useBranchPickerCount();
|
1268
|
-
return /* @__PURE__ */
|
1371
|
+
return /* @__PURE__ */ jsx16(Fragment2, { children: branchCount });
|
1269
1372
|
};
|
1270
1373
|
BranchPickerPrimitiveCount.displayName = "BranchPickerPrimitive.Count";
|
1271
1374
|
|
1272
1375
|
// src/primitives/branchPicker/BranchPickerNumber.tsx
|
1273
|
-
import { Fragment as
|
1376
|
+
import { Fragment as Fragment3, jsx as jsx17 } from "react/jsx-runtime";
|
1274
1377
|
var BranchPickerPrimitiveNumber = () => {
|
1275
1378
|
const branchNumber = useBranchPickerNumber();
|
1276
|
-
return /* @__PURE__ */
|
1379
|
+
return /* @__PURE__ */ jsx17(Fragment3, { children: branchNumber });
|
1277
1380
|
};
|
1278
1381
|
BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
|
1279
1382
|
|
1280
1383
|
// src/primitives/branchPicker/BranchPickerRoot.tsx
|
1281
|
-
import { Primitive as
|
1282
|
-
import { forwardRef as
|
1384
|
+
import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
|
1385
|
+
import { forwardRef as forwardRef16 } from "react";
|
1283
1386
|
|
1284
1387
|
// src/primitives/message/index.ts
|
1285
1388
|
var message_exports = {};
|
@@ -1292,17 +1395,17 @@ __export(message_exports, {
|
|
1292
1395
|
});
|
1293
1396
|
|
1294
1397
|
// src/primitives/message/MessageRoot.tsx
|
1295
|
-
import { Primitive as
|
1398
|
+
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
1296
1399
|
import {
|
1297
|
-
forwardRef as
|
1298
|
-
useCallback as
|
1400
|
+
forwardRef as forwardRef12,
|
1401
|
+
useCallback as useCallback19
|
1299
1402
|
} from "react";
|
1300
1403
|
|
1301
1404
|
// src/utils/hooks/useManagedRef.ts
|
1302
|
-
import { useCallback as
|
1405
|
+
import { useCallback as useCallback18, useRef } from "react";
|
1303
1406
|
var useManagedRef = (callback) => {
|
1304
1407
|
const cleanupRef = useRef();
|
1305
|
-
const ref =
|
1408
|
+
const ref = useCallback18(
|
1306
1409
|
(el) => {
|
1307
1410
|
if (cleanupRef.current) {
|
1308
1411
|
cleanupRef.current();
|
@@ -1318,10 +1421,10 @@ var useManagedRef = (callback) => {
|
|
1318
1421
|
|
1319
1422
|
// src/primitives/message/MessageRoot.tsx
|
1320
1423
|
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
1321
|
-
import { jsx as
|
1424
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
1322
1425
|
var useIsHoveringRef = () => {
|
1323
1426
|
const messageUtilsStore = useMessageUtilsStore();
|
1324
|
-
const callbackRef =
|
1427
|
+
const callbackRef = useCallback19(
|
1325
1428
|
(el) => {
|
1326
1429
|
const setIsHovering = messageUtilsStore.getState().setIsHovering;
|
1327
1430
|
const handleMouseEnter = () => {
|
@@ -1342,10 +1445,10 @@ var useIsHoveringRef = () => {
|
|
1342
1445
|
);
|
1343
1446
|
return useManagedRef(callbackRef);
|
1344
1447
|
};
|
1345
|
-
var MessagePrimitiveRoot =
|
1448
|
+
var MessagePrimitiveRoot = forwardRef12((props, forwardRef35) => {
|
1346
1449
|
const isHoveringRef = useIsHoveringRef();
|
1347
|
-
const ref = useComposedRefs(
|
1348
|
-
return /* @__PURE__ */
|
1450
|
+
const ref = useComposedRefs(forwardRef35, isHoveringRef);
|
1451
|
+
return /* @__PURE__ */ jsx18(Primitive9.div, { ...props, ref });
|
1349
1452
|
});
|
1350
1453
|
MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
|
1351
1454
|
|
@@ -1365,7 +1468,7 @@ import { memo as memo2, useMemo as useMemo6 } from "react";
|
|
1365
1468
|
// src/context/providers/ContentPartRuntimeProvider.tsx
|
1366
1469
|
import { useEffect as useEffect8, useState as useState5 } from "react";
|
1367
1470
|
import { create as create6 } from "zustand";
|
1368
|
-
import { jsx as
|
1471
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
1369
1472
|
var useContentPartRuntimeStore = (runtime) => {
|
1370
1473
|
const [store] = useState5(() => create6(() => runtime));
|
1371
1474
|
useEffect8(() => {
|
@@ -1391,12 +1494,12 @@ var ContentPartRuntimeProvider = ({
|
|
1391
1494
|
const [context] = useState5(() => {
|
1392
1495
|
return { useContentPartRuntime: useContentPartRuntime2, useContentPart: useContentPart2 };
|
1393
1496
|
});
|
1394
|
-
return /* @__PURE__ */
|
1497
|
+
return /* @__PURE__ */ jsx19(ContentPartContext.Provider, { value: context, children });
|
1395
1498
|
};
|
1396
1499
|
|
1397
1500
|
// src/primitives/contentPart/ContentPartText.tsx
|
1398
1501
|
import {
|
1399
|
-
forwardRef as
|
1502
|
+
forwardRef as forwardRef14
|
1400
1503
|
} from "react";
|
1401
1504
|
|
1402
1505
|
// src/utils/smooth/useSmooth.tsx
|
@@ -1405,14 +1508,14 @@ import { useCallbackRef as useCallbackRef2 } from "@radix-ui/react-use-callback-
|
|
1405
1508
|
|
1406
1509
|
// src/utils/smooth/SmoothContext.tsx
|
1407
1510
|
import {
|
1408
|
-
createContext as
|
1409
|
-
forwardRef as
|
1410
|
-
useContext as
|
1511
|
+
createContext as createContext6,
|
1512
|
+
forwardRef as forwardRef13,
|
1513
|
+
useContext as useContext3,
|
1411
1514
|
useState as useState6
|
1412
1515
|
} from "react";
|
1413
1516
|
import { create as create7 } from "zustand";
|
1414
|
-
import { jsx as
|
1415
|
-
var SmoothContext =
|
1517
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
1518
|
+
var SmoothContext = createContext6(null);
|
1416
1519
|
var makeSmoothContext = (initialState) => {
|
1417
1520
|
const useSmoothStatus2 = create7(() => initialState);
|
1418
1521
|
return { useSmoothStatus: useSmoothStatus2 };
|
@@ -1424,17 +1527,17 @@ var SmoothContextProvider = ({ children }) => {
|
|
1424
1527
|
() => makeSmoothContext(contentPartStore.getState().status)
|
1425
1528
|
);
|
1426
1529
|
if (outer) return children;
|
1427
|
-
return /* @__PURE__ */
|
1530
|
+
return /* @__PURE__ */ jsx20(SmoothContext.Provider, { value: context, children });
|
1428
1531
|
};
|
1429
1532
|
var withSmoothContextProvider = (Component) => {
|
1430
|
-
const Wrapped =
|
1431
|
-
return /* @__PURE__ */
|
1533
|
+
const Wrapped = forwardRef13((props, ref) => {
|
1534
|
+
return /* @__PURE__ */ jsx20(SmoothContextProvider, { children: /* @__PURE__ */ jsx20(Component, { ...props, ref }) });
|
1432
1535
|
});
|
1433
1536
|
Wrapped.displayName = Component.displayName;
|
1434
1537
|
return Wrapped;
|
1435
1538
|
};
|
1436
1539
|
function useSmoothContext(options) {
|
1437
|
-
const context =
|
1540
|
+
const context = useContext3(SmoothContext);
|
1438
1541
|
if (!options?.optional && !context)
|
1439
1542
|
throw new Error(
|
1440
1543
|
"This component must be used within a SmoothContextProvider."
|
@@ -1554,20 +1657,20 @@ var useSmooth = (state, smooth = false) => {
|
|
1554
1657
|
};
|
1555
1658
|
|
1556
1659
|
// src/primitives/contentPart/ContentPartText.tsx
|
1557
|
-
import { jsx as
|
1558
|
-
var ContentPartPrimitiveText =
|
1660
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
1661
|
+
var ContentPartPrimitiveText = forwardRef14(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
|
1559
1662
|
const { text, status } = useSmooth(useContentPartText(), smooth);
|
1560
|
-
return /* @__PURE__ */
|
1663
|
+
return /* @__PURE__ */ jsx21(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
|
1561
1664
|
});
|
1562
1665
|
ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
|
1563
1666
|
|
1564
1667
|
// src/primitives/contentPart/ContentPartImage.tsx
|
1565
|
-
import { Primitive as
|
1566
|
-
import { forwardRef as
|
1567
|
-
import { jsx as
|
1568
|
-
var ContentPartPrimitiveImage =
|
1668
|
+
import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
|
1669
|
+
import { forwardRef as forwardRef15 } from "react";
|
1670
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
1671
|
+
var ContentPartPrimitiveImage = forwardRef15((props, forwardedRef) => {
|
1569
1672
|
const { image } = useContentPartImage();
|
1570
|
-
return /* @__PURE__ */
|
1673
|
+
return /* @__PURE__ */ jsx22(Primitive10.img, { src: image, ...props, ref: forwardedRef });
|
1571
1674
|
});
|
1572
1675
|
ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
|
1573
1676
|
|
@@ -2136,22 +2239,22 @@ var MessageRuntimeImpl = class {
|
|
2136
2239
|
};
|
2137
2240
|
|
2138
2241
|
// src/primitives/message/MessageContent.tsx
|
2139
|
-
import { jsx as
|
2242
|
+
import { jsx as jsx23, jsxs as jsxs2 } from "react/jsx-runtime";
|
2140
2243
|
var ToolUIDisplay = ({
|
2141
2244
|
UI,
|
2142
2245
|
...props
|
2143
2246
|
}) => {
|
2144
2247
|
const Render = useToolUIs((s) => s.getToolUI(props.toolName)) ?? UI;
|
2145
2248
|
if (!Render) return null;
|
2146
|
-
return /* @__PURE__ */
|
2249
|
+
return /* @__PURE__ */ jsx23(Render, { ...props });
|
2147
2250
|
};
|
2148
2251
|
var defaultComponents = {
|
2149
|
-
Text: () => /* @__PURE__ */
|
2150
|
-
/* @__PURE__ */
|
2151
|
-
/* @__PURE__ */
|
2252
|
+
Text: () => /* @__PURE__ */ jsxs2("p", { style: { whiteSpace: "pre-line" }, children: [
|
2253
|
+
/* @__PURE__ */ jsx23(ContentPartPrimitiveText, {}),
|
2254
|
+
/* @__PURE__ */ jsx23(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx23("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
|
2152
2255
|
] }),
|
2153
|
-
Image: () => /* @__PURE__ */
|
2154
|
-
UI: () => /* @__PURE__ */
|
2256
|
+
Image: () => /* @__PURE__ */ jsx23(ContentPartPrimitiveImage, {}),
|
2257
|
+
UI: () => /* @__PURE__ */ jsx23(ContentPartPrimitiveDisplay, {})
|
2155
2258
|
};
|
2156
2259
|
var MessageContentPartComponent = ({
|
2157
2260
|
components: {
|
@@ -2171,17 +2274,17 @@ var MessageContentPartComponent = ({
|
|
2171
2274
|
if (part.status.type === "requires-action")
|
2172
2275
|
throw new Error("Encountered unexpected requires-action status");
|
2173
2276
|
if (part.part === EMPTY_CONTENT && !!Empty) {
|
2174
|
-
return /* @__PURE__ */
|
2277
|
+
return /* @__PURE__ */ jsx23(Empty, { status: part.status });
|
2175
2278
|
}
|
2176
|
-
return /* @__PURE__ */
|
2279
|
+
return /* @__PURE__ */ jsx23(Text2, { ...part, part });
|
2177
2280
|
case "image":
|
2178
2281
|
if (part.status.type === "requires-action")
|
2179
2282
|
throw new Error("Encountered unexpected requires-action status");
|
2180
|
-
return /* @__PURE__ */
|
2283
|
+
return /* @__PURE__ */ jsx23(Image2, { ...part, part });
|
2181
2284
|
case "ui":
|
2182
2285
|
if (part.status.type === "requires-action")
|
2183
2286
|
throw new Error("Encountered unexpected requires-action status");
|
2184
|
-
return /* @__PURE__ */
|
2287
|
+
return /* @__PURE__ */ jsx23(UI, { ...part, part });
|
2185
2288
|
case "tool-call": {
|
2186
2289
|
const Tool = by_name[part.toolName] || Fallback2;
|
2187
2290
|
const addResult = (result) => threadRuntime.addToolResult({
|
@@ -2190,7 +2293,7 @@ var MessageContentPartComponent = ({
|
|
2190
2293
|
toolCallId: part.toolCallId,
|
2191
2294
|
result
|
2192
2295
|
});
|
2193
|
-
return /* @__PURE__ */
|
2296
|
+
return /* @__PURE__ */ jsx23(ToolUIDisplay, { ...part, part, UI: Tool, addResult });
|
2194
2297
|
}
|
2195
2298
|
default:
|
2196
2299
|
const unhandledType = type;
|
@@ -2206,7 +2309,7 @@ var MessageContentPartImpl = ({
|
|
2206
2309
|
() => messageRuntime.getContentPartByIndex(partIndex),
|
2207
2310
|
[messageRuntime, partIndex]
|
2208
2311
|
);
|
2209
|
-
return /* @__PURE__ */
|
2312
|
+
return /* @__PURE__ */ jsx23(ContentPartRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx23(MessageContentPartComponent, { components }) });
|
2210
2313
|
};
|
2211
2314
|
var MessageContentPart = memo2(
|
2212
2315
|
MessageContentPartImpl,
|
@@ -2216,7 +2319,7 @@ var MessagePrimitiveContent = ({
|
|
2216
2319
|
components
|
2217
2320
|
}) => {
|
2218
2321
|
const contentLength = useMessage((s) => s.content.length) || 1;
|
2219
|
-
return Array.from({ length: contentLength }, (_, index) => /* @__PURE__ */
|
2322
|
+
return Array.from({ length: contentLength }, (_, index) => /* @__PURE__ */ jsx23(MessageContentPart, { partIndex: index, components }, index));
|
2220
2323
|
};
|
2221
2324
|
MessagePrimitiveContent.displayName = "MessagePrimitive.Content";
|
2222
2325
|
|
@@ -2229,62 +2332,6 @@ MessagePrimitiveInProgress.displayName = "MessagePrimitive.InProgress";
|
|
2229
2332
|
// src/primitives/message/MessageAttachments.tsx
|
2230
2333
|
import { memo as memo3, useMemo as useMemo8 } from "react";
|
2231
2334
|
|
2232
|
-
// src/context/react/AttachmentContext.ts
|
2233
|
-
import { createContext as createContext6, useContext as useContext3 } from "react";
|
2234
|
-
var AttachmentContext = createContext6(
|
2235
|
-
null
|
2236
|
-
);
|
2237
|
-
function useAttachmentContext(options) {
|
2238
|
-
const context = useContext3(AttachmentContext);
|
2239
|
-
if (!options?.optional && !context)
|
2240
|
-
throw new Error(
|
2241
|
-
"This component must be used within a ComposerPrimitive.Attachments or MessagePrimitive.Attachments component."
|
2242
|
-
);
|
2243
|
-
return context;
|
2244
|
-
}
|
2245
|
-
function useThreadComposerAttachmentContext(options) {
|
2246
|
-
const context = useAttachmentContext(options);
|
2247
|
-
if (!context) return null;
|
2248
|
-
if (context.source !== "thread-composer")
|
2249
|
-
throw new Error(
|
2250
|
-
"This component must be used within a thread's ComposerPrimitive.Attachments component."
|
2251
|
-
);
|
2252
|
-
return context;
|
2253
|
-
}
|
2254
|
-
function useEditComposerAttachmentContext(options) {
|
2255
|
-
const context = useAttachmentContext(options);
|
2256
|
-
if (!context) return null;
|
2257
|
-
if (context.source !== "edit-composer")
|
2258
|
-
throw new Error(
|
2259
|
-
"This component must be used within a messages's ComposerPrimitive.Attachments component."
|
2260
|
-
);
|
2261
|
-
return context;
|
2262
|
-
}
|
2263
|
-
function useMessageAttachmentContext(options) {
|
2264
|
-
const context = useAttachmentContext(options);
|
2265
|
-
if (!context) return null;
|
2266
|
-
if (context.source !== "message")
|
2267
|
-
throw new Error(
|
2268
|
-
"This component must be used within a MessagePrimitive.Attachments component."
|
2269
|
-
);
|
2270
|
-
return context;
|
2271
|
-
}
|
2272
|
-
function useAttachmentRuntime(options) {
|
2273
|
-
const attachmentRuntime = useAttachmentContext(options);
|
2274
|
-
if (!attachmentRuntime) return null;
|
2275
|
-
return attachmentRuntime.useAttachmentRuntime();
|
2276
|
-
}
|
2277
|
-
var { useAttachment } = createContextStoreHook(
|
2278
|
-
useAttachmentContext,
|
2279
|
-
"useAttachment"
|
2280
|
-
);
|
2281
|
-
var { useAttachment: useThreadComposerAttachment } = createContextStoreHook(useThreadComposerAttachmentContext, "useAttachment");
|
2282
|
-
var { useAttachment: useEditComposerAttachment } = createContextStoreHook(useEditComposerAttachmentContext, "useAttachment");
|
2283
|
-
var { useAttachment: useMessageAttachment } = createContextStoreHook(
|
2284
|
-
useMessageAttachmentContext,
|
2285
|
-
"useAttachment"
|
2286
|
-
);
|
2287
|
-
|
2288
2335
|
// src/context/providers/AttachmentRuntimeProvider.tsx
|
2289
2336
|
import {
|
2290
2337
|
useEffect as useEffect10,
|
@@ -2292,7 +2339,7 @@ import {
|
|
2292
2339
|
useState as useState8
|
2293
2340
|
} from "react";
|
2294
2341
|
import { create as create8 } from "zustand";
|
2295
|
-
import { jsx as
|
2342
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
2296
2343
|
var useAttachmentRuntimeStore = (runtime) => {
|
2297
2344
|
const [store] = useState8(() => create8(() => runtime));
|
2298
2345
|
useEffect10(() => {
|
@@ -2323,11 +2370,11 @@ var AttachmentRuntimeProvider = ({
|
|
2323
2370
|
useAttachment: useAttachment2
|
2324
2371
|
};
|
2325
2372
|
}, [useAttachmentRuntime2, useAttachment2]);
|
2326
|
-
return /* @__PURE__ */
|
2373
|
+
return /* @__PURE__ */ jsx24(AttachmentContext.Provider, { value: context, children });
|
2327
2374
|
};
|
2328
2375
|
|
2329
2376
|
// src/primitives/message/MessageAttachments.tsx
|
2330
|
-
import { jsx as
|
2377
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
2331
2378
|
var getComponent = (components, attachment) => {
|
2332
2379
|
const type = attachment.type;
|
2333
2380
|
switch (type) {
|
@@ -2347,7 +2394,7 @@ var AttachmentComponent = ({ components }) => {
|
|
2347
2394
|
(a) => getComponent(components, a.attachment)
|
2348
2395
|
);
|
2349
2396
|
if (!Component) return null;
|
2350
|
-
return /* @__PURE__ */
|
2397
|
+
return /* @__PURE__ */ jsx25(Component, {});
|
2351
2398
|
};
|
2352
2399
|
var MessageAttachmentImpl = ({ components, attachmentIndex }) => {
|
2353
2400
|
const messageRuntime = useMessageRuntime();
|
@@ -2355,7 +2402,7 @@ var MessageAttachmentImpl = ({ components, attachmentIndex }) => {
|
|
2355
2402
|
() => messageRuntime.getAttachmentByIndex(attachmentIndex),
|
2356
2403
|
[messageRuntime, attachmentIndex]
|
2357
2404
|
);
|
2358
|
-
return /* @__PURE__ */
|
2405
|
+
return /* @__PURE__ */ jsx25(AttachmentRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx25(AttachmentComponent, { components }) });
|
2359
2406
|
};
|
2360
2407
|
var MessageAttachment = memo3(
|
2361
2408
|
MessageAttachmentImpl,
|
@@ -2366,7 +2413,7 @@ var MessagePrimitiveAttachments = ({ components }) => {
|
|
2366
2413
|
if (message.role !== "user") return 0;
|
2367
2414
|
return message.attachments.length;
|
2368
2415
|
});
|
2369
|
-
return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */
|
2416
|
+
return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx25(
|
2370
2417
|
MessageAttachment,
|
2371
2418
|
{
|
2372
2419
|
attachmentIndex: index,
|
@@ -2378,9 +2425,9 @@ var MessagePrimitiveAttachments = ({ components }) => {
|
|
2378
2425
|
MessagePrimitiveAttachments.displayName = "MessagePrimitive.Attachments";
|
2379
2426
|
|
2380
2427
|
// src/primitives/branchPicker/BranchPickerRoot.tsx
|
2381
|
-
import { jsx as
|
2382
|
-
var BranchPickerPrimitiveRoot =
|
2383
|
-
return /* @__PURE__ */
|
2428
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
2429
|
+
var BranchPickerPrimitiveRoot = forwardRef16(({ hideWhenSingleBranch, ...rest }, ref) => {
|
2430
|
+
return /* @__PURE__ */ jsx26(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx26(Primitive11.div, { ...rest, ref }) });
|
2384
2431
|
});
|
2385
2432
|
BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
|
2386
2433
|
|
@@ -2398,20 +2445,20 @@ __export(composer_exports, {
|
|
2398
2445
|
|
2399
2446
|
// src/primitives/composer/ComposerRoot.tsx
|
2400
2447
|
import { composeEventHandlers as composeEventHandlers8 } from "@radix-ui/primitive";
|
2401
|
-
import { Primitive as
|
2448
|
+
import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
|
2402
2449
|
import {
|
2403
|
-
forwardRef as
|
2450
|
+
forwardRef as forwardRef17
|
2404
2451
|
} from "react";
|
2405
|
-
import { jsx as
|
2406
|
-
var ComposerPrimitiveRoot =
|
2452
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
2453
|
+
var ComposerPrimitiveRoot = forwardRef17(({ onSubmit, ...rest }, forwardedRef) => {
|
2407
2454
|
const send = useComposerSend();
|
2408
2455
|
const handleSubmit = (e) => {
|
2409
2456
|
e.preventDefault();
|
2410
2457
|
if (!send) return;
|
2411
2458
|
send();
|
2412
2459
|
};
|
2413
|
-
return /* @__PURE__ */
|
2414
|
-
|
2460
|
+
return /* @__PURE__ */ jsx27(
|
2461
|
+
Primitive12.form,
|
2415
2462
|
{
|
2416
2463
|
...rest,
|
2417
2464
|
ref: forwardedRef,
|
@@ -2426,15 +2473,15 @@ import { composeEventHandlers as composeEventHandlers9 } from "@radix-ui/primiti
|
|
2426
2473
|
import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
|
2427
2474
|
import { Slot } from "@radix-ui/react-slot";
|
2428
2475
|
import {
|
2429
|
-
forwardRef as
|
2430
|
-
useCallback as
|
2476
|
+
forwardRef as forwardRef18,
|
2477
|
+
useCallback as useCallback20,
|
2431
2478
|
useEffect as useEffect11,
|
2432
2479
|
useRef as useRef3
|
2433
2480
|
} from "react";
|
2434
2481
|
import TextareaAutosize from "react-textarea-autosize";
|
2435
2482
|
import { useEscapeKeydown as useEscapeKeydown2 } from "@radix-ui/react-use-escape-keydown";
|
2436
|
-
import { jsx as
|
2437
|
-
var ComposerPrimitiveInput =
|
2483
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
2484
|
+
var ComposerPrimitiveInput = forwardRef18(
|
2438
2485
|
({
|
2439
2486
|
autoFocus = false,
|
2440
2487
|
asChild,
|
@@ -2475,7 +2522,7 @@ var ComposerPrimitiveInput = forwardRef16(
|
|
2475
2522
|
}
|
2476
2523
|
};
|
2477
2524
|
const autoFocusEnabled = autoFocus && !isDisabled;
|
2478
|
-
const focus =
|
2525
|
+
const focus = useCallback20(() => {
|
2479
2526
|
const textarea = textareaRef.current;
|
2480
2527
|
if (!textarea || !autoFocusEnabled) return;
|
2481
2528
|
textarea.focus({ preventScroll: true });
|
@@ -2490,7 +2537,7 @@ var ComposerPrimitiveInput = forwardRef16(
|
|
2490
2537
|
focus();
|
2491
2538
|
}
|
2492
2539
|
});
|
2493
|
-
return /* @__PURE__ */
|
2540
|
+
return /* @__PURE__ */ jsx28(
|
2494
2541
|
Component,
|
2495
2542
|
{
|
2496
2543
|
name: "input",
|
@@ -2530,7 +2577,7 @@ var ComposerPrimitiveAddAttachment = createActionButton(
|
|
2530
2577
|
|
2531
2578
|
// src/primitives/composer/ComposerAttachments.tsx
|
2532
2579
|
import { memo as memo4, useMemo as useMemo9 } from "react";
|
2533
|
-
import { jsx as
|
2580
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
2534
2581
|
var getComponent2 = (components, attachment) => {
|
2535
2582
|
const type = attachment.type;
|
2536
2583
|
switch (type) {
|
@@ -2550,7 +2597,7 @@ var AttachmentComponent2 = ({ components }) => {
|
|
2550
2597
|
(a) => getComponent2(components, a)
|
2551
2598
|
);
|
2552
2599
|
if (!Component) return null;
|
2553
|
-
return /* @__PURE__ */
|
2600
|
+
return /* @__PURE__ */ jsx29(Component, {});
|
2554
2601
|
};
|
2555
2602
|
var ComposerAttachmentImpl = ({ components, attachmentIndex }) => {
|
2556
2603
|
const composerRuntime = useComposerRuntime();
|
@@ -2558,7 +2605,7 @@ var ComposerAttachmentImpl = ({ components, attachmentIndex }) => {
|
|
2558
2605
|
() => composerRuntime.getAttachmentByIndex(attachmentIndex),
|
2559
2606
|
[composerRuntime, attachmentIndex]
|
2560
2607
|
);
|
2561
|
-
return /* @__PURE__ */
|
2608
|
+
return /* @__PURE__ */ jsx29(AttachmentRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx29(AttachmentComponent2, { components }) });
|
2562
2609
|
};
|
2563
2610
|
var ComposerAttachment = memo4(
|
2564
2611
|
ComposerAttachmentImpl,
|
@@ -2566,7 +2613,7 @@ var ComposerAttachment = memo4(
|
|
2566
2613
|
);
|
2567
2614
|
var ComposerPrimitiveAttachments = ({ components }) => {
|
2568
2615
|
const attachmentsCount = useComposer((s) => s.attachments.length);
|
2569
|
-
return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */
|
2616
|
+
return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx29(
|
2570
2617
|
ComposerAttachment,
|
2571
2618
|
{
|
2572
2619
|
attachmentIndex: index,
|
@@ -2609,11 +2656,11 @@ __export(thread_exports, {
|
|
2609
2656
|
});
|
2610
2657
|
|
2611
2658
|
// src/primitives/thread/ThreadRoot.tsx
|
2612
|
-
import { Primitive as
|
2613
|
-
import { forwardRef as
|
2614
|
-
import { jsx as
|
2615
|
-
var ThreadPrimitiveRoot =
|
2616
|
-
return /* @__PURE__ */
|
2659
|
+
import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
|
2660
|
+
import { forwardRef as forwardRef19 } from "react";
|
2661
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
2662
|
+
var ThreadPrimitiveRoot = forwardRef19((props, ref) => {
|
2663
|
+
return /* @__PURE__ */ jsx30(Primitive13.div, { ...props, ref });
|
2617
2664
|
});
|
2618
2665
|
ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
|
2619
2666
|
|
@@ -2638,8 +2685,8 @@ ThreadPrimitiveIf.displayName = "ThreadPrimitive.If";
|
|
2638
2685
|
|
2639
2686
|
// src/primitives/thread/ThreadViewport.tsx
|
2640
2687
|
import { useComposedRefs as useComposedRefs4 } from "@radix-ui/react-compose-refs";
|
2641
|
-
import { Primitive as
|
2642
|
-
import { forwardRef as
|
2688
|
+
import { Primitive as Primitive14 } from "@radix-ui/react-primitive";
|
2689
|
+
import { forwardRef as forwardRef20 } from "react";
|
2643
2690
|
|
2644
2691
|
// src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx
|
2645
2692
|
import { useComposedRefs as useComposedRefs3 } from "@radix-ui/react-compose-refs";
|
@@ -2647,10 +2694,10 @@ import { useRef as useRef4 } from "react";
|
|
2647
2694
|
|
2648
2695
|
// src/utils/hooks/useOnResizeContent.tsx
|
2649
2696
|
import { useCallbackRef as useCallbackRef3 } from "@radix-ui/react-use-callback-ref";
|
2650
|
-
import { useCallback as
|
2697
|
+
import { useCallback as useCallback21 } from "react";
|
2651
2698
|
var useOnResizeContent = (callback) => {
|
2652
2699
|
const callbackRef = useCallbackRef3(callback);
|
2653
|
-
const refCallback =
|
2700
|
+
const refCallback = useCallback21(
|
2654
2701
|
(el) => {
|
2655
2702
|
const resizeObserver = new ResizeObserver(() => {
|
2656
2703
|
callbackRef();
|
@@ -2750,13 +2797,13 @@ var useThreadViewportAutoScroll = ({
|
|
2750
2797
|
};
|
2751
2798
|
|
2752
2799
|
// src/primitives/thread/ThreadViewport.tsx
|
2753
|
-
import { jsx as
|
2754
|
-
var ThreadPrimitiveViewport =
|
2800
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
2801
|
+
var ThreadPrimitiveViewport = forwardRef20(({ autoScroll, children, ...rest }, forwardedRef) => {
|
2755
2802
|
const autoScrollRef = useThreadViewportAutoScroll({
|
2756
2803
|
autoScroll
|
2757
2804
|
});
|
2758
2805
|
const ref = useComposedRefs4(forwardedRef, autoScrollRef);
|
2759
|
-
return /* @__PURE__ */
|
2806
|
+
return /* @__PURE__ */ jsx31(Primitive14.div, { ...rest, ref, children });
|
2760
2807
|
});
|
2761
2808
|
ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
|
2762
2809
|
|
@@ -2799,7 +2846,7 @@ var makeMessageUtilsStore = () => create9((set) => {
|
|
2799
2846
|
});
|
2800
2847
|
|
2801
2848
|
// src/context/providers/MessageRuntimeProvider.tsx
|
2802
|
-
import { jsx as
|
2849
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
2803
2850
|
var useMessageRuntimeStore = (runtime) => {
|
2804
2851
|
const [store] = useState9(() => create10(() => runtime));
|
2805
2852
|
useEffect13(() => {
|
@@ -2841,11 +2888,11 @@ var MessageRuntimeProvider = ({
|
|
2841
2888
|
const [context] = useState9(() => {
|
2842
2889
|
return { useMessageRuntime: useMessageRuntime2, useMessage: useMessage2, useMessageUtils: useMessageUtils2, useEditComposer: useEditComposer2 };
|
2843
2890
|
});
|
2844
|
-
return /* @__PURE__ */
|
2891
|
+
return /* @__PURE__ */ jsx32(MessageContext.Provider, { value: context, children });
|
2845
2892
|
};
|
2846
2893
|
|
2847
2894
|
// src/primitives/thread/ThreadMessages.tsx
|
2848
|
-
import { jsx as
|
2895
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
2849
2896
|
var isComponentsSame = (prev, next) => {
|
2850
2897
|
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;
|
2851
2898
|
};
|
@@ -2881,7 +2928,7 @@ var ThreadMessageComponent = ({
|
|
2881
2928
|
const role = useMessage((m) => m.role);
|
2882
2929
|
const isEditing = useEditComposer((c) => c.isEditing);
|
2883
2930
|
const Component = getComponent3(components, role, isEditing);
|
2884
|
-
return /* @__PURE__ */
|
2931
|
+
return /* @__PURE__ */ jsx33(Component, {});
|
2885
2932
|
};
|
2886
2933
|
var ThreadMessageImpl = ({
|
2887
2934
|
messageIndex,
|
@@ -2892,7 +2939,7 @@ var ThreadMessageImpl = ({
|
|
2892
2939
|
() => threadRuntime.getMesssageByIndex(messageIndex),
|
2893
2940
|
[threadRuntime, messageIndex]
|
2894
2941
|
);
|
2895
|
-
return /* @__PURE__ */
|
2942
|
+
return /* @__PURE__ */ jsx33(MessageRuntimeProvider, { runtime, children: /* @__PURE__ */ jsx33(ThreadMessageComponent, { components }) });
|
2896
2943
|
};
|
2897
2944
|
var ThreadMessage = memo5(
|
2898
2945
|
ThreadMessageImpl,
|
@@ -2903,7 +2950,7 @@ var ThreadPrimitiveMessagesImpl = ({
|
|
2903
2950
|
}) => {
|
2904
2951
|
const messagesLength = useThread((t) => t.messages.length);
|
2905
2952
|
if (messagesLength === 0) return null;
|
2906
|
-
return Array.from({ length: messagesLength }, (_, index) => /* @__PURE__ */
|
2953
|
+
return Array.from({ length: messagesLength }, (_, index) => /* @__PURE__ */ jsx33(ThreadMessage, { messageIndex: index, components }, index));
|
2907
2954
|
};
|
2908
2955
|
ThreadPrimitiveMessagesImpl.displayName = "ThreadPrimitive.Messages";
|
2909
2956
|
var ThreadPrimitiveMessages = memo5(
|
@@ -3370,17 +3417,17 @@ var MessageRepository = class {
|
|
3370
3417
|
};
|
3371
3418
|
|
3372
3419
|
// src/ui/base/tooltip-icon-button.tsx
|
3373
|
-
import { forwardRef as
|
3420
|
+
import { forwardRef as forwardRef23 } from "react";
|
3374
3421
|
|
3375
3422
|
// src/ui/base/tooltip.tsx
|
3376
3423
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
3377
3424
|
|
3378
3425
|
// src/ui/utils/withDefaults.tsx
|
3379
3426
|
import {
|
3380
|
-
forwardRef as
|
3427
|
+
forwardRef as forwardRef21
|
3381
3428
|
} from "react";
|
3382
3429
|
import classNames from "classnames";
|
3383
|
-
import { jsx as
|
3430
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
3384
3431
|
var withDefaultProps = ({
|
3385
3432
|
className,
|
3386
3433
|
...defaultProps
|
@@ -3393,10 +3440,10 @@ var withDefaultProps = ({
|
|
3393
3440
|
};
|
3394
3441
|
var withDefaults = (Component, defaultProps) => {
|
3395
3442
|
const getProps = withDefaultProps(defaultProps);
|
3396
|
-
const WithDefaults =
|
3443
|
+
const WithDefaults = forwardRef21(
|
3397
3444
|
(props, ref) => {
|
3398
3445
|
const ComponentAsAny = Component;
|
3399
|
-
return /* @__PURE__ */
|
3446
|
+
return /* @__PURE__ */ jsx34(ComponentAsAny, { ...getProps(props), ref });
|
3400
3447
|
}
|
3401
3448
|
);
|
3402
3449
|
WithDefaults.displayName = "withDefaults(" + (typeof Component === "string" ? Component : Component.displayName) + ")";
|
@@ -3404,9 +3451,9 @@ var withDefaults = (Component, defaultProps) => {
|
|
3404
3451
|
};
|
3405
3452
|
|
3406
3453
|
// src/ui/base/tooltip.tsx
|
3407
|
-
import { jsx as
|
3454
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
3408
3455
|
var Tooltip = (props) => {
|
3409
|
-
return /* @__PURE__ */
|
3456
|
+
return /* @__PURE__ */ jsx35(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsx35(TooltipPrimitive.Root, { ...props }) });
|
3410
3457
|
};
|
3411
3458
|
Tooltip.displayName = "Tooltip";
|
3412
3459
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
@@ -3418,9 +3465,9 @@ TooltipContent.displayName = "TooltipContent";
|
|
3418
3465
|
|
3419
3466
|
// src/ui/base/button.tsx
|
3420
3467
|
import { cva } from "class-variance-authority";
|
3421
|
-
import { Primitive as
|
3422
|
-
import { forwardRef as
|
3423
|
-
import { jsx as
|
3468
|
+
import { Primitive as Primitive15 } from "@radix-ui/react-primitive";
|
3469
|
+
import { forwardRef as forwardRef22 } from "react";
|
3470
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
3424
3471
|
var buttonVariants = cva("aui-button", {
|
3425
3472
|
variants: {
|
3426
3473
|
variant: {
|
@@ -3438,10 +3485,10 @@ var buttonVariants = cva("aui-button", {
|
|
3438
3485
|
size: "default"
|
3439
3486
|
}
|
3440
3487
|
});
|
3441
|
-
var Button =
|
3488
|
+
var Button = forwardRef22(
|
3442
3489
|
({ className, variant, size, ...props }, ref) => {
|
3443
|
-
return /* @__PURE__ */
|
3444
|
-
|
3490
|
+
return /* @__PURE__ */ jsx36(
|
3491
|
+
Primitive15.button,
|
3445
3492
|
{
|
3446
3493
|
className: buttonVariants({ variant, size, className }),
|
3447
3494
|
...props,
|
@@ -3453,14 +3500,14 @@ var Button = forwardRef20(
|
|
3453
3500
|
Button.displayName = "Button";
|
3454
3501
|
|
3455
3502
|
// src/ui/base/tooltip-icon-button.tsx
|
3456
|
-
import { jsx as
|
3457
|
-
var TooltipIconButton =
|
3458
|
-
return /* @__PURE__ */
|
3459
|
-
/* @__PURE__ */
|
3503
|
+
import { jsx as jsx37, jsxs as jsxs3 } from "react/jsx-runtime";
|
3504
|
+
var TooltipIconButton = forwardRef23(({ children, tooltip, side = "bottom", ...rest }, ref) => {
|
3505
|
+
return /* @__PURE__ */ jsxs3(Tooltip, { children: [
|
3506
|
+
/* @__PURE__ */ jsx37(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(Button, { variant: "ghost", size: "icon", ...rest, ref, children: [
|
3460
3507
|
children,
|
3461
|
-
/* @__PURE__ */
|
3508
|
+
/* @__PURE__ */ jsx37("span", { className: "aui-sr-only", children: tooltip })
|
3462
3509
|
] }) }),
|
3463
|
-
/* @__PURE__ */
|
3510
|
+
/* @__PURE__ */ jsx37(TooltipContent, { side, children: tooltip })
|
3464
3511
|
] });
|
3465
3512
|
});
|
3466
3513
|
TooltipIconButton.displayName = "TooltipIconButton";
|
@@ -5154,7 +5201,7 @@ import {
|
|
5154
5201
|
createContext as createContext7,
|
5155
5202
|
useContext as useContext4
|
5156
5203
|
} from "react";
|
5157
|
-
import { Fragment as
|
5204
|
+
import { Fragment as Fragment4, jsx as jsx38 } from "react/jsx-runtime";
|
5158
5205
|
var ThreadConfigContext = createContext7({});
|
5159
5206
|
var useThreadConfig = () => {
|
5160
5207
|
return useContext4(ThreadConfigContext);
|
@@ -5164,19 +5211,19 @@ var ThreadConfigProvider = ({
|
|
5164
5211
|
config
|
5165
5212
|
}) => {
|
5166
5213
|
const hasAssistant = !!useAssistantRuntime({ optional: true });
|
5167
|
-
const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */
|
5214
|
+
const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx38(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx38(Fragment4, { children });
|
5168
5215
|
if (!config?.runtime) return configProvider;
|
5169
5216
|
if (hasAssistant) {
|
5170
5217
|
throw new Error(
|
5171
5218
|
"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
|
5172
5219
|
);
|
5173
5220
|
}
|
5174
|
-
return /* @__PURE__ */
|
5221
|
+
return /* @__PURE__ */ jsx38(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
|
5175
5222
|
};
|
5176
5223
|
ThreadConfigProvider.displayName = "ThreadConfigProvider";
|
5177
5224
|
|
5178
5225
|
// src/ui/assistant-action-bar.tsx
|
5179
|
-
import { forwardRef as
|
5226
|
+
import { forwardRef as forwardRef24 } from "react";
|
5180
5227
|
import {
|
5181
5228
|
AudioLinesIcon,
|
5182
5229
|
CheckIcon,
|
@@ -5186,7 +5233,7 @@ import {
|
|
5186
5233
|
ThumbsDownIcon,
|
5187
5234
|
ThumbsUpIcon
|
5188
5235
|
} from "lucide-react";
|
5189
|
-
import { Fragment as
|
5236
|
+
import { Fragment as Fragment5, jsx as jsx39, jsxs as jsxs4 } from "react/jsx-runtime";
|
5190
5237
|
var useAllowCopy = (ensureCapability = false) => {
|
5191
5238
|
const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
|
5192
5239
|
const copySupported = useThread((t) => t.capabilities.unstable_copy);
|
@@ -5220,18 +5267,18 @@ var AssistantActionBar = () => {
|
|
5220
5267
|
const allowFeedbackNegative = useAllowFeedbackNegative(true);
|
5221
5268
|
if (!allowCopy && !allowReload && !allowSpeak && !allowFeedbackPositive && !allowFeedbackNegative)
|
5222
5269
|
return null;
|
5223
|
-
return /* @__PURE__ */
|
5270
|
+
return /* @__PURE__ */ jsxs4(
|
5224
5271
|
AssistantActionBarRoot,
|
5225
5272
|
{
|
5226
5273
|
hideWhenRunning: true,
|
5227
5274
|
autohide: "not-last",
|
5228
5275
|
autohideFloat: "single-branch",
|
5229
5276
|
children: [
|
5230
|
-
allowSpeak && /* @__PURE__ */
|
5231
|
-
allowCopy && /* @__PURE__ */
|
5232
|
-
allowReload && /* @__PURE__ */
|
5233
|
-
allowFeedbackPositive && /* @__PURE__ */
|
5234
|
-
allowFeedbackNegative && /* @__PURE__ */
|
5277
|
+
allowSpeak && /* @__PURE__ */ jsx39(AssistantActionBarSpeechControl, {}),
|
5278
|
+
allowCopy && /* @__PURE__ */ jsx39(AssistantActionBarCopy, {}),
|
5279
|
+
allowReload && /* @__PURE__ */ jsx39(AssistantActionBarReload, {}),
|
5280
|
+
allowFeedbackPositive && /* @__PURE__ */ jsx39(AssistantActionBarFeedbackPositive, {}),
|
5281
|
+
allowFeedbackNegative && /* @__PURE__ */ jsx39(AssistantActionBarFeedbackNegative, {})
|
5235
5282
|
]
|
5236
5283
|
}
|
5237
5284
|
);
|
@@ -5241,35 +5288,35 @@ var AssistantActionBarRoot = withDefaults(actionBar_exports.Root, {
|
|
5241
5288
|
className: "aui-assistant-action-bar-root"
|
5242
5289
|
});
|
5243
5290
|
AssistantActionBarRoot.displayName = "AssistantActionBarRoot";
|
5244
|
-
var AssistantActionBarCopy =
|
5291
|
+
var AssistantActionBarCopy = forwardRef24((props, ref) => {
|
5245
5292
|
const {
|
5246
5293
|
strings: {
|
5247
5294
|
assistantMessage: { copy: { tooltip = "Copy" } = {} } = {}
|
5248
5295
|
} = {}
|
5249
5296
|
} = useThreadConfig();
|
5250
|
-
return /* @__PURE__ */
|
5251
|
-
/* @__PURE__ */
|
5252
|
-
/* @__PURE__ */
|
5297
|
+
return /* @__PURE__ */ jsx39(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs4(Fragment5, { children: [
|
5298
|
+
/* @__PURE__ */ jsx39(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx39(CheckIcon, {}) }),
|
5299
|
+
/* @__PURE__ */ jsx39(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx39(CopyIcon, {}) })
|
5253
5300
|
] }) }) });
|
5254
5301
|
});
|
5255
5302
|
AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
|
5256
5303
|
var AssistantActionBarSpeechControl = () => {
|
5257
|
-
return /* @__PURE__ */
|
5258
|
-
/* @__PURE__ */
|
5259
|
-
/* @__PURE__ */
|
5304
|
+
return /* @__PURE__ */ jsxs4(Fragment5, { children: [
|
5305
|
+
/* @__PURE__ */ jsx39(message_exports.If, { speaking: false, children: /* @__PURE__ */ jsx39(AssistantActionBarSpeak, {}) }),
|
5306
|
+
/* @__PURE__ */ jsx39(message_exports.If, { speaking: true, children: /* @__PURE__ */ jsx39(AssistantActionBarStopSpeaking, {}) })
|
5260
5307
|
] });
|
5261
5308
|
};
|
5262
|
-
var AssistantActionBarSpeak =
|
5309
|
+
var AssistantActionBarSpeak = forwardRef24((props, ref) => {
|
5263
5310
|
const {
|
5264
5311
|
strings: {
|
5265
5312
|
assistantMessage: { speak: { tooltip = "Read aloud" } = {} } = {}
|
5266
5313
|
} = {}
|
5267
5314
|
} = useThreadConfig();
|
5268
5315
|
const allowSpeak = useAllowSpeak();
|
5269
|
-
return /* @__PURE__ */
|
5316
|
+
return /* @__PURE__ */ jsx39(actionBar_exports.Speak, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(AudioLinesIcon, {}) }) });
|
5270
5317
|
});
|
5271
5318
|
AssistantActionBarSpeak.displayName = "AssistantActionBarSpeak";
|
5272
|
-
var AssistantActionBarStopSpeaking =
|
5319
|
+
var AssistantActionBarStopSpeaking = forwardRef24((props, ref) => {
|
5273
5320
|
const {
|
5274
5321
|
strings: {
|
5275
5322
|
assistantMessage: {
|
@@ -5278,20 +5325,20 @@ var AssistantActionBarStopSpeaking = forwardRef22((props, ref) => {
|
|
5278
5325
|
} = {}
|
5279
5326
|
} = useThreadConfig();
|
5280
5327
|
const allowSpeak = useAllowSpeak();
|
5281
|
-
return /* @__PURE__ */
|
5328
|
+
return /* @__PURE__ */ jsx39(actionBar_exports.StopSpeaking, { disabled: !allowSpeak, asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip: stopTooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(StopCircleIcon, {}) }) });
|
5282
5329
|
});
|
5283
5330
|
AssistantActionBarStopSpeaking.displayName = "AssistantActionBarStopSpeaking";
|
5284
|
-
var AssistantActionBarReload =
|
5331
|
+
var AssistantActionBarReload = forwardRef24((props, ref) => {
|
5285
5332
|
const {
|
5286
5333
|
strings: {
|
5287
5334
|
assistantMessage: { reload: { tooltip = "Refresh" } = {} } = {}
|
5288
5335
|
} = {}
|
5289
5336
|
} = useThreadConfig();
|
5290
5337
|
const allowReload = useAllowReload();
|
5291
|
-
return /* @__PURE__ */
|
5338
|
+
return /* @__PURE__ */ jsx39(actionBar_exports.Reload, { disabled: !allowReload, asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(RefreshCwIcon, {}) }) });
|
5292
5339
|
});
|
5293
5340
|
AssistantActionBarReload.displayName = "AssistantActionBarReload";
|
5294
|
-
var AssistantActionBarFeedbackPositive =
|
5341
|
+
var AssistantActionBarFeedbackPositive = forwardRef24((props, ref) => {
|
5295
5342
|
const {
|
5296
5343
|
strings: {
|
5297
5344
|
assistantMessage: {
|
@@ -5300,18 +5347,18 @@ var AssistantActionBarFeedbackPositive = forwardRef22((props, ref) => {
|
|
5300
5347
|
} = {}
|
5301
5348
|
} = useThreadConfig();
|
5302
5349
|
const allowFeedbackPositive = useAllowFeedbackPositive();
|
5303
|
-
return /* @__PURE__ */
|
5350
|
+
return /* @__PURE__ */ jsx39(
|
5304
5351
|
actionBar_exports.FeedbackPositive,
|
5305
5352
|
{
|
5306
5353
|
disabled: !allowFeedbackPositive,
|
5307
5354
|
className: "aui-assistant-action-bar-feedback-positive",
|
5308
5355
|
asChild: true,
|
5309
|
-
children: /* @__PURE__ */
|
5356
|
+
children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(ThumbsUpIcon, {}) })
|
5310
5357
|
}
|
5311
5358
|
);
|
5312
5359
|
});
|
5313
5360
|
AssistantActionBarFeedbackPositive.displayName = "AssistantActionBarFeedbackPositive";
|
5314
|
-
var AssistantActionBarFeedbackNegative =
|
5361
|
+
var AssistantActionBarFeedbackNegative = forwardRef24((props, ref) => {
|
5315
5362
|
const {
|
5316
5363
|
strings: {
|
5317
5364
|
assistantMessage: {
|
@@ -5320,13 +5367,13 @@ var AssistantActionBarFeedbackNegative = forwardRef22((props, ref) => {
|
|
5320
5367
|
} = {}
|
5321
5368
|
} = useThreadConfig();
|
5322
5369
|
const allowFeedbackNegative = useAllowFeedbackNegative();
|
5323
|
-
return /* @__PURE__ */
|
5370
|
+
return /* @__PURE__ */ jsx39(
|
5324
5371
|
actionBar_exports.FeedbackNegative,
|
5325
5372
|
{
|
5326
5373
|
disabled: !allowFeedbackNegative,
|
5327
5374
|
className: "aui-assistant-action-bar-feedback-negative",
|
5328
5375
|
asChild: true,
|
5329
|
-
children: /* @__PURE__ */
|
5376
|
+
children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(ThumbsDownIcon, {}) })
|
5330
5377
|
}
|
5331
5378
|
);
|
5332
5379
|
});
|
@@ -5347,12 +5394,12 @@ var assistant_action_bar_default = Object.assign(
|
|
5347
5394
|
);
|
5348
5395
|
|
5349
5396
|
// src/ui/assistant-message.tsx
|
5350
|
-
import { forwardRef as
|
5397
|
+
import { forwardRef as forwardRef26, useMemo as useMemo14 } from "react";
|
5351
5398
|
|
5352
5399
|
// src/ui/branch-picker.tsx
|
5353
|
-
import { forwardRef as
|
5400
|
+
import { forwardRef as forwardRef25 } from "react";
|
5354
5401
|
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
5355
|
-
import { jsx as
|
5402
|
+
import { jsx as jsx40, jsxs as jsxs5 } from "react/jsx-runtime";
|
5356
5403
|
var useAllowBranchPicker = (ensureCapability = false) => {
|
5357
5404
|
const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
|
5358
5405
|
const branchPickerSupported = useThread((t) => t.capabilities.edit);
|
@@ -5361,10 +5408,10 @@ var useAllowBranchPicker = (ensureCapability = false) => {
|
|
5361
5408
|
var BranchPicker = () => {
|
5362
5409
|
const allowBranchPicker = useAllowBranchPicker(true);
|
5363
5410
|
if (!allowBranchPicker) return null;
|
5364
|
-
return /* @__PURE__ */
|
5365
|
-
/* @__PURE__ */
|
5366
|
-
/* @__PURE__ */
|
5367
|
-
/* @__PURE__ */
|
5411
|
+
return /* @__PURE__ */ jsxs5(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
|
5412
|
+
/* @__PURE__ */ jsx40(BranchPickerPrevious2, {}),
|
5413
|
+
/* @__PURE__ */ jsx40(BranchPickerState, {}),
|
5414
|
+
/* @__PURE__ */ jsx40(BranchPickerNext, {})
|
5368
5415
|
] });
|
5369
5416
|
};
|
5370
5417
|
BranchPicker.displayName = "BranchPicker";
|
@@ -5372,33 +5419,33 @@ var BranchPickerRoot = withDefaults(branchPicker_exports.Root, {
|
|
5372
5419
|
className: "aui-branch-picker-root"
|
5373
5420
|
});
|
5374
5421
|
BranchPickerRoot.displayName = "BranchPickerRoot";
|
5375
|
-
var BranchPickerPrevious2 =
|
5422
|
+
var BranchPickerPrevious2 = forwardRef25((props, ref) => {
|
5376
5423
|
const {
|
5377
5424
|
strings: {
|
5378
5425
|
branchPicker: { previous: { tooltip = "Previous" } = {} } = {}
|
5379
5426
|
} = {}
|
5380
5427
|
} = useThreadConfig();
|
5381
5428
|
const allowBranchPicker = useAllowBranchPicker();
|
5382
|
-
return /* @__PURE__ */
|
5429
|
+
return /* @__PURE__ */ jsx40(branchPicker_exports.Previous, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx40(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx40(ChevronLeftIcon, {}) }) });
|
5383
5430
|
});
|
5384
5431
|
BranchPickerPrevious2.displayName = "BranchPickerPrevious";
|
5385
5432
|
var BranchPickerStateWrapper = withDefaults("span", {
|
5386
5433
|
className: "aui-branch-picker-state"
|
5387
5434
|
});
|
5388
|
-
var BranchPickerState =
|
5389
|
-
return /* @__PURE__ */
|
5390
|
-
/* @__PURE__ */
|
5435
|
+
var BranchPickerState = forwardRef25((props, ref) => {
|
5436
|
+
return /* @__PURE__ */ jsxs5(BranchPickerStateWrapper, { ...props, ref, children: [
|
5437
|
+
/* @__PURE__ */ jsx40(branchPicker_exports.Number, {}),
|
5391
5438
|
" / ",
|
5392
|
-
/* @__PURE__ */
|
5439
|
+
/* @__PURE__ */ jsx40(branchPicker_exports.Count, {})
|
5393
5440
|
] });
|
5394
5441
|
});
|
5395
5442
|
BranchPickerState.displayName = "BranchPickerState";
|
5396
|
-
var BranchPickerNext =
|
5443
|
+
var BranchPickerNext = forwardRef25((props, ref) => {
|
5397
5444
|
const {
|
5398
5445
|
strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
|
5399
5446
|
} = useThreadConfig();
|
5400
5447
|
const allowBranchPicker = useAllowBranchPicker();
|
5401
|
-
return /* @__PURE__ */
|
5448
|
+
return /* @__PURE__ */ jsx40(branchPicker_exports.Next, { disabled: !allowBranchPicker, asChild: true, children: /* @__PURE__ */ jsx40(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx40(ChevronRightIcon, {}) }) });
|
5402
5449
|
});
|
5403
5450
|
BranchPickerNext.displayName = "BranchPickerNext";
|
5404
5451
|
var exports2 = {
|
@@ -5410,12 +5457,12 @@ var branch_picker_default = Object.assign(BranchPicker, exports2);
|
|
5410
5457
|
|
5411
5458
|
// src/ui/base/avatar.tsx
|
5412
5459
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
5413
|
-
import { jsx as
|
5460
|
+
import { jsx as jsx41, jsxs as jsxs6 } from "react/jsx-runtime";
|
5414
5461
|
var Avatar = ({ src, alt, fallback }) => {
|
5415
5462
|
if (src == null && fallback == null) return null;
|
5416
|
-
return /* @__PURE__ */
|
5417
|
-
src != null && /* @__PURE__ */
|
5418
|
-
fallback != null && /* @__PURE__ */
|
5463
|
+
return /* @__PURE__ */ jsxs6(AvatarRoot, { children: [
|
5464
|
+
src != null && /* @__PURE__ */ jsx41(AvatarImage, { src, alt }),
|
5465
|
+
fallback != null && /* @__PURE__ */ jsx41(AvatarFallback, { children: fallback })
|
5419
5466
|
] });
|
5420
5467
|
};
|
5421
5468
|
Avatar.displayName = "Avatar";
|
@@ -5434,10 +5481,10 @@ AvatarFallback.displayName = "AvatarFallback";
|
|
5434
5481
|
|
5435
5482
|
// src/ui/content-part.tsx
|
5436
5483
|
import classNames2 from "classnames";
|
5437
|
-
import { jsx as
|
5484
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
5438
5485
|
var Text = () => {
|
5439
5486
|
const status = useSmoothStatus();
|
5440
|
-
return /* @__PURE__ */
|
5487
|
+
return /* @__PURE__ */ jsx42(
|
5441
5488
|
contentPart_exports.Text,
|
5442
5489
|
{
|
5443
5490
|
className: classNames2(
|
@@ -5452,19 +5499,19 @@ var exports3 = { Text: withSmoothContextProvider(Text) };
|
|
5452
5499
|
var content_part_default = exports3;
|
5453
5500
|
|
5454
5501
|
// src/ui/assistant-message.tsx
|
5455
|
-
import { jsx as
|
5502
|
+
import { jsx as jsx43, jsxs as jsxs7 } from "react/jsx-runtime";
|
5456
5503
|
var AssistantMessage = () => {
|
5457
|
-
return /* @__PURE__ */
|
5458
|
-
/* @__PURE__ */
|
5459
|
-
/* @__PURE__ */
|
5460
|
-
/* @__PURE__ */
|
5461
|
-
/* @__PURE__ */
|
5504
|
+
return /* @__PURE__ */ jsxs7(AssistantMessageRoot, { children: [
|
5505
|
+
/* @__PURE__ */ jsx43(AssistantMessageAvatar, {}),
|
5506
|
+
/* @__PURE__ */ jsx43(AssistantMessageContent, {}),
|
5507
|
+
/* @__PURE__ */ jsx43(branch_picker_default, {}),
|
5508
|
+
/* @__PURE__ */ jsx43(assistant_action_bar_default, {})
|
5462
5509
|
] });
|
5463
5510
|
};
|
5464
5511
|
AssistantMessage.displayName = "AssistantMessage";
|
5465
5512
|
var AssistantMessageAvatar = () => {
|
5466
5513
|
const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
|
5467
|
-
return /* @__PURE__ */
|
5514
|
+
return /* @__PURE__ */ jsx43(Avatar, { ...avatar });
|
5468
5515
|
};
|
5469
5516
|
var AssistantMessageRoot = withDefaults(message_exports.Root, {
|
5470
5517
|
className: "aui-assistant-message-root"
|
@@ -5473,7 +5520,7 @@ AssistantMessageRoot.displayName = "AssistantMessageRoot";
|
|
5473
5520
|
var AssistantMessageContentWrapper = withDefaults("div", {
|
5474
5521
|
className: "aui-assistant-message-content"
|
5475
5522
|
});
|
5476
|
-
var AssistantMessageContent =
|
5523
|
+
var AssistantMessageContent = forwardRef26(({ components: componentsProp, ...rest }, ref) => {
|
5477
5524
|
const { tools, assistantMessage: { components = {} } = {} } = useThreadConfig();
|
5478
5525
|
const toolsComponents = useMemo14(
|
5479
5526
|
() => ({
|
@@ -5488,7 +5535,7 @@ var AssistantMessageContent = forwardRef24(({ components: componentsProp, ...res
|
|
5488
5535
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
5489
5536
|
[...tools ?? [], components.ToolFallback]
|
5490
5537
|
);
|
5491
|
-
return /* @__PURE__ */
|
5538
|
+
return /* @__PURE__ */ jsx43(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx43(
|
5492
5539
|
message_exports.Content,
|
5493
5540
|
{
|
5494
5541
|
components: {
|
@@ -5511,21 +5558,21 @@ var assistant_message_default = Object.assign(
|
|
5511
5558
|
);
|
5512
5559
|
|
5513
5560
|
// src/ui/assistant-modal.tsx
|
5514
|
-
import { forwardRef as
|
5561
|
+
import { forwardRef as forwardRef34 } from "react";
|
5515
5562
|
import { BotIcon, ChevronDownIcon } from "lucide-react";
|
5516
5563
|
|
5517
5564
|
// src/ui/thread.tsx
|
5518
|
-
import { forwardRef as
|
5565
|
+
import { forwardRef as forwardRef33 } from "react";
|
5519
5566
|
import { ArrowDownIcon } from "lucide-react";
|
5520
5567
|
|
5521
5568
|
// src/ui/composer.tsx
|
5522
|
-
import { forwardRef as
|
5569
|
+
import { forwardRef as forwardRef28 } from "react";
|
5523
5570
|
import { PaperclipIcon, SendHorizontalIcon } from "lucide-react";
|
5524
5571
|
|
5525
5572
|
// src/ui/base/CircleStopIcon.tsx
|
5526
|
-
import { jsx as
|
5573
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
5527
5574
|
var CircleStopIcon = () => {
|
5528
|
-
return /* @__PURE__ */
|
5575
|
+
return /* @__PURE__ */ jsx44(
|
5529
5576
|
"svg",
|
5530
5577
|
{
|
5531
5578
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -5533,51 +5580,44 @@ var CircleStopIcon = () => {
|
|
5533
5580
|
fill: "currentColor",
|
5534
5581
|
width: "16",
|
5535
5582
|
height: "16",
|
5536
|
-
children: /* @__PURE__ */
|
5583
|
+
children: /* @__PURE__ */ jsx44("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
|
5537
5584
|
}
|
5538
5585
|
);
|
5539
5586
|
};
|
5540
5587
|
CircleStopIcon.displayName = "CircleStopIcon";
|
5541
5588
|
|
5542
5589
|
// src/ui/composer-attachment.tsx
|
5543
|
-
import { forwardRef as
|
5590
|
+
import { forwardRef as forwardRef27 } from "react";
|
5544
5591
|
import { CircleXIcon } from "lucide-react";
|
5545
|
-
import { jsx as
|
5546
|
-
var ComposerAttachmentRoot = withDefaults(
|
5592
|
+
import { jsx as jsx45, jsxs as jsxs8 } from "react/jsx-runtime";
|
5593
|
+
var ComposerAttachmentRoot = withDefaults(attachment_exports.Root, {
|
5547
5594
|
className: "aui-composer-attachment-root"
|
5548
5595
|
});
|
5549
5596
|
ComposerAttachmentRoot.displayName = "ComposerAttachmentRoot";
|
5550
5597
|
var ComposerAttachment2 = () => {
|
5551
|
-
|
5552
|
-
|
5553
|
-
|
5554
|
-
attachment.name.split(".").pop(),
|
5555
|
-
/* @__PURE__ */ jsx43(ComposerAttachmentRemove, {})
|
5598
|
+
return /* @__PURE__ */ jsxs8(ComposerAttachmentRoot, { children: [
|
5599
|
+
/* @__PURE__ */ jsx45(attachment_exports.unstable_Thumb, {}),
|
5600
|
+
/* @__PURE__ */ jsx45(ComposerAttachmentRemove, {})
|
5556
5601
|
] });
|
5557
5602
|
};
|
5558
5603
|
ComposerAttachment2.displayName = "ComposerAttachment";
|
5559
|
-
var ComposerAttachmentRemove =
|
5604
|
+
var ComposerAttachmentRemove = forwardRef27((props, ref) => {
|
5560
5605
|
const {
|
5561
5606
|
strings: {
|
5562
5607
|
composer: { removeAttachment: { tooltip = "Remove file" } = {} } = {}
|
5563
5608
|
} = {}
|
5564
5609
|
} = useThreadConfig();
|
5565
|
-
|
5566
|
-
const handleRemoveAttachment = () => {
|
5567
|
-
attachmentRuntime.remove();
|
5568
|
-
};
|
5569
|
-
return /* @__PURE__ */ jsx43(
|
5610
|
+
return /* @__PURE__ */ jsx45(attachment_exports.Remove, { asChild: true, children: /* @__PURE__ */ jsx45(
|
5570
5611
|
TooltipIconButton,
|
5571
5612
|
{
|
5572
5613
|
tooltip,
|
5573
5614
|
className: "aui-composer-attachment-remove",
|
5574
5615
|
side: "top",
|
5575
5616
|
...props,
|
5576
|
-
onClick: handleRemoveAttachment,
|
5577
5617
|
ref,
|
5578
|
-
children: props.children ?? /* @__PURE__ */
|
5618
|
+
children: props.children ?? /* @__PURE__ */ jsx45(CircleXIcon, {})
|
5579
5619
|
}
|
5580
|
-
);
|
5620
|
+
) });
|
5581
5621
|
});
|
5582
5622
|
ComposerAttachmentRemove.displayName = "ComposerAttachmentRemove";
|
5583
5623
|
var exports5 = {
|
@@ -5590,7 +5630,7 @@ var composer_attachment_default = Object.assign(
|
|
5590
5630
|
);
|
5591
5631
|
|
5592
5632
|
// src/ui/composer.tsx
|
5593
|
-
import { Fragment as
|
5633
|
+
import { Fragment as Fragment6, jsx as jsx46, jsxs as jsxs9 } from "react/jsx-runtime";
|
5594
5634
|
var useAllowAttachments = (ensureCapability = false) => {
|
5595
5635
|
const { composer: { allowAttachments = true } = {} } = useThreadConfig();
|
5596
5636
|
const attachmentsSupported = useThread((t) => t.capabilities.attachments);
|
@@ -5598,11 +5638,11 @@ var useAllowAttachments = (ensureCapability = false) => {
|
|
5598
5638
|
};
|
5599
5639
|
var Composer = () => {
|
5600
5640
|
const allowAttachments = useAllowAttachments(true);
|
5601
|
-
return /* @__PURE__ */
|
5602
|
-
allowAttachments && /* @__PURE__ */
|
5603
|
-
allowAttachments && /* @__PURE__ */
|
5604
|
-
/* @__PURE__ */
|
5605
|
-
/* @__PURE__ */
|
5641
|
+
return /* @__PURE__ */ jsxs9(ComposerRoot, { children: [
|
5642
|
+
allowAttachments && /* @__PURE__ */ jsx46(ComposerAttachments, {}),
|
5643
|
+
allowAttachments && /* @__PURE__ */ jsx46(ComposerAddAttachment, {}),
|
5644
|
+
/* @__PURE__ */ jsx46(ComposerInput, { autoFocus: true }),
|
5645
|
+
/* @__PURE__ */ jsx46(ComposerAction, {})
|
5606
5646
|
] });
|
5607
5647
|
};
|
5608
5648
|
Composer.displayName = "Composer";
|
@@ -5615,14 +5655,14 @@ var ComposerInputStyled = withDefaults(composer_exports.Input, {
|
|
5615
5655
|
autoFocus: true,
|
5616
5656
|
className: "aui-composer-input"
|
5617
5657
|
});
|
5618
|
-
var ComposerInput =
|
5658
|
+
var ComposerInput = forwardRef28(
|
5619
5659
|
(props, ref) => {
|
5620
5660
|
const {
|
5621
5661
|
strings: {
|
5622
5662
|
composer: { input: { placeholder = "Write a message..." } = {} } = {}
|
5623
5663
|
} = {}
|
5624
5664
|
} = useThreadConfig();
|
5625
|
-
return /* @__PURE__ */
|
5665
|
+
return /* @__PURE__ */ jsx46(ComposerInputStyled, { placeholder, ...props, ref });
|
5626
5666
|
}
|
5627
5667
|
);
|
5628
5668
|
ComposerInput.displayName = "ComposerInput";
|
@@ -5630,7 +5670,7 @@ var ComposerAttachmentsContainer = withDefaults("div", {
|
|
5630
5670
|
className: "aui-composer-attachments"
|
5631
5671
|
});
|
5632
5672
|
var ComposerAttachments = ({ components }) => {
|
5633
|
-
return /* @__PURE__ */
|
5673
|
+
return /* @__PURE__ */ jsx46(ComposerAttachmentsContainer, { children: /* @__PURE__ */ jsx46(
|
5634
5674
|
composer_exports.Attachments,
|
5635
5675
|
{
|
5636
5676
|
components: {
|
@@ -5644,21 +5684,21 @@ var ComposerAttachButton = withDefaults(TooltipIconButton, {
|
|
5644
5684
|
variant: "default",
|
5645
5685
|
className: "aui-composer-attach"
|
5646
5686
|
});
|
5647
|
-
var ComposerAddAttachment =
|
5687
|
+
var ComposerAddAttachment = forwardRef28((props, ref) => {
|
5648
5688
|
const {
|
5649
5689
|
strings: {
|
5650
5690
|
composer: { addAttachment: { tooltip = "Attach file" } = {} } = {}
|
5651
5691
|
} = {}
|
5652
5692
|
} = useThreadConfig();
|
5653
5693
|
const allowAttachments = useAllowAttachments();
|
5654
|
-
return /* @__PURE__ */
|
5694
|
+
return /* @__PURE__ */ jsx46(composer_exports.AddAttachment, { disabled: !allowAttachments, asChild: true, children: /* @__PURE__ */ jsx46(
|
5655
5695
|
ComposerAttachButton,
|
5656
5696
|
{
|
5657
5697
|
tooltip,
|
5658
5698
|
variant: "ghost",
|
5659
5699
|
...props,
|
5660
5700
|
ref,
|
5661
|
-
children: props.children ?? /* @__PURE__ */
|
5701
|
+
children: props.children ?? /* @__PURE__ */ jsx46(PaperclipIcon, {})
|
5662
5702
|
}
|
5663
5703
|
) });
|
5664
5704
|
});
|
@@ -5669,10 +5709,10 @@ var useAllowCancel = () => {
|
|
5669
5709
|
};
|
5670
5710
|
var ComposerAction = () => {
|
5671
5711
|
const allowCancel = useAllowCancel();
|
5672
|
-
if (!allowCancel) return /* @__PURE__ */
|
5673
|
-
return /* @__PURE__ */
|
5674
|
-
/* @__PURE__ */
|
5675
|
-
/* @__PURE__ */
|
5712
|
+
if (!allowCancel) return /* @__PURE__ */ jsx46(ComposerSend, {});
|
5713
|
+
return /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
5714
|
+
/* @__PURE__ */ jsx46(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx46(ComposerSend, {}) }),
|
5715
|
+
/* @__PURE__ */ jsx46(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx46(ComposerCancel, {}) })
|
5676
5716
|
] });
|
5677
5717
|
};
|
5678
5718
|
ComposerAction.displayName = "ComposerAction";
|
@@ -5680,22 +5720,22 @@ var ComposerSendButton = withDefaults(TooltipIconButton, {
|
|
5680
5720
|
variant: "default",
|
5681
5721
|
className: "aui-composer-send"
|
5682
5722
|
});
|
5683
|
-
var ComposerSend =
|
5723
|
+
var ComposerSend = forwardRef28((props, ref) => {
|
5684
5724
|
const {
|
5685
5725
|
strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
|
5686
5726
|
} = useThreadConfig();
|
5687
|
-
return /* @__PURE__ */
|
5727
|
+
return /* @__PURE__ */ jsx46(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx46(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx46(SendHorizontalIcon, {}) }) });
|
5688
5728
|
});
|
5689
5729
|
ComposerSend.displayName = "ComposerSend";
|
5690
5730
|
var ComposerCancelButton = withDefaults(TooltipIconButton, {
|
5691
5731
|
variant: "default",
|
5692
5732
|
className: "aui-composer-cancel"
|
5693
5733
|
});
|
5694
|
-
var ComposerCancel =
|
5734
|
+
var ComposerCancel = forwardRef28((props, ref) => {
|
5695
5735
|
const {
|
5696
5736
|
strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
|
5697
5737
|
} = useThreadConfig();
|
5698
|
-
return /* @__PURE__ */
|
5738
|
+
return /* @__PURE__ */ jsx46(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx46(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx46(CircleStopIcon, {}) }) });
|
5699
5739
|
});
|
5700
5740
|
ComposerCancel.displayName = "ComposerCancel";
|
5701
5741
|
var exports6 = {
|
@@ -5710,15 +5750,15 @@ var exports6 = {
|
|
5710
5750
|
var composer_default = Object.assign(Composer, exports6);
|
5711
5751
|
|
5712
5752
|
// src/ui/thread-welcome.tsx
|
5713
|
-
import { forwardRef as
|
5714
|
-
import { jsx as
|
5753
|
+
import { forwardRef as forwardRef29 } from "react";
|
5754
|
+
import { jsx as jsx47, jsxs as jsxs10 } from "react/jsx-runtime";
|
5715
5755
|
var ThreadWelcome = () => {
|
5716
|
-
return /* @__PURE__ */
|
5717
|
-
/* @__PURE__ */
|
5718
|
-
/* @__PURE__ */
|
5719
|
-
/* @__PURE__ */
|
5756
|
+
return /* @__PURE__ */ jsxs10(ThreadWelcomeRoot, { children: [
|
5757
|
+
/* @__PURE__ */ jsxs10(ThreadWelcomeCenter, { children: [
|
5758
|
+
/* @__PURE__ */ jsx47(ThreadWelcomeAvatar, {}),
|
5759
|
+
/* @__PURE__ */ jsx47(ThreadWelcomeMessage, {})
|
5720
5760
|
] }),
|
5721
|
-
/* @__PURE__ */
|
5761
|
+
/* @__PURE__ */ jsx47(ThreadWelcomeSuggestions, {})
|
5722
5762
|
] });
|
5723
5763
|
};
|
5724
5764
|
ThreadWelcome.displayName = "ThreadWelcome";
|
@@ -5728,22 +5768,22 @@ var ThreadWelcomeRootStyled = withDefaults("div", {
|
|
5728
5768
|
var ThreadWelcomeCenter = withDefaults("div", {
|
5729
5769
|
className: "aui-thread-welcome-center"
|
5730
5770
|
});
|
5731
|
-
var ThreadWelcomeRoot =
|
5771
|
+
var ThreadWelcomeRoot = forwardRef29(
|
5732
5772
|
(props, ref) => {
|
5733
|
-
return /* @__PURE__ */
|
5773
|
+
return /* @__PURE__ */ jsx47(thread_exports.Empty, { children: /* @__PURE__ */ jsx47(ThreadWelcomeRootStyled, { ...props, ref }) });
|
5734
5774
|
}
|
5735
5775
|
);
|
5736
5776
|
ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
|
5737
5777
|
var ThreadWelcomeAvatar = () => {
|
5738
5778
|
const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
|
5739
|
-
return /* @__PURE__ */
|
5779
|
+
return /* @__PURE__ */ jsx47(Avatar, { ...avatar });
|
5740
5780
|
};
|
5741
5781
|
var ThreadWelcomeMessageStyled = withDefaults("p", {
|
5742
5782
|
className: "aui-thread-welcome-message"
|
5743
5783
|
});
|
5744
|
-
var ThreadWelcomeMessage =
|
5784
|
+
var ThreadWelcomeMessage = forwardRef29(({ message: messageProp, ...rest }, ref) => {
|
5745
5785
|
const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
|
5746
|
-
return /* @__PURE__ */
|
5786
|
+
return /* @__PURE__ */ jsx47(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
|
5747
5787
|
});
|
5748
5788
|
ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
|
5749
5789
|
var ThreadWelcomeSuggestionContainer = withDefaults("div", {
|
@@ -5755,15 +5795,15 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
|
|
5755
5795
|
var ThreadWelcomeSuggestion = ({
|
5756
5796
|
suggestion: { text, prompt }
|
5757
5797
|
}) => {
|
5758
|
-
return /* @__PURE__ */
|
5798
|
+
return /* @__PURE__ */ jsx47(ThreadWelcomeSuggestionStyled, { prompt, method: "replace", autoSend: true, children: /* @__PURE__ */ jsx47("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt }) });
|
5759
5799
|
};
|
5760
5800
|
var ThreadWelcomeSuggestions = () => {
|
5761
5801
|
const suggestions2 = useThread((t) => t.suggestions);
|
5762
5802
|
const { welcome: { suggestions } = {} } = useThreadConfig();
|
5763
5803
|
const finalSuggestions = suggestions2.length ? suggestions2 : suggestions;
|
5764
|
-
return /* @__PURE__ */
|
5804
|
+
return /* @__PURE__ */ jsx47(ThreadWelcomeSuggestionContainer, { children: finalSuggestions?.map((suggestion, idx) => {
|
5765
5805
|
const key = `${suggestion.prompt}-${idx}`;
|
5766
|
-
return /* @__PURE__ */
|
5806
|
+
return /* @__PURE__ */ jsx47(ThreadWelcomeSuggestion, { suggestion }, key);
|
5767
5807
|
}) });
|
5768
5808
|
};
|
5769
5809
|
ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
|
@@ -5778,12 +5818,12 @@ var exports7 = {
|
|
5778
5818
|
var thread_welcome_default = Object.assign(ThreadWelcome, exports7);
|
5779
5819
|
|
5780
5820
|
// src/ui/user-message.tsx
|
5781
|
-
import { forwardRef as
|
5821
|
+
import { forwardRef as forwardRef31 } from "react";
|
5782
5822
|
|
5783
5823
|
// src/ui/user-action-bar.tsx
|
5784
|
-
import { forwardRef as
|
5824
|
+
import { forwardRef as forwardRef30 } from "react";
|
5785
5825
|
import { PencilIcon } from "lucide-react";
|
5786
|
-
import { jsx as
|
5826
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
5787
5827
|
var useAllowEdit = (ensureCapability = false) => {
|
5788
5828
|
const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
|
5789
5829
|
const editSupported = useThread((t) => t.capabilities.edit);
|
@@ -5792,19 +5832,19 @@ var useAllowEdit = (ensureCapability = false) => {
|
|
5792
5832
|
var UserActionBar = () => {
|
5793
5833
|
const allowEdit = useAllowEdit(true);
|
5794
5834
|
if (!allowEdit) return null;
|
5795
|
-
return /* @__PURE__ */
|
5835
|
+
return /* @__PURE__ */ jsx48(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx48(UserActionBarEdit, {}) });
|
5796
5836
|
};
|
5797
5837
|
UserActionBar.displayName = "UserActionBar";
|
5798
5838
|
var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
|
5799
5839
|
className: "aui-user-action-bar-root"
|
5800
5840
|
});
|
5801
5841
|
UserActionBarRoot.displayName = "UserActionBarRoot";
|
5802
|
-
var UserActionBarEdit =
|
5842
|
+
var UserActionBarEdit = forwardRef30((props, ref) => {
|
5803
5843
|
const {
|
5804
5844
|
strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
|
5805
5845
|
} = useThreadConfig();
|
5806
5846
|
const allowEdit = useAllowEdit();
|
5807
|
-
return /* @__PURE__ */
|
5847
|
+
return /* @__PURE__ */ jsx48(actionBar_exports.Edit, { disabled: !allowEdit, asChild: true, children: /* @__PURE__ */ jsx48(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx48(PencilIcon, {}) }) });
|
5808
5848
|
});
|
5809
5849
|
UserActionBarEdit.displayName = "UserActionBarEdit";
|
5810
5850
|
var exports8 = {
|
@@ -5814,17 +5854,13 @@ var exports8 = {
|
|
5814
5854
|
var user_action_bar_default = Object.assign(UserActionBar, exports8);
|
5815
5855
|
|
5816
5856
|
// src/ui/user-message-attachment.tsx
|
5817
|
-
import {
|
5818
|
-
var UserMessageAttachmentRoot = withDefaults(
|
5857
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
5858
|
+
var UserMessageAttachmentRoot = withDefaults(attachment_exports.Root, {
|
5819
5859
|
className: "aui-user-message-attachment-root"
|
5820
5860
|
});
|
5821
5861
|
UserMessageAttachmentRoot.displayName = "UserMessageAttachmentRoot";
|
5822
5862
|
var UserMessageAttachment = () => {
|
5823
|
-
|
5824
|
-
return /* @__PURE__ */ jsxs10(UserMessageAttachmentRoot, { children: [
|
5825
|
-
".",
|
5826
|
-
attachment.name.split(".").pop()
|
5827
|
-
] });
|
5863
|
+
return /* @__PURE__ */ jsx49(UserMessageAttachmentRoot, { children: /* @__PURE__ */ jsx49(attachment_exports.unstable_Thumb, {}) });
|
5828
5864
|
};
|
5829
5865
|
UserMessageAttachment.displayName = "UserMessageAttachment";
|
5830
5866
|
var exports9 = {
|
@@ -5836,13 +5872,13 @@ var user_message_attachment_default = Object.assign(
|
|
5836
5872
|
);
|
5837
5873
|
|
5838
5874
|
// src/ui/user-message.tsx
|
5839
|
-
import { jsx as
|
5875
|
+
import { jsx as jsx50, jsxs as jsxs11 } from "react/jsx-runtime";
|
5840
5876
|
var UserMessage = () => {
|
5841
5877
|
return /* @__PURE__ */ jsxs11(UserMessageRoot, { children: [
|
5842
|
-
/* @__PURE__ */
|
5843
|
-
/* @__PURE__ */
|
5844
|
-
/* @__PURE__ */
|
5845
|
-
/* @__PURE__ */
|
5878
|
+
/* @__PURE__ */ jsx50(UserMessageAttachments, {}),
|
5879
|
+
/* @__PURE__ */ jsx50(user_action_bar_default, {}),
|
5880
|
+
/* @__PURE__ */ jsx50(UserMessageContent, {}),
|
5881
|
+
/* @__PURE__ */ jsx50(branch_picker_default, {})
|
5846
5882
|
] });
|
5847
5883
|
};
|
5848
5884
|
UserMessage.displayName = "UserMessage";
|
@@ -5853,9 +5889,9 @@ UserMessageRoot.displayName = "UserMessageRoot";
|
|
5853
5889
|
var UserMessageContentWrapper = withDefaults("div", {
|
5854
5890
|
className: "aui-user-message-content"
|
5855
5891
|
});
|
5856
|
-
var UserMessageContent =
|
5892
|
+
var UserMessageContent = forwardRef31(
|
5857
5893
|
({ components, ...props }, ref) => {
|
5858
|
-
return /* @__PURE__ */
|
5894
|
+
return /* @__PURE__ */ jsx50(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx50(
|
5859
5895
|
message_exports.Content,
|
5860
5896
|
{
|
5861
5897
|
components: {
|
@@ -5873,7 +5909,7 @@ var UserMessageAttachmentsContainer = withDefaults("div", {
|
|
5873
5909
|
var UserMessageAttachments = ({
|
5874
5910
|
components
|
5875
5911
|
}) => {
|
5876
|
-
return /* @__PURE__ */
|
5912
|
+
return /* @__PURE__ */ jsx50(message_exports.If, { hasAttachments: true, children: /* @__PURE__ */ jsx50(UserMessageAttachmentsContainer, { children: /* @__PURE__ */ jsx50(
|
5877
5913
|
message_exports.Attachments,
|
5878
5914
|
{
|
5879
5915
|
components: {
|
@@ -5891,14 +5927,14 @@ var exports10 = {
|
|
5891
5927
|
var user_message_default = Object.assign(UserMessage, exports10);
|
5892
5928
|
|
5893
5929
|
// src/ui/edit-composer.tsx
|
5894
|
-
import { forwardRef as
|
5895
|
-
import { jsx as
|
5930
|
+
import { forwardRef as forwardRef32 } from "react";
|
5931
|
+
import { jsx as jsx51, jsxs as jsxs12 } from "react/jsx-runtime";
|
5896
5932
|
var EditComposer = () => {
|
5897
5933
|
return /* @__PURE__ */ jsxs12(EditComposerRoot, { children: [
|
5898
|
-
/* @__PURE__ */
|
5934
|
+
/* @__PURE__ */ jsx51(EditComposerInput, {}),
|
5899
5935
|
/* @__PURE__ */ jsxs12(EditComposerFooter, { children: [
|
5900
|
-
/* @__PURE__ */
|
5901
|
-
/* @__PURE__ */
|
5936
|
+
/* @__PURE__ */ jsx51(EditComposerCancel, {}),
|
5937
|
+
/* @__PURE__ */ jsx51(EditComposerSend, {})
|
5902
5938
|
] })
|
5903
5939
|
] });
|
5904
5940
|
};
|
@@ -5915,23 +5951,23 @@ var EditComposerFooter = withDefaults("div", {
|
|
5915
5951
|
className: "aui-edit-composer-footer"
|
5916
5952
|
});
|
5917
5953
|
EditComposerFooter.displayName = "EditComposerFooter";
|
5918
|
-
var EditComposerCancel =
|
5954
|
+
var EditComposerCancel = forwardRef32(
|
5919
5955
|
(props, ref) => {
|
5920
5956
|
const {
|
5921
5957
|
strings: {
|
5922
5958
|
editComposer: { cancel: { label = "Cancel" } = {} } = {}
|
5923
5959
|
} = {}
|
5924
5960
|
} = useThreadConfig();
|
5925
|
-
return /* @__PURE__ */
|
5961
|
+
return /* @__PURE__ */ jsx51(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx51(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
|
5926
5962
|
}
|
5927
5963
|
);
|
5928
5964
|
EditComposerCancel.displayName = "EditComposerCancel";
|
5929
|
-
var EditComposerSend =
|
5965
|
+
var EditComposerSend = forwardRef32(
|
5930
5966
|
(props, ref) => {
|
5931
5967
|
const {
|
5932
5968
|
strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
|
5933
5969
|
} = useThreadConfig();
|
5934
|
-
return /* @__PURE__ */
|
5970
|
+
return /* @__PURE__ */ jsx51(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx51(Button, { ...props, ref, children: props.children ?? label }) });
|
5935
5971
|
}
|
5936
5972
|
);
|
5937
5973
|
EditComposerSend.displayName = "EditComposerSend";
|
@@ -5945,7 +5981,7 @@ var exports11 = {
|
|
5945
5981
|
var edit_composer_default = Object.assign(EditComposer, exports11);
|
5946
5982
|
|
5947
5983
|
// src/ui/thread.tsx
|
5948
|
-
import { Fragment as
|
5984
|
+
import { Fragment as Fragment7, jsx as jsx52, jsxs as jsxs13 } from "react/jsx-runtime";
|
5949
5985
|
var Thread = (config) => {
|
5950
5986
|
const {
|
5951
5987
|
components: {
|
@@ -5953,22 +5989,22 @@ var Thread = (config) => {
|
|
5953
5989
|
ThreadWelcome: ThreadWelcomeComponent = thread_welcome_default
|
5954
5990
|
} = {}
|
5955
5991
|
} = config;
|
5956
|
-
return /* @__PURE__ */
|
5957
|
-
/* @__PURE__ */
|
5958
|
-
/* @__PURE__ */
|
5959
|
-
/* @__PURE__ */
|
5992
|
+
return /* @__PURE__ */ jsx52(ThreadRoot, { config, children: /* @__PURE__ */ jsxs13(ThreadViewport, { children: [
|
5993
|
+
/* @__PURE__ */ jsx52(ThreadWelcomeComponent, {}),
|
5994
|
+
/* @__PURE__ */ jsx52(ThreadMessages, {}),
|
5995
|
+
/* @__PURE__ */ jsx52(ThreadFollowupSuggestions, {}),
|
5960
5996
|
/* @__PURE__ */ jsxs13(ThreadViewportFooter, { children: [
|
5961
|
-
/* @__PURE__ */
|
5962
|
-
/* @__PURE__ */
|
5997
|
+
/* @__PURE__ */ jsx52(ThreadScrollToBottom, {}),
|
5998
|
+
/* @__PURE__ */ jsx52(ComposerComponent, {})
|
5963
5999
|
] })
|
5964
6000
|
] }) });
|
5965
6001
|
};
|
5966
6002
|
var ThreadRootStyled = withDefaults(thread_exports.Root, {
|
5967
6003
|
className: "aui-root aui-thread-root"
|
5968
6004
|
});
|
5969
|
-
var ThreadRoot =
|
6005
|
+
var ThreadRoot = forwardRef33(
|
5970
6006
|
({ config, ...props }, ref) => {
|
5971
|
-
return /* @__PURE__ */
|
6007
|
+
return /* @__PURE__ */ jsx52(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx52(ThreadRootStyled, { ...props, ref }) });
|
5972
6008
|
}
|
5973
6009
|
);
|
5974
6010
|
ThreadRoot.displayName = "ThreadRoot";
|
@@ -5982,8 +6018,8 @@ var ThreadViewportFooter = withDefaults("div", {
|
|
5982
6018
|
ThreadViewportFooter.displayName = "ThreadViewportFooter";
|
5983
6019
|
var SystemMessage = () => null;
|
5984
6020
|
var ThreadMessages = ({ components, unstable_flexGrowDiv: flexGrowDiv = true, ...rest }) => {
|
5985
|
-
return /* @__PURE__ */ jsxs13(
|
5986
|
-
/* @__PURE__ */
|
6021
|
+
return /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
6022
|
+
/* @__PURE__ */ jsx52(
|
5987
6023
|
thread_exports.Messages,
|
5988
6024
|
{
|
5989
6025
|
components: {
|
@@ -5995,13 +6031,13 @@ var ThreadMessages = ({ components, unstable_flexGrowDiv: flexGrowDiv = true, ..
|
|
5995
6031
|
...rest
|
5996
6032
|
}
|
5997
6033
|
),
|
5998
|
-
flexGrowDiv && /* @__PURE__ */
|
6034
|
+
flexGrowDiv && /* @__PURE__ */ jsx52(thread_exports.If, { empty: false, children: /* @__PURE__ */ jsx52("div", { style: { flexGrow: 1 } }) })
|
5999
6035
|
] });
|
6000
6036
|
};
|
6001
6037
|
ThreadMessages.displayName = "ThreadMessages";
|
6002
6038
|
var ThreadFollowupSuggestions = () => {
|
6003
6039
|
const suggestions = useThread((t) => t.suggestions);
|
6004
|
-
return /* @__PURE__ */
|
6040
|
+
return /* @__PURE__ */ jsx52(thread_exports.If, { empty: false, running: false, children: /* @__PURE__ */ jsx52("div", { className: "aui-thread-followup-suggestions", children: suggestions?.map((suggestion, idx) => /* @__PURE__ */ jsx52(
|
6005
6041
|
thread_exports.Suggestion,
|
6006
6042
|
{
|
6007
6043
|
className: "aui-thread-followup-suggestion",
|
@@ -6017,13 +6053,13 @@ var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
|
|
6017
6053
|
variant: "outline",
|
6018
6054
|
className: "aui-thread-scroll-to-bottom"
|
6019
6055
|
});
|
6020
|
-
var ThreadScrollToBottom =
|
6056
|
+
var ThreadScrollToBottom = forwardRef33((props, ref) => {
|
6021
6057
|
const {
|
6022
6058
|
strings: {
|
6023
6059
|
thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
|
6024
6060
|
} = {}
|
6025
6061
|
} = useThreadConfig();
|
6026
|
-
return /* @__PURE__ */
|
6062
|
+
return /* @__PURE__ */ jsx52(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx52(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx52(ArrowDownIcon, {}) }) });
|
6027
6063
|
});
|
6028
6064
|
ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
|
6029
6065
|
var exports12 = {
|
@@ -6037,20 +6073,20 @@ var exports12 = {
|
|
6037
6073
|
var thread_default = Object.assign(Thread, exports12);
|
6038
6074
|
|
6039
6075
|
// src/ui/assistant-modal.tsx
|
6040
|
-
import { Fragment as
|
6076
|
+
import { Fragment as Fragment8, jsx as jsx53, jsxs as jsxs14 } from "react/jsx-runtime";
|
6041
6077
|
var AssistantModal = (config) => {
|
6042
6078
|
return /* @__PURE__ */ jsxs14(AssistantModalRoot, { config, children: [
|
6043
|
-
/* @__PURE__ */
|
6044
|
-
/* @__PURE__ */
|
6079
|
+
/* @__PURE__ */ jsx53(AssistantModalTrigger, {}),
|
6080
|
+
/* @__PURE__ */ jsx53(AssistantModalContent, { children: /* @__PURE__ */ jsx53(thread_default, {}) })
|
6045
6081
|
] });
|
6046
6082
|
};
|
6047
6083
|
AssistantModal.displayName = "AssistantModal";
|
6048
6084
|
var AssistantModalRoot = ({ config, ...props }) => {
|
6049
|
-
return /* @__PURE__ */
|
6085
|
+
return /* @__PURE__ */ jsx53(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx53(assistantModal_exports.Root, { ...props }) });
|
6050
6086
|
};
|
6051
6087
|
AssistantModalRoot.displayName = "AssistantModalRoot";
|
6052
|
-
var AssistantModalTrigger =
|
6053
|
-
return /* @__PURE__ */
|
6088
|
+
var AssistantModalTrigger = forwardRef34((props, ref) => {
|
6089
|
+
return /* @__PURE__ */ jsx53(AssistantModalAnchor, { children: /* @__PURE__ */ jsx53(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx53(AssistantModalButton, { ...props, ref }) }) });
|
6054
6090
|
});
|
6055
6091
|
AssistantModalTrigger.displayName = "AssistantModalTrigger";
|
6056
6092
|
var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
|
@@ -6061,7 +6097,7 @@ var ModalButtonStyled = withDefaults(TooltipIconButton, {
|
|
6061
6097
|
variant: "default",
|
6062
6098
|
className: "aui-modal-button"
|
6063
6099
|
});
|
6064
|
-
var AssistantModalButton =
|
6100
|
+
var AssistantModalButton = forwardRef34(({ "data-state": state, ...rest }, ref) => {
|
6065
6101
|
const {
|
6066
6102
|
strings: {
|
6067
6103
|
assistantModal: {
|
@@ -6075,7 +6111,7 @@ var AssistantModalButton = forwardRef32(({ "data-state": state, ...rest }, ref)
|
|
6075
6111
|
} = {}
|
6076
6112
|
} = useThreadConfig();
|
6077
6113
|
const tooltip = state === "open" ? openTooltip : closedTooltip;
|
6078
|
-
return /* @__PURE__ */
|
6114
|
+
return /* @__PURE__ */ jsx53(
|
6079
6115
|
ModalButtonStyled,
|
6080
6116
|
{
|
6081
6117
|
side: "left",
|
@@ -6083,15 +6119,15 @@ var AssistantModalButton = forwardRef32(({ "data-state": state, ...rest }, ref)
|
|
6083
6119
|
"data-state": state,
|
6084
6120
|
...rest,
|
6085
6121
|
ref,
|
6086
|
-
children: rest.children ?? /* @__PURE__ */ jsxs14(
|
6087
|
-
/* @__PURE__ */
|
6122
|
+
children: rest.children ?? /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
6123
|
+
/* @__PURE__ */ jsx53(
|
6088
6124
|
BotIcon,
|
6089
6125
|
{
|
6090
6126
|
"data-state": state,
|
6091
6127
|
className: "aui-modal-button-closed-icon"
|
6092
6128
|
}
|
6093
6129
|
),
|
6094
|
-
/* @__PURE__ */
|
6130
|
+
/* @__PURE__ */ jsx53(
|
6095
6131
|
ChevronDownIcon,
|
6096
6132
|
{
|
6097
6133
|
"data-state": state,
|
@@ -6123,6 +6159,7 @@ export {
|
|
6123
6159
|
assistant_modal_default as AssistantModal,
|
6124
6160
|
assistantModal_exports as AssistantModalPrimitive,
|
6125
6161
|
AssistantRuntimeProvider,
|
6162
|
+
attachment_exports as AttachmentPrimitive,
|
6126
6163
|
branch_picker_default as BranchPicker,
|
6127
6164
|
branchPicker_exports as BranchPickerPrimitive,
|
6128
6165
|
composer_default as Composer,
|