@mvriu5/payload-ai 1.2.0 → 1.3.2
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 +42 -0
- package/dist/components/Icons.d.ts +0 -8
- package/dist/components/Icons.js +4 -216
- package/dist/components/{ActionToast.d.ts → action-toast/ActionToast.d.ts} +1 -2
- package/dist/components/{ActionToast.js → action-toast/ActionToast.js} +25 -34
- package/dist/components/{ActionToast.module.css → action-toast/ActionToast.module.css} +0 -79
- package/dist/components/ai-input/AIInput.js +433 -0
- package/dist/components/{AIInput.module.css → ai-input/AIInput.module.css} +111 -43
- package/dist/components/ai-input/badge.d.ts +14 -0
- package/dist/components/ai-input/badge.js +85 -0
- package/dist/components/{AuditLogList.d.ts → audit-log-list/AuditLogList.d.ts} +4 -8
- package/dist/components/{AuditLogList.js → audit-log-list/AuditLogList.js} +49 -21
- package/dist/components/{AuditLogList.module.css → audit-log-list/AuditLogList.module.css} +11 -65
- package/dist/components/dashboard/Dashboard.d.ts +2 -0
- package/dist/components/dashboard/Dashboard.js +15 -0
- package/dist/components/dashboard/Dashboard.module.css +13 -0
- package/dist/components/{DiffDialog.d.ts → diff-dialog/DiffDialog.d.ts} +2 -2
- package/dist/components/{DiffDialog.js → diff-dialog/DiffDialog.js} +200 -189
- package/dist/components/{DiffDialog.module.css → diff-dialog/DiffDialog.module.css} +17 -35
- package/dist/components/hooks/useAIChatStream.d.ts +39 -0
- package/dist/components/hooks/useAIChatStream.js +217 -0
- package/dist/components/hooks/useAISettings.js +26 -25
- package/dist/components/hooks/useAuditLog.d.ts +11 -0
- package/dist/components/hooks/useAuditLog.js +41 -0
- package/dist/components/hooks/useDocumentMentionSuggestions.d.ts +1 -1
- package/dist/components/hooks/useDocumentMentionSuggestions.js +31 -27
- package/dist/components/hooks/useMentions.d.ts +58 -0
- package/dist/components/hooks/useMentions.js +276 -0
- package/dist/components/hooks/usePluginConfig.d.ts +52 -0
- package/dist/components/hooks/usePluginConfig.js +20 -0
- package/dist/components/{MentionPopover.d.ts → mention-popover/MentionPopover.d.ts} +2 -4
- package/dist/components/{MentionPopover.js → mention-popover/MentionPopover.js} +1 -8
- package/dist/components/{MentionPopover.module.css → mention-popover/MentionPopover.module.css} +1 -1
- package/dist/exports/client.d.ts +2 -2
- package/dist/exports/client.js +2 -2
- package/dist/handlers/applyActionHandler.js +27 -7
- package/dist/handlers/chatHandler.js +302 -58
- package/dist/handlers/mediaUploadHandler.d.ts +7 -0
- package/dist/handlers/mediaUploadHandler.js +99 -0
- package/dist/handlers/mentionSuggestionHandler.js +16 -14
- package/dist/handlers/proposalDiffHandler.js +41 -29
- package/dist/index.d.ts +6 -0
- package/dist/index.js +39 -7
- package/dist/payload/collectionPermissions.js +3 -1
- package/dist/payload/normalizeData.d.ts +0 -6
- package/dist/payload/normalizeData.js +25 -13
- package/dist/payload/proposalData.js +4 -1
- package/dist/payload/schemaContext.js +98 -43
- package/package.json +6 -6
- package/dist/components/AIInput.js +0 -896
- /package/dist/components/{AIInput.d.ts → ai-input/AIInput.d.ts} +0 -0
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { getJSONLineKey } from "../payload/shared.js";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { getJSONLineKey } from "../../payload/shared.js";
|
|
5
4
|
import styles from "./DiffDialog.module.css";
|
|
5
|
+
import { Button } from "@payloadcms/ui";
|
|
6
6
|
const formatDiffValue = (value)=>{
|
|
7
7
|
return JSON.stringify(value, null, 2);
|
|
8
8
|
};
|
|
9
|
+
const dateTimeFormatter = new Intl.DateTimeFormat(undefined, {
|
|
10
|
+
dateStyle: "medium",
|
|
11
|
+
timeStyle: "short"
|
|
12
|
+
});
|
|
9
13
|
const formatDateTime = (value)=>{
|
|
10
14
|
if (!value) return null;
|
|
11
15
|
const date = new Date(value);
|
|
12
16
|
if (Number.isNaN(date.getTime())) return value;
|
|
13
|
-
return
|
|
14
|
-
dateStyle: "medium",
|
|
15
|
-
timeStyle: "short"
|
|
16
|
-
}).format(date);
|
|
17
|
+
return dateTimeFormatter.format(date);
|
|
17
18
|
};
|
|
18
19
|
const createLine = ({ changed, path, placeholder = false, text = "" })=>({
|
|
19
20
|
changed,
|
|
@@ -90,7 +91,6 @@ const buildDisplayRows = (rows, expandedGroups, groupPrefix = "")=>{
|
|
|
90
91
|
count: count - contextRows * 2,
|
|
91
92
|
expanded: isExpanded,
|
|
92
93
|
id: groupID,
|
|
93
|
-
path: getRowPath(rows[start + contextRows]),
|
|
94
94
|
type: "collapsed"
|
|
95
95
|
});
|
|
96
96
|
if (isExpanded) {
|
|
@@ -133,12 +133,10 @@ const getDiffRows = (before, after)=>{
|
|
|
133
133
|
rows.push({
|
|
134
134
|
after: createLine({
|
|
135
135
|
changed: false,
|
|
136
|
-
path: afterLinePaths[afterIndex],
|
|
137
136
|
text: afterLines[afterIndex]
|
|
138
137
|
}),
|
|
139
138
|
before: createLine({
|
|
140
139
|
changed: false,
|
|
141
|
-
path: beforeLinePaths[beforeIndex],
|
|
142
140
|
text: beforeLines[beforeIndex]
|
|
143
141
|
})
|
|
144
142
|
});
|
|
@@ -258,23 +256,34 @@ export const DiffDialog = ({ change, diff, onClose, proposal, tokenUsage })=>{
|
|
|
258
256
|
const totalTokens = formatTokenUsage(change?.totalTokens) || formatTokenUsage(tokenUsage?.totalTokens);
|
|
259
257
|
const inputTokens = formatTokenUsage(change?.inputTokens) || formatTokenUsage(tokenUsage?.inputTokens);
|
|
260
258
|
const outputTokens = formatTokenUsage(change?.outputTokens) || formatTokenUsage(tokenUsage?.outputTokens);
|
|
259
|
+
const dialogRef = useRef(null);
|
|
261
260
|
useEffect(()=>{
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
261
|
+
const dialog = dialogRef.current;
|
|
262
|
+
if (!dialog) return;
|
|
263
|
+
if (!dialog.open) {
|
|
264
|
+
if (typeof dialog.showModal === "function") {
|
|
265
|
+
dialog.showModal();
|
|
266
|
+
} else {
|
|
267
|
+
dialog.setAttribute("open", "");
|
|
265
268
|
}
|
|
266
|
-
}
|
|
267
|
-
window.addEventListener("keydown", handleKeyDown);
|
|
269
|
+
}
|
|
268
270
|
return ()=>{
|
|
269
|
-
|
|
271
|
+
if (!dialog.open) return;
|
|
272
|
+
if (typeof dialog.close === "function") {
|
|
273
|
+
dialog.close();
|
|
274
|
+
} else {
|
|
275
|
+
dialog.removeAttribute("open");
|
|
276
|
+
}
|
|
270
277
|
};
|
|
271
|
-
}, [
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
275
|
-
"aria-modal": "true",
|
|
278
|
+
}, []);
|
|
279
|
+
return /*#__PURE__*/ _jsx("dialog", {
|
|
280
|
+
"aria-labelledby": "payload-ai-diff-dialog-title",
|
|
276
281
|
className: styles.dialogOverlay,
|
|
277
|
-
|
|
282
|
+
onCancel: (event)=>{
|
|
283
|
+
event.preventDefault();
|
|
284
|
+
onClose();
|
|
285
|
+
},
|
|
286
|
+
ref: dialogRef,
|
|
278
287
|
children: /*#__PURE__*/ _jsxs("div", {
|
|
279
288
|
className: styles.dialog,
|
|
280
289
|
children: [
|
|
@@ -285,6 +294,7 @@ export const DiffDialog = ({ change, diff, onClose, proposal, tokenUsage })=>{
|
|
|
285
294
|
children: [
|
|
286
295
|
/*#__PURE__*/ _jsx("div", {
|
|
287
296
|
className: styles.dialogTitle,
|
|
297
|
+
id: "payload-ai-diff-dialog-title",
|
|
288
298
|
children: proposal.label
|
|
289
299
|
}),
|
|
290
300
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -298,60 +308,38 @@ export const DiffDialog = ({ change, diff, onClose, proposal, tokenUsage })=>{
|
|
|
298
308
|
})
|
|
299
309
|
]
|
|
300
310
|
}),
|
|
301
|
-
/*#__PURE__*/ _jsx(
|
|
302
|
-
"aria-
|
|
303
|
-
|
|
311
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
312
|
+
"aria-labelabel": "Close",
|
|
313
|
+
margin: false,
|
|
314
|
+
size: "small",
|
|
315
|
+
buttonStyle: "tab",
|
|
304
316
|
onClick: onClose,
|
|
305
|
-
|
|
306
|
-
children: /*#__PURE__*/ _jsx(XIcon, {})
|
|
317
|
+
icon: "x"
|
|
307
318
|
})
|
|
308
319
|
]
|
|
309
320
|
}),
|
|
310
|
-
/*#__PURE__*/
|
|
311
|
-
className: styles.
|
|
312
|
-
children:
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
className: styles.
|
|
317
|
-
children:
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
children: formatDateTime(change.createdAt) || "Unknown"
|
|
333
|
-
}),
|
|
334
|
-
totalTokens && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
335
|
-
children: [
|
|
336
|
-
/*#__PURE__*/ _jsx("span", {
|
|
337
|
-
className: styles.detailLabel,
|
|
338
|
-
children: "Tokens"
|
|
339
|
-
}),
|
|
340
|
-
/*#__PURE__*/ _jsxs("span", {
|
|
341
|
-
className: styles.detailValue,
|
|
342
|
-
children: [
|
|
343
|
-
totalTokens,
|
|
344
|
-
inputTokens && outputTokens ? ` (${inputTokens} in / ${outputTokens} out)` : ""
|
|
345
|
-
]
|
|
346
|
-
})
|
|
347
|
-
]
|
|
348
|
-
})
|
|
349
|
-
]
|
|
350
|
-
})
|
|
351
|
-
}) : totalTokens && /*#__PURE__*/ _jsx("div", {
|
|
352
|
-
className: styles.detailSection,
|
|
353
|
-
children: /*#__PURE__*/ _jsxs("div", {
|
|
354
|
-
className: styles.detailGrid,
|
|
321
|
+
change ? /*#__PURE__*/ _jsx("div", {
|
|
322
|
+
className: styles.detailSection,
|
|
323
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
324
|
+
className: styles.detailGrid,
|
|
325
|
+
children: [
|
|
326
|
+
/*#__PURE__*/ _jsx("span", {
|
|
327
|
+
className: styles.detailLabel,
|
|
328
|
+
children: "User"
|
|
329
|
+
}),
|
|
330
|
+
/*#__PURE__*/ _jsx("span", {
|
|
331
|
+
className: styles.detailValue,
|
|
332
|
+
children: change.userLabel || change.userID || "Unknown"
|
|
333
|
+
}),
|
|
334
|
+
/*#__PURE__*/ _jsx("span", {
|
|
335
|
+
className: styles.detailLabel,
|
|
336
|
+
children: "Date"
|
|
337
|
+
}),
|
|
338
|
+
/*#__PURE__*/ _jsx("span", {
|
|
339
|
+
className: styles.detailValue,
|
|
340
|
+
children: formatDateTime(change.createdAt) || "Unknown"
|
|
341
|
+
}),
|
|
342
|
+
totalTokens && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
355
343
|
children: [
|
|
356
344
|
/*#__PURE__*/ _jsx("span", {
|
|
357
345
|
className: styles.detailLabel,
|
|
@@ -366,130 +354,153 @@ export const DiffDialog = ({ change, diff, onClose, proposal, tokenUsage })=>{
|
|
|
366
354
|
})
|
|
367
355
|
]
|
|
368
356
|
})
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
357
|
+
]
|
|
358
|
+
})
|
|
359
|
+
}) : totalTokens && /*#__PURE__*/ _jsx("div", {
|
|
360
|
+
className: styles.detailSection,
|
|
361
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
362
|
+
className: styles.detailGrid,
|
|
363
|
+
children: [
|
|
364
|
+
/*#__PURE__*/ _jsx("span", {
|
|
365
|
+
className: styles.detailLabel,
|
|
366
|
+
children: "Tokens"
|
|
367
|
+
}),
|
|
368
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
369
|
+
className: styles.detailValue,
|
|
380
370
|
children: [
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
371
|
+
totalTokens,
|
|
372
|
+
inputTokens && outputTokens ? ` (${inputTokens} in / ${outputTokens} out)` : ""
|
|
373
|
+
]
|
|
374
|
+
})
|
|
375
|
+
]
|
|
376
|
+
})
|
|
377
|
+
}),
|
|
378
|
+
/*#__PURE__*/ _jsx("div", {
|
|
379
|
+
className: styles.dialogContent,
|
|
380
|
+
children: diffSections.map((section)=>{
|
|
381
|
+
const diffRows = getDiffRows(section.beforeValue, section.afterValue);
|
|
382
|
+
const displayRows = buildDisplayRows(diffRows, expandedGroups, section.id);
|
|
383
|
+
const longestLineLength = Math.max(...section.beforeValue.split("\n").map((line)=>line.length), ...section.afterValue.split("\n").map((line)=>line.length), 80);
|
|
384
|
+
const diffShellStyle = {
|
|
385
|
+
"--diff-line-offset": `-${scrollLeft}px`,
|
|
386
|
+
"--diff-line-width": `${longestLineLength + 8}ch`
|
|
387
|
+
};
|
|
388
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
389
|
+
className: styles.diffSection,
|
|
390
|
+
children: [
|
|
391
|
+
section.label ? /*#__PURE__*/ _jsx("div", {
|
|
392
|
+
className: styles.diffSectionLabel,
|
|
393
|
+
children: section.label
|
|
394
|
+
}) : null,
|
|
395
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
396
|
+
className: styles.diffShell,
|
|
397
|
+
style: diffShellStyle,
|
|
398
|
+
children: [
|
|
399
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
400
|
+
className: styles.diffScroll,
|
|
401
|
+
children: [
|
|
402
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
403
|
+
className: styles.diffHeaderGrid,
|
|
404
|
+
children: [
|
|
405
|
+
/*#__PURE__*/ _jsx("div", {
|
|
406
|
+
className: styles.diffPaneHeader,
|
|
407
|
+
children: "Current"
|
|
408
|
+
}),
|
|
409
|
+
/*#__PURE__*/ _jsx("div", {
|
|
410
|
+
className: styles.diffPaneHeader,
|
|
411
|
+
children: "Proposed"
|
|
412
|
+
})
|
|
413
|
+
]
|
|
414
|
+
}),
|
|
415
|
+
/*#__PURE__*/ _jsx("div", {
|
|
416
|
+
className: styles.diffRows,
|
|
417
|
+
children: displayRows.map((displayRow)=>{
|
|
418
|
+
if (displayRow.type === "collapsed") {
|
|
419
|
+
return /*#__PURE__*/ _jsxs("button", {
|
|
420
|
+
className: styles.diffCollapsedRow,
|
|
421
|
+
onClick: ()=>{
|
|
422
|
+
setExpandedGroups((current)=>{
|
|
423
|
+
const next = new Set(current);
|
|
424
|
+
const groupID = `${section.id}:${displayRow.id}`;
|
|
425
|
+
if (displayRow.expanded) {
|
|
426
|
+
next.delete(groupID);
|
|
427
|
+
} else {
|
|
428
|
+
next.add(groupID);
|
|
429
|
+
}
|
|
430
|
+
return next;
|
|
431
|
+
});
|
|
432
|
+
},
|
|
433
|
+
type: "button",
|
|
439
434
|
children: [
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
children:
|
|
447
|
-
row.before.changed && row.before.path && /*#__PURE__*/ _jsx("span", {
|
|
448
|
-
className: styles.diffPathBadge,
|
|
449
|
-
children: row.before.path
|
|
450
|
-
}),
|
|
451
|
-
/*#__PURE__*/ _jsx("span", {
|
|
452
|
-
className: styles.diffLineContent,
|
|
453
|
-
children: row.before.text || " "
|
|
454
|
-
})
|
|
455
|
-
]
|
|
456
|
-
}),
|
|
457
|
-
/*#__PURE__*/ _jsxs("span", {
|
|
458
|
-
className: [
|
|
459
|
-
styles.diffLine,
|
|
460
|
-
row.after.changed && styles.diffLineAdded,
|
|
461
|
-
row.after.placeholder && styles.diffLinePlaceholder
|
|
462
|
-
].filter(Boolean).join(" "),
|
|
463
|
-
children: [
|
|
464
|
-
row.after.changed && row.after.path && /*#__PURE__*/ _jsx("span", {
|
|
465
|
-
className: styles.diffPathBadge,
|
|
466
|
-
children: row.after.path
|
|
467
|
-
}),
|
|
468
|
-
/*#__PURE__*/ _jsx("span", {
|
|
469
|
-
className: styles.diffLineContent,
|
|
470
|
-
children: row.after.text || " "
|
|
471
|
-
})
|
|
472
|
-
]
|
|
435
|
+
displayRow.expanded ? "Hide" : "Show",
|
|
436
|
+
" ",
|
|
437
|
+
displayRow.count,
|
|
438
|
+
" unchanged lines",
|
|
439
|
+
displayRow.path && /*#__PURE__*/ _jsx("span", {
|
|
440
|
+
className: styles.diffCollapsedPath,
|
|
441
|
+
children: displayRow.path
|
|
473
442
|
})
|
|
474
443
|
]
|
|
475
|
-
}, `${section.id}-
|
|
476
|
-
}
|
|
444
|
+
}, `${section.id}-collapsed-${displayRow.id}`);
|
|
445
|
+
}
|
|
446
|
+
const row = displayRow.row;
|
|
447
|
+
const showBeforePath = row.before.changed && row.before.path && !row.after.placeholder;
|
|
448
|
+
const showAfterPath = row.after.changed && row.after.path && !row.before.placeholder;
|
|
449
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
450
|
+
className: styles.diffRow,
|
|
451
|
+
children: [
|
|
452
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
453
|
+
className: [
|
|
454
|
+
styles.diffLine,
|
|
455
|
+
row.before.changed && styles.diffLineRemoved,
|
|
456
|
+
row.before.placeholder && styles.diffLinePlaceholder
|
|
457
|
+
].filter(Boolean).join(" "),
|
|
458
|
+
children: [
|
|
459
|
+
showBeforePath && /*#__PURE__*/ _jsx("span", {
|
|
460
|
+
className: styles.diffPathBadge,
|
|
461
|
+
children: row.before.path
|
|
462
|
+
}),
|
|
463
|
+
/*#__PURE__*/ _jsx("span", {
|
|
464
|
+
className: styles.diffLineContent,
|
|
465
|
+
children: row.before.text || " "
|
|
466
|
+
})
|
|
467
|
+
]
|
|
468
|
+
}),
|
|
469
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
470
|
+
className: [
|
|
471
|
+
styles.diffLine,
|
|
472
|
+
row.after.changed && styles.diffLineAdded,
|
|
473
|
+
row.after.placeholder && styles.diffLinePlaceholder
|
|
474
|
+
].filter(Boolean).join(" "),
|
|
475
|
+
children: [
|
|
476
|
+
showAfterPath && /*#__PURE__*/ _jsx("span", {
|
|
477
|
+
className: styles.diffPathBadge,
|
|
478
|
+
children: row.after.path
|
|
479
|
+
}),
|
|
480
|
+
/*#__PURE__*/ _jsx("span", {
|
|
481
|
+
className: styles.diffLineContent,
|
|
482
|
+
children: row.after.text || " "
|
|
483
|
+
})
|
|
484
|
+
]
|
|
485
|
+
})
|
|
486
|
+
]
|
|
487
|
+
}, `${section.id}-row-${displayRow.index}`);
|
|
477
488
|
})
|
|
478
|
-
]
|
|
479
|
-
}),
|
|
480
|
-
/*#__PURE__*/ _jsx("div", {
|
|
481
|
-
className: styles.horizontalScroll,
|
|
482
|
-
onScroll: (event)=>setScrollLeft(event.currentTarget.scrollLeft),
|
|
483
|
-
children: /*#__PURE__*/ _jsx("div", {
|
|
484
|
-
className: styles.horizontalScrollSpacer
|
|
485
489
|
})
|
|
490
|
+
]
|
|
491
|
+
}),
|
|
492
|
+
/*#__PURE__*/ _jsx("div", {
|
|
493
|
+
className: styles.horizontalScroll,
|
|
494
|
+
onScroll: (event)=>setScrollLeft(event.currentTarget.scrollLeft),
|
|
495
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
496
|
+
className: styles.horizontalScrollSpacer
|
|
486
497
|
})
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
})
|
|
492
|
-
|
|
498
|
+
})
|
|
499
|
+
]
|
|
500
|
+
})
|
|
501
|
+
]
|
|
502
|
+
}, section.id);
|
|
503
|
+
})
|
|
493
504
|
})
|
|
494
505
|
]
|
|
495
506
|
})
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
.dialogOverlay {
|
|
2
2
|
align-items: center;
|
|
3
|
-
background:
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
background: transparent;
|
|
4
|
+
border: 0;
|
|
5
|
+
color: inherit;
|
|
6
|
+
height: 100dvh;
|
|
6
7
|
justify-content: center;
|
|
8
|
+
margin: 0;
|
|
9
|
+
max-height: 100dvh;
|
|
10
|
+
max-width: 100vw;
|
|
7
11
|
overflow: auto;
|
|
8
12
|
padding: 24px;
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
width: 100vw;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.dialogOverlay[open] {
|
|
17
|
+
display: flex;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.dialogOverlay::backdrop {
|
|
21
|
+
background: rgba(0, 0, 0, 0.42);
|
|
11
22
|
}
|
|
12
23
|
|
|
13
24
|
.dialog {
|
|
@@ -78,7 +89,7 @@
|
|
|
78
89
|
|
|
79
90
|
.detailValue {
|
|
80
91
|
color: var(--theme-text);
|
|
81
|
-
font-size:
|
|
92
|
+
font-size: 11px;
|
|
82
93
|
line-height: 1.4;
|
|
83
94
|
min-width: 0;
|
|
84
95
|
overflow: hidden;
|
|
@@ -108,30 +119,6 @@
|
|
|
108
119
|
word-break: break-word;
|
|
109
120
|
}
|
|
110
121
|
|
|
111
|
-
.closeButton {
|
|
112
|
-
align-items: center;
|
|
113
|
-
background: transparent;
|
|
114
|
-
border: 1px solid var(--theme-elevation-150);
|
|
115
|
-
border-radius: 4px;
|
|
116
|
-
color: var(--theme-text);
|
|
117
|
-
cursor: pointer;
|
|
118
|
-
display: inline-flex;
|
|
119
|
-
flex: 0 0 auto;
|
|
120
|
-
font: inherit;
|
|
121
|
-
height: 24px;
|
|
122
|
-
justify-content: center;
|
|
123
|
-
line-height: 24px;
|
|
124
|
-
min-height: 24px;
|
|
125
|
-
padding: 0;
|
|
126
|
-
text-decoration: none;
|
|
127
|
-
width: 24px;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.closeButton svg {
|
|
131
|
-
height: 12px;
|
|
132
|
-
width: 12px;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
122
|
.diffShell {
|
|
136
123
|
border: 1px solid var(--theme-elevation-150);
|
|
137
124
|
border-radius: 0;
|
|
@@ -322,12 +309,7 @@
|
|
|
322
309
|
grid-template-columns: minmax(0, 1fr);
|
|
323
310
|
}
|
|
324
311
|
|
|
325
|
-
.closeButton {
|
|
326
|
-
align-self: flex-end;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
312
|
.diffScroll {
|
|
330
313
|
min-height: 0;
|
|
331
314
|
}
|
|
332
|
-
|
|
333
315
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
import type { ActionProposal } from "../action-toast/ActionToast.js";
|
|
3
|
+
import type { Mention } from "./useMentions.js";
|
|
4
|
+
export type TokenUsage = {
|
|
5
|
+
inputTokens?: number;
|
|
6
|
+
outputTokens?: number;
|
|
7
|
+
totalTokens?: number;
|
|
8
|
+
};
|
|
9
|
+
export type MediaAttachment = {
|
|
10
|
+
collection: string;
|
|
11
|
+
filename: string;
|
|
12
|
+
filesize: number;
|
|
13
|
+
id: string;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
type: "media";
|
|
16
|
+
url?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const useAIChatStream: ({ apiRoute, clearInput, mentionsRef, prompt, selectedModel, }: {
|
|
19
|
+
apiRoute: string;
|
|
20
|
+
clearInput: () => void;
|
|
21
|
+
mentionsRef: RefObject<Mention[]>;
|
|
22
|
+
prompt: string;
|
|
23
|
+
selectedModel: string;
|
|
24
|
+
}) => {
|
|
25
|
+
dismissChat: () => void;
|
|
26
|
+
error: string;
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
proposals: ActionProposal[];
|
|
29
|
+
resetChatState: () => void;
|
|
30
|
+
response: string;
|
|
31
|
+
setError: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
32
|
+
setProposals: import("react").Dispatch<import("react").SetStateAction<ActionProposal[]>>;
|
|
33
|
+
setResponse: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
34
|
+
setTokenUsage: import("react").Dispatch<import("react").SetStateAction<TokenUsage | null>>;
|
|
35
|
+
submit: ({ attachments }?: {
|
|
36
|
+
attachments?: MediaAttachment[];
|
|
37
|
+
}) => Promise<void>;
|
|
38
|
+
tokenUsage: TokenUsage | null;
|
|
39
|
+
};
|