@smartspace/chat-ui 1.14.4-dev.3850792 → 1.14.4-dev.3f92249
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.js +36 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MuiButton from '@mui/material/Button';
|
|
2
2
|
import IconButton from '@mui/material/IconButton';
|
|
3
|
-
import { Loader2, Cpu, ChevronDown, Check, Globe, Zap, SlidersHorizontal, X, Paperclip, Mic, Square, Send, Minimize2, AlertTriangle, FileImage, FileVideo, FileAudio, FileArchive, FileCode, FileSpreadsheet, Presentation, FileText, ChevronUp, Download, ShieldAlert, Copy } from 'lucide-react';
|
|
3
|
+
import { Loader2, Cpu, ChevronDown, Check, Globe, Zap, SlidersHorizontal, X, Paperclip, Mic, Square, Send, Minimize2, AlertTriangle, FileImage, FileVideo, FileAudio, FileArchive, FileCode, FileSpreadsheet, Presentation, FileText, ChevronUp, ExternalLink, Download, ShieldAlert, Copy } from 'lucide-react';
|
|
4
4
|
import * as React8 from 'react';
|
|
5
5
|
import { createContext, forwardRef, useImperativeHandle, useRef, useState, useEffect, useMemo, useCallback, useContext, useSyncExternalStore } from 'react';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
@@ -3474,9 +3474,11 @@ function buildSimpleSchemaAndUi(vars, threadVars, useDefaults) {
|
|
|
3474
3474
|
const properties2 = {};
|
|
3475
3475
|
const controls = [];
|
|
3476
3476
|
const initialData = {};
|
|
3477
|
+
const $defs = {};
|
|
3477
3478
|
for (const name of names) {
|
|
3478
3479
|
const cfg = vars?.[name] || {};
|
|
3479
|
-
const s2 = cfg.schema || {};
|
|
3480
|
+
const { $defs: varDefs, ...s2 } = cfg.schema || {};
|
|
3481
|
+
if (varDefs) Object.assign($defs, varDefs);
|
|
3480
3482
|
properties2[name] = s2;
|
|
3481
3483
|
const hasServerKey = threadVars !== void 0 && Object.prototype.hasOwnProperty.call(threadVars, name);
|
|
3482
3484
|
const val = hasServerKey ? threadVars?.[name] : useDefaults ? s2.default : void 0;
|
|
@@ -3492,6 +3494,7 @@ function buildSimpleSchemaAndUi(vars, threadVars, useDefaults) {
|
|
|
3492
3494
|
controls.push(control);
|
|
3493
3495
|
}
|
|
3494
3496
|
const schema = { type: "object", properties: properties2 };
|
|
3497
|
+
if (Object.keys($defs).length > 0) schema.$defs = $defs;
|
|
3495
3498
|
const innerRow = {
|
|
3496
3499
|
type: "HorizontalLayout",
|
|
3497
3500
|
elements: controls,
|
|
@@ -19547,6 +19550,7 @@ function ChatMessageSources({
|
|
|
19547
19550
|
/* @__PURE__ */ jsx(SectionLabel, { children: "Files" }),
|
|
19548
19551
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: fileSources.map((source) => {
|
|
19549
19552
|
const Icon = getFileIcon3(source.file.name);
|
|
19553
|
+
const sourceHref = source.webUrl ? getSafeUrl(source.webUrl) : null;
|
|
19550
19554
|
if (!openIndexes.has(source.index)) {
|
|
19551
19555
|
return /* @__PURE__ */ jsxs(
|
|
19552
19556
|
"button",
|
|
@@ -19595,19 +19599,36 @@ function ChatMessageSources({
|
|
|
19595
19599
|
)
|
|
19596
19600
|
] }),
|
|
19597
19601
|
/* @__PURE__ */ jsx(CitedQuote, { text: source.citedText }),
|
|
19598
|
-
/* @__PURE__ */ jsxs(
|
|
19599
|
-
|
|
19600
|
-
|
|
19601
|
-
|
|
19602
|
-
|
|
19603
|
-
|
|
19604
|
-
|
|
19605
|
-
|
|
19606
|
-
|
|
19607
|
-
|
|
19608
|
-
|
|
19609
|
-
|
|
19610
|
-
|
|
19602
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
19603
|
+
sourceHref && /* @__PURE__ */ jsxs(
|
|
19604
|
+
"a",
|
|
19605
|
+
{
|
|
19606
|
+
href: sourceHref,
|
|
19607
|
+
target: "_blank",
|
|
19608
|
+
rel: "noreferrer",
|
|
19609
|
+
title: source.webUrl ?? void 0,
|
|
19610
|
+
className: "inline-flex w-fit items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-xs font-medium text-foreground no-underline transition-colors hover:bg-muted/40",
|
|
19611
|
+
children: [
|
|
19612
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "h-3 w-3" }),
|
|
19613
|
+
"Open in ",
|
|
19614
|
+
getHost(sourceHref)
|
|
19615
|
+
]
|
|
19616
|
+
}
|
|
19617
|
+
),
|
|
19618
|
+
/* @__PURE__ */ jsxs(
|
|
19619
|
+
"button",
|
|
19620
|
+
{
|
|
19621
|
+
type: "button",
|
|
19622
|
+
onClick: () => downloadFileMutation.mutate(source.file),
|
|
19623
|
+
disabled: downloadFileMutation.isPending,
|
|
19624
|
+
className: "inline-flex w-fit items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-xs font-medium text-foreground transition-colors hover:bg-muted/40 disabled:cursor-not-allowed disabled:opacity-50",
|
|
19625
|
+
children: [
|
|
19626
|
+
/* @__PURE__ */ jsx(Download, { className: "h-3 w-3" }),
|
|
19627
|
+
"Download"
|
|
19628
|
+
]
|
|
19629
|
+
}
|
|
19630
|
+
)
|
|
19631
|
+
] })
|
|
19611
19632
|
]
|
|
19612
19633
|
},
|
|
19613
19634
|
`${source.file.id}-${source.index}`
|