@arbidocs/react 0.3.107 → 0.3.108
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/dist/index.cjs +383 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +116 -3
- package/dist/index.d.ts +116 -3
- package/dist/index.js +381 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { diffWords } from 'diff';
|
|
|
15
15
|
import ReactMarkdown from 'react-markdown';
|
|
16
16
|
import remarkGfm from 'remark-gfm';
|
|
17
17
|
import rehypeRaw from 'rehype-raw';
|
|
18
|
-
import { MoreVertical, Loader2, AlertTriangle, ShieldCheck, Check, Copy, Sparkles, FileText, GitCompareArrows, Download, Search, CornerDownLeft, Send, Tags, Eye, FolderOpen, Bot, Calendar, Folder, StickyNote, Hash, List, SquareCheckBig, Package } from 'lucide-react';
|
|
18
|
+
import { MoreVertical, Loader2, AlertTriangle, ShieldCheck, Check, Copy, Sparkles, FileText, GitCompareArrows, Download, Search, CornerDownLeft, Send, Tags, Eye, FolderOpen, Bot, Calendar, Folder, StickyNote, Hash, List, SquareCheckBig, Package, X } from 'lucide-react';
|
|
19
19
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
20
20
|
import { AgGridReact } from 'ag-grid-react';
|
|
21
21
|
import { ModuleRegistry, AllCommunityModule } from 'ag-grid-community';
|
|
@@ -605,6 +605,8 @@ var arbiQueryKeys = {
|
|
|
605
605
|
documents: (workspaceId) => ["arbi", "documents", workspaceId],
|
|
606
606
|
conversations: (workspaceId) => ["arbi", "conversations", workspaceId],
|
|
607
607
|
tags: (workspaceId) => ["arbi", "tags", workspaceId],
|
|
608
|
+
thumbnails: (docIds) => ["arbi", "thumbnails", [...docIds].sort().join(",")],
|
|
609
|
+
parsedDoc: (docId, stage) => ["arbi", "parsedDoc", docId, stage],
|
|
608
610
|
agents: () => ["arbi", "agents"],
|
|
609
611
|
sessions: () => ["arbi", "sessions"],
|
|
610
612
|
health: () => ["arbi", "health"],
|
|
@@ -644,6 +646,23 @@ function useTags(workspaceId, options) {
|
|
|
644
646
|
enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace
|
|
645
647
|
});
|
|
646
648
|
}
|
|
649
|
+
function useThumbnails(docIds, options) {
|
|
650
|
+
const arbi = useArbi();
|
|
651
|
+
return useQuery({
|
|
652
|
+
queryKey: arbiQueryKeys.thumbnails(docIds),
|
|
653
|
+
queryFn: () => arbi.documents.getThumbnails(docIds),
|
|
654
|
+
enabled: (options?.enabled ?? true) && docIds.length > 0 && arbi.hasWorkspace,
|
|
655
|
+
staleTime: 5 * 6e4
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
function useParsedDocument(docId, stage = "final", options) {
|
|
659
|
+
const arbi = useArbi();
|
|
660
|
+
return useQuery({
|
|
661
|
+
queryKey: arbiQueryKeys.parsedDoc(docId ?? "", stage),
|
|
662
|
+
queryFn: () => arbi.documents.getParsedContent(docId, stage),
|
|
663
|
+
enabled: (options?.enabled ?? true) && !!docId && arbi.hasWorkspace
|
|
664
|
+
});
|
|
665
|
+
}
|
|
647
666
|
function useAssistantQuery() {
|
|
648
667
|
const arbi = useArbi();
|
|
649
668
|
return useMutation({
|
|
@@ -3213,7 +3232,367 @@ function DocumentTable({
|
|
|
3213
3232
|
}
|
|
3214
3233
|
) });
|
|
3215
3234
|
}
|
|
3235
|
+
var STATUS_VARIANTS2 = {
|
|
3236
|
+
completed: "default",
|
|
3237
|
+
empty: "secondary",
|
|
3238
|
+
"low-content": "secondary",
|
|
3239
|
+
processing: "outline",
|
|
3240
|
+
queued: "outline",
|
|
3241
|
+
failed: "destructive",
|
|
3242
|
+
skipped: "destructive"
|
|
3243
|
+
};
|
|
3244
|
+
var IMAGE_EXTENSIONS2 = /* @__PURE__ */ new Set(["jpg", "jpeg", "png", "gif", "bmp", "tiff", "tif", "webp"]);
|
|
3245
|
+
var VIDEO_EXTENSIONS2 = /* @__PURE__ */ new Set(["mp4", "mpeg", "mpg", "webm", "mov", "avi", "mkv"]);
|
|
3246
|
+
var AUDIO_EXTENSIONS2 = /* @__PURE__ */ new Set(["mp3", "wav", "m4a", "aac", "ogg", "flac"]);
|
|
3247
|
+
var EMAIL_EXTENSIONS2 = /* @__PURE__ */ new Set(["eml", "msg"]);
|
|
3248
|
+
function fileIcon(fileName) {
|
|
3249
|
+
const ext = fileName?.split(".").pop()?.toLowerCase();
|
|
3250
|
+
const size = 44;
|
|
3251
|
+
if (ext && VIDEO_EXTENSIONS2.has(ext)) return /* @__PURE__ */ jsx(VidIcon, { size });
|
|
3252
|
+
if (ext && AUDIO_EXTENSIONS2.has(ext)) return /* @__PURE__ */ jsx(AudIcon, { size });
|
|
3253
|
+
if (ext && IMAGE_EXTENSIONS2.has(ext)) return /* @__PURE__ */ jsx(ImgIcon, { size });
|
|
3254
|
+
if (ext && EMAIL_EXTENSIONS2.has(ext)) return /* @__PURE__ */ jsx(EmlIcon, { size });
|
|
3255
|
+
return /* @__PURE__ */ jsx(PdfIcon, { size });
|
|
3256
|
+
}
|
|
3257
|
+
function docTitle(doc) {
|
|
3258
|
+
return doc.doc_metadata?.title || doc.file_name || "Untitled";
|
|
3259
|
+
}
|
|
3260
|
+
function DocumentGallery({
|
|
3261
|
+
workspaceId,
|
|
3262
|
+
documents,
|
|
3263
|
+
onOpenDocument,
|
|
3264
|
+
selectedIds,
|
|
3265
|
+
onSelectionChange,
|
|
3266
|
+
minTileWidth = 180,
|
|
3267
|
+
className
|
|
3268
|
+
}) {
|
|
3269
|
+
const query = useDocuments(workspaceId, { enabled: !documents });
|
|
3270
|
+
const rows = documents ?? query.data ?? [];
|
|
3271
|
+
const isLoading = !documents && query.isLoading;
|
|
3272
|
+
const tagsQuery = useTags(workspaceId);
|
|
3273
|
+
const tagNameById = React__default.useMemo(() => {
|
|
3274
|
+
const map = /* @__PURE__ */ new Map();
|
|
3275
|
+
for (const t of tagsQuery.data ?? []) {
|
|
3276
|
+
if (t.external_id) map.set(t.external_id, t.name ?? t.external_id.slice(0, 8));
|
|
3277
|
+
}
|
|
3278
|
+
return map;
|
|
3279
|
+
}, [tagsQuery.data]);
|
|
3280
|
+
const docIds = React__default.useMemo(
|
|
3281
|
+
() => rows.map((d) => d.external_id).filter((id) => !!id),
|
|
3282
|
+
[rows]
|
|
3283
|
+
);
|
|
3284
|
+
const thumbsQuery = useThumbnails(docIds);
|
|
3285
|
+
const thumbs = thumbsQuery.data ?? {};
|
|
3286
|
+
const storeSelected = useArbiUiStore((s) => s.selectedDocIds);
|
|
3287
|
+
const storeSetSelected = useArbiUiStore((s) => s.setSelectedDocIds);
|
|
3288
|
+
const viewingDocId = useArbiUiStore((s) => s.viewingDocId);
|
|
3289
|
+
const setViewingDocId = useArbiUiStore((s) => s.setViewingDocId);
|
|
3290
|
+
const effectiveSelected = selectedIds ?? storeSelected;
|
|
3291
|
+
const emitSelection = onSelectionChange ?? storeSetSelected;
|
|
3292
|
+
const selectedSet = React__default.useMemo(() => new Set(effectiveSelected), [effectiveSelected]);
|
|
3293
|
+
const toggleSelected = React__default.useCallback(
|
|
3294
|
+
(id) => {
|
|
3295
|
+
const next = new Set(effectiveSelected);
|
|
3296
|
+
if (next.has(id)) next.delete(id);
|
|
3297
|
+
else next.add(id);
|
|
3298
|
+
emitSelection([...next]);
|
|
3299
|
+
},
|
|
3300
|
+
[effectiveSelected, emitSelection]
|
|
3301
|
+
);
|
|
3302
|
+
const openDocument = React__default.useCallback(
|
|
3303
|
+
(id) => {
|
|
3304
|
+
setViewingDocId(id);
|
|
3305
|
+
onOpenDocument?.(id);
|
|
3306
|
+
},
|
|
3307
|
+
[onOpenDocument, setViewingDocId]
|
|
3308
|
+
);
|
|
3309
|
+
if (isLoading) {
|
|
3310
|
+
return /* @__PURE__ */ jsx(
|
|
3311
|
+
"div",
|
|
3312
|
+
{
|
|
3313
|
+
className: cn(
|
|
3314
|
+
"flex items-center justify-center p-8 text-sm text-muted-foreground",
|
|
3315
|
+
className
|
|
3316
|
+
),
|
|
3317
|
+
children: "Loading documents\u2026"
|
|
3318
|
+
}
|
|
3319
|
+
);
|
|
3320
|
+
}
|
|
3321
|
+
if (rows.length === 0) {
|
|
3322
|
+
return /* @__PURE__ */ jsx(
|
|
3323
|
+
"div",
|
|
3324
|
+
{
|
|
3325
|
+
className: cn(
|
|
3326
|
+
"flex items-center justify-center p-8 text-sm text-muted-foreground",
|
|
3327
|
+
className
|
|
3328
|
+
),
|
|
3329
|
+
children: "No documents"
|
|
3330
|
+
}
|
|
3331
|
+
);
|
|
3332
|
+
}
|
|
3333
|
+
return /* @__PURE__ */ jsx(
|
|
3334
|
+
"div",
|
|
3335
|
+
{
|
|
3336
|
+
"data-testid": "document-gallery",
|
|
3337
|
+
className: cn("grid gap-4", className),
|
|
3338
|
+
style: { gridTemplateColumns: `repeat(auto-fill, minmax(${minTileWidth}px, 1fr))` },
|
|
3339
|
+
children: rows.map((doc) => {
|
|
3340
|
+
const id = doc.external_id;
|
|
3341
|
+
if (!id) return null;
|
|
3342
|
+
const title = docTitle(doc);
|
|
3343
|
+
const thumb = thumbs[id];
|
|
3344
|
+
const selected = selectedSet.has(id);
|
|
3345
|
+
const viewing = viewingDocId === id;
|
|
3346
|
+
const status = doc.status;
|
|
3347
|
+
const doctags = doc.doctags ?? [];
|
|
3348
|
+
return /* @__PURE__ */ jsxs(
|
|
3349
|
+
"div",
|
|
3350
|
+
{
|
|
3351
|
+
"data-doc-id": id,
|
|
3352
|
+
"data-testid": "document-gallery-card",
|
|
3353
|
+
role: "button",
|
|
3354
|
+
tabIndex: 0,
|
|
3355
|
+
onClick: () => openDocument(id),
|
|
3356
|
+
onKeyDown: (e) => {
|
|
3357
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3358
|
+
e.preventDefault();
|
|
3359
|
+
openDocument(id);
|
|
3360
|
+
}
|
|
3361
|
+
},
|
|
3362
|
+
className: cn(
|
|
3363
|
+
"group relative flex flex-col overflow-hidden rounded-lg border bg-card text-left shadow-sm transition",
|
|
3364
|
+
"hover:shadow-md hover:border-ring focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3365
|
+
viewing && "ring-2 ring-ring",
|
|
3366
|
+
selected && "border-ring"
|
|
3367
|
+
),
|
|
3368
|
+
children: [
|
|
3369
|
+
/* @__PURE__ */ jsx(
|
|
3370
|
+
"label",
|
|
3371
|
+
{
|
|
3372
|
+
className: "absolute left-2 top-2 z-10 flex h-5 w-5 items-center justify-center rounded bg-background/80 shadow-sm backdrop-blur",
|
|
3373
|
+
onClick: (e) => e.stopPropagation(),
|
|
3374
|
+
children: /* @__PURE__ */ jsx(
|
|
3375
|
+
"input",
|
|
3376
|
+
{
|
|
3377
|
+
type: "checkbox",
|
|
3378
|
+
"aria-label": `Select ${title}`,
|
|
3379
|
+
checked: selected,
|
|
3380
|
+
onChange: () => toggleSelected(id),
|
|
3381
|
+
className: "h-3.5 w-3.5 cursor-pointer accent-current"
|
|
3382
|
+
}
|
|
3383
|
+
)
|
|
3384
|
+
}
|
|
3385
|
+
),
|
|
3386
|
+
/* @__PURE__ */ jsx("div", { className: "flex aspect-[3/4] items-center justify-center overflow-hidden bg-muted", children: thumb ? /* @__PURE__ */ jsx(
|
|
3387
|
+
"img",
|
|
3388
|
+
{
|
|
3389
|
+
src: thumb,
|
|
3390
|
+
alt: title,
|
|
3391
|
+
loading: "lazy",
|
|
3392
|
+
className: "h-full w-full object-cover object-top"
|
|
3393
|
+
}
|
|
3394
|
+
) : /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center gap-2 text-muted-foreground", children: fileIcon(doc.file_name) }) }),
|
|
3395
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-2 p-3", children: [
|
|
3396
|
+
/* @__PURE__ */ jsx("div", { className: "line-clamp-2 text-sm font-medium leading-snug", title, children: title }),
|
|
3397
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-auto flex flex-wrap items-center gap-1", children: [
|
|
3398
|
+
status ? /* @__PURE__ */ jsx(Badge, { variant: STATUS_VARIANTS2[status.toLowerCase()] ?? "secondary", children: status }) : null,
|
|
3399
|
+
doctags.slice(0, 3).map((dt) => /* @__PURE__ */ jsx(
|
|
3400
|
+
TagEntity,
|
|
3401
|
+
{
|
|
3402
|
+
size: "sm",
|
|
3403
|
+
tag: {
|
|
3404
|
+
external_id: dt.tag_ext_id,
|
|
3405
|
+
name: tagNameById.get(dt.tag_ext_id) ?? dt.tag_ext_id.slice(0, 8)
|
|
3406
|
+
}
|
|
3407
|
+
},
|
|
3408
|
+
dt.tag_ext_id
|
|
3409
|
+
)),
|
|
3410
|
+
doctags.length > 3 ? /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
3411
|
+
"+",
|
|
3412
|
+
doctags.length - 3
|
|
3413
|
+
] }) : null
|
|
3414
|
+
] })
|
|
3415
|
+
] })
|
|
3416
|
+
]
|
|
3417
|
+
},
|
|
3418
|
+
id
|
|
3419
|
+
);
|
|
3420
|
+
})
|
|
3421
|
+
}
|
|
3422
|
+
);
|
|
3423
|
+
}
|
|
3424
|
+
function DocumentReview({
|
|
3425
|
+
docId,
|
|
3426
|
+
doc,
|
|
3427
|
+
workspaceId,
|
|
3428
|
+
stage = "final",
|
|
3429
|
+
onClose,
|
|
3430
|
+
className
|
|
3431
|
+
}) {
|
|
3432
|
+
const parsedQuery = useParsedDocument(docId, stage);
|
|
3433
|
+
const tagsQuery = useTags(workspaceId);
|
|
3434
|
+
const tagNameById = React__default.useMemo(() => {
|
|
3435
|
+
const map = /* @__PURE__ */ new Map();
|
|
3436
|
+
for (const t of tagsQuery.data ?? []) {
|
|
3437
|
+
if (t.external_id) map.set(t.external_id, t.name ?? t.external_id.slice(0, 8));
|
|
3438
|
+
}
|
|
3439
|
+
return map;
|
|
3440
|
+
}, [tagsQuery.data]);
|
|
3441
|
+
const title = doc?.doc_metadata?.title || doc?.file_name || "Document";
|
|
3442
|
+
const { findings, chunkToTag } = React__default.useMemo(() => {
|
|
3443
|
+
const list = [];
|
|
3444
|
+
const chunkTag = /* @__PURE__ */ new Map();
|
|
3445
|
+
for (const dt of doc?.doctags ?? []) {
|
|
3446
|
+
const citations = dt.citations ?? {};
|
|
3447
|
+
for (const [citId, cit] of Object.entries(citations)) {
|
|
3448
|
+
const chunkIds = cit?.chunk_ids ?? [];
|
|
3449
|
+
if (chunkIds.length === 0) continue;
|
|
3450
|
+
list.push({
|
|
3451
|
+
key: `${dt.tag_ext_id}:${citId}`,
|
|
3452
|
+
tagExtId: dt.tag_ext_id,
|
|
3453
|
+
statement: cit.statement,
|
|
3454
|
+
chunkIds
|
|
3455
|
+
});
|
|
3456
|
+
for (const cid of chunkIds) if (!chunkTag.has(cid)) chunkTag.set(cid, dt.tag_ext_id);
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
return { findings: list, chunkToTag: chunkTag };
|
|
3460
|
+
}, [doc?.doctags]);
|
|
3461
|
+
const pages = React__default.useMemo(() => {
|
|
3462
|
+
const chunks = parsedQuery.data?.chunks ?? [];
|
|
3463
|
+
const byPage = /* @__PURE__ */ new Map();
|
|
3464
|
+
for (const c of chunks) {
|
|
3465
|
+
const p = c.metadata?.page_number ?? 0;
|
|
3466
|
+
if (!byPage.has(p)) byPage.set(p, []);
|
|
3467
|
+
byPage.get(p).push(c);
|
|
3468
|
+
}
|
|
3469
|
+
return [...byPage.entries()].sort((a, b) => a[0] - b[0]);
|
|
3470
|
+
}, [parsedQuery.data]);
|
|
3471
|
+
const scrollRef = React__default.useRef(null);
|
|
3472
|
+
const [flash, setFlash] = React__default.useState(null);
|
|
3473
|
+
const jumpToChunk = React__default.useCallback((chunkId) => {
|
|
3474
|
+
const el = scrollRef.current?.querySelector(`[data-chunk-id="${chunkId}"]`);
|
|
3475
|
+
if (!el) return;
|
|
3476
|
+
el.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
3477
|
+
setFlash(chunkId);
|
|
3478
|
+
window.setTimeout(() => setFlash((c) => c === chunkId ? null : c), 1600);
|
|
3479
|
+
}, []);
|
|
3480
|
+
return /* @__PURE__ */ jsxs(
|
|
3481
|
+
"div",
|
|
3482
|
+
{
|
|
3483
|
+
"data-testid": "document-review",
|
|
3484
|
+
className: cn(
|
|
3485
|
+
"flex h-full min-h-0 flex-col overflow-hidden rounded-lg border bg-card",
|
|
3486
|
+
className
|
|
3487
|
+
),
|
|
3488
|
+
children: [
|
|
3489
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 border-b px-4 py-3", children: [
|
|
3490
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3491
|
+
/* @__PURE__ */ jsx("div", { className: "truncate text-sm font-semibold", title, children: title }),
|
|
3492
|
+
/* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground", children: [
|
|
3493
|
+
parsedQuery.data?.metadata?.total_number_of_pages ? `${parsedQuery.data.metadata.total_number_of_pages} pages` : `${pages.length} pages`,
|
|
3494
|
+
findings.length ? ` \xB7 ${findings.length} findings` : ""
|
|
3495
|
+
] })
|
|
3496
|
+
] }),
|
|
3497
|
+
doc?.status ? /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: doc.status }) : null,
|
|
3498
|
+
onClose ? /* @__PURE__ */ jsx(
|
|
3499
|
+
"button",
|
|
3500
|
+
{
|
|
3501
|
+
type: "button",
|
|
3502
|
+
"aria-label": "Close review",
|
|
3503
|
+
"data-testid": "document-review-close",
|
|
3504
|
+
onClick: onClose,
|
|
3505
|
+
className: "rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3506
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4" })
|
|
3507
|
+
}
|
|
3508
|
+
) : null
|
|
3509
|
+
] }),
|
|
3510
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1", children: [
|
|
3511
|
+
findings.length > 0 ? /* @__PURE__ */ jsxs(
|
|
3512
|
+
"aside",
|
|
3513
|
+
{
|
|
3514
|
+
className: "hidden w-64 shrink-0 overflow-y-auto border-r p-3 md:block",
|
|
3515
|
+
"data-testid": "document-review-findings",
|
|
3516
|
+
children: [
|
|
3517
|
+
/* @__PURE__ */ jsx("div", { className: "mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "AI findings" }),
|
|
3518
|
+
/* @__PURE__ */ jsx("ul", { className: "space-y-2", children: findings.map((f) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
3519
|
+
"div",
|
|
3520
|
+
{
|
|
3521
|
+
role: "button",
|
|
3522
|
+
tabIndex: 0,
|
|
3523
|
+
"data-testid": "review-finding",
|
|
3524
|
+
onClick: () => jumpToChunk(f.chunkIds[0]),
|
|
3525
|
+
onKeyDown: (e) => {
|
|
3526
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3527
|
+
e.preventDefault();
|
|
3528
|
+
jumpToChunk(f.chunkIds[0]);
|
|
3529
|
+
}
|
|
3530
|
+
},
|
|
3531
|
+
className: "w-full cursor-pointer rounded-md border p-2 text-left text-xs transition hover:border-ring hover:bg-muted/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3532
|
+
children: [
|
|
3533
|
+
/* @__PURE__ */ jsx(
|
|
3534
|
+
TagEntity,
|
|
3535
|
+
{
|
|
3536
|
+
size: "sm",
|
|
3537
|
+
tag: {
|
|
3538
|
+
external_id: f.tagExtId,
|
|
3539
|
+
name: tagNameById.get(f.tagExtId) ?? f.tagExtId.slice(0, 8)
|
|
3540
|
+
}
|
|
3541
|
+
}
|
|
3542
|
+
),
|
|
3543
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 line-clamp-3 text-muted-foreground", children: f.statement })
|
|
3544
|
+
]
|
|
3545
|
+
}
|
|
3546
|
+
) }, f.key)) })
|
|
3547
|
+
]
|
|
3548
|
+
}
|
|
3549
|
+
) : null,
|
|
3550
|
+
/* @__PURE__ */ jsx("div", { ref: scrollRef, className: "min-w-0 flex-1 overflow-y-auto px-6 py-4", children: parsedQuery.isLoading ? /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center text-sm text-muted-foreground", children: "Loading document\u2026" }) : parsedQuery.isError ? /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center text-sm text-muted-foreground", children: "Could not load this document\u2019s content." }) : pages.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center text-sm text-muted-foreground", children: "No readable content." }) : /* @__PURE__ */ jsx("div", { className: "mx-auto max-w-3xl space-y-8", children: pages.map(([pageNum, chunks]) => /* @__PURE__ */ jsxs("section", { children: [
|
|
3551
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-center gap-3", children: [
|
|
3552
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: [
|
|
3553
|
+
"Page ",
|
|
3554
|
+
pageNum
|
|
3555
|
+
] }),
|
|
3556
|
+
/* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-border" })
|
|
3557
|
+
] }),
|
|
3558
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-3", children: chunks.map((c, i) => {
|
|
3559
|
+
const cid = c.metadata?.chunk_ext_id;
|
|
3560
|
+
const tagExtId = cid ? chunkToTag.get(cid) : void 0;
|
|
3561
|
+
const highlighted = !!tagExtId;
|
|
3562
|
+
return /* @__PURE__ */ jsxs(
|
|
3563
|
+
"div",
|
|
3564
|
+
{
|
|
3565
|
+
"data-chunk-id": cid,
|
|
3566
|
+
"data-testid": highlighted ? "review-chunk-cited" : "review-chunk",
|
|
3567
|
+
className: cn(
|
|
3568
|
+
"scroll-mt-4 rounded-md px-2 py-1 transition-colors",
|
|
3569
|
+
highlighted && "bg-[var(--color-ai-accent-soft,theme(colors.amber.100))] ring-1 ring-inset ring-border",
|
|
3570
|
+
flash === cid && "ring-2 ring-ring"
|
|
3571
|
+
),
|
|
3572
|
+
children: [
|
|
3573
|
+
highlighted ? /* @__PURE__ */ jsx("div", { className: "mb-1", children: /* @__PURE__ */ jsx(
|
|
3574
|
+
TagEntity,
|
|
3575
|
+
{
|
|
3576
|
+
size: "sm",
|
|
3577
|
+
tag: {
|
|
3578
|
+
external_id: tagExtId,
|
|
3579
|
+
name: tagNameById.get(tagExtId) ?? tagExtId.slice(0, 8)
|
|
3580
|
+
}
|
|
3581
|
+
}
|
|
3582
|
+
) }) : null,
|
|
3583
|
+
/* @__PURE__ */ jsx(AiMarkdown, { className: "prose prose-sm max-w-none dark:prose-invert", children: c.content })
|
|
3584
|
+
]
|
|
3585
|
+
},
|
|
3586
|
+
cid ?? i
|
|
3587
|
+
);
|
|
3588
|
+
}) })
|
|
3589
|
+
] }, pageNum)) }) })
|
|
3590
|
+
] })
|
|
3591
|
+
]
|
|
3592
|
+
}
|
|
3593
|
+
);
|
|
3594
|
+
}
|
|
3216
3595
|
|
|
3217
|
-
export { AiActionCard, AiAnswer, AiMarkdown, ArbiChat, ArbiChatPanel, ArbiProvider, ArtifactCanvas, AudIcon, Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, DocQaPanel, DocSearch, DocumentEntity, DocumentTable, EmlIcon, EntityPill, FILE_TYPE_COLORS, FileIcon, HoverCard, HoverCardContent, HoverCardTrigger, ImgIcon, Input, PdfIcon, ProjectEntity, TagEntity, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VidIcon, arbiQueryKeys, badgeVariants, buttonVariants, cn, redlineStats, textToArtifact, toRedlineMarkdown, useAgents, useAiTask, useArbi, useArbiUiStore, useAssistantQuery, useConfigs, useConversations, useDeleteAgents, useDocuments, useHealth, useMemories, useSemanticSearch, useSessions, useTags, useTasks, useWorkspaceDocs, useWorkspaces };
|
|
3596
|
+
export { AiActionCard, AiAnswer, AiMarkdown, ArbiChat, ArbiChatPanel, ArbiProvider, ArtifactCanvas, AudIcon, Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, DocQaPanel, DocSearch, DocumentEntity, DocumentGallery, DocumentReview, DocumentTable, EmlIcon, EntityPill, FILE_TYPE_COLORS, FileIcon, HoverCard, HoverCardContent, HoverCardTrigger, ImgIcon, Input, PdfIcon, ProjectEntity, TagEntity, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VidIcon, arbiQueryKeys, badgeVariants, buttonVariants, cn, redlineStats, textToArtifact, toRedlineMarkdown, useAgents, useAiTask, useArbi, useArbiUiStore, useAssistantQuery, useConfigs, useConversations, useDeleteAgents, useDocuments, useHealth, useMemories, useParsedDocument, useSemanticSearch, useSessions, useTags, useTasks, useThumbnails, useWorkspaceDocs, useWorkspaces };
|
|
3218
3597
|
//# sourceMappingURL=index.js.map
|
|
3219
3598
|
//# sourceMappingURL=index.js.map
|