@arbidocs/blocks 0.4.5 → 0.4.6
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 +46 -6
- package/dist/agents/index.cjs +163 -162
- package/dist/agents/index.js +6 -5
- package/dist/chat/ChatMessageContent.d.ts +16 -0
- package/dist/chat/ChatPage.d.ts +11 -8
- package/dist/chat/ChatThreads.d.ts +3 -1
- package/dist/chat/CitationMark.d.ts +18 -0
- package/dist/chat/chat-page-types.d.ts +75 -1
- package/dist/chat/index.cjs +126 -117
- package/dist/chat/index.d.ts +3 -1
- package/dist/chat/index.js +5 -4
- package/dist/{chunk-3MIQASHO.cjs → chunk-23XL6SVZ.cjs} +39 -19
- package/dist/chunk-23XL6SVZ.cjs.map +1 -0
- package/dist/{chunk-ULWRNGGE.cjs → chunk-2ZTONLT5.cjs} +4 -25
- package/dist/chunk-2ZTONLT5.cjs.map +1 -0
- package/dist/{chunk-O637DUKS.cjs → chunk-56BUD74K.cjs} +28 -28
- package/dist/{chunk-O637DUKS.cjs.map → chunk-56BUD74K.cjs.map} +1 -1
- package/dist/{chunk-YLOKCIQJ.cjs → chunk-5SLLMK5K.cjs} +421 -115
- package/dist/chunk-5SLLMK5K.cjs.map +1 -0
- package/dist/{chunk-SS23F63U.cjs → chunk-5ZBP7TCD.cjs} +55 -3
- package/dist/chunk-5ZBP7TCD.cjs.map +1 -0
- package/dist/{chunk-3PZPRAAR.cjs → chunk-67HGXV4I.cjs} +14 -14
- package/dist/{chunk-3PZPRAAR.cjs.map → chunk-67HGXV4I.cjs.map} +1 -1
- package/dist/{chunk-RCP6THBS.js → chunk-7OCFHEE6.js} +3 -3
- package/dist/{chunk-RCP6THBS.js.map → chunk-7OCFHEE6.js.map} +1 -1
- package/dist/{chunk-TX2ZICS7.js → chunk-CPMNAJLF.js} +4 -24
- package/dist/chunk-CPMNAJLF.js.map +1 -0
- package/dist/{chunk-5XTZFH65.js → chunk-CVFBSUXL.js} +5 -5
- package/dist/{chunk-5XTZFH65.js.map → chunk-CVFBSUXL.js.map} +1 -1
- package/dist/chunk-DCDVWPMB.cjs +29 -0
- package/dist/chunk-DCDVWPMB.cjs.map +1 -0
- package/dist/{chunk-TI4UTYRL.js → chunk-EY2RJW27.js} +258 -10
- package/dist/chunk-EY2RJW27.js.map +1 -0
- package/dist/{chunk-7YADKWZT.js → chunk-G2E3O3HI.js} +3 -3
- package/dist/{chunk-7YADKWZT.js.map → chunk-G2E3O3HI.js.map} +1 -1
- package/dist/{chunk-6YHWXMPQ.js → chunk-G2T3KTZ3.js} +419 -115
- package/dist/chunk-G2T3KTZ3.js.map +1 -0
- package/dist/{chunk-2NNTQLBY.js → chunk-IAKUTBPX.js} +4 -4
- package/dist/{chunk-2NNTQLBY.js.map → chunk-IAKUTBPX.js.map} +1 -1
- package/dist/{chunk-IZHWP6WQ.cjs → chunk-JG4TFS3Z.cjs} +6 -6
- package/dist/{chunk-IZHWP6WQ.cjs.map → chunk-JG4TFS3Z.cjs.map} +1 -1
- package/dist/chunk-JLOYWXRB.js +1156 -0
- package/dist/chunk-JLOYWXRB.js.map +1 -0
- package/dist/{chunk-WJZBJUPX.js → chunk-KXMDOTGW.js} +56 -4
- package/dist/chunk-KXMDOTGW.js.map +1 -0
- package/dist/{chunk-2VBJ763Y.js → chunk-KZJAG7T3.js} +37 -7
- package/dist/chunk-KZJAG7T3.js.map +1 -0
- package/dist/{chunk-RIL7G7AS.cjs → chunk-MGUHR3JI.cjs} +4 -4
- package/dist/{chunk-RIL7G7AS.cjs.map → chunk-MGUHR3JI.cjs.map} +1 -1
- package/dist/{chunk-NPKGUQU5.js → chunk-NJL4LIXX.js} +4 -4
- package/dist/{chunk-NPKGUQU5.js.map → chunk-NJL4LIXX.js.map} +1 -1
- package/dist/{chunk-DN3NFNIA.cjs → chunk-QMDLPO3M.cjs} +266 -10
- package/dist/chunk-QMDLPO3M.cjs.map +1 -0
- package/dist/chunk-TJMKFY5P.js +27 -0
- package/dist/chunk-TJMKFY5P.js.map +1 -0
- package/dist/{chunk-3PJCET7H.js → chunk-UHVNYKV2.js} +38 -18
- package/dist/chunk-UHVNYKV2.js.map +1 -0
- package/dist/{chunk-6CHMNKXC.cjs → chunk-UTYQPVIW.cjs} +11 -11
- package/dist/chunk-UTYQPVIW.cjs.map +1 -0
- package/dist/{chunk-KHX2BX3S.cjs → chunk-VGOFFCMT.cjs} +37 -5
- package/dist/chunk-VGOFFCMT.cjs.map +1 -0
- package/dist/{chunk-67MKU5U7.js → chunk-YMHGF6R5.js} +8 -8
- package/dist/chunk-YMHGF6R5.js.map +1 -0
- package/dist/chunk-YVIOCITQ.cjs +1186 -0
- package/dist/chunk-YVIOCITQ.cjs.map +1 -0
- package/dist/{chunk-MVNCQDDE.cjs → chunk-ZVPTFTGV.cjs} +4 -4
- package/dist/{chunk-MVNCQDDE.cjs.map → chunk-ZVPTFTGV.cjs.map} +1 -1
- package/dist/collaboration/index.cjs +38 -37
- package/dist/collaboration/index.js +3 -2
- package/dist/connect/index.cjs +358 -19
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +1 -0
- package/dist/connect/index.js +341 -9
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedSettings.d.ts +64 -0
- package/dist/facts/index.cjs +2 -2
- package/dist/facts/index.js +2 -2
- package/dist/files/index.cjs +15 -14
- package/dist/files/index.cjs.map +1 -1
- package/dist/files/index.js +5 -4
- package/dist/files/index.js.map +1 -1
- package/dist/home/index.cjs +19 -19
- package/dist/home/index.js +4 -4
- package/dist/index.cjs +526 -477
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/dist/lib/bottom-inset.d.ts +16 -0
- package/dist/lib/useElementSize.d.ts +13 -0
- package/dist/lib/useFillHeight.d.ts +10 -0
- package/dist/settings/account-views.d.ts +55 -0
- package/dist/settings/index.cjs +179 -1148
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.d.ts +1 -0
- package/dist/settings/index.js +10 -1073
- package/dist/settings/index.js.map +1 -1
- package/dist/shell/InstallPrompt.d.ts +28 -0
- package/dist/shell/MobileBars.d.ts +1 -1
- package/dist/shell/index.cjs +85 -45
- package/dist/shell/index.d.ts +4 -0
- package/dist/shell/index.js +3 -3
- package/dist/shell/install-instructions.d.ts +19 -0
- package/dist/shell/types.d.ts +6 -0
- package/dist/shell/use-install-prompt.d.ts +49 -0
- package/dist/site/index.cjs +62 -62
- package/dist/site/index.js +2 -2
- package/dist/studio/index.cjs +78 -77
- package/dist/studio/index.cjs.map +1 -1
- package/dist/studio/index.js +8 -7
- package/dist/studio/index.js.map +1 -1
- package/dist/theme/ThemeEditor.d.ts +4 -2
- package/dist/workspaces/index.cjs +4 -3
- package/dist/workspaces/index.cjs.map +1 -1
- package/dist/workspaces/index.js +3 -2
- package/dist/workspaces/index.js.map +1 -1
- package/package.json +8 -4
- package/src/blocks.css +30 -0
- package/dist/chunk-2VBJ763Y.js.map +0 -1
- package/dist/chunk-3MIQASHO.cjs.map +0 -1
- package/dist/chunk-3PJCET7H.js.map +0 -1
- package/dist/chunk-67MKU5U7.js.map +0 -1
- package/dist/chunk-6CHMNKXC.cjs.map +0 -1
- package/dist/chunk-6YHWXMPQ.js.map +0 -1
- package/dist/chunk-DN3NFNIA.cjs.map +0 -1
- package/dist/chunk-KHX2BX3S.cjs.map +0 -1
- package/dist/chunk-SS23F63U.cjs.map +0 -1
- package/dist/chunk-TI4UTYRL.js.map +0 -1
- package/dist/chunk-TX2ZICS7.js.map +0 -1
- package/dist/chunk-ULWRNGGE.cjs.map +0 -1
- package/dist/chunk-WJZBJUPX.js.map +0 -1
- package/dist/chunk-YLOKCIQJ.cjs.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ToolButton, Shell } from './chunk-
|
|
3
|
-
import {
|
|
2
|
+
import { useShellBottomInset, ToolButton, Shell } from './chunk-KZJAG7T3.js';
|
|
3
|
+
import { observeResize } from './chunk-NPLYHR2E.js';
|
|
4
4
|
import { formatCount } from './chunk-OXF2IFXG.js';
|
|
5
|
-
import {
|
|
5
|
+
import { testIdOr } from './chunk-7F6CBP3Z.js';
|
|
6
|
+
import { forwardRef, useState, useRef, useEffect, useMemo, useCallback, useSyncExternalStore, useLayoutEffect } from 'react';
|
|
6
7
|
import { FileText, ChevronDown, Pencil, Sparkles, ChevronUp, MoreHorizontal, RotateCw, AlertCircle, ArrowLeft, Edit3, Send, Loader2, Square, Mic, ArrowDown, GanttChartSquare, ArrowUpRight, Upload, MessageSquarePlus, Trash2, PanelRight, MessageSquare, X, FileUp } from 'lucide-react';
|
|
7
|
-
import { cn, Textarea, Button, PopoverTrigger, Popover, PopoverAnchor, PopoverContent, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, Tooltip, TooltipTrigger, TooltipContent, MarkdownRenderer } from '@arbidocs/react/ui';
|
|
8
|
+
import { cn, Textarea, Button, PopoverTrigger, Popover, PopoverAnchor, PopoverContent, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, Tooltip, TooltipTrigger, TooltipContent, MarkdownRenderer, trimOpenCitation } from '@arbidocs/react/ui';
|
|
8
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
10
|
|
|
10
11
|
var DEFAULT_MESSAGE_LABELS = {
|
|
@@ -673,9 +674,12 @@ function ComposerRoot({
|
|
|
673
674
|
children,
|
|
674
675
|
...rest
|
|
675
676
|
}) {
|
|
677
|
+
const rootRef = useRef(null);
|
|
678
|
+
useShellBottomInset(rootRef);
|
|
676
679
|
return /* @__PURE__ */ jsxs(
|
|
677
680
|
"div",
|
|
678
681
|
{
|
|
682
|
+
ref: rootRef,
|
|
679
683
|
"data-slot": "composer",
|
|
680
684
|
className: cn("relative z-[20] shrink-0", isBranching && "bg-muted/30"),
|
|
681
685
|
"data-testid": testId,
|
|
@@ -1247,6 +1251,168 @@ var ContextChip = forwardRef(function ContextChip2({
|
|
|
1247
1251
|
}
|
|
1248
1252
|
);
|
|
1249
1253
|
});
|
|
1254
|
+
var MARK = "ml-px align-super text-[0.7em] font-medium leading-none tabular-nums text-muted-foreground";
|
|
1255
|
+
function sourceLabel(citation, labels) {
|
|
1256
|
+
return [citation.documentTitle, citation.page != null ? labels.page(citation.page) : ""].filter(Boolean).join(", ");
|
|
1257
|
+
}
|
|
1258
|
+
function CitationMark({ num, citation, labels, onOpen, className }) {
|
|
1259
|
+
const [isOpen2, setIsOpen] = useState(false);
|
|
1260
|
+
if (!citation) {
|
|
1261
|
+
return /* @__PURE__ */ jsx("sup", { className: cn(MARK, className), "data-cite": num, children: num });
|
|
1262
|
+
}
|
|
1263
|
+
const open = (passage) => {
|
|
1264
|
+
setIsOpen(false);
|
|
1265
|
+
onOpen?.({
|
|
1266
|
+
documentId: passage?.documentId ?? null,
|
|
1267
|
+
documentTitle: passage?.documentTitle ?? citation.documentTitle,
|
|
1268
|
+
page: passage?.page ?? citation.page,
|
|
1269
|
+
passage,
|
|
1270
|
+
citation
|
|
1271
|
+
});
|
|
1272
|
+
};
|
|
1273
|
+
return /* @__PURE__ */ jsxs(Popover, { open: isOpen2, onOpenChange: setIsOpen, children: [
|
|
1274
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1275
|
+
"button",
|
|
1276
|
+
{
|
|
1277
|
+
type: "button",
|
|
1278
|
+
"data-cite": num,
|
|
1279
|
+
"data-testid": `chat-citation-${num}`,
|
|
1280
|
+
"aria-label": labels.citation(num, sourceLabel(citation, labels)),
|
|
1281
|
+
className: cn(
|
|
1282
|
+
MARK,
|
|
1283
|
+
// A pill hit area: 44px on touch without moving the text.
|
|
1284
|
+
"relative -my-1 inline-flex min-w-[1.1em] justify-center rounded px-1 py-1 hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-muted data-[state=open]:text-foreground",
|
|
1285
|
+
"pointer-coarse:after:absolute pointer-coarse:after:-inset-3 pointer-coarse:after:content-['']",
|
|
1286
|
+
className
|
|
1287
|
+
),
|
|
1288
|
+
children: num
|
|
1289
|
+
}
|
|
1290
|
+
) }),
|
|
1291
|
+
/* @__PURE__ */ jsxs(
|
|
1292
|
+
PopoverContent,
|
|
1293
|
+
{
|
|
1294
|
+
align: "start",
|
|
1295
|
+
"aria-label": labels.citationHeading(num),
|
|
1296
|
+
"data-testid": `chat-citation-popover-${num}`,
|
|
1297
|
+
className: "w-96 max-w-[calc(100vw-1rem)] p-0 text-sm",
|
|
1298
|
+
children: [
|
|
1299
|
+
/* @__PURE__ */ jsx("div", { className: "border-b border-border px-3 py-2 text-xs font-semibold text-muted-foreground", children: labels.citationHeading(num) }),
|
|
1300
|
+
citation.passages.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-3 py-3 text-muted-foreground", children: labels.citationNoSource }) : /* @__PURE__ */ jsx("ul", { className: "divide-y divide-border", children: citation.passages.map((passage) => /* @__PURE__ */ jsxs("li", { className: "space-y-1.5 px-3 py-3", children: [
|
|
1301
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
1302
|
+
/* @__PURE__ */ jsx(
|
|
1303
|
+
FileText,
|
|
1304
|
+
{
|
|
1305
|
+
className: "mt-0.5 size-4 shrink-0 text-muted-foreground",
|
|
1306
|
+
"aria-hidden": "true"
|
|
1307
|
+
}
|
|
1308
|
+
),
|
|
1309
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1310
|
+
/* @__PURE__ */ jsx("div", { className: "break-words font-medium text-foreground", children: passage.documentTitle }),
|
|
1311
|
+
passage.page != null && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: labels.page(passage.page) })
|
|
1312
|
+
] })
|
|
1313
|
+
] }),
|
|
1314
|
+
/* @__PURE__ */ jsx("blockquote", { className: "line-clamp-6 border-l-2 border-border pl-3 text-xs italic text-muted-foreground", children: passage.text }),
|
|
1315
|
+
onOpen && /* @__PURE__ */ jsx(
|
|
1316
|
+
Button,
|
|
1317
|
+
{
|
|
1318
|
+
type: "button",
|
|
1319
|
+
variant: "outline",
|
|
1320
|
+
size: "sm",
|
|
1321
|
+
className: "pointer-coarse:min-h-11",
|
|
1322
|
+
onClick: () => open(passage),
|
|
1323
|
+
"data-testid": `chat-citation-open-${num}`,
|
|
1324
|
+
children: labels.openDocument
|
|
1325
|
+
}
|
|
1326
|
+
)
|
|
1327
|
+
] }, passage.id)) })
|
|
1328
|
+
]
|
|
1329
|
+
}
|
|
1330
|
+
)
|
|
1331
|
+
] });
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
// src/chat/chat-page-types.ts
|
|
1335
|
+
var DEFAULT_CHAT_PAGE_LABELS = {
|
|
1336
|
+
chat: "Assistant chat",
|
|
1337
|
+
conversations: "Conversations",
|
|
1338
|
+
newChat: "New chat",
|
|
1339
|
+
untitled: "New chat",
|
|
1340
|
+
deleteConversation: (title) => `Delete conversation ${title}`,
|
|
1341
|
+
assistant: "Assistant",
|
|
1342
|
+
thinking: "Thinking\u2026",
|
|
1343
|
+
steps: (count) => count === 1 ? "1 step" : `${count} steps`,
|
|
1344
|
+
responseFailed: "Response failed",
|
|
1345
|
+
answerFailedTitle: "The answer could not be completed",
|
|
1346
|
+
uploadFailedTitle: "The upload failed",
|
|
1347
|
+
placeholder: "Ask about your documents",
|
|
1348
|
+
composerAriaLabel: "Message the assistant",
|
|
1349
|
+
documentsInChat: (selected, total) => `${selected} of ${total} documents in this chat`,
|
|
1350
|
+
documentsHeading: "Documents in this chat",
|
|
1351
|
+
selectAllDocuments: "Select all",
|
|
1352
|
+
noDocuments: "No documents yet",
|
|
1353
|
+
uploadDocuments: "Upload documents",
|
|
1354
|
+
uploading: "Uploading\u2026",
|
|
1355
|
+
emptyTitle: "Ask about your documents",
|
|
1356
|
+
emptyDescription: "Every answer is grounded in the selected documents and cites its sources.",
|
|
1357
|
+
emptyUploadTitle: "Add a document to start",
|
|
1358
|
+
emptyUploadDescription: "Upload the documents you want to ask about.",
|
|
1359
|
+
workflows: "Workflows",
|
|
1360
|
+
loadingDocuments: "Loading documents\u2026",
|
|
1361
|
+
stop: "Stop generating",
|
|
1362
|
+
stopped: "Stopped",
|
|
1363
|
+
loadingConversation: "Loading conversation\u2026",
|
|
1364
|
+
historyFailedTitle: "The conversation history could not be used",
|
|
1365
|
+
citation: (num, source) => source ? `Source ${num}: ${source}` : `Source ${num}`,
|
|
1366
|
+
citationHeading: (num) => `Source ${num}`,
|
|
1367
|
+
citationNoSource: "The passage for this source is not available.",
|
|
1368
|
+
openDocument: "Open document",
|
|
1369
|
+
page: (page) => `Page ${page}`,
|
|
1370
|
+
morePassages: (count) => count === 1 ? "1 more passage" : `${count} more passages`
|
|
1371
|
+
};
|
|
1372
|
+
function ChatMessageContent({
|
|
1373
|
+
message,
|
|
1374
|
+
labels,
|
|
1375
|
+
onOpenCitation,
|
|
1376
|
+
className
|
|
1377
|
+
}) {
|
|
1378
|
+
const l = { ...DEFAULT_CHAT_PAGE_LABELS, ...labels };
|
|
1379
|
+
const { citation, citationHeading, citationNoSource, openDocument, page } = l;
|
|
1380
|
+
const citationLabels = useMemo(
|
|
1381
|
+
() => ({ citation, citationHeading, citationNoSource, openDocument, page }),
|
|
1382
|
+
[citation, citationHeading, citationNoSource, openDocument, page]
|
|
1383
|
+
);
|
|
1384
|
+
const byNum = useMemo(
|
|
1385
|
+
() => new Map((message.citations ?? []).map((c) => [c.num, c])),
|
|
1386
|
+
[message.citations]
|
|
1387
|
+
);
|
|
1388
|
+
const renderCitation = useCallback(
|
|
1389
|
+
({ num, children }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1390
|
+
children,
|
|
1391
|
+
/* @__PURE__ */ jsx(
|
|
1392
|
+
CitationMark,
|
|
1393
|
+
{
|
|
1394
|
+
num,
|
|
1395
|
+
citation: byNum.get(num),
|
|
1396
|
+
labels: citationLabels,
|
|
1397
|
+
onOpen: onOpenCitation
|
|
1398
|
+
}
|
|
1399
|
+
)
|
|
1400
|
+
] }),
|
|
1401
|
+
[byNum, citationLabels, onOpenCitation]
|
|
1402
|
+
);
|
|
1403
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1404
|
+
/* @__PURE__ */ jsx(
|
|
1405
|
+
MarkdownRenderer,
|
|
1406
|
+
{
|
|
1407
|
+
isStreaming: message.status === "streaming",
|
|
1408
|
+
renderCitation,
|
|
1409
|
+
className,
|
|
1410
|
+
children: message.status === "streaming" || message.stopped ? trimOpenCitation(message.content) : message.content
|
|
1411
|
+
}
|
|
1412
|
+
),
|
|
1413
|
+
message.stopped && /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs italic text-muted-foreground", "data-testid": "chat-stopped", children: l.stopped })
|
|
1414
|
+
] });
|
|
1415
|
+
}
|
|
1250
1416
|
function ChatDocuments({ chat, labels, onPickFiles, testIds }) {
|
|
1251
1417
|
const [isOpen2, setIsOpen] = useState(false);
|
|
1252
1418
|
const selected = chat.documents.filter((d) => d.isSelected).length;
|
|
@@ -1324,6 +1490,7 @@ function ChatThreadList({
|
|
|
1324
1490
|
onSelect,
|
|
1325
1491
|
onNew,
|
|
1326
1492
|
onDelete,
|
|
1493
|
+
isLoading,
|
|
1327
1494
|
testIds
|
|
1328
1495
|
}) {
|
|
1329
1496
|
return /* @__PURE__ */ jsxs(
|
|
@@ -1348,38 +1515,45 @@ function ChatThreadList({
|
|
|
1348
1515
|
]
|
|
1349
1516
|
}
|
|
1350
1517
|
),
|
|
1351
|
-
/* @__PURE__ */ jsx(
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1518
|
+
/* @__PURE__ */ jsx(
|
|
1519
|
+
"ul",
|
|
1520
|
+
{
|
|
1521
|
+
className: "flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto",
|
|
1522
|
+
"aria-busy": isLoading ? "true" : void 0,
|
|
1523
|
+
children: threads.map((thread) => {
|
|
1524
|
+
const isActive = thread.id === activeId;
|
|
1525
|
+
const title = thread.title || labels.untitled;
|
|
1526
|
+
return /* @__PURE__ */ jsxs("li", { className: "group relative", children: [
|
|
1527
|
+
/* @__PURE__ */ jsx(
|
|
1528
|
+
"button",
|
|
1529
|
+
{
|
|
1530
|
+
type: "button",
|
|
1531
|
+
onClick: () => onSelect(thread.id),
|
|
1532
|
+
"aria-current": isActive ? "true" : void 0,
|
|
1533
|
+
title,
|
|
1534
|
+
"data-testid": `${testIdOr(testIds?.row, { testId: "chat-conversation" })}-${thread.id}`,
|
|
1535
|
+
className: cn(
|
|
1536
|
+
"flex w-full items-center rounded-md px-3 py-2 pr-10 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11",
|
|
1537
|
+
isActive ? "bg-muted font-medium text-foreground" : "text-muted-foreground hover:bg-muted/60 hover:text-foreground"
|
|
1538
|
+
),
|
|
1539
|
+
children: /* @__PURE__ */ jsx("span", { className: "truncate", children: title })
|
|
1540
|
+
}
|
|
1366
1541
|
),
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
}) })
|
|
1542
|
+
onDelete && /* @__PURE__ */ jsx(
|
|
1543
|
+
"button",
|
|
1544
|
+
{
|
|
1545
|
+
type: "button",
|
|
1546
|
+
onClick: () => onDelete(thread.id),
|
|
1547
|
+
"aria-label": labels.deleteConversation(title),
|
|
1548
|
+
"data-testid": `${testIdOr(testIds?.delete, { testId: "chat-delete" })}-${thread.id}`,
|
|
1549
|
+
className: "absolute right-1 top-1/2 flex size-8 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground opacity-100 hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-fine:opacity-0 pointer-fine:group-hover:opacity-100 pointer-coarse:size-11",
|
|
1550
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "size-4", "aria-hidden": "true" })
|
|
1551
|
+
}
|
|
1552
|
+
)
|
|
1553
|
+
] }, thread.id);
|
|
1554
|
+
})
|
|
1555
|
+
}
|
|
1556
|
+
)
|
|
1383
1557
|
]
|
|
1384
1558
|
}
|
|
1385
1559
|
);
|
|
@@ -1431,38 +1605,88 @@ function useChatSurface() {
|
|
|
1431
1605
|
);
|
|
1432
1606
|
return { hasEmbeddedChat: count > 0, isDockAvailable: count === 0 };
|
|
1433
1607
|
}
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1608
|
+
function useElementSize(ref) {
|
|
1609
|
+
const [size, setSize] = useState({ width: 0, height: 0 });
|
|
1610
|
+
useLayoutEffect(() => {
|
|
1611
|
+
const el = ref.current;
|
|
1612
|
+
if (!el) return;
|
|
1613
|
+
const measure = () => {
|
|
1614
|
+
const rect = el.getBoundingClientRect();
|
|
1615
|
+
setSize(
|
|
1616
|
+
(prev) => prev.width === rect.width && prev.height === rect.height ? prev : { width: rect.width, height: rect.height }
|
|
1617
|
+
);
|
|
1618
|
+
};
|
|
1619
|
+
measure();
|
|
1620
|
+
window.addEventListener("resize", measure);
|
|
1621
|
+
const stopObserving = observeResize(el, measure);
|
|
1622
|
+
return () => {
|
|
1623
|
+
window.removeEventListener("resize", measure);
|
|
1624
|
+
stopObserving();
|
|
1625
|
+
};
|
|
1626
|
+
}, [ref]);
|
|
1627
|
+
return size;
|
|
1628
|
+
}
|
|
1629
|
+
function rootFontSizePx() {
|
|
1630
|
+
if (typeof document === "undefined") return 16;
|
|
1631
|
+
const size = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
1632
|
+
return Number.isFinite(size) && size > 0 ? size : 16;
|
|
1633
|
+
}
|
|
1634
|
+
function bottomSpace(el, until) {
|
|
1635
|
+
let space = 0;
|
|
1636
|
+
for (let node = el.parentElement; node; node = node.parentElement) {
|
|
1637
|
+
const style = getComputedStyle(node);
|
|
1638
|
+
space += (parseFloat(style.paddingBottom) || 0) + (parseFloat(style.borderBottomWidth) || 0);
|
|
1639
|
+
if (node === until) break;
|
|
1640
|
+
}
|
|
1641
|
+
return space;
|
|
1642
|
+
}
|
|
1643
|
+
function scrollParent(el) {
|
|
1644
|
+
for (let node = el.parentElement; node; node = node.parentElement) {
|
|
1645
|
+
const overflowY = getComputedStyle(node).overflowY;
|
|
1646
|
+
if (overflowY === "auto" || overflowY === "scroll") return node;
|
|
1647
|
+
}
|
|
1648
|
+
return null;
|
|
1649
|
+
}
|
|
1650
|
+
function useFillHeight(ref, enabled, minHeight) {
|
|
1651
|
+
const [height, setHeight] = useState(null);
|
|
1652
|
+
useLayoutEffect(() => {
|
|
1653
|
+
const el = ref.current;
|
|
1654
|
+
if (!enabled || !el) return;
|
|
1655
|
+
const scroller = scrollParent(el);
|
|
1656
|
+
const measure = () => {
|
|
1657
|
+
const viewport = window.visualViewport?.height ?? window.innerHeight;
|
|
1658
|
+
const rect = el.getBoundingClientRect();
|
|
1659
|
+
const scrolled = scroller ? scroller.scrollTop : window.scrollY;
|
|
1660
|
+
let available;
|
|
1661
|
+
if (scroller) {
|
|
1662
|
+
const top = rect.top - scroller.getBoundingClientRect().top;
|
|
1663
|
+
available = scroller.clientHeight - (top + scrolled) - bottomSpace(el, scroller);
|
|
1664
|
+
} else {
|
|
1665
|
+
available = viewport - rect.top;
|
|
1666
|
+
}
|
|
1667
|
+
const bar = document.querySelector('[data-slot="mobile-tab-bar"]')?.getBoundingClientRect();
|
|
1668
|
+
const barHeight = bar && bar.height > 0 ? Math.max(0, viewport - bar.top) : 0;
|
|
1669
|
+
available = Math.min(available, viewport - barHeight - (rect.top + scrolled));
|
|
1670
|
+
setHeight(Math.max(minHeight, Math.floor(available)));
|
|
1671
|
+
};
|
|
1672
|
+
measure();
|
|
1673
|
+
window.addEventListener("resize", measure);
|
|
1674
|
+
window.visualViewport?.addEventListener("resize", measure);
|
|
1675
|
+
const stopObserving = scroller ? observeResize(scroller, measure) : () => {
|
|
1676
|
+
};
|
|
1677
|
+
return () => {
|
|
1678
|
+
window.removeEventListener("resize", measure);
|
|
1679
|
+
window.visualViewport?.removeEventListener("resize", measure);
|
|
1680
|
+
stopObserving();
|
|
1681
|
+
};
|
|
1682
|
+
}, [ref, enabled, minHeight]);
|
|
1683
|
+
return enabled ? height : null;
|
|
1684
|
+
}
|
|
1463
1685
|
var USER_BUBBLE = "bg-[color:hsl(var(--chat-user-bubble,var(--muted)))] text-[color:hsl(var(--chat-user-bubble-foreground,var(--foreground)))]";
|
|
1464
1686
|
var NEAR_BOTTOM_PX = 96;
|
|
1465
|
-
|
|
1687
|
+
var LIST_COLUMN_REM = 48;
|
|
1688
|
+
var DEFAULT_ASIDE_BREAKPOINT_REM = 60;
|
|
1689
|
+
function MessageRow({ message, identity, renderContent, onOpenCitation, labels }) {
|
|
1466
1690
|
if (message.role === "user") {
|
|
1467
1691
|
return /* @__PURE__ */ jsx(Message.Root, { role: "user", messageId: message.id, children: /* @__PURE__ */ jsx(Message.Content, { role: "user", messageId: message.id, children: /* @__PURE__ */ jsx(
|
|
1468
1692
|
Message.Bubble,
|
|
@@ -1490,7 +1714,15 @@ function MessageRow({ message, identity, renderContent, labels }) {
|
|
|
1490
1714
|
statusLabel: isFailed ? labels.responseFailed : ""
|
|
1491
1715
|
}
|
|
1492
1716
|
),
|
|
1493
|
-
hasText && (renderContent?.(message) ?? /* @__PURE__ */ jsx(
|
|
1717
|
+
hasText && (renderContent?.(message) ?? /* @__PURE__ */ jsx(
|
|
1718
|
+
ChatMessageContent,
|
|
1719
|
+
{
|
|
1720
|
+
message,
|
|
1721
|
+
labels,
|
|
1722
|
+
onOpenCitation
|
|
1723
|
+
}
|
|
1724
|
+
)),
|
|
1725
|
+
!hasText && message.stopped && /* @__PURE__ */ jsx("p", { className: "text-xs italic text-muted-foreground", "data-testid": "chat-stopped", children: labels.stopped }),
|
|
1494
1726
|
isStreaming && !hasText && /* @__PURE__ */ jsxs(
|
|
1495
1727
|
"span",
|
|
1496
1728
|
{
|
|
@@ -1515,6 +1747,11 @@ function ChatPage({
|
|
|
1515
1747
|
emptyDescription,
|
|
1516
1748
|
identity,
|
|
1517
1749
|
renderContent,
|
|
1750
|
+
onOpenCitation,
|
|
1751
|
+
asideBreakpoint = DEFAULT_ASIDE_BREAKPOINT_REM,
|
|
1752
|
+
fillHeight = false,
|
|
1753
|
+
minHeight = 360,
|
|
1754
|
+
compactHeader = false,
|
|
1518
1755
|
accept,
|
|
1519
1756
|
labels,
|
|
1520
1757
|
className,
|
|
@@ -1525,9 +1762,40 @@ function ChatPage({
|
|
|
1525
1762
|
const [draft, setDraft] = useState("");
|
|
1526
1763
|
const [isAsideOpen, setIsAsideOpen] = useState(false);
|
|
1527
1764
|
const [isAway, setIsAway] = useState(false);
|
|
1765
|
+
const rootRef = useRef(null);
|
|
1766
|
+
const headerRef = useRef(null);
|
|
1767
|
+
const asideToggleRef = useRef(null);
|
|
1768
|
+
const asideRef = useRef(null);
|
|
1528
1769
|
const scrollRef = useRef(null);
|
|
1529
1770
|
const fileRef = useRef(null);
|
|
1530
1771
|
const textareaRef = useRef(null);
|
|
1772
|
+
const { width } = useElementSize(rootRef);
|
|
1773
|
+
const { height: headerHeight } = useElementSize(headerRef);
|
|
1774
|
+
const rem = rootFontSizePx();
|
|
1775
|
+
const hasListColumn = width >= LIST_COLUMN_REM * rem;
|
|
1776
|
+
const hasAsideColumn = width > 0 && width >= asideBreakpoint * rem;
|
|
1777
|
+
const fillPx = useFillHeight(rootRef, fillHeight, minHeight);
|
|
1778
|
+
const closeAside = useCallback(() => setIsAsideOpen(false), []);
|
|
1779
|
+
const isAsidePanelOpen = !!aside && !hasAsideColumn && isAsideOpen;
|
|
1780
|
+
useEffect(() => {
|
|
1781
|
+
if (!isAsidePanelOpen) return;
|
|
1782
|
+
const onKey = (e) => {
|
|
1783
|
+
if (e.key !== "Escape") return;
|
|
1784
|
+
closeAside();
|
|
1785
|
+
asideToggleRef.current?.focus();
|
|
1786
|
+
};
|
|
1787
|
+
const onPointer = (e) => {
|
|
1788
|
+
const target = e.target;
|
|
1789
|
+
if (asideRef.current?.contains(target) || asideToggleRef.current?.contains(target)) return;
|
|
1790
|
+
closeAside();
|
|
1791
|
+
};
|
|
1792
|
+
document.addEventListener("keydown", onKey);
|
|
1793
|
+
document.addEventListener("pointerdown", onPointer);
|
|
1794
|
+
return () => {
|
|
1795
|
+
document.removeEventListener("keydown", onKey);
|
|
1796
|
+
document.removeEventListener("pointerdown", onPointer);
|
|
1797
|
+
};
|
|
1798
|
+
}, [isAsidePanelOpen, closeAside]);
|
|
1531
1799
|
const last = chat.messages[chat.messages.length - 1];
|
|
1532
1800
|
const announcement = useStreamAnnouncement({
|
|
1533
1801
|
isStreaming: chat.isRunning,
|
|
@@ -1560,27 +1828,34 @@ function ChatPage({
|
|
|
1560
1828
|
const onFiles = (files) => {
|
|
1561
1829
|
if (files.length > 0) void chat.upload(files);
|
|
1562
1830
|
};
|
|
1831
|
+
const hasHeader = !(compactHeader && hasListColumn && !headerActions && !(aside && !hasAsideColumn));
|
|
1563
1832
|
const activeThread = chat.threads.find((t) => t.id === chat.activeThreadId);
|
|
1564
1833
|
const hasDocuments = chat.documents.length > 0;
|
|
1565
1834
|
const isEmpty = chat.messages.length === 0;
|
|
1566
|
-
const heading = header ?? /* @__PURE__ */ jsx("h2", { className: "min-w-0 truncate text-sm font-semibold text-foreground", children: activeThread?.title || l.untitled });
|
|
1835
|
+
const heading = compactHeader ? null : header ?? /* @__PURE__ */ jsx("h2", { className: "min-w-0 truncate text-sm font-semibold text-foreground", children: activeThread?.title || l.untitled });
|
|
1567
1836
|
return /* @__PURE__ */ jsxs(
|
|
1568
1837
|
"section",
|
|
1569
1838
|
{
|
|
1839
|
+
ref: rootRef,
|
|
1570
1840
|
"aria-label": l.chat,
|
|
1571
1841
|
"data-slot": "chat-page",
|
|
1572
1842
|
"data-surface": surface,
|
|
1843
|
+
"data-list": hasListColumn ? "column" : "select",
|
|
1844
|
+
"data-aside": aside ? hasAsideColumn ? "column" : "panel" : void 0,
|
|
1573
1845
|
"data-testid": testIdOr(testIds?.root, { testId: "chat-page" }),
|
|
1846
|
+
style: fillPx != null ? { height: fillPx } : void 0,
|
|
1574
1847
|
className: cn(
|
|
1575
|
-
"@container/chat flex
|
|
1848
|
+
"@container/chat relative flex min-h-0 w-full overflow-hidden bg-background text-foreground",
|
|
1849
|
+
fillHeight ? "h-[70dvh]" : "h-full",
|
|
1576
1850
|
className
|
|
1577
1851
|
),
|
|
1578
1852
|
children: [
|
|
1579
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
1853
|
+
hasListColumn && /* @__PURE__ */ jsx("div", { className: "flex w-64 shrink-0 flex-col border-r border-border", children: /* @__PURE__ */ jsx(
|
|
1580
1854
|
ChatThreadList,
|
|
1581
1855
|
{
|
|
1582
1856
|
threads: chat.threads,
|
|
1583
1857
|
activeId: chat.activeThreadId,
|
|
1858
|
+
isLoading: chat.isLoadingThreads,
|
|
1584
1859
|
labels: l,
|
|
1585
1860
|
onSelect: chat.selectThread,
|
|
1586
1861
|
onNew: chat.newThread,
|
|
@@ -1588,48 +1863,48 @@ function ChatPage({
|
|
|
1588
1863
|
}
|
|
1589
1864
|
) }),
|
|
1590
1865
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
1591
|
-
/* @__PURE__ */ jsxs(
|
|
1866
|
+
hasHeader && /* @__PURE__ */ jsxs(
|
|
1592
1867
|
"div",
|
|
1593
1868
|
{
|
|
1869
|
+
ref: headerRef,
|
|
1594
1870
|
"data-slot": "chat-page-header",
|
|
1595
1871
|
className: "flex min-h-12 shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",
|
|
1596
1872
|
children: [
|
|
1597
|
-
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
1598
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
1599
|
-
/* @__PURE__ */
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
)
|
|
1622
|
-
] })
|
|
1873
|
+
hasListColumn ? /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-center", children: heading }) : /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
1874
|
+
heading ? /* @__PURE__ */ jsx("div", { className: "min-w-0 shrink", children: heading }) : null,
|
|
1875
|
+
/* @__PURE__ */ jsx(
|
|
1876
|
+
ChatThreadSelect,
|
|
1877
|
+
{
|
|
1878
|
+
threads: chat.threads,
|
|
1879
|
+
activeId: chat.activeThreadId,
|
|
1880
|
+
labels: l,
|
|
1881
|
+
onSelect: chat.selectThread
|
|
1882
|
+
}
|
|
1883
|
+
),
|
|
1884
|
+
/* @__PURE__ */ jsx(
|
|
1885
|
+
Button,
|
|
1886
|
+
{
|
|
1887
|
+
type: "button",
|
|
1888
|
+
variant: "ghost",
|
|
1889
|
+
size: "icon",
|
|
1890
|
+
className: "size-9 shrink-0 pointer-coarse:size-11",
|
|
1891
|
+
"aria-label": l.newChat,
|
|
1892
|
+
onClick: chat.newThread,
|
|
1893
|
+
"data-testid": "chat-new-compact",
|
|
1894
|
+
children: /* @__PURE__ */ jsx(MessageSquarePlus, { className: "size-4", "aria-hidden": "true" })
|
|
1895
|
+
}
|
|
1896
|
+
)
|
|
1623
1897
|
] }),
|
|
1624
|
-
aside && /* @__PURE__ */ jsxs(
|
|
1898
|
+
aside && !hasAsideColumn && /* @__PURE__ */ jsxs(
|
|
1625
1899
|
Button,
|
|
1626
1900
|
{
|
|
1901
|
+
ref: asideToggleRef,
|
|
1627
1902
|
type: "button",
|
|
1628
1903
|
variant: "outline",
|
|
1629
1904
|
size: "sm",
|
|
1630
|
-
className: "shrink-0 gap-1.5 pointer-coarse:min-h-11
|
|
1905
|
+
className: "shrink-0 gap-1.5 pointer-coarse:min-h-11",
|
|
1631
1906
|
"aria-expanded": isAsideOpen,
|
|
1632
|
-
"aria-controls": "chat-page-aside
|
|
1907
|
+
"aria-controls": "chat-page-aside",
|
|
1633
1908
|
onClick: () => setIsAsideOpen((v) => !v),
|
|
1634
1909
|
"data-testid": testIdOr(testIds?.asideToggle, { testId: "chat-aside-toggle" }),
|
|
1635
1910
|
children: [
|
|
@@ -1642,15 +1917,6 @@ function ChatPage({
|
|
|
1642
1917
|
]
|
|
1643
1918
|
}
|
|
1644
1919
|
),
|
|
1645
|
-
aside && isAsideOpen && /* @__PURE__ */ jsx(
|
|
1646
|
-
"div",
|
|
1647
|
-
{
|
|
1648
|
-
id: "chat-page-aside-panel",
|
|
1649
|
-
"data-slot": "chat-page-aside-panel",
|
|
1650
|
-
className: "max-h-[45%] shrink-0 overflow-y-auto border-b border-border p-3 @6xl/chat:hidden",
|
|
1651
|
-
children: aside
|
|
1652
|
-
}
|
|
1653
|
-
),
|
|
1654
1920
|
/* @__PURE__ */ jsxs(
|
|
1655
1921
|
MessageList.Root,
|
|
1656
1922
|
{
|
|
@@ -1665,8 +1931,16 @@ function ChatPage({
|
|
|
1665
1931
|
ref: scrollRef,
|
|
1666
1932
|
onScroll,
|
|
1667
1933
|
"data-slot": "chat-page-scroll",
|
|
1668
|
-
className: "relative min-h-0 flex-1 overflow-y-auto overscroll-contain",
|
|
1669
|
-
children: isEmpty ? chat.isLoadingDocuments
|
|
1934
|
+
className: "scrollbar-themed relative min-h-0 flex-1 overflow-y-auto overscroll-contain",
|
|
1935
|
+
children: isEmpty ? chat.isLoadingDocuments || chat.isLoadingThread ? /* @__PURE__ */ jsx(
|
|
1936
|
+
"div",
|
|
1937
|
+
{
|
|
1938
|
+
role: "status",
|
|
1939
|
+
className: "flex h-full items-center justify-center text-sm text-muted-foreground",
|
|
1940
|
+
"data-testid": "chat-loading",
|
|
1941
|
+
children: chat.isLoadingThread ? l.loadingConversation : l.loadingDocuments
|
|
1942
|
+
}
|
|
1943
|
+
) : /* @__PURE__ */ jsx(
|
|
1670
1944
|
ConversationEmpty,
|
|
1671
1945
|
{
|
|
1672
1946
|
hasDocuments,
|
|
@@ -1711,6 +1985,7 @@ function ChatPage({
|
|
|
1711
1985
|
message,
|
|
1712
1986
|
identity,
|
|
1713
1987
|
renderContent,
|
|
1988
|
+
onOpenCitation,
|
|
1714
1989
|
labels: l
|
|
1715
1990
|
}
|
|
1716
1991
|
) }, message.id))
|
|
@@ -1743,6 +2018,14 @@ function ChatPage({
|
|
|
1743
2018
|
testId: testIdOr(testIds?.alert, { testId: "chat-alert" })
|
|
1744
2019
|
}
|
|
1745
2020
|
),
|
|
2021
|
+
chat.historyError && /* @__PURE__ */ jsx(
|
|
2022
|
+
MessageAlert,
|
|
2023
|
+
{
|
|
2024
|
+
title: l.historyFailedTitle,
|
|
2025
|
+
description: chat.historyError,
|
|
2026
|
+
testId: "chat-history-alert"
|
|
2027
|
+
}
|
|
2028
|
+
),
|
|
1746
2029
|
chat.uploadError && /* @__PURE__ */ jsx(
|
|
1747
2030
|
MessageAlert,
|
|
1748
2031
|
{
|
|
@@ -1775,7 +2058,20 @@ function ChatPage({
|
|
|
1775
2058
|
testIds: { documents: testIds?.documents, upload: testIds?.upload }
|
|
1776
2059
|
}
|
|
1777
2060
|
),
|
|
1778
|
-
trailing: /* @__PURE__ */ jsx(
|
|
2061
|
+
trailing: chat.isRunning && chat.stop ? /* @__PURE__ */ jsx(
|
|
2062
|
+
Button,
|
|
2063
|
+
{
|
|
2064
|
+
type: "button",
|
|
2065
|
+
size: "icon",
|
|
2066
|
+
variant: "outline",
|
|
2067
|
+
className: "h-9 w-9 shrink-0 pointer-coarse:h-11 pointer-coarse:w-11",
|
|
2068
|
+
"aria-label": l.stop,
|
|
2069
|
+
title: l.stop,
|
|
2070
|
+
onClick: chat.stop,
|
|
2071
|
+
"data-testid": "chat-stop",
|
|
2072
|
+
children: /* @__PURE__ */ jsx(Square, { className: "h-3.5 w-3.5 fill-current", "aria-hidden": "true" })
|
|
2073
|
+
}
|
|
2074
|
+
) : /* @__PURE__ */ jsx(
|
|
1779
2075
|
Composer.Send,
|
|
1780
2076
|
{
|
|
1781
2077
|
onSend: () => submit(),
|
|
@@ -1791,10 +2087,18 @@ function ChatPage({
|
|
|
1791
2087
|
aside && /* @__PURE__ */ jsx(
|
|
1792
2088
|
"aside",
|
|
1793
2089
|
{
|
|
2090
|
+
ref: asideRef,
|
|
2091
|
+
id: "chat-page-aside",
|
|
1794
2092
|
"aria-label": l.workflows,
|
|
1795
2093
|
"data-slot": "chat-page-aside",
|
|
2094
|
+
"data-mode": hasAsideColumn ? "column" : "panel",
|
|
1796
2095
|
"data-testid": testIdOr(testIds?.aside, { testId: "chat-aside" }),
|
|
1797
|
-
|
|
2096
|
+
hidden: !hasAsideColumn && !isAsideOpen,
|
|
2097
|
+
style: hasAsideColumn ? void 0 : { top: headerHeight + 4 },
|
|
2098
|
+
className: cn(
|
|
2099
|
+
"scrollbar-themed overflow-y-auto bg-background",
|
|
2100
|
+
hasAsideColumn ? "w-72 shrink-0 border-l border-border p-4" : "absolute right-2 z-20 max-h-[min(60%,32rem)] w-[min(22rem,calc(100%-1rem))] rounded-lg border border-border bg-popover p-3 text-popover-foreground shadow-lg"
|
|
2101
|
+
),
|
|
1798
2102
|
children: aside
|
|
1799
2103
|
}
|
|
1800
2104
|
),
|
|
@@ -1894,6 +2198,6 @@ function AssistantDock({
|
|
|
1894
2198
|
);
|
|
1895
2199
|
}
|
|
1896
2200
|
|
|
1897
|
-
export { AssistantDock, AssistantDockToggle, ChatDocuments, ChatPage, ChatThreadList, ChatThreadSelect, Composer, ComposerBranchingNotice, ComposerContainer, ComposerDock, ComposerFrame, ComposerInput, ComposerRoot, ComposerSend, ComposerToolbar, ComposerVoiceButton, ContextChip, ConversationEmpty, DEFAULT_CHAT_PAGE_LABELS, DEFAULT_COMPOSER_LABELS, DEFAULT_CONVERSATION_EMPTY_LABELS, DEFAULT_MESSAGE_ALERT_LABELS, DEFAULT_MESSAGE_LABELS, DEFAULT_MESSAGE_LIST_LABELS, Message, MessageActionButton, MessageActionMenu, MessageAlert, MessageBody, MessageBubble, MessageByline, MessageContent, MessageFooter, MessageList, MessageListBanner, MessageListEmpty, MessageListRoot, MessageListRow, MessageListRows, MessageListStatus, MessageListTail, MessageNarration, MessageRoot, MessageSources, MessageSubagentBadge, ScrollToBottom, SourceChip, toSpeakableText, useAssistantDock, useChatSurface, useRegisterEmbeddedChat, useStreamAnnouncement };
|
|
1898
|
-
//# sourceMappingURL=chunk-
|
|
1899
|
-
//# sourceMappingURL=chunk-
|
|
2201
|
+
export { AssistantDock, AssistantDockToggle, ChatDocuments, ChatMessageContent, ChatPage, ChatThreadList, ChatThreadSelect, CitationMark, Composer, ComposerBranchingNotice, ComposerContainer, ComposerDock, ComposerFrame, ComposerInput, ComposerRoot, ComposerSend, ComposerToolbar, ComposerVoiceButton, ContextChip, ConversationEmpty, DEFAULT_CHAT_PAGE_LABELS, DEFAULT_COMPOSER_LABELS, DEFAULT_CONVERSATION_EMPTY_LABELS, DEFAULT_MESSAGE_ALERT_LABELS, DEFAULT_MESSAGE_LABELS, DEFAULT_MESSAGE_LIST_LABELS, Message, MessageActionButton, MessageActionMenu, MessageAlert, MessageBody, MessageBubble, MessageByline, MessageContent, MessageFooter, MessageList, MessageListBanner, MessageListEmpty, MessageListRoot, MessageListRow, MessageListRows, MessageListStatus, MessageListTail, MessageNarration, MessageRoot, MessageSources, MessageSubagentBadge, ScrollToBottom, SourceChip, toSpeakableText, useAssistantDock, useChatSurface, useRegisterEmbeddedChat, useStreamAnnouncement };
|
|
2202
|
+
//# sourceMappingURL=chunk-G2T3KTZ3.js.map
|
|
2203
|
+
//# sourceMappingURL=chunk-G2T3KTZ3.js.map
|