@assistant-ui/react 0.5.18 → 0.5.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/ModelConfigTypes-ComYH1b6.d.mts +156 -0
- package/dist/ModelConfigTypes-ComYH1b6.d.ts +156 -0
- package/dist/chunk-BV6Y7C43.mjs +61 -0
- package/dist/chunk-BV6Y7C43.mjs.map +1 -0
- package/dist/edge.d.mts +5 -90
- package/dist/edge.d.ts +5 -90
- package/dist/edge.mjs +44 -56
- package/dist/edge.mjs.map +1 -1
- package/dist/index.d.mts +36 -13
- package/dist/index.d.ts +36 -13
- package/dist/index.js +342 -282
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +307 -240
- package/dist/index.mjs.map +1 -1
- package/dist/internal.d.mts +128 -0
- package/dist/internal.d.ts +128 -0
- package/dist/internal.js +619 -0
- package/dist/internal.js.map +1 -0
- package/dist/internal.mjs +531 -0
- package/dist/internal.mjs.map +1 -0
- package/dist/styles/index.css +3 -3
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/thread.css +1 -1
- package/internal/README.md +1 -0
- package/internal/package.json +5 -0
- package/package.json +12 -1
package/dist/index.mjs
CHANGED
@@ -1118,8 +1118,8 @@ var BranchPickerPrimitiveNumber = () => {
|
|
1118
1118
|
BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
|
1119
1119
|
|
1120
1120
|
// src/primitives/branchPicker/BranchPickerRoot.tsx
|
1121
|
-
import { Primitive as
|
1122
|
-
import { forwardRef as
|
1121
|
+
import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
|
1122
|
+
import { forwardRef as forwardRef10 } from "react";
|
1123
1123
|
|
1124
1124
|
// src/primitives/message/index.ts
|
1125
1125
|
var message_exports = {};
|
@@ -1161,9 +1161,9 @@ var useIsHoveringRef = () => {
|
|
1161
1161
|
);
|
1162
1162
|
return useManagedRef(callbackRef);
|
1163
1163
|
};
|
1164
|
-
var MessagePrimitiveRoot = forwardRef6(({ onMouseEnter, onMouseLeave, ...rest },
|
1164
|
+
var MessagePrimitiveRoot = forwardRef6(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef29) => {
|
1165
1165
|
const isHoveringRef = useIsHoveringRef();
|
1166
|
-
const ref = useComposedRefs(
|
1166
|
+
const ref = useComposedRefs(forwardRef29, isHoveringRef);
|
1167
1167
|
return /* @__PURE__ */ jsx12(Primitive3.div, { ...rest, ref });
|
1168
1168
|
});
|
1169
1169
|
MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
|
@@ -1225,7 +1225,6 @@ var useContentPartContext2 = (partIndex) => {
|
|
1225
1225
|
const useContentPart = create10(
|
1226
1226
|
() => getContentPartState(useMessage.getState(), void 0, partIndex)
|
1227
1227
|
);
|
1228
|
-
getContentPartState(useMessage.getState(), useContentPart, partIndex);
|
1229
1228
|
return { useContentPart };
|
1230
1229
|
});
|
1231
1230
|
useEffect6(() => {
|
@@ -1252,11 +1251,58 @@ var ContentPartProvider = ({
|
|
1252
1251
|
};
|
1253
1252
|
|
1254
1253
|
// src/primitives/contentPart/ContentPartText.tsx
|
1255
|
-
import {
|
1256
|
-
|
1254
|
+
import {
|
1255
|
+
forwardRef as forwardRef8
|
1256
|
+
} from "react";
|
1257
|
+
|
1258
|
+
// src/utils/smooth/useSmooth.tsx
|
1259
|
+
import { useEffect as useEffect7, useMemo as useMemo3, useRef as useRef3, useState as useState6 } from "react";
|
1260
|
+
|
1261
|
+
// src/utils/smooth/SmoothContext.tsx
|
1262
|
+
import {
|
1263
|
+
createContext as createContext5,
|
1264
|
+
forwardRef as forwardRef7,
|
1265
|
+
useContext as useContext5,
|
1266
|
+
useState as useState5
|
1267
|
+
} from "react";
|
1268
|
+
import { create as create11 } from "zustand";
|
1269
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
1270
|
+
var SmoothContext = createContext5(null);
|
1271
|
+
var makeSmoothContext = (initialState) => {
|
1272
|
+
const useSmoothStatus2 = create11(() => initialState);
|
1273
|
+
return { useSmoothStatus: useSmoothStatus2 };
|
1274
|
+
};
|
1275
|
+
var SmoothContextProvider = ({ children }) => {
|
1276
|
+
const outer = useSmoothContext({ optional: true });
|
1277
|
+
const { useContentPart } = useContentPartContext();
|
1278
|
+
const [context] = useState5(
|
1279
|
+
() => makeSmoothContext(useContentPart.getState().status)
|
1280
|
+
);
|
1281
|
+
if (outer) return children;
|
1282
|
+
return /* @__PURE__ */ jsx14(SmoothContext.Provider, { value: context, children });
|
1283
|
+
};
|
1284
|
+
var withSmoothContextProvider = (Component) => {
|
1285
|
+
const Wrapped = forwardRef7((props, ref) => {
|
1286
|
+
return /* @__PURE__ */ jsx14(SmoothContextProvider, { children: /* @__PURE__ */ jsx14(Component, { ...props, ref }) });
|
1287
|
+
});
|
1288
|
+
Wrapped.displayName = Component.displayName;
|
1289
|
+
return Wrapped;
|
1290
|
+
};
|
1291
|
+
function useSmoothContext(options) {
|
1292
|
+
const context = useContext5(SmoothContext);
|
1293
|
+
if (!options?.optional && !context)
|
1294
|
+
throw new Error(
|
1295
|
+
"This component must be used within a SmoothContextProvider."
|
1296
|
+
);
|
1297
|
+
return context;
|
1298
|
+
}
|
1299
|
+
var useSmoothStatus = () => {
|
1300
|
+
const { useSmoothStatus: useSmoothStatus2 } = useSmoothContext();
|
1301
|
+
return useSmoothStatus2();
|
1302
|
+
};
|
1257
1303
|
|
1258
|
-
// src/utils/
|
1259
|
-
import {
|
1304
|
+
// src/utils/smooth/useSmooth.tsx
|
1305
|
+
import { useCallbackRef as useCallbackRef2 } from "@radix-ui/react-use-callback-ref";
|
1260
1306
|
var TextStreamAnimator = class {
|
1261
1307
|
constructor(currentText, setText) {
|
1262
1308
|
this.currentText = currentText;
|
@@ -1301,13 +1347,24 @@ var TextStreamAnimator = class {
|
|
1301
1347
|
this.setText(this.currentText);
|
1302
1348
|
};
|
1303
1349
|
};
|
1304
|
-
var
|
1350
|
+
var SMOOTH_STATUS = Object.freeze({
|
1351
|
+
type: "running"
|
1352
|
+
});
|
1353
|
+
var useSmooth = (state, smooth = false) => {
|
1354
|
+
const { useSmoothStatus: useSmoothStatus2 } = useSmoothContext({ optional: true }) ?? {};
|
1355
|
+
const {
|
1356
|
+
part: { text }
|
1357
|
+
} = state;
|
1305
1358
|
const { useMessage } = useMessageContext();
|
1306
1359
|
const id = useMessage((m) => m.message.id);
|
1307
1360
|
const idRef = useRef3(id);
|
1308
|
-
const [displayedText, setDisplayedText] =
|
1309
|
-
const
|
1310
|
-
|
1361
|
+
const [displayedText, setDisplayedText] = useState6(text);
|
1362
|
+
const setText = useCallbackRef2((text2) => {
|
1363
|
+
setDisplayedText(text2);
|
1364
|
+
useSmoothStatus2?.setState(text2 !== state.part.text ? SMOOTH_STATUS : state.status);
|
1365
|
+
});
|
1366
|
+
const [animatorRef] = useState6(
|
1367
|
+
new TextStreamAnimator(text, setText)
|
1311
1368
|
);
|
1312
1369
|
useEffect7(() => {
|
1313
1370
|
if (!smooth) {
|
@@ -1316,7 +1373,7 @@ var useSmooth = (text, smooth = false) => {
|
|
1316
1373
|
}
|
1317
1374
|
if (idRef.current !== id || !text.startsWith(animatorRef.targetText)) {
|
1318
1375
|
idRef.current = id;
|
1319
|
-
|
1376
|
+
setText(text);
|
1320
1377
|
animatorRef.currentText = text;
|
1321
1378
|
animatorRef.targetText = text;
|
1322
1379
|
animatorRef.stop();
|
@@ -1324,36 +1381,41 @@ var useSmooth = (text, smooth = false) => {
|
|
1324
1381
|
}
|
1325
1382
|
animatorRef.targetText = text;
|
1326
1383
|
animatorRef.start();
|
1327
|
-
}, [animatorRef, id, smooth, text]);
|
1384
|
+
}, [setText, animatorRef, id, smooth, text]);
|
1328
1385
|
useEffect7(() => {
|
1329
1386
|
return () => {
|
1330
1387
|
animatorRef.stop();
|
1331
1388
|
};
|
1332
1389
|
}, [animatorRef]);
|
1333
|
-
return
|
1390
|
+
return useMemo3(
|
1391
|
+
() => smooth ? {
|
1392
|
+
part: { type: "text", text: displayedText },
|
1393
|
+
status: text === displayedText ? state.status : SMOOTH_STATUS
|
1394
|
+
} : state,
|
1395
|
+
[smooth, displayedText, state, text]
|
1396
|
+
);
|
1334
1397
|
};
|
1335
1398
|
|
1336
1399
|
// src/primitives/contentPart/ContentPartText.tsx
|
1337
|
-
import { jsx as
|
1338
|
-
var ContentPartPrimitiveText =
|
1400
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
1401
|
+
var ContentPartPrimitiveText = forwardRef8(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
|
1339
1402
|
const {
|
1340
|
-
|
1341
|
-
|
1342
|
-
} = useContentPartText();
|
1343
|
-
|
1344
|
-
return /* @__PURE__ */ jsx14(Primitive4.span, { "data-status": status.type, ...rest, ref: forwardedRef, children: smoothText });
|
1403
|
+
part: { text },
|
1404
|
+
status
|
1405
|
+
} = useSmooth(useContentPartText(), smooth);
|
1406
|
+
return /* @__PURE__ */ jsx15(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
|
1345
1407
|
});
|
1346
1408
|
ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
|
1347
1409
|
|
1348
1410
|
// src/primitives/contentPart/ContentPartImage.tsx
|
1349
|
-
import { Primitive as
|
1350
|
-
import { forwardRef as
|
1351
|
-
import { jsx as
|
1352
|
-
var ContentPartPrimitiveImage =
|
1411
|
+
import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
|
1412
|
+
import { forwardRef as forwardRef9 } from "react";
|
1413
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
1414
|
+
var ContentPartPrimitiveImage = forwardRef9((props, forwardedRef) => {
|
1353
1415
|
const {
|
1354
1416
|
part: { image }
|
1355
1417
|
} = useContentPartImage();
|
1356
|
-
return /* @__PURE__ */
|
1418
|
+
return /* @__PURE__ */ jsx16(Primitive4.img, { src: image, ...props, ref: forwardedRef });
|
1357
1419
|
});
|
1358
1420
|
ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
|
1359
1421
|
|
@@ -1375,25 +1437,26 @@ var ContentPartPrimitiveInProgress = ({ children }) => {
|
|
1375
1437
|
ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
|
1376
1438
|
|
1377
1439
|
// src/primitives/message/MessageContent.tsx
|
1378
|
-
import { jsx as
|
1440
|
+
import { jsx as jsx17, jsxs as jsxs2 } from "react/jsx-runtime";
|
1379
1441
|
var defaultComponents = {
|
1380
1442
|
Text: () => /* @__PURE__ */ jsxs2("p", { style: { whiteSpace: "pre-line" }, children: [
|
1381
|
-
/* @__PURE__ */
|
1382
|
-
/* @__PURE__ */
|
1443
|
+
/* @__PURE__ */ jsx17(ContentPartPrimitiveText, {}),
|
1444
|
+
/* @__PURE__ */ jsx17(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx17("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
|
1383
1445
|
] }),
|
1384
|
-
Image: () => /* @__PURE__ */
|
1385
|
-
UI: () => /* @__PURE__ */
|
1446
|
+
Image: () => /* @__PURE__ */ jsx17(ContentPartPrimitiveImage, {}),
|
1447
|
+
UI: () => /* @__PURE__ */ jsx17(ContentPartPrimitiveDisplay, {}),
|
1386
1448
|
tools: {
|
1387
1449
|
Fallback: (props) => {
|
1388
1450
|
const { useToolUIs } = useAssistantContext();
|
1389
1451
|
const Render = useToolUIs((s) => s.getToolUI(props.part.toolName));
|
1390
1452
|
if (!Render) return null;
|
1391
|
-
return /* @__PURE__ */
|
1453
|
+
return /* @__PURE__ */ jsx17(Render, { ...props });
|
1392
1454
|
}
|
1393
1455
|
}
|
1394
1456
|
};
|
1395
1457
|
var MessageContentPartComponent = ({
|
1396
1458
|
components: {
|
1459
|
+
Empty = defaultComponents.Text,
|
1397
1460
|
Text: Text2 = defaultComponents.Text,
|
1398
1461
|
Image: Image2 = defaultComponents.Image,
|
1399
1462
|
UI = defaultComponents.UI,
|
@@ -1410,15 +1473,16 @@ var MessageContentPartComponent = ({
|
|
1410
1473
|
case "text":
|
1411
1474
|
if (status.type === "requires-action")
|
1412
1475
|
throw new Error("Encountered unexpected requires-action status");
|
1413
|
-
return /* @__PURE__ */
|
1476
|
+
if (part === EMPTY_CONTENT) return /* @__PURE__ */ jsx17(Empty, { part, status });
|
1477
|
+
return /* @__PURE__ */ jsx17(Text2, { part, status });
|
1414
1478
|
case "image":
|
1415
1479
|
if (status.type === "requires-action")
|
1416
1480
|
throw new Error("Encountered unexpected requires-action status");
|
1417
|
-
return /* @__PURE__ */
|
1481
|
+
return /* @__PURE__ */ jsx17(Image2, { part, status });
|
1418
1482
|
case "ui":
|
1419
1483
|
if (status.type === "requires-action")
|
1420
1484
|
throw new Error("Encountered unexpected requires-action status");
|
1421
|
-
return /* @__PURE__ */
|
1485
|
+
return /* @__PURE__ */ jsx17(UI, { part, status });
|
1422
1486
|
case "tool-call": {
|
1423
1487
|
const Tool = by_name[part.toolName] || Fallback2;
|
1424
1488
|
const addResult = (result) => addToolResult({
|
@@ -1426,7 +1490,7 @@ var MessageContentPartComponent = ({
|
|
1426
1490
|
toolCallId: part.toolCallId,
|
1427
1491
|
result
|
1428
1492
|
});
|
1429
|
-
return /* @__PURE__ */
|
1493
|
+
return /* @__PURE__ */ jsx17(Tool, { part, status, addResult });
|
1430
1494
|
}
|
1431
1495
|
default:
|
1432
1496
|
const unhandledType = type;
|
@@ -1437,7 +1501,7 @@ var MessageContentPartImpl = ({
|
|
1437
1501
|
partIndex,
|
1438
1502
|
components
|
1439
1503
|
}) => {
|
1440
|
-
return /* @__PURE__ */
|
1504
|
+
return /* @__PURE__ */ jsx17(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx17(MessageContentPartComponent, { components }) });
|
1441
1505
|
};
|
1442
1506
|
var MessageContentPart = memo2(
|
1443
1507
|
MessageContentPartImpl,
|
@@ -1450,7 +1514,7 @@ var MessagePrimitiveContent = ({
|
|
1450
1514
|
const contentLength = useMessage((s) => s.message.content.length) || 1;
|
1451
1515
|
return new Array(contentLength).fill(null).map((_, idx) => {
|
1452
1516
|
const partIndex = idx;
|
1453
|
-
return /* @__PURE__ */
|
1517
|
+
return /* @__PURE__ */ jsx17(
|
1454
1518
|
MessageContentPart,
|
1455
1519
|
{
|
1456
1520
|
partIndex,
|
@@ -1469,9 +1533,9 @@ var MessagePrimitiveInProgress = () => {
|
|
1469
1533
|
MessagePrimitiveInProgress.displayName = "MessagePrimitive.InProgress";
|
1470
1534
|
|
1471
1535
|
// src/primitives/branchPicker/BranchPickerRoot.tsx
|
1472
|
-
import { jsx as
|
1473
|
-
var BranchPickerPrimitiveRoot =
|
1474
|
-
return /* @__PURE__ */
|
1536
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
1537
|
+
var BranchPickerPrimitiveRoot = forwardRef10(({ hideWhenSingleBranch, ...rest }, ref) => {
|
1538
|
+
return /* @__PURE__ */ jsx18(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx18(Primitive5.div, { ...rest, ref }) });
|
1475
1539
|
});
|
1476
1540
|
BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
|
1477
1541
|
|
@@ -1487,20 +1551,20 @@ __export(composer_exports, {
|
|
1487
1551
|
|
1488
1552
|
// src/primitives/composer/ComposerRoot.tsx
|
1489
1553
|
import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
|
1490
|
-
import { Primitive as
|
1554
|
+
import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
|
1491
1555
|
import {
|
1492
|
-
forwardRef as
|
1556
|
+
forwardRef as forwardRef11
|
1493
1557
|
} from "react";
|
1494
|
-
import { jsx as
|
1495
|
-
var ComposerPrimitiveRoot =
|
1558
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
1559
|
+
var ComposerPrimitiveRoot = forwardRef11(({ onSubmit, ...rest }, forwardedRef) => {
|
1496
1560
|
const send = useComposerSend();
|
1497
1561
|
const handleSubmit = (e) => {
|
1498
1562
|
e.preventDefault();
|
1499
1563
|
if (!send) return;
|
1500
1564
|
send();
|
1501
1565
|
};
|
1502
|
-
return /* @__PURE__ */
|
1503
|
-
|
1566
|
+
return /* @__PURE__ */ jsx19(
|
1567
|
+
Primitive6.form,
|
1504
1568
|
{
|
1505
1569
|
...rest,
|
1506
1570
|
ref: forwardedRef,
|
@@ -1515,15 +1579,15 @@ import { composeEventHandlers as composeEventHandlers5 } from "@radix-ui/primiti
|
|
1515
1579
|
import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
|
1516
1580
|
import { Slot } from "@radix-ui/react-slot";
|
1517
1581
|
import {
|
1518
|
-
forwardRef as
|
1582
|
+
forwardRef as forwardRef12,
|
1519
1583
|
useCallback as useCallback15,
|
1520
1584
|
useEffect as useEffect8,
|
1521
1585
|
useRef as useRef4
|
1522
1586
|
} from "react";
|
1523
1587
|
import TextareaAutosize from "react-textarea-autosize";
|
1524
1588
|
import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
|
1525
|
-
import { jsx as
|
1526
|
-
var ComposerPrimitiveInput =
|
1589
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
1590
|
+
var ComposerPrimitiveInput = forwardRef12(
|
1527
1591
|
({
|
1528
1592
|
autoFocus = false,
|
1529
1593
|
asChild,
|
@@ -1575,7 +1639,7 @@ var ComposerPrimitiveInput = forwardRef11(
|
|
1575
1639
|
focus();
|
1576
1640
|
}
|
1577
1641
|
});
|
1578
|
-
return /* @__PURE__ */
|
1642
|
+
return /* @__PURE__ */ jsx20(
|
1579
1643
|
Component,
|
1580
1644
|
{
|
1581
1645
|
name: "input",
|
@@ -1596,14 +1660,14 @@ var ComposerPrimitiveInput = forwardRef11(
|
|
1596
1660
|
ComposerPrimitiveInput.displayName = "ComposerPrimitive.Input";
|
1597
1661
|
|
1598
1662
|
// src/primitives/composer/ComposerSend.tsx
|
1599
|
-
import { forwardRef as
|
1600
|
-
import { Primitive as
|
1601
|
-
import { jsx as
|
1602
|
-
var ComposerPrimitiveSend =
|
1663
|
+
import { forwardRef as forwardRef13 } from "react";
|
1664
|
+
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
1665
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
1666
|
+
var ComposerPrimitiveSend = forwardRef13(({ disabled, ...rest }, ref) => {
|
1603
1667
|
const { useComposer } = useComposerContext();
|
1604
1668
|
const hasValue = useComposer((c) => c.isEditing && c.value.length > 0);
|
1605
|
-
return /* @__PURE__ */
|
1606
|
-
|
1669
|
+
return /* @__PURE__ */ jsx21(
|
1670
|
+
Primitive7.button,
|
1607
1671
|
{
|
1608
1672
|
type: "submit",
|
1609
1673
|
...rest,
|
@@ -1652,11 +1716,11 @@ __export(thread_exports, {
|
|
1652
1716
|
});
|
1653
1717
|
|
1654
1718
|
// src/primitives/thread/ThreadRoot.tsx
|
1655
|
-
import { Primitive as
|
1656
|
-
import { forwardRef as
|
1657
|
-
import { jsx as
|
1658
|
-
var ThreadPrimitiveRoot =
|
1659
|
-
return /* @__PURE__ */
|
1719
|
+
import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
1720
|
+
import { forwardRef as forwardRef14 } from "react";
|
1721
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
1722
|
+
var ThreadPrimitiveRoot = forwardRef14((props, ref) => {
|
1723
|
+
return /* @__PURE__ */ jsx22(Primitive8.div, { ...props, ref });
|
1660
1724
|
});
|
1661
1725
|
ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
|
1662
1726
|
|
@@ -1681,18 +1745,18 @@ ThreadPrimitiveIf.displayName = "ThreadPrimitive.If";
|
|
1681
1745
|
|
1682
1746
|
// src/primitives/thread/ThreadViewport.tsx
|
1683
1747
|
import { useComposedRefs as useComposedRefs4 } from "@radix-ui/react-compose-refs";
|
1684
|
-
import { Primitive as
|
1685
|
-
import { forwardRef as
|
1748
|
+
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
1749
|
+
import { forwardRef as forwardRef15 } from "react";
|
1686
1750
|
|
1687
1751
|
// src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx
|
1688
1752
|
import { useComposedRefs as useComposedRefs3 } from "@radix-ui/react-compose-refs";
|
1689
1753
|
import { useRef as useRef5 } from "react";
|
1690
1754
|
|
1691
1755
|
// src/utils/hooks/useOnResizeContent.tsx
|
1692
|
-
import { useCallbackRef as
|
1756
|
+
import { useCallbackRef as useCallbackRef3 } from "@radix-ui/react-use-callback-ref";
|
1693
1757
|
import { useCallback as useCallback16 } from "react";
|
1694
1758
|
var useOnResizeContent = (callback) => {
|
1695
|
-
const callbackRef =
|
1759
|
+
const callbackRef = useCallbackRef3(callback);
|
1696
1760
|
const refCallback = useCallback16(
|
1697
1761
|
(el) => {
|
1698
1762
|
const resizeObserver = new ResizeObserver(() => {
|
@@ -1729,10 +1793,10 @@ var useOnResizeContent = (callback) => {
|
|
1729
1793
|
};
|
1730
1794
|
|
1731
1795
|
// src/utils/hooks/useOnScrollToBottom.tsx
|
1732
|
-
import { useCallbackRef as
|
1796
|
+
import { useCallbackRef as useCallbackRef4 } from "@radix-ui/react-use-callback-ref";
|
1733
1797
|
import { useEffect as useEffect9 } from "react";
|
1734
1798
|
var useOnScrollToBottom = (callback) => {
|
1735
|
-
const callbackRef =
|
1799
|
+
const callbackRef = useCallbackRef4(callback);
|
1736
1800
|
const { useViewport } = useThreadContext();
|
1737
1801
|
useEffect9(() => {
|
1738
1802
|
return useViewport.getState().onScrollToBottom(() => {
|
@@ -1793,13 +1857,13 @@ var useThreadViewportAutoScroll = ({
|
|
1793
1857
|
};
|
1794
1858
|
|
1795
1859
|
// src/primitives/thread/ThreadViewport.tsx
|
1796
|
-
import { jsx as
|
1797
|
-
var ThreadPrimitiveViewport =
|
1860
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
1861
|
+
var ThreadPrimitiveViewport = forwardRef15(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
|
1798
1862
|
const autoScrollRef = useThreadViewportAutoScroll({
|
1799
1863
|
autoScroll
|
1800
1864
|
});
|
1801
1865
|
const ref = useComposedRefs4(forwardedRef, autoScrollRef);
|
1802
|
-
return /* @__PURE__ */
|
1866
|
+
return /* @__PURE__ */ jsx23(Primitive9.div, { ...rest, ref, children });
|
1803
1867
|
});
|
1804
1868
|
ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
|
1805
1869
|
|
@@ -1807,15 +1871,15 @@ ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
|
|
1807
1871
|
import { memo as memo3 } from "react";
|
1808
1872
|
|
1809
1873
|
// src/context/providers/MessageProvider.tsx
|
1810
|
-
import { useEffect as useEffect10, useState as
|
1811
|
-
import { create as
|
1874
|
+
import { useEffect as useEffect10, useState as useState7 } from "react";
|
1875
|
+
import { create as create14 } from "zustand";
|
1812
1876
|
|
1813
1877
|
// src/context/stores/EditComposer.ts
|
1814
|
-
import { create as
|
1878
|
+
import { create as create12 } from "zustand";
|
1815
1879
|
var makeEditComposerStore = ({
|
1816
1880
|
onEdit,
|
1817
1881
|
onSend
|
1818
|
-
}) =>
|
1882
|
+
}) => create12()((set, get, store) => ({
|
1819
1883
|
...makeBaseComposer(set, get, store),
|
1820
1884
|
canCancel: false,
|
1821
1885
|
isEditing: false,
|
@@ -1834,8 +1898,8 @@ var makeEditComposerStore = ({
|
|
1834
1898
|
}));
|
1835
1899
|
|
1836
1900
|
// src/context/stores/MessageUtils.ts
|
1837
|
-
import { create as
|
1838
|
-
var makeMessageUtilsStore = () =>
|
1901
|
+
import { create as create13 } from "zustand";
|
1902
|
+
var makeMessageUtilsStore = () => create13((set) => ({
|
1839
1903
|
isCopied: false,
|
1840
1904
|
setIsCopied: (value) => {
|
1841
1905
|
set({ isCopied: value });
|
@@ -1847,7 +1911,7 @@ var makeMessageUtilsStore = () => create12((set) => ({
|
|
1847
1911
|
}));
|
1848
1912
|
|
1849
1913
|
// src/context/providers/MessageProvider.tsx
|
1850
|
-
import { jsx as
|
1914
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
1851
1915
|
var getIsLast = (messages, message) => {
|
1852
1916
|
return messages[messages.length - 1]?.id === message.id;
|
1853
1917
|
};
|
@@ -1869,8 +1933,8 @@ var getMessageState = (messages, getBranches, useMessage, messageIndex) => {
|
|
1869
1933
|
};
|
1870
1934
|
var useMessageContext2 = (messageIndex) => {
|
1871
1935
|
const { useThreadMessages, useThreadActions } = useThreadContext();
|
1872
|
-
const [context] =
|
1873
|
-
const useMessage =
|
1936
|
+
const [context] = useState7(() => {
|
1937
|
+
const useMessage = create14(
|
1874
1938
|
() => getMessageState(
|
1875
1939
|
useThreadMessages.getState(),
|
1876
1940
|
useThreadActions.getState().getBranches,
|
@@ -1931,11 +1995,11 @@ var MessageProvider = ({
|
|
1931
1995
|
children
|
1932
1996
|
}) => {
|
1933
1997
|
const context = useMessageContext2(messageIndex);
|
1934
|
-
return /* @__PURE__ */
|
1998
|
+
return /* @__PURE__ */ jsx24(MessageContext.Provider, { value: context, children });
|
1935
1999
|
};
|
1936
2000
|
|
1937
2001
|
// src/primitives/thread/ThreadMessages.tsx
|
1938
|
-
import { jsx as
|
2002
|
+
import { jsx as jsx25, jsxs as jsxs3 } from "react/jsx-runtime";
|
1939
2003
|
var DEFAULT_SYSTEM_MESSAGE = () => null;
|
1940
2004
|
var getComponents = (components) => {
|
1941
2005
|
return {
|
@@ -1952,11 +2016,11 @@ var ThreadMessageImpl = ({
|
|
1952
2016
|
const { UserMessage: UserMessage2, EditComposer: EditComposer2, AssistantMessage: AssistantMessage2, SystemMessage: SystemMessage2 } = getComponents(components);
|
1953
2017
|
return /* @__PURE__ */ jsxs3(MessageProvider, { messageIndex, children: [
|
1954
2018
|
/* @__PURE__ */ jsxs3(MessagePrimitiveIf, { user: true, children: [
|
1955
|
-
/* @__PURE__ */
|
1956
|
-
/* @__PURE__ */
|
2019
|
+
/* @__PURE__ */ jsx25(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx25(UserMessage2, {}) }),
|
2020
|
+
/* @__PURE__ */ jsx25(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx25(EditComposer2, {}) })
|
1957
2021
|
] }),
|
1958
|
-
/* @__PURE__ */
|
1959
|
-
/* @__PURE__ */
|
2022
|
+
/* @__PURE__ */ jsx25(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx25(AssistantMessage2, {}) }),
|
2023
|
+
/* @__PURE__ */ jsx25(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ jsx25(SystemMessage2, {}) })
|
1960
2024
|
] });
|
1961
2025
|
};
|
1962
2026
|
var ThreadMessage = memo3(
|
@@ -1971,7 +2035,7 @@ var ThreadPrimitiveMessagesImpl = ({
|
|
1971
2035
|
if (messagesLength === 0) return null;
|
1972
2036
|
return new Array(messagesLength).fill(null).map((_, idx) => {
|
1973
2037
|
const messageIndex = idx;
|
1974
|
-
return /* @__PURE__ */
|
2038
|
+
return /* @__PURE__ */ jsx25(
|
1975
2039
|
ThreadMessage,
|
1976
2040
|
{
|
1977
2041
|
messageIndex,
|
@@ -2001,7 +2065,7 @@ var ThreadPrimitiveSuggestion = createActionButton(
|
|
2001
2065
|
);
|
2002
2066
|
|
2003
2067
|
// src/runtimes/local/useLocalRuntime.tsx
|
2004
|
-
import { useInsertionEffect as useInsertionEffect3, useState as
|
2068
|
+
import { useInsertionEffect as useInsertionEffect3, useState as useState9 } from "react";
|
2005
2069
|
|
2006
2070
|
// src/runtimes/core/BaseAssistantRuntime.tsx
|
2007
2071
|
var BaseAssistantRuntime = class {
|
@@ -2034,7 +2098,9 @@ __export(internal_exports, {
|
|
2034
2098
|
ProxyConfigProvider: () => ProxyConfigProvider,
|
2035
2099
|
TooltipIconButton: () => TooltipIconButton,
|
2036
2100
|
generateId: () => generateId,
|
2037
|
-
useSmooth: () => useSmooth
|
2101
|
+
useSmooth: () => useSmooth,
|
2102
|
+
useSmoothStatus: () => useSmoothStatus,
|
2103
|
+
withSmoothContextProvider: () => withSmoothContextProvider
|
2038
2104
|
});
|
2039
2105
|
|
2040
2106
|
// src/utils/idUtils.tsx
|
@@ -2258,17 +2324,17 @@ var MessageRepository = class {
|
|
2258
2324
|
};
|
2259
2325
|
|
2260
2326
|
// src/ui/base/tooltip-icon-button.tsx
|
2261
|
-
import { forwardRef as
|
2327
|
+
import { forwardRef as forwardRef18 } from "react";
|
2262
2328
|
|
2263
2329
|
// src/ui/base/tooltip.tsx
|
2264
2330
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
2265
2331
|
|
2266
2332
|
// src/ui/utils/withDefaults.tsx
|
2267
2333
|
import {
|
2268
|
-
forwardRef as
|
2334
|
+
forwardRef as forwardRef16
|
2269
2335
|
} from "react";
|
2270
2336
|
import classNames from "classnames";
|
2271
|
-
import { jsx as
|
2337
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
2272
2338
|
var withDefaultProps = ({
|
2273
2339
|
className,
|
2274
2340
|
...defaultProps
|
@@ -2281,10 +2347,10 @@ var withDefaultProps = ({
|
|
2281
2347
|
};
|
2282
2348
|
var withDefaults = (Component, defaultProps) => {
|
2283
2349
|
const getProps = withDefaultProps(defaultProps);
|
2284
|
-
const WithDefaults =
|
2350
|
+
const WithDefaults = forwardRef16(
|
2285
2351
|
(props, ref) => {
|
2286
2352
|
const ComponentAsAny = Component;
|
2287
|
-
return /* @__PURE__ */
|
2353
|
+
return /* @__PURE__ */ jsx26(ComponentAsAny, { ...getProps(props), ref });
|
2288
2354
|
}
|
2289
2355
|
);
|
2290
2356
|
WithDefaults.displayName = "withDefaults(" + (typeof Component === "string" ? Component : Component.displayName) + ")";
|
@@ -2292,9 +2358,9 @@ var withDefaults = (Component, defaultProps) => {
|
|
2292
2358
|
};
|
2293
2359
|
|
2294
2360
|
// src/ui/base/tooltip.tsx
|
2295
|
-
import { jsx as
|
2361
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
2296
2362
|
var Tooltip = (props) => {
|
2297
|
-
return /* @__PURE__ */
|
2363
|
+
return /* @__PURE__ */ jsx27(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsx27(TooltipPrimitive.Root, { ...props }) });
|
2298
2364
|
};
|
2299
2365
|
Tooltip.displayName = "Tooltip";
|
2300
2366
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
@@ -2306,9 +2372,9 @@ TooltipContent.displayName = "TooltipContent";
|
|
2306
2372
|
|
2307
2373
|
// src/ui/base/button.tsx
|
2308
2374
|
import { cva } from "class-variance-authority";
|
2309
|
-
import { Primitive as
|
2310
|
-
import { forwardRef as
|
2311
|
-
import { jsx as
|
2375
|
+
import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
|
2376
|
+
import { forwardRef as forwardRef17 } from "react";
|
2377
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
2312
2378
|
var buttonVariants = cva("aui-button", {
|
2313
2379
|
variants: {
|
2314
2380
|
variant: {
|
@@ -2326,10 +2392,10 @@ var buttonVariants = cva("aui-button", {
|
|
2326
2392
|
size: "default"
|
2327
2393
|
}
|
2328
2394
|
});
|
2329
|
-
var Button =
|
2395
|
+
var Button = forwardRef17(
|
2330
2396
|
({ className, variant, size, ...props }, ref) => {
|
2331
|
-
return /* @__PURE__ */
|
2332
|
-
|
2397
|
+
return /* @__PURE__ */ jsx28(
|
2398
|
+
Primitive10.button,
|
2333
2399
|
{
|
2334
2400
|
className: buttonVariants({ variant, size, className }),
|
2335
2401
|
...props,
|
@@ -2341,14 +2407,14 @@ var Button = forwardRef16(
|
|
2341
2407
|
Button.displayName = "Button";
|
2342
2408
|
|
2343
2409
|
// src/ui/base/tooltip-icon-button.tsx
|
2344
|
-
import { jsx as
|
2345
|
-
var TooltipIconButton =
|
2410
|
+
import { jsx as jsx29, jsxs as jsxs4 } from "react/jsx-runtime";
|
2411
|
+
var TooltipIconButton = forwardRef18(({ children, tooltip, side = "bottom", ...rest }, ref) => {
|
2346
2412
|
return /* @__PURE__ */ jsxs4(Tooltip, { children: [
|
2347
|
-
/* @__PURE__ */
|
2413
|
+
/* @__PURE__ */ jsx29(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs4(Button, { variant: "ghost", size: "icon", ...rest, ref, children: [
|
2348
2414
|
children,
|
2349
|
-
/* @__PURE__ */
|
2415
|
+
/* @__PURE__ */ jsx29("span", { className: "aui-sr-only", children: tooltip })
|
2350
2416
|
] }) }),
|
2351
|
-
/* @__PURE__ */
|
2417
|
+
/* @__PURE__ */ jsx29(TooltipContent, { side, children: tooltip })
|
2352
2418
|
] });
|
2353
2419
|
});
|
2354
2420
|
TooltipIconButton.displayName = "TooltipIconButton";
|
@@ -2638,7 +2704,7 @@ var toLanguageModelTools = (tools) => {
|
|
2638
2704
|
};
|
2639
2705
|
|
2640
2706
|
// src/runtimes/edge/useEdgeRuntime.ts
|
2641
|
-
import { useState as
|
2707
|
+
import { useState as useState8 } from "react";
|
2642
2708
|
|
2643
2709
|
// src/runtimes/edge/streams/assistantDecoderStream.ts
|
2644
2710
|
function assistantDecoderStream() {
|
@@ -3378,7 +3444,7 @@ var useEdgeRuntime = ({
|
|
3378
3444
|
initialMessages,
|
3379
3445
|
...options
|
3380
3446
|
}) => {
|
3381
|
-
const [adapter] =
|
3447
|
+
const [adapter] = useState8(() => new EdgeChatAdapter(options));
|
3382
3448
|
return useLocalRuntime(adapter, { initialMessages });
|
3383
3449
|
};
|
3384
3450
|
|
@@ -3592,7 +3658,7 @@ var LocalRuntime = class extends BaseAssistantRuntime {
|
|
3592
3658
|
|
3593
3659
|
// src/runtimes/local/useLocalRuntime.tsx
|
3594
3660
|
var useLocalRuntime = (adapter, options) => {
|
3595
|
-
const [runtime] =
|
3661
|
+
const [runtime] = useState9(() => new LocalRuntime(adapter, options));
|
3596
3662
|
useInsertionEffect3(() => {
|
3597
3663
|
runtime.adapter = adapter;
|
3598
3664
|
});
|
@@ -3600,7 +3666,7 @@ var useLocalRuntime = (adapter, options) => {
|
|
3600
3666
|
};
|
3601
3667
|
|
3602
3668
|
// src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
|
3603
|
-
import { create as
|
3669
|
+
import { create as create15 } from "zustand";
|
3604
3670
|
|
3605
3671
|
// src/runtimes/external-store/getExternalStoreMessage.tsx
|
3606
3672
|
var symbolInnerMessage = Symbol("innerMessage");
|
@@ -3609,7 +3675,7 @@ var getExternalStoreMessage = (message) => {
|
|
3609
3675
|
};
|
3610
3676
|
|
3611
3677
|
// src/runtimes/external-store/useExternalStoreSync.tsx
|
3612
|
-
import { useEffect as useEffect11, useInsertionEffect as useInsertionEffect4, useMemo as
|
3678
|
+
import { useEffect as useEffect11, useInsertionEffect as useInsertionEffect4, useMemo as useMemo4, useRef as useRef6 } from "react";
|
3613
3679
|
|
3614
3680
|
// src/runtimes/external-store/ThreadMessageConverter.ts
|
3615
3681
|
var ThreadMessageConverter = class {
|
@@ -3707,7 +3773,7 @@ var useExternalStoreSync = (adapter, updateData) => {
|
|
3707
3773
|
useInsertionEffect4(() => {
|
3708
3774
|
adapterRef.current = adapter;
|
3709
3775
|
});
|
3710
|
-
const [converter, convertCallback] =
|
3776
|
+
const [converter, convertCallback] = useMemo4(() => {
|
3711
3777
|
const converter2 = adapter.convertMessage ?? ((m) => m);
|
3712
3778
|
const convertCallback2 = (cache, m, idx) => {
|
3713
3779
|
const autoStatus = getAutoStatus(
|
@@ -3754,7 +3820,7 @@ var ExternalStoreThreadRuntime = class {
|
|
3754
3820
|
store.isRunning ?? false,
|
3755
3821
|
store.messages
|
3756
3822
|
);
|
3757
|
-
this.useStore =
|
3823
|
+
this.useStore = create15(() => ({
|
3758
3824
|
store
|
3759
3825
|
}));
|
3760
3826
|
}
|
@@ -3895,9 +3961,9 @@ var ExternalStoreRuntime = class extends BaseAssistantRuntime {
|
|
3895
3961
|
};
|
3896
3962
|
|
3897
3963
|
// src/runtimes/external-store/useExternalStoreRuntime.tsx
|
3898
|
-
import { useEffect as useEffect12, useInsertionEffect as useInsertionEffect5, useState as
|
3964
|
+
import { useEffect as useEffect12, useInsertionEffect as useInsertionEffect5, useState as useState10 } from "react";
|
3899
3965
|
var useExternalStoreRuntime = (store) => {
|
3900
|
-
const [runtime] =
|
3966
|
+
const [runtime] = useState10(() => new ExternalStoreRuntime(store));
|
3901
3967
|
useInsertionEffect5(() => {
|
3902
3968
|
runtime.store = store;
|
3903
3969
|
});
|
@@ -3909,34 +3975,34 @@ var useExternalStoreRuntime = (store) => {
|
|
3909
3975
|
|
3910
3976
|
// src/ui/thread-config.tsx
|
3911
3977
|
import {
|
3912
|
-
createContext as
|
3913
|
-
useContext as
|
3978
|
+
createContext as createContext6,
|
3979
|
+
useContext as useContext6
|
3914
3980
|
} from "react";
|
3915
|
-
import { Fragment as Fragment3, jsx as
|
3916
|
-
var ThreadConfigContext =
|
3981
|
+
import { Fragment as Fragment3, jsx as jsx30 } from "react/jsx-runtime";
|
3982
|
+
var ThreadConfigContext = createContext6({});
|
3917
3983
|
var useThreadConfig = () => {
|
3918
|
-
return
|
3984
|
+
return useContext6(ThreadConfigContext);
|
3919
3985
|
};
|
3920
3986
|
var ThreadConfigProvider = ({
|
3921
3987
|
children,
|
3922
3988
|
config
|
3923
3989
|
}) => {
|
3924
3990
|
const assistant = useAssistantContext({ optional: true });
|
3925
|
-
const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */
|
3991
|
+
const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx30(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx30(Fragment3, { children });
|
3926
3992
|
if (!config?.runtime) return configProvider;
|
3927
3993
|
if (assistant) {
|
3928
3994
|
throw new Error(
|
3929
3995
|
"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
|
3930
3996
|
);
|
3931
3997
|
}
|
3932
|
-
return /* @__PURE__ */
|
3998
|
+
return /* @__PURE__ */ jsx30(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
|
3933
3999
|
};
|
3934
4000
|
ThreadConfigProvider.displayName = "ThreadConfigProvider";
|
3935
4001
|
|
3936
4002
|
// src/ui/assistant-action-bar.tsx
|
3937
|
-
import { forwardRef as
|
4003
|
+
import { forwardRef as forwardRef19 } from "react";
|
3938
4004
|
import { CheckIcon, CopyIcon, RefreshCwIcon } from "lucide-react";
|
3939
|
-
import { Fragment as Fragment4, jsx as
|
4005
|
+
import { Fragment as Fragment4, jsx as jsx31, jsxs as jsxs5 } from "react/jsx-runtime";
|
3940
4006
|
var useAllowCopy = () => {
|
3941
4007
|
const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
|
3942
4008
|
const { useThreadActions } = useThreadContext();
|
@@ -3960,8 +4026,8 @@ var AssistantActionBar = () => {
|
|
3960
4026
|
autohide: "not-last",
|
3961
4027
|
autohideFloat: "single-branch",
|
3962
4028
|
children: [
|
3963
|
-
/* @__PURE__ */
|
3964
|
-
/* @__PURE__ */
|
4029
|
+
/* @__PURE__ */ jsx31(AssistantActionBarCopy, {}),
|
4030
|
+
/* @__PURE__ */ jsx31(AssistantActionBarReload, {})
|
3965
4031
|
]
|
3966
4032
|
}
|
3967
4033
|
);
|
@@ -3971,7 +4037,7 @@ var AssistantActionBarRoot = withDefaults(actionBar_exports.Root, {
|
|
3971
4037
|
className: "aui-assistant-action-bar-root"
|
3972
4038
|
});
|
3973
4039
|
AssistantActionBarRoot.displayName = "AssistantActionBarRoot";
|
3974
|
-
var AssistantActionBarCopy =
|
4040
|
+
var AssistantActionBarCopy = forwardRef19((props, ref) => {
|
3975
4041
|
const {
|
3976
4042
|
strings: {
|
3977
4043
|
assistantMessage: { reload: { tooltip = "Copy" } = {} } = {}
|
@@ -3979,13 +4045,13 @@ var AssistantActionBarCopy = forwardRef18((props, ref) => {
|
|
3979
4045
|
} = useThreadConfig();
|
3980
4046
|
const allowCopy = useAllowCopy();
|
3981
4047
|
if (!allowCopy) return null;
|
3982
|
-
return /* @__PURE__ */
|
3983
|
-
/* @__PURE__ */
|
3984
|
-
/* @__PURE__ */
|
4048
|
+
return /* @__PURE__ */ jsx31(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx31(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
4049
|
+
/* @__PURE__ */ jsx31(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx31(CheckIcon, {}) }),
|
4050
|
+
/* @__PURE__ */ jsx31(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx31(CopyIcon, {}) })
|
3985
4051
|
] }) }) });
|
3986
4052
|
});
|
3987
4053
|
AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
|
3988
|
-
var AssistantActionBarReload =
|
4054
|
+
var AssistantActionBarReload = forwardRef19((props, ref) => {
|
3989
4055
|
const {
|
3990
4056
|
strings: {
|
3991
4057
|
assistantMessage: { reload: { tooltip = "Refresh" } = {} } = {}
|
@@ -3993,7 +4059,7 @@ var AssistantActionBarReload = forwardRef18((props, ref) => {
|
|
3993
4059
|
} = useThreadConfig();
|
3994
4060
|
const allowReload = useAllowReload();
|
3995
4061
|
if (!allowReload) return null;
|
3996
|
-
return /* @__PURE__ */
|
4062
|
+
return /* @__PURE__ */ jsx31(actionBar_exports.Reload, { asChild: true, children: /* @__PURE__ */ jsx31(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx31(RefreshCwIcon, {}) }) });
|
3997
4063
|
});
|
3998
4064
|
AssistantActionBarReload.displayName = "AssistantActionBarReload";
|
3999
4065
|
var exports = {
|
@@ -4007,12 +4073,12 @@ var assistant_action_bar_default = Object.assign(
|
|
4007
4073
|
);
|
4008
4074
|
|
4009
4075
|
// src/ui/assistant-message.tsx
|
4010
|
-
import { forwardRef as
|
4076
|
+
import { forwardRef as forwardRef21 } from "react";
|
4011
4077
|
|
4012
4078
|
// src/ui/branch-picker.tsx
|
4013
|
-
import { forwardRef as
|
4079
|
+
import { forwardRef as forwardRef20 } from "react";
|
4014
4080
|
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
4015
|
-
import { jsx as
|
4081
|
+
import { jsx as jsx32, jsxs as jsxs6 } from "react/jsx-runtime";
|
4016
4082
|
var useAllowBranchPicker = () => {
|
4017
4083
|
const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
|
4018
4084
|
const { useThreadActions } = useThreadContext();
|
@@ -4023,9 +4089,9 @@ var BranchPicker = () => {
|
|
4023
4089
|
const allowBranchPicker = useAllowBranchPicker();
|
4024
4090
|
if (!allowBranchPicker) return null;
|
4025
4091
|
return /* @__PURE__ */ jsxs6(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
|
4026
|
-
/* @__PURE__ */
|
4027
|
-
/* @__PURE__ */
|
4028
|
-
/* @__PURE__ */
|
4092
|
+
/* @__PURE__ */ jsx32(BranchPickerPrevious2, {}),
|
4093
|
+
/* @__PURE__ */ jsx32(BranchPickerState, {}),
|
4094
|
+
/* @__PURE__ */ jsx32(BranchPickerNext, {})
|
4029
4095
|
] });
|
4030
4096
|
};
|
4031
4097
|
BranchPicker.displayName = "BranchPicker";
|
@@ -4033,31 +4099,31 @@ var BranchPickerRoot = withDefaults(branchPicker_exports.Root, {
|
|
4033
4099
|
className: "aui-branch-picker-root"
|
4034
4100
|
});
|
4035
4101
|
BranchPickerRoot.displayName = "BranchPickerRoot";
|
4036
|
-
var BranchPickerPrevious2 =
|
4102
|
+
var BranchPickerPrevious2 = forwardRef20((props, ref) => {
|
4037
4103
|
const {
|
4038
4104
|
strings: {
|
4039
4105
|
branchPicker: { previous: { tooltip = "Previous" } = {} } = {}
|
4040
4106
|
} = {}
|
4041
4107
|
} = useThreadConfig();
|
4042
|
-
return /* @__PURE__ */
|
4108
|
+
return /* @__PURE__ */ jsx32(branchPicker_exports.Previous, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(ChevronLeftIcon, {}) }) });
|
4043
4109
|
});
|
4044
4110
|
BranchPickerPrevious2.displayName = "BranchPickerPrevious";
|
4045
4111
|
var BranchPickerStateWrapper = withDefaults("span", {
|
4046
4112
|
className: "aui-branch-picker-state"
|
4047
4113
|
});
|
4048
|
-
var BranchPickerState =
|
4114
|
+
var BranchPickerState = forwardRef20((props, ref) => {
|
4049
4115
|
return /* @__PURE__ */ jsxs6(BranchPickerStateWrapper, { ...props, ref, children: [
|
4050
|
-
/* @__PURE__ */
|
4116
|
+
/* @__PURE__ */ jsx32(branchPicker_exports.Number, {}),
|
4051
4117
|
" / ",
|
4052
|
-
/* @__PURE__ */
|
4118
|
+
/* @__PURE__ */ jsx32(branchPicker_exports.Count, {})
|
4053
4119
|
] });
|
4054
4120
|
});
|
4055
4121
|
BranchPickerState.displayName = "BranchPickerState";
|
4056
|
-
var BranchPickerNext =
|
4122
|
+
var BranchPickerNext = forwardRef20((props, ref) => {
|
4057
4123
|
const {
|
4058
4124
|
strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
|
4059
4125
|
} = useThreadConfig();
|
4060
|
-
return /* @__PURE__ */
|
4126
|
+
return /* @__PURE__ */ jsx32(branchPicker_exports.Next, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(ChevronRightIcon, {}) }) });
|
4061
4127
|
});
|
4062
4128
|
BranchPickerNext.displayName = "BranchPickerNext";
|
4063
4129
|
var exports2 = {
|
@@ -4069,12 +4135,12 @@ var branch_picker_default = Object.assign(BranchPicker, exports2);
|
|
4069
4135
|
|
4070
4136
|
// src/ui/base/avatar.tsx
|
4071
4137
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
4072
|
-
import { jsx as
|
4138
|
+
import { jsx as jsx33, jsxs as jsxs7 } from "react/jsx-runtime";
|
4073
4139
|
var Avatar = ({ src, alt, fallback }) => {
|
4074
4140
|
if (src == null && fallback == null) return null;
|
4075
4141
|
return /* @__PURE__ */ jsxs7(AvatarRoot, { children: [
|
4076
|
-
src != null && /* @__PURE__ */
|
4077
|
-
fallback != null && /* @__PURE__ */
|
4142
|
+
src != null && /* @__PURE__ */ jsx33(AvatarImage, { src, alt }),
|
4143
|
+
fallback != null && /* @__PURE__ */ jsx33(AvatarFallback, { children: fallback })
|
4078
4144
|
] });
|
4079
4145
|
};
|
4080
4146
|
Avatar.displayName = "Avatar";
|
@@ -4093,36 +4159,37 @@ AvatarFallback.displayName = "AvatarFallback";
|
|
4093
4159
|
|
4094
4160
|
// src/ui/content-part.tsx
|
4095
4161
|
import classNames2 from "classnames";
|
4096
|
-
import { jsx as
|
4097
|
-
var Text = (
|
4098
|
-
|
4099
|
-
|
4162
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
4163
|
+
var Text = () => {
|
4164
|
+
const status = useSmoothStatus();
|
4165
|
+
return /* @__PURE__ */ jsx34(
|
4166
|
+
contentPart_exports.Text,
|
4100
4167
|
{
|
4101
4168
|
className: classNames2(
|
4102
4169
|
"aui-text",
|
4103
|
-
status.type === "running" && "aui-text-
|
4170
|
+
status.type === "running" && "aui-text-running"
|
4104
4171
|
),
|
4105
|
-
|
4172
|
+
component: "p"
|
4106
4173
|
}
|
4107
4174
|
);
|
4108
4175
|
};
|
4109
|
-
var exports3 = { Text };
|
4176
|
+
var exports3 = { Text: withSmoothContextProvider(Text) };
|
4110
4177
|
var content_part_default = exports3;
|
4111
4178
|
|
4112
4179
|
// src/ui/assistant-message.tsx
|
4113
|
-
import { jsx as
|
4180
|
+
import { jsx as jsx35, jsxs as jsxs8 } from "react/jsx-runtime";
|
4114
4181
|
var AssistantMessage = () => {
|
4115
4182
|
return /* @__PURE__ */ jsxs8(AssistantMessageRoot, { children: [
|
4116
|
-
/* @__PURE__ */
|
4117
|
-
/* @__PURE__ */
|
4118
|
-
/* @__PURE__ */
|
4119
|
-
/* @__PURE__ */
|
4183
|
+
/* @__PURE__ */ jsx35(AssistantMessageAvatar, {}),
|
4184
|
+
/* @__PURE__ */ jsx35(AssistantMessageContent, {}),
|
4185
|
+
/* @__PURE__ */ jsx35(branch_picker_default, {}),
|
4186
|
+
/* @__PURE__ */ jsx35(assistant_action_bar_default, {})
|
4120
4187
|
] });
|
4121
4188
|
};
|
4122
4189
|
AssistantMessage.displayName = "AssistantMessage";
|
4123
4190
|
var AssistantMessageAvatar = () => {
|
4124
4191
|
const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
|
4125
|
-
return /* @__PURE__ */
|
4192
|
+
return /* @__PURE__ */ jsx35(Avatar, { ...avatar });
|
4126
4193
|
};
|
4127
4194
|
var AssistantMessageRoot = withDefaults(message_exports.Root, {
|
4128
4195
|
className: "aui-assistant-message-root"
|
@@ -4131,9 +4198,9 @@ AssistantMessageRoot.displayName = "AssistantMessageRoot";
|
|
4131
4198
|
var AssistantMessageContentWrapper = withDefaults("div", {
|
4132
4199
|
className: "aui-assistant-message-content"
|
4133
4200
|
});
|
4134
|
-
var AssistantMessageContent =
|
4201
|
+
var AssistantMessageContent = forwardRef21(({ components: componentsProp, ...rest }, ref) => {
|
4135
4202
|
const { assistantMessage: { components = {} } = {} } = useThreadConfig();
|
4136
|
-
return /* @__PURE__ */
|
4203
|
+
return /* @__PURE__ */ jsx35(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx35(
|
4137
4204
|
message_exports.Content,
|
4138
4205
|
{
|
4139
4206
|
components: {
|
@@ -4155,38 +4222,38 @@ var assistant_message_default = Object.assign(
|
|
4155
4222
|
);
|
4156
4223
|
|
4157
4224
|
// src/ui/assistant-modal.tsx
|
4158
|
-
import { forwardRef as
|
4225
|
+
import { forwardRef as forwardRef28 } from "react";
|
4159
4226
|
import { BotIcon, ChevronDownIcon } from "lucide-react";
|
4160
4227
|
|
4161
4228
|
// src/ui/thread.tsx
|
4162
|
-
import { forwardRef as
|
4229
|
+
import { forwardRef as forwardRef27 } from "react";
|
4163
4230
|
import { ArrowDownIcon } from "lucide-react";
|
4164
4231
|
|
4165
4232
|
// src/ui/composer.tsx
|
4166
|
-
import { forwardRef as
|
4233
|
+
import { forwardRef as forwardRef22 } from "react";
|
4167
4234
|
import { SendHorizontalIcon } from "lucide-react";
|
4168
4235
|
|
4169
4236
|
// src/ui/base/CircleStopIcon.tsx
|
4170
|
-
import { jsx as
|
4237
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
4171
4238
|
var CircleStopIcon = () => {
|
4172
|
-
return /* @__PURE__ */
|
4239
|
+
return /* @__PURE__ */ jsx36(
|
4173
4240
|
"svg",
|
4174
4241
|
{
|
4175
4242
|
xmlns: "http://www.w3.org/2000/svg",
|
4176
4243
|
viewBox: "0 0 16 16",
|
4177
4244
|
fill: "currentColor",
|
4178
|
-
children: /* @__PURE__ */
|
4245
|
+
children: /* @__PURE__ */ jsx36("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
|
4179
4246
|
}
|
4180
4247
|
);
|
4181
4248
|
};
|
4182
4249
|
CircleStopIcon.displayName = "CircleStopIcon";
|
4183
4250
|
|
4184
4251
|
// src/ui/composer.tsx
|
4185
|
-
import { Fragment as Fragment5, jsx as
|
4252
|
+
import { Fragment as Fragment5, jsx as jsx37, jsxs as jsxs9 } from "react/jsx-runtime";
|
4186
4253
|
var Composer = () => {
|
4187
4254
|
return /* @__PURE__ */ jsxs9(ComposerRoot, { children: [
|
4188
|
-
/* @__PURE__ */
|
4189
|
-
/* @__PURE__ */
|
4255
|
+
/* @__PURE__ */ jsx37(ComposerInput, { autoFocus: true }),
|
4256
|
+
/* @__PURE__ */ jsx37(ComposerAction, {})
|
4190
4257
|
] });
|
4191
4258
|
};
|
4192
4259
|
Composer.displayName = "Composer";
|
@@ -4199,14 +4266,14 @@ var ComposerInputStyled = withDefaults(composer_exports.Input, {
|
|
4199
4266
|
autoFocus: true,
|
4200
4267
|
className: "aui-composer-input"
|
4201
4268
|
});
|
4202
|
-
var ComposerInput =
|
4269
|
+
var ComposerInput = forwardRef22(
|
4203
4270
|
(props, ref) => {
|
4204
4271
|
const {
|
4205
4272
|
strings: {
|
4206
4273
|
composer: { input: { placeholder = "Write a message..." } = {} } = {}
|
4207
4274
|
} = {}
|
4208
4275
|
} = useThreadConfig();
|
4209
|
-
return /* @__PURE__ */
|
4276
|
+
return /* @__PURE__ */ jsx37(ComposerInputStyled, { placeholder, ...props, ref });
|
4210
4277
|
}
|
4211
4278
|
);
|
4212
4279
|
ComposerInput.displayName = "ComposerInput";
|
@@ -4217,10 +4284,10 @@ var useAllowCancel = () => {
|
|
4217
4284
|
};
|
4218
4285
|
var ComposerAction = () => {
|
4219
4286
|
const allowCancel = useAllowCancel();
|
4220
|
-
if (!allowCancel) return /* @__PURE__ */
|
4287
|
+
if (!allowCancel) return /* @__PURE__ */ jsx37(ComposerSend, {});
|
4221
4288
|
return /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
4222
|
-
/* @__PURE__ */
|
4223
|
-
/* @__PURE__ */
|
4289
|
+
/* @__PURE__ */ jsx37(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx37(ComposerSend, {}) }),
|
4290
|
+
/* @__PURE__ */ jsx37(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx37(ComposerCancel, {}) })
|
4224
4291
|
] });
|
4225
4292
|
};
|
4226
4293
|
ComposerAction.displayName = "ComposerAction";
|
@@ -4228,22 +4295,22 @@ var ComposerSendButton = withDefaults(TooltipIconButton, {
|
|
4228
4295
|
variant: "default",
|
4229
4296
|
className: "aui-composer-send"
|
4230
4297
|
});
|
4231
|
-
var ComposerSend =
|
4298
|
+
var ComposerSend = forwardRef22((props, ref) => {
|
4232
4299
|
const {
|
4233
4300
|
strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
|
4234
4301
|
} = useThreadConfig();
|
4235
|
-
return /* @__PURE__ */
|
4302
|
+
return /* @__PURE__ */ jsx37(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx37(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(SendHorizontalIcon, {}) }) });
|
4236
4303
|
});
|
4237
4304
|
ComposerSend.displayName = "ComposerSend";
|
4238
4305
|
var ComposerCancelButton = withDefaults(TooltipIconButton, {
|
4239
4306
|
variant: "default",
|
4240
4307
|
className: "aui-composer-cancel"
|
4241
4308
|
});
|
4242
|
-
var ComposerCancel =
|
4309
|
+
var ComposerCancel = forwardRef22((props, ref) => {
|
4243
4310
|
const {
|
4244
4311
|
strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
|
4245
4312
|
} = useThreadConfig();
|
4246
|
-
return /* @__PURE__ */
|
4313
|
+
return /* @__PURE__ */ jsx37(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx37(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(CircleStopIcon, {}) }) });
|
4247
4314
|
});
|
4248
4315
|
ComposerCancel.displayName = "ComposerCancel";
|
4249
4316
|
var exports5 = {
|
@@ -4256,15 +4323,15 @@ var exports5 = {
|
|
4256
4323
|
var composer_default = Object.assign(Composer, exports5);
|
4257
4324
|
|
4258
4325
|
// src/ui/thread-welcome.tsx
|
4259
|
-
import { forwardRef as
|
4260
|
-
import { jsx as
|
4326
|
+
import { forwardRef as forwardRef23 } from "react";
|
4327
|
+
import { jsx as jsx38, jsxs as jsxs10 } from "react/jsx-runtime";
|
4261
4328
|
var ThreadWelcome = () => {
|
4262
4329
|
return /* @__PURE__ */ jsxs10(ThreadWelcomeRoot, { children: [
|
4263
4330
|
/* @__PURE__ */ jsxs10(ThreadWelcomeCenter, { children: [
|
4264
|
-
/* @__PURE__ */
|
4265
|
-
/* @__PURE__ */
|
4331
|
+
/* @__PURE__ */ jsx38(ThreadWelcomeAvatar, {}),
|
4332
|
+
/* @__PURE__ */ jsx38(ThreadWelcomeMessage, {})
|
4266
4333
|
] }),
|
4267
|
-
/* @__PURE__ */
|
4334
|
+
/* @__PURE__ */ jsx38(ThreadWelcomeSuggestions, {})
|
4268
4335
|
] });
|
4269
4336
|
};
|
4270
4337
|
ThreadWelcome.displayName = "ThreadWelcome";
|
@@ -4274,22 +4341,22 @@ var ThreadWelcomeRootStyled = withDefaults("div", {
|
|
4274
4341
|
var ThreadWelcomeCenter = withDefaults("div", {
|
4275
4342
|
className: "aui-thread-welcome-center"
|
4276
4343
|
});
|
4277
|
-
var ThreadWelcomeRoot =
|
4344
|
+
var ThreadWelcomeRoot = forwardRef23(
|
4278
4345
|
(props, ref) => {
|
4279
|
-
return /* @__PURE__ */
|
4346
|
+
return /* @__PURE__ */ jsx38(thread_exports.Empty, { children: /* @__PURE__ */ jsx38(ThreadWelcomeRootStyled, { ...props, ref }) });
|
4280
4347
|
}
|
4281
4348
|
);
|
4282
4349
|
ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
|
4283
4350
|
var ThreadWelcomeAvatar = () => {
|
4284
4351
|
const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
|
4285
|
-
return /* @__PURE__ */
|
4352
|
+
return /* @__PURE__ */ jsx38(Avatar, { ...avatar });
|
4286
4353
|
};
|
4287
4354
|
var ThreadWelcomeMessageStyled = withDefaults("p", {
|
4288
4355
|
className: "aui-thread-welcome-message"
|
4289
4356
|
});
|
4290
|
-
var ThreadWelcomeMessage =
|
4357
|
+
var ThreadWelcomeMessage = forwardRef23(({ message: messageProp, ...rest }, ref) => {
|
4291
4358
|
const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
|
4292
|
-
return /* @__PURE__ */
|
4359
|
+
return /* @__PURE__ */ jsx38(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
|
4293
4360
|
});
|
4294
4361
|
ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
|
4295
4362
|
var ThreadWelcomeSuggestionContainer = withDefaults("div", {
|
@@ -4301,21 +4368,21 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
|
|
4301
4368
|
var ThreadWelcomeSuggestion = ({
|
4302
4369
|
suggestion: { text, prompt }
|
4303
4370
|
}) => {
|
4304
|
-
return /* @__PURE__ */
|
4371
|
+
return /* @__PURE__ */ jsx38(
|
4305
4372
|
ThreadWelcomeSuggestionStyled,
|
4306
4373
|
{
|
4307
4374
|
prompt,
|
4308
4375
|
method: "replace",
|
4309
4376
|
autoSend: true,
|
4310
|
-
children: /* @__PURE__ */
|
4377
|
+
children: /* @__PURE__ */ jsx38("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
|
4311
4378
|
}
|
4312
4379
|
);
|
4313
4380
|
};
|
4314
4381
|
var ThreadWelcomeSuggestions = () => {
|
4315
4382
|
const { welcome: { suggestions } = {} } = useThreadConfig();
|
4316
|
-
return /* @__PURE__ */
|
4383
|
+
return /* @__PURE__ */ jsx38(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
|
4317
4384
|
const key = `${suggestion.prompt}-${idx}`;
|
4318
|
-
return /* @__PURE__ */
|
4385
|
+
return /* @__PURE__ */ jsx38(ThreadWelcomeSuggestion, { suggestion }, key);
|
4319
4386
|
}) });
|
4320
4387
|
};
|
4321
4388
|
ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
|
@@ -4330,12 +4397,12 @@ var exports6 = {
|
|
4330
4397
|
var thread_welcome_default = Object.assign(ThreadWelcome, exports6);
|
4331
4398
|
|
4332
4399
|
// src/ui/user-message.tsx
|
4333
|
-
import { forwardRef as
|
4400
|
+
import { forwardRef as forwardRef25 } from "react";
|
4334
4401
|
|
4335
4402
|
// src/ui/user-action-bar.tsx
|
4336
|
-
import { forwardRef as
|
4403
|
+
import { forwardRef as forwardRef24 } from "react";
|
4337
4404
|
import { PencilIcon } from "lucide-react";
|
4338
|
-
import { jsx as
|
4405
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
4339
4406
|
var useAllowEdit = () => {
|
4340
4407
|
const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
|
4341
4408
|
const { useThreadActions } = useThreadContext();
|
@@ -4345,20 +4412,20 @@ var useAllowEdit = () => {
|
|
4345
4412
|
var UserActionBar = () => {
|
4346
4413
|
const allowEdit = useAllowEdit();
|
4347
4414
|
if (!allowEdit) return null;
|
4348
|
-
return /* @__PURE__ */
|
4415
|
+
return /* @__PURE__ */ jsx39(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx39(UserActionBarEdit, {}) });
|
4349
4416
|
};
|
4350
4417
|
UserActionBar.displayName = "UserActionBar";
|
4351
4418
|
var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
|
4352
4419
|
className: "aui-user-action-bar-root"
|
4353
4420
|
});
|
4354
4421
|
UserActionBarRoot.displayName = "UserActionBarRoot";
|
4355
|
-
var UserActionBarEdit =
|
4422
|
+
var UserActionBarEdit = forwardRef24((props, ref) => {
|
4356
4423
|
const {
|
4357
4424
|
strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
|
4358
4425
|
} = useThreadConfig();
|
4359
4426
|
const allowEdit = useAllowEdit();
|
4360
4427
|
if (!allowEdit) return null;
|
4361
|
-
return /* @__PURE__ */
|
4428
|
+
return /* @__PURE__ */ jsx39(actionBar_exports.Edit, { asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(PencilIcon, {}) }) });
|
4362
4429
|
});
|
4363
4430
|
UserActionBarEdit.displayName = "UserActionBarEdit";
|
4364
4431
|
var exports7 = {
|
@@ -4368,12 +4435,12 @@ var exports7 = {
|
|
4368
4435
|
var user_action_bar_default = Object.assign(UserActionBar, exports7);
|
4369
4436
|
|
4370
4437
|
// src/ui/user-message.tsx
|
4371
|
-
import { jsx as
|
4438
|
+
import { jsx as jsx40, jsxs as jsxs11 } from "react/jsx-runtime";
|
4372
4439
|
var UserMessage = () => {
|
4373
4440
|
return /* @__PURE__ */ jsxs11(UserMessageRoot, { children: [
|
4374
|
-
/* @__PURE__ */
|
4375
|
-
/* @__PURE__ */
|
4376
|
-
/* @__PURE__ */
|
4441
|
+
/* @__PURE__ */ jsx40(user_action_bar_default, {}),
|
4442
|
+
/* @__PURE__ */ jsx40(UserMessageContent, {}),
|
4443
|
+
/* @__PURE__ */ jsx40(branch_picker_default, {})
|
4377
4444
|
] });
|
4378
4445
|
};
|
4379
4446
|
UserMessage.displayName = "UserMessage";
|
@@ -4384,9 +4451,9 @@ UserMessageRoot.displayName = "UserMessageRoot";
|
|
4384
4451
|
var UserMessageContentWrapper = withDefaults("div", {
|
4385
4452
|
className: "aui-user-message-content"
|
4386
4453
|
});
|
4387
|
-
var UserMessageContent =
|
4454
|
+
var UserMessageContent = forwardRef25(
|
4388
4455
|
({ components, ...props }, ref) => {
|
4389
|
-
return /* @__PURE__ */
|
4456
|
+
return /* @__PURE__ */ jsx40(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx40(
|
4390
4457
|
message_exports.Content,
|
4391
4458
|
{
|
4392
4459
|
components: {
|
@@ -4405,14 +4472,14 @@ var exports8 = {
|
|
4405
4472
|
var user_message_default = Object.assign(UserMessage, exports8);
|
4406
4473
|
|
4407
4474
|
// src/ui/edit-composer.tsx
|
4408
|
-
import { forwardRef as
|
4409
|
-
import { jsx as
|
4475
|
+
import { forwardRef as forwardRef26 } from "react";
|
4476
|
+
import { jsx as jsx41, jsxs as jsxs12 } from "react/jsx-runtime";
|
4410
4477
|
var EditComposer = () => {
|
4411
4478
|
return /* @__PURE__ */ jsxs12(EditComposerRoot, { children: [
|
4412
|
-
/* @__PURE__ */
|
4479
|
+
/* @__PURE__ */ jsx41(EditComposerInput, {}),
|
4413
4480
|
/* @__PURE__ */ jsxs12(EditComposerFooter, { children: [
|
4414
|
-
/* @__PURE__ */
|
4415
|
-
/* @__PURE__ */
|
4481
|
+
/* @__PURE__ */ jsx41(EditComposerCancel, {}),
|
4482
|
+
/* @__PURE__ */ jsx41(EditComposerSend, {})
|
4416
4483
|
] })
|
4417
4484
|
] });
|
4418
4485
|
};
|
@@ -4429,23 +4496,23 @@ var EditComposerFooter = withDefaults("div", {
|
|
4429
4496
|
className: "aui-edit-composer-footer"
|
4430
4497
|
});
|
4431
4498
|
EditComposerFooter.displayName = "EditComposerFooter";
|
4432
|
-
var EditComposerCancel =
|
4499
|
+
var EditComposerCancel = forwardRef26(
|
4433
4500
|
(props, ref) => {
|
4434
4501
|
const {
|
4435
4502
|
strings: {
|
4436
4503
|
editComposer: { cancel: { label = "Cancel" } = {} } = {}
|
4437
4504
|
} = {}
|
4438
4505
|
} = useThreadConfig();
|
4439
|
-
return /* @__PURE__ */
|
4506
|
+
return /* @__PURE__ */ jsx41(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx41(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
|
4440
4507
|
}
|
4441
4508
|
);
|
4442
4509
|
EditComposerCancel.displayName = "EditComposerCancel";
|
4443
|
-
var EditComposerSend =
|
4510
|
+
var EditComposerSend = forwardRef26(
|
4444
4511
|
(props, ref) => {
|
4445
4512
|
const {
|
4446
4513
|
strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
|
4447
4514
|
} = useThreadConfig();
|
4448
|
-
return /* @__PURE__ */
|
4515
|
+
return /* @__PURE__ */ jsx41(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx41(Button, { ...props, ref, children: props.children ?? label }) });
|
4449
4516
|
}
|
4450
4517
|
);
|
4451
4518
|
EditComposerSend.displayName = "EditComposerSend";
|
@@ -4459,23 +4526,23 @@ var exports9 = {
|
|
4459
4526
|
var edit_composer_default = Object.assign(EditComposer, exports9);
|
4460
4527
|
|
4461
4528
|
// src/ui/thread.tsx
|
4462
|
-
import { jsx as
|
4529
|
+
import { jsx as jsx42, jsxs as jsxs13 } from "react/jsx-runtime";
|
4463
4530
|
var Thread = (config) => {
|
4464
|
-
return /* @__PURE__ */
|
4465
|
-
/* @__PURE__ */
|
4466
|
-
/* @__PURE__ */
|
4531
|
+
return /* @__PURE__ */ jsx42(ThreadRoot, { config, children: /* @__PURE__ */ jsxs13(ThreadViewport, { children: [
|
4532
|
+
/* @__PURE__ */ jsx42(thread_welcome_default, {}),
|
4533
|
+
/* @__PURE__ */ jsx42(ThreadMessages, {}),
|
4467
4534
|
/* @__PURE__ */ jsxs13(ThreadViewportFooter, { children: [
|
4468
|
-
/* @__PURE__ */
|
4469
|
-
/* @__PURE__ */
|
4535
|
+
/* @__PURE__ */ jsx42(ThreadScrollToBottom, {}),
|
4536
|
+
/* @__PURE__ */ jsx42(composer_default, {})
|
4470
4537
|
] })
|
4471
4538
|
] }) });
|
4472
4539
|
};
|
4473
4540
|
var ThreadRootStyled = withDefaults(thread_exports.Root, {
|
4474
4541
|
className: "aui-root aui-thread-root"
|
4475
4542
|
});
|
4476
|
-
var ThreadRoot =
|
4543
|
+
var ThreadRoot = forwardRef27(
|
4477
4544
|
({ config, ...props }, ref) => {
|
4478
|
-
return /* @__PURE__ */
|
4545
|
+
return /* @__PURE__ */ jsx42(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx42(ThreadRootStyled, { ...props, ref }) });
|
4479
4546
|
}
|
4480
4547
|
);
|
4481
4548
|
ThreadRoot.displayName = "ThreadRoot";
|
@@ -4489,7 +4556,7 @@ var ThreadViewportFooter = withDefaults("div", {
|
|
4489
4556
|
ThreadViewportFooter.displayName = "ThreadViewportFooter";
|
4490
4557
|
var SystemMessage = () => null;
|
4491
4558
|
var ThreadMessages = ({ components, ...rest }) => {
|
4492
|
-
return /* @__PURE__ */
|
4559
|
+
return /* @__PURE__ */ jsx42(
|
4493
4560
|
thread_exports.Messages,
|
4494
4561
|
{
|
4495
4562
|
components: {
|
@@ -4507,13 +4574,13 @@ var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
|
|
4507
4574
|
variant: "outline",
|
4508
4575
|
className: "aui-thread-scroll-to-bottom"
|
4509
4576
|
});
|
4510
|
-
var ThreadScrollToBottom =
|
4577
|
+
var ThreadScrollToBottom = forwardRef27((props, ref) => {
|
4511
4578
|
const {
|
4512
4579
|
strings: {
|
4513
4580
|
thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
|
4514
4581
|
} = {}
|
4515
4582
|
} = useThreadConfig();
|
4516
|
-
return /* @__PURE__ */
|
4583
|
+
return /* @__PURE__ */ jsx42(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx42(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx42(ArrowDownIcon, {}) }) });
|
4517
4584
|
});
|
4518
4585
|
ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
|
4519
4586
|
var exports10 = {
|
@@ -4526,20 +4593,20 @@ var exports10 = {
|
|
4526
4593
|
var thread_default = Object.assign(Thread, exports10);
|
4527
4594
|
|
4528
4595
|
// src/ui/assistant-modal.tsx
|
4529
|
-
import { Fragment as Fragment6, jsx as
|
4596
|
+
import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs14 } from "react/jsx-runtime";
|
4530
4597
|
var AssistantModal = (config) => {
|
4531
4598
|
return /* @__PURE__ */ jsxs14(AssistantModalRoot, { config, children: [
|
4532
|
-
/* @__PURE__ */
|
4533
|
-
/* @__PURE__ */
|
4599
|
+
/* @__PURE__ */ jsx43(AssistantModalTrigger, {}),
|
4600
|
+
/* @__PURE__ */ jsx43(AssistantModalContent, { children: /* @__PURE__ */ jsx43(thread_default, {}) })
|
4534
4601
|
] });
|
4535
4602
|
};
|
4536
4603
|
AssistantModal.displayName = "AssistantModal";
|
4537
4604
|
var AssistantModalRoot = ({ config, ...props }) => {
|
4538
|
-
return /* @__PURE__ */
|
4605
|
+
return /* @__PURE__ */ jsx43(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx43(assistantModal_exports.Root, { ...props }) });
|
4539
4606
|
};
|
4540
4607
|
AssistantModalRoot.displayName = "AssistantModalRoot";
|
4541
|
-
var AssistantModalTrigger =
|
4542
|
-
return /* @__PURE__ */
|
4608
|
+
var AssistantModalTrigger = forwardRef28((props, ref) => {
|
4609
|
+
return /* @__PURE__ */ jsx43(AssistantModalAnchor, { children: /* @__PURE__ */ jsx43(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx43(AssistantModalButton, { ...props, ref }) }) });
|
4543
4610
|
});
|
4544
4611
|
AssistantModalTrigger.displayName = "AssistantModalTrigger";
|
4545
4612
|
var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
|
@@ -4550,7 +4617,7 @@ var ModalButtonStyled = withDefaults(TooltipIconButton, {
|
|
4550
4617
|
variant: "default",
|
4551
4618
|
className: "aui-modal-button"
|
4552
4619
|
});
|
4553
|
-
var AssistantModalButton =
|
4620
|
+
var AssistantModalButton = forwardRef28(({ "data-state": state, ...rest }, ref) => {
|
4554
4621
|
const {
|
4555
4622
|
strings: {
|
4556
4623
|
assistantModal: {
|
@@ -4564,7 +4631,7 @@ var AssistantModalButton = forwardRef27(({ "data-state": state, ...rest }, ref)
|
|
4564
4631
|
} = {}
|
4565
4632
|
} = useThreadConfig();
|
4566
4633
|
const tooltip = state === "open" ? openTooltip : closedTooltip;
|
4567
|
-
return /* @__PURE__ */
|
4634
|
+
return /* @__PURE__ */ jsx43(
|
4568
4635
|
ModalButtonStyled,
|
4569
4636
|
{
|
4570
4637
|
side: "left",
|
@@ -4573,14 +4640,14 @@ var AssistantModalButton = forwardRef27(({ "data-state": state, ...rest }, ref)
|
|
4573
4640
|
...rest,
|
4574
4641
|
ref,
|
4575
4642
|
children: rest.children ?? /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
4576
|
-
/* @__PURE__ */
|
4643
|
+
/* @__PURE__ */ jsx43(
|
4577
4644
|
BotIcon,
|
4578
4645
|
{
|
4579
4646
|
"data-state": state,
|
4580
4647
|
className: "aui-modal-button-closed-icon"
|
4581
4648
|
}
|
4582
4649
|
),
|
4583
|
-
/* @__PURE__ */
|
4650
|
+
/* @__PURE__ */ jsx43(
|
4584
4651
|
ChevronDownIcon,
|
4585
4652
|
{
|
4586
4653
|
"data-state": state,
|