@uipath/apollo-react 7.6.1 → 7.7.0
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/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/locales/en.cjs +1 -1
- package/dist/chat/locales/en.d.ts.map +1 -1
- package/dist/chat/locales/en.js +1 -1
- package/dist/chat/stories/chat-story-fixtures.d.ts +1 -1
- package/dist/chat/stories/chat-story-fixtures.d.ts.map +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/chat/wind/composer/chat-composer.cjs +1 -3
- package/dist/chat/wind/composer/chat-composer.d.ts.map +1 -1
- package/dist/chat/wind/composer/chat-composer.js +2 -4
- package/dist/chat/wind/composer/chat-dropzone.cjs +29 -25
- package/dist/chat/wind/composer/chat-dropzone.d.ts +1 -1
- package/dist/chat/wind/composer/chat-dropzone.d.ts.map +1 -1
- package/dist/chat/wind/composer/chat-dropzone.js +20 -26
- package/dist/chat/wind/history/chat-history.d.ts.map +1 -1
- package/dist/chat/wind/history/history-panel.cjs +18 -7
- package/dist/chat/wind/history/history-panel.d.ts.map +1 -1
- package/dist/chat/wind/history/history-panel.js +19 -8
- package/dist/chat/wind/layout/full-screen-layout.cjs +0 -6
- package/dist/chat/wind/layout/full-screen-layout.d.ts.map +1 -1
- package/dist/chat/wind/layout/full-screen-layout.js +0 -6
- package/dist/chat/wind/layout/regions.cjs +1 -1
- package/dist/chat/wind/layout/regions.js +1 -1
- package/dist/chat/wind/messages/message-attachments.cjs +3 -20
- package/dist/chat/wind/messages/message-attachments.d.ts +0 -4
- package/dist/chat/wind/messages/message-attachments.d.ts.map +1 -1
- package/dist/chat/wind/messages/message-attachments.js +2 -10
- package/dist/chat/wind/messages/message-list.cjs +4 -0
- package/dist/chat/wind/messages/message-list.d.ts.map +1 -1
- package/dist/chat/wind/messages/message-list.js +4 -0
- package/dist/chat/wind/renderers/chat-code-block.cjs +169 -0
- package/dist/chat/wind/renderers/chat-code-block.d.ts +10 -0
- package/dist/chat/wind/renderers/chat-code-block.d.ts.map +1 -0
- package/dist/chat/wind/renderers/chat-code-block.js +125 -0
- package/dist/chat/wind/renderers/markdown-renderer.cjs +4 -3
- package/dist/chat/wind/renderers/markdown-renderer.d.ts.map +1 -1
- package/dist/chat/wind/renderers/markdown-renderer.js +4 -3
- package/dist/chat/wind/renderers/tool-call-renderer.cjs +13 -17
- package/dist/chat/wind/renderers/tool-call-renderer.d.ts.map +1 -1
- package/dist/chat/wind/renderers/tool-call-renderer.js +13 -17
- package/dist/chat/wind/renderers/tree-renderer.cjs +14 -9
- package/dist/chat/wind/renderers/tree-renderer.d.ts.map +1 -1
- package/dist/chat/wind/renderers/tree-renderer.js +13 -8
- package/package.json +3 -3
- package/dist/chat/wind/renderers/code-block-actions.cjs +0 -176
- package/dist/chat/wind/renderers/code-block-actions.d.ts +0 -9
- package/dist/chat/wind/renderers/code-block-actions.d.ts.map +0 -1
- package/dist/chat/wind/renderers/code-block-actions.js +0 -132
- package/dist/chat/wind/renderers/disclosure-tree.cjs +0 -136
- package/dist/chat/wind/renderers/disclosure-tree.d.ts +0 -22
- package/dist/chat/wind/renderers/disclosure-tree.d.ts.map +0 -1
- package/dist/chat/wind/renderers/disclosure-tree.js +0 -92
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
ChatCodeBlock: ()=>ChatCodeBlock
|
|
37
|
+
});
|
|
38
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
39
|
+
const react_namespaceObject = require("@lingui/react");
|
|
40
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
41
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
42
|
+
const external_react_namespaceObject = require("react");
|
|
43
|
+
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
44
|
+
const html_preview_cjs_namespaceObject = require("../../headless/markdown/html-preview.cjs");
|
|
45
|
+
const dialog_container_cjs_namespaceObject = require("../common/dialog-container.cjs");
|
|
46
|
+
const PREVIEW_CSP = "default-src 'none'; img-src data: https:; font-src data: https:; style-src 'unsafe-inline'; script-src 'unsafe-inline'";
|
|
47
|
+
function HtmlPreviewFrame({ code, title, className }) {
|
|
48
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("iframe", {
|
|
49
|
+
"data-slot": "wind-chat-html-preview",
|
|
50
|
+
sandbox: "allow-scripts",
|
|
51
|
+
srcDoc: (0, html_preview_cjs_namespaceObject.buildHtmlPreviewDocument)(code, {
|
|
52
|
+
contentSecurityPolicy: PREVIEW_CSP
|
|
53
|
+
}),
|
|
54
|
+
title: title,
|
|
55
|
+
className: (0, apollo_wind_namespaceObject.cn)('block size-full bg-white', className)
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function ChatCodeBlock({ block, codeBlockProps, htmlPreview, streaming }) {
|
|
59
|
+
const { _ } = (0, react_namespaceObject.useLingui)();
|
|
60
|
+
const dialogContainer = (0, dialog_container_cjs_namespaceObject.useDialogContainer)();
|
|
61
|
+
const previewable = htmlPreview && block.language?.trim().toLowerCase() === 'html';
|
|
62
|
+
const [previewedCode, setPreviewedCode] = external_react_default().useState(null);
|
|
63
|
+
if (!previewable && null !== previewedCode) setPreviewedCode(null);
|
|
64
|
+
const showPreview = previewable && !streaming && previewedCode === block.code;
|
|
65
|
+
const [expanded, setExpanded] = external_react_default().useState(false);
|
|
66
|
+
const codeLabel = _({
|
|
67
|
+
id: 'autopilot-chat.message.code-block-code'
|
|
68
|
+
});
|
|
69
|
+
const previewLabel = _({
|
|
70
|
+
id: 'autopilot-chat.message.code-block-preview'
|
|
71
|
+
});
|
|
72
|
+
const previewTitle = _({
|
|
73
|
+
id: 'autopilot-chat.message.html-preview'
|
|
74
|
+
});
|
|
75
|
+
const expandLabel = _({
|
|
76
|
+
id: 'autopilot-chat.message.expand'
|
|
77
|
+
});
|
|
78
|
+
const closeLabel = _({
|
|
79
|
+
id: 'autopilot-chat.message.dialog-close'
|
|
80
|
+
});
|
|
81
|
+
const toggleLabel = showPreview ? codeLabel : previewLabel;
|
|
82
|
+
const actions = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
83
|
+
children: [
|
|
84
|
+
previewable && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
85
|
+
variant: "ghost",
|
|
86
|
+
size: "2xs",
|
|
87
|
+
icon: true,
|
|
88
|
+
"aria-label": toggleLabel,
|
|
89
|
+
title: toggleLabel,
|
|
90
|
+
disabled: streaming,
|
|
91
|
+
onClick: ()=>setPreviewedCode(showPreview ? null : block.code),
|
|
92
|
+
children: showPreview ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Code, {
|
|
93
|
+
"aria-hidden": true
|
|
94
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Eye, {
|
|
95
|
+
"aria-hidden": true
|
|
96
|
+
})
|
|
97
|
+
}),
|
|
98
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Dialog, {
|
|
99
|
+
open: expanded,
|
|
100
|
+
onOpenChange: setExpanded,
|
|
101
|
+
children: [
|
|
102
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.DialogTrigger, {
|
|
103
|
+
asChild: true,
|
|
104
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
105
|
+
variant: "ghost",
|
|
106
|
+
size: "2xs",
|
|
107
|
+
icon: true,
|
|
108
|
+
"aria-label": expandLabel,
|
|
109
|
+
title: expandLabel,
|
|
110
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Maximize2, {
|
|
111
|
+
"aria-hidden": true
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
}),
|
|
115
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.DialogContent, {
|
|
116
|
+
container: dialogContainer,
|
|
117
|
+
strings: {
|
|
118
|
+
close: closeLabel
|
|
119
|
+
},
|
|
120
|
+
onOpenAutoFocus: (event)=>{
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
event.currentTarget?.focus();
|
|
123
|
+
},
|
|
124
|
+
"aria-describedby": void 0,
|
|
125
|
+
className: "flex h-[90vh] max-h-[900px] w-[95vw] max-w-[1400px] flex-col gap-3 p-4 sm:max-w-[1400px]",
|
|
126
|
+
children: [
|
|
127
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.DialogTitle, {
|
|
128
|
+
className: "truncate pr-8 text-sm leading-4",
|
|
129
|
+
children: showPreview ? previewTitle : block.language?.trim() || codeLabel
|
|
130
|
+
}),
|
|
131
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
132
|
+
className: "min-h-0 flex-1 overflow-auto",
|
|
133
|
+
children: showPreview ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(HtmlPreviewFrame, {
|
|
134
|
+
code: block.code,
|
|
135
|
+
title: previewTitle,
|
|
136
|
+
className: "rounded-lg border border-border-subtle"
|
|
137
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.CodeBlock, {
|
|
138
|
+
code: block.code,
|
|
139
|
+
language: block.language,
|
|
140
|
+
wrap: true,
|
|
141
|
+
hideHeader: true
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
}),
|
|
148
|
+
codeBlockProps.actions
|
|
149
|
+
]
|
|
150
|
+
});
|
|
151
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.CodeBlock, {
|
|
152
|
+
...codeBlockProps,
|
|
153
|
+
actions: actions,
|
|
154
|
+
body: showPreview && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
155
|
+
className: "h-100 resize-y overflow-hidden",
|
|
156
|
+
children: !expanded && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(HtmlPreviewFrame, {
|
|
157
|
+
code: block.code,
|
|
158
|
+
title: previewTitle
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
exports.ChatCodeBlock = __webpack_exports__.ChatCodeBlock;
|
|
164
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
165
|
+
"ChatCodeBlock"
|
|
166
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
167
|
+
Object.defineProperty(exports, '__esModule', {
|
|
168
|
+
value: true
|
|
169
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CodeBlockProps, type MarkdownCodeBlock } from '@uipath/apollo-wind';
|
|
2
|
+
interface ChatCodeBlockProps {
|
|
3
|
+
block: MarkdownCodeBlock;
|
|
4
|
+
codeBlockProps: CodeBlockProps;
|
|
5
|
+
htmlPreview: boolean;
|
|
6
|
+
streaming: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function ChatCodeBlock({ block, codeBlockProps, htmlPreview, streaming, }: ChatCodeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=chat-code-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-code-block.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/renderers/chat-code-block.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,cAAc,EAMnB,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAY7B,UAAU,kBAAkB;IAC1B,KAAK,EAAE,iBAAiB,CAAC;IAEzB,cAAc,EAAE,cAAc,CAAC;IAE/B,WAAW,EAAE,OAAO,CAAC;IAErB,SAAS,EAAE,OAAO,CAAC;CACpB;AA4BD,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,cAAc,EACd,WAAW,EACX,SAAS,GACV,EAAE,kBAAkB,2CA8FpB"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLingui } from "@lingui/react";
|
|
3
|
+
import { Button, CodeBlock, Dialog, DialogContent, DialogTitle, DialogTrigger, cn } from "@uipath/apollo-wind";
|
|
4
|
+
import { Code, Eye, Maximize2 } from "lucide-react";
|
|
5
|
+
import react from "react";
|
|
6
|
+
import { buildHtmlPreviewDocument } from "../../headless/markdown/html-preview.js";
|
|
7
|
+
import { useDialogContainer } from "../common/dialog-container.js";
|
|
8
|
+
const PREVIEW_CSP = "default-src 'none'; img-src data: https:; font-src data: https:; style-src 'unsafe-inline'; script-src 'unsafe-inline'";
|
|
9
|
+
function HtmlPreviewFrame({ code, title, className }) {
|
|
10
|
+
return /*#__PURE__*/ jsx("iframe", {
|
|
11
|
+
"data-slot": "wind-chat-html-preview",
|
|
12
|
+
sandbox: "allow-scripts",
|
|
13
|
+
srcDoc: buildHtmlPreviewDocument(code, {
|
|
14
|
+
contentSecurityPolicy: PREVIEW_CSP
|
|
15
|
+
}),
|
|
16
|
+
title: title,
|
|
17
|
+
className: cn('block size-full bg-white', className)
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function ChatCodeBlock({ block, codeBlockProps, htmlPreview, streaming }) {
|
|
21
|
+
const { _ } = useLingui();
|
|
22
|
+
const dialogContainer = useDialogContainer();
|
|
23
|
+
const previewable = htmlPreview && block.language?.trim().toLowerCase() === 'html';
|
|
24
|
+
const [previewedCode, setPreviewedCode] = react.useState(null);
|
|
25
|
+
if (!previewable && null !== previewedCode) setPreviewedCode(null);
|
|
26
|
+
const showPreview = previewable && !streaming && previewedCode === block.code;
|
|
27
|
+
const [expanded, setExpanded] = react.useState(false);
|
|
28
|
+
const codeLabel = _({
|
|
29
|
+
id: 'autopilot-chat.message.code-block-code'
|
|
30
|
+
});
|
|
31
|
+
const previewLabel = _({
|
|
32
|
+
id: 'autopilot-chat.message.code-block-preview'
|
|
33
|
+
});
|
|
34
|
+
const previewTitle = _({
|
|
35
|
+
id: 'autopilot-chat.message.html-preview'
|
|
36
|
+
});
|
|
37
|
+
const expandLabel = _({
|
|
38
|
+
id: 'autopilot-chat.message.expand'
|
|
39
|
+
});
|
|
40
|
+
const closeLabel = _({
|
|
41
|
+
id: 'autopilot-chat.message.dialog-close'
|
|
42
|
+
});
|
|
43
|
+
const toggleLabel = showPreview ? codeLabel : previewLabel;
|
|
44
|
+
const actions = /*#__PURE__*/ jsxs(Fragment, {
|
|
45
|
+
children: [
|
|
46
|
+
previewable && /*#__PURE__*/ jsx(Button, {
|
|
47
|
+
variant: "ghost",
|
|
48
|
+
size: "2xs",
|
|
49
|
+
icon: true,
|
|
50
|
+
"aria-label": toggleLabel,
|
|
51
|
+
title: toggleLabel,
|
|
52
|
+
disabled: streaming,
|
|
53
|
+
onClick: ()=>setPreviewedCode(showPreview ? null : block.code),
|
|
54
|
+
children: showPreview ? /*#__PURE__*/ jsx(Code, {
|
|
55
|
+
"aria-hidden": true
|
|
56
|
+
}) : /*#__PURE__*/ jsx(Eye, {
|
|
57
|
+
"aria-hidden": true
|
|
58
|
+
})
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ jsxs(Dialog, {
|
|
61
|
+
open: expanded,
|
|
62
|
+
onOpenChange: setExpanded,
|
|
63
|
+
children: [
|
|
64
|
+
/*#__PURE__*/ jsx(DialogTrigger, {
|
|
65
|
+
asChild: true,
|
|
66
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
67
|
+
variant: "ghost",
|
|
68
|
+
size: "2xs",
|
|
69
|
+
icon: true,
|
|
70
|
+
"aria-label": expandLabel,
|
|
71
|
+
title: expandLabel,
|
|
72
|
+
children: /*#__PURE__*/ jsx(Maximize2, {
|
|
73
|
+
"aria-hidden": true
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
}),
|
|
77
|
+
/*#__PURE__*/ jsxs(DialogContent, {
|
|
78
|
+
container: dialogContainer,
|
|
79
|
+
strings: {
|
|
80
|
+
close: closeLabel
|
|
81
|
+
},
|
|
82
|
+
onOpenAutoFocus: (event)=>{
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
event.currentTarget?.focus();
|
|
85
|
+
},
|
|
86
|
+
"aria-describedby": void 0,
|
|
87
|
+
className: "flex h-[90vh] max-h-[900px] w-[95vw] max-w-[1400px] flex-col gap-3 p-4 sm:max-w-[1400px]",
|
|
88
|
+
children: [
|
|
89
|
+
/*#__PURE__*/ jsx(DialogTitle, {
|
|
90
|
+
className: "truncate pr-8 text-sm leading-4",
|
|
91
|
+
children: showPreview ? previewTitle : block.language?.trim() || codeLabel
|
|
92
|
+
}),
|
|
93
|
+
/*#__PURE__*/ jsx("div", {
|
|
94
|
+
className: "min-h-0 flex-1 overflow-auto",
|
|
95
|
+
children: showPreview ? /*#__PURE__*/ jsx(HtmlPreviewFrame, {
|
|
96
|
+
code: block.code,
|
|
97
|
+
title: previewTitle,
|
|
98
|
+
className: "rounded-lg border border-border-subtle"
|
|
99
|
+
}) : /*#__PURE__*/ jsx(CodeBlock, {
|
|
100
|
+
code: block.code,
|
|
101
|
+
language: block.language,
|
|
102
|
+
wrap: true,
|
|
103
|
+
hideHeader: true
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
}),
|
|
110
|
+
codeBlockProps.actions
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
return /*#__PURE__*/ jsx(CodeBlock, {
|
|
114
|
+
...codeBlockProps,
|
|
115
|
+
actions: actions,
|
|
116
|
+
body: showPreview && /*#__PURE__*/ jsx("div", {
|
|
117
|
+
className: "h-100 resize-y overflow-hidden",
|
|
118
|
+
children: !expanded && /*#__PURE__*/ jsx(HtmlPreviewFrame, {
|
|
119
|
+
code: block.code,
|
|
120
|
+
title: previewTitle
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
export { ChatCodeBlock };
|
|
@@ -46,8 +46,8 @@ const use_streamed_message_content_cjs_namespaceObject = require("../../headless
|
|
|
46
46
|
const citation_parser_cjs_namespaceObject = require("../../headless/markdown/citation-parser.cjs");
|
|
47
47
|
const resource_token_parser_cjs_namespaceObject = require("../../headless/markdown/resource-token-parser.cjs");
|
|
48
48
|
const chat_state_provider_cjs_namespaceObject = require("../../headless/providers/chat-state-provider.cjs");
|
|
49
|
+
const external_chat_code_block_cjs_namespaceObject = require("./chat-code-block.cjs");
|
|
49
50
|
const external_citation_highlights_cjs_namespaceObject = require("./citation-highlights.cjs");
|
|
50
|
-
const external_code_block_actions_cjs_namespaceObject = require("./code-block-actions.cjs");
|
|
51
51
|
const external_markdown_citation_cjs_namespaceObject = require("./markdown-citation.cjs");
|
|
52
52
|
const external_markdown_resource_chip_cjs_namespaceObject = require("./markdown-resource-chip.cjs");
|
|
53
53
|
const REMARK_PLUGINS = [
|
|
@@ -94,8 +94,9 @@ function MarkdownMessageRendererComponent({ message }) {
|
|
|
94
94
|
const streaming = !!isStreaming || fakeStreaming;
|
|
95
95
|
const htmlPreview = !disabledFeatures.htmlPreview;
|
|
96
96
|
const highlights = (0, external_citation_highlights_cjs_namespaceObject.useCitationHighlights)(content, streaming);
|
|
97
|
-
const
|
|
97
|
+
const renderCodeBlock = external_react_default().useCallback((block, props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_chat_code_block_cjs_namespaceObject.ChatCodeBlock, {
|
|
98
98
|
block: block,
|
|
99
|
+
codeBlockProps: props,
|
|
99
100
|
htmlPreview: htmlPreview,
|
|
100
101
|
streaming: streaming
|
|
101
102
|
}), [
|
|
@@ -109,7 +110,7 @@ function MarkdownMessageRendererComponent({ message }) {
|
|
|
109
110
|
codeWrap: true,
|
|
110
111
|
remarkPlugins: REMARK_PLUGINS,
|
|
111
112
|
components: COMPONENTS,
|
|
112
|
-
|
|
113
|
+
renderCodeBlock: renderCodeBlock,
|
|
113
114
|
strings: strings,
|
|
114
115
|
children: content
|
|
115
116
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-renderer.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/renderers/markdown-renderer.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"markdown-renderer.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/renderers/markdown-renderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAe1D,wBAAgB,kBAAkB,IAAI,aAAa,CAAC,SAAS,CAAC,CAiB7D;AAMD,iBAAS,gCAAgC,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,oBAAoB,CAAA;CAAE,2CAoCvF;AAED,eAAO,MAAM,uBAAuB,oEAA+C,CAAC"}
|
|
@@ -7,8 +7,8 @@ import { useStreamedMessageContent } from "../../headless/hooks/use-streamed-mes
|
|
|
7
7
|
import { citationPlugin } from "../../headless/markdown/citation-parser.js";
|
|
8
8
|
import { resourceTokenPlugin } from "../../headless/markdown/resource-token-parser.js";
|
|
9
9
|
import { useChatState } from "../../headless/providers/chat-state-provider.js";
|
|
10
|
+
import { ChatCodeBlock } from "./chat-code-block.js";
|
|
10
11
|
import { CitationHighlightsContext, useCitationHighlights } from "./citation-highlights.js";
|
|
11
|
-
import { CodeBlockActions } from "./code-block-actions.js";
|
|
12
12
|
import { MarkdownCitation } from "./markdown-citation.js";
|
|
13
13
|
import { MarkdownResourceChip } from "./markdown-resource-chip.js";
|
|
14
14
|
const REMARK_PLUGINS = [
|
|
@@ -55,8 +55,9 @@ function MarkdownMessageRendererComponent({ message }) {
|
|
|
55
55
|
const streaming = !!isStreaming || fakeStreaming;
|
|
56
56
|
const htmlPreview = !disabledFeatures.htmlPreview;
|
|
57
57
|
const highlights = useCitationHighlights(content, streaming);
|
|
58
|
-
const
|
|
58
|
+
const renderCodeBlock = react.useCallback((block, props)=>/*#__PURE__*/ jsx(ChatCodeBlock, {
|
|
59
59
|
block: block,
|
|
60
|
+
codeBlockProps: props,
|
|
60
61
|
htmlPreview: htmlPreview,
|
|
61
62
|
streaming: streaming
|
|
62
63
|
}), [
|
|
@@ -70,7 +71,7 @@ function MarkdownMessageRendererComponent({ message }) {
|
|
|
70
71
|
codeWrap: true,
|
|
71
72
|
remarkPlugins: REMARK_PLUGINS,
|
|
72
73
|
components: COMPONENTS,
|
|
73
|
-
|
|
74
|
+
renderCodeBlock: renderCodeBlock,
|
|
74
75
|
strings: strings,
|
|
75
76
|
children: content
|
|
76
77
|
})
|
|
@@ -43,7 +43,6 @@ var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_
|
|
|
43
43
|
const span_icon_cjs_namespaceObject = require("../../headless/tool-call/span-icon.cjs");
|
|
44
44
|
const tool_call_model_cjs_namespaceObject = require("../../headless/tool-call/tool-call-model.cjs");
|
|
45
45
|
const openable_url_cjs_namespaceObject = require("../../headless/utils/openable-url.cjs");
|
|
46
|
-
const external_disclosure_tree_cjs_namespaceObject = require("./disclosure-tree.cjs");
|
|
47
46
|
const external_tool_call_strings_cjs_namespaceObject = require("./tool-call-strings.cjs");
|
|
48
47
|
const STATUS = {
|
|
49
48
|
loading: 'executing',
|
|
@@ -73,13 +72,15 @@ function toTraceItems(nodes) {
|
|
|
73
72
|
};
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
|
-
function TraceList({ span,
|
|
75
|
+
function TraceList({ span, label, expanded, onExpandedChange }) {
|
|
77
76
|
const items = external_react_default().useMemo(()=>toTraceItems((0, tool_call_model_cjs_namespaceObject.getVisibleTraceChildren)(span)), [
|
|
78
77
|
span
|
|
79
78
|
]);
|
|
80
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
79
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.DisclosureTree, {
|
|
81
80
|
items: items,
|
|
82
|
-
|
|
81
|
+
"aria-label": label,
|
|
82
|
+
expanded: expanded,
|
|
83
|
+
onExpandedChange: onExpandedChange
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
86
|
const INITIAL_SECTIONS = {
|
|
@@ -98,18 +99,11 @@ function ToolCallMessageRendererComponent({ message }) {
|
|
|
98
99
|
]);
|
|
99
100
|
const [open, setOpen] = external_react_default().useState(false);
|
|
100
101
|
const [sections, setSections] = external_react_default().useState(INITIAL_SECTIONS);
|
|
101
|
-
const [openTraceRows, setOpenTraceRows] = external_react_default().useState(
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (next) updated.add(id);
|
|
107
|
-
else updated.delete(id);
|
|
108
|
-
return updated;
|
|
109
|
-
})
|
|
110
|
-
}), [
|
|
111
|
-
openTraceRows
|
|
112
|
-
]);
|
|
102
|
+
const [openTraceRows, setOpenTraceRows] = external_react_default().useState([]);
|
|
103
|
+
const onTraceRowChange = external_react_default().useCallback((id, next)=>setOpenTraceRows((previous)=>next ? [
|
|
104
|
+
...previous,
|
|
105
|
+
id
|
|
106
|
+
] : previous.filter((openId)=>openId !== id)), []);
|
|
113
107
|
const sectionProps = (section)=>({
|
|
114
108
|
open: sections[section],
|
|
115
109
|
onOpenChange: (next)=>setSections((previous)=>({
|
|
@@ -172,7 +166,9 @@ function ToolCallMessageRendererComponent({ message }) {
|
|
|
172
166
|
...sectionProps('traces'),
|
|
173
167
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TraceList, {
|
|
174
168
|
span: span,
|
|
175
|
-
|
|
169
|
+
label: strings.traces,
|
|
170
|
+
expanded: openTraceRows,
|
|
171
|
+
onExpandedChange: onTraceRowChange
|
|
176
172
|
})
|
|
177
173
|
}),
|
|
178
174
|
taskUrls.length > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ToolCallSection, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-call-renderer.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/renderers/tool-call-renderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-call-renderer.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/renderers/tool-call-renderer.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,MAAM,OAAO,CAAC;AAe1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAyE1D,iBAAS,gCAAgC,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,oBAAoB,CAAA;CAAE,kDAgIvF;AAED,eAAO,MAAM,uBAAuB,oEAA+C,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CodeBlock, ToolCall, ToolCallContent, ToolCallError, ToolCallHeader, ToolCallInput, ToolCallOutput, ToolCallSection } from "@uipath/apollo-wind";
|
|
2
|
+
import { CodeBlock, DisclosureTree, ToolCall, ToolCallContent, ToolCallError, ToolCallHeader, ToolCallInput, ToolCallOutput, ToolCallSection } from "@uipath/apollo-wind";
|
|
3
3
|
import { CircleAlert, CircleCheck } from "lucide-react";
|
|
4
4
|
import react from "react";
|
|
5
5
|
import { getSpanIconSvg } from "../../headless/tool-call/span-icon.js";
|
|
6
6
|
import { getTaskUrls, getToolCallDurationSeconds, getToolCallName, getToolCallState, getToolCallValues, getVisibleTraceChildren } from "../../headless/tool-call/tool-call-model.js";
|
|
7
7
|
import { isOpenableUrl } from "../../headless/utils/openable-url.js";
|
|
8
|
-
import { DisclosureTree } from "./disclosure-tree.js";
|
|
9
8
|
import { useToolCallStrings } from "./tool-call-strings.js";
|
|
10
9
|
const STATUS = {
|
|
11
10
|
loading: 'executing',
|
|
@@ -35,13 +34,15 @@ function toTraceItems(nodes) {
|
|
|
35
34
|
};
|
|
36
35
|
});
|
|
37
36
|
}
|
|
38
|
-
function TraceList({ span,
|
|
37
|
+
function TraceList({ span, label, expanded, onExpandedChange }) {
|
|
39
38
|
const items = react.useMemo(()=>toTraceItems(getVisibleTraceChildren(span)), [
|
|
40
39
|
span
|
|
41
40
|
]);
|
|
42
41
|
return /*#__PURE__*/ jsx(DisclosureTree, {
|
|
43
42
|
items: items,
|
|
44
|
-
|
|
43
|
+
"aria-label": label,
|
|
44
|
+
expanded: expanded,
|
|
45
|
+
onExpandedChange: onExpandedChange
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
const INITIAL_SECTIONS = {
|
|
@@ -60,18 +61,11 @@ function ToolCallMessageRendererComponent({ message }) {
|
|
|
60
61
|
]);
|
|
61
62
|
const [open, setOpen] = react.useState(false);
|
|
62
63
|
const [sections, setSections] = react.useState(INITIAL_SECTIONS);
|
|
63
|
-
const [openTraceRows, setOpenTraceRows] = react.useState(
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (next) updated.add(id);
|
|
69
|
-
else updated.delete(id);
|
|
70
|
-
return updated;
|
|
71
|
-
})
|
|
72
|
-
}), [
|
|
73
|
-
openTraceRows
|
|
74
|
-
]);
|
|
64
|
+
const [openTraceRows, setOpenTraceRows] = react.useState([]);
|
|
65
|
+
const onTraceRowChange = react.useCallback((id, next)=>setOpenTraceRows((previous)=>next ? [
|
|
66
|
+
...previous,
|
|
67
|
+
id
|
|
68
|
+
] : previous.filter((openId)=>openId !== id)), []);
|
|
75
69
|
const sectionProps = (section)=>({
|
|
76
70
|
open: sections[section],
|
|
77
71
|
onOpenChange: (next)=>setSections((previous)=>({
|
|
@@ -134,7 +128,9 @@ function ToolCallMessageRendererComponent({ message }) {
|
|
|
134
128
|
...sectionProps('traces'),
|
|
135
129
|
children: /*#__PURE__*/ jsx(TraceList, {
|
|
136
130
|
span: span,
|
|
137
|
-
|
|
131
|
+
label: strings.traces,
|
|
132
|
+
expanded: openTraceRows,
|
|
133
|
+
onExpandedChange: onTraceRowChange
|
|
138
134
|
})
|
|
139
135
|
}),
|
|
140
136
|
taskUrls.length > 0 && /*#__PURE__*/ jsx(ToolCallSection, {
|
|
@@ -37,24 +37,26 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
37
37
|
});
|
|
38
38
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
39
39
|
const react_namespaceObject = require("@lingui/react");
|
|
40
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
40
41
|
const external_react_namespaceObject = require("react");
|
|
41
42
|
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
42
43
|
const chat_tree_cjs_namespaceObject = require("../../headless/tree/chat-tree.cjs");
|
|
43
44
|
const service_icon_cjs_namespaceObject = require("../common/service-icon.cjs");
|
|
44
|
-
const external_disclosure_tree_cjs_namespaceObject = require("./disclosure-tree.cjs");
|
|
45
45
|
function toDisclosureItems(items, expanded) {
|
|
46
46
|
return items.map((item)=>({
|
|
47
47
|
id: item.id,
|
|
48
|
-
label: item.
|
|
48
|
+
label: item.titleColor ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
49
|
+
style: {
|
|
50
|
+
color: item.titleColor
|
|
51
|
+
},
|
|
52
|
+
children: item.title
|
|
53
|
+
}) : item.title,
|
|
49
54
|
icon: item.icon ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(service_icon_cjs_namespaceObject.ServiceIcon, {
|
|
50
55
|
icon: item.icon
|
|
51
56
|
}) : void 0,
|
|
52
57
|
description: item.description,
|
|
53
58
|
trailing: item.additionalInfo,
|
|
54
|
-
|
|
55
|
-
color: item.titleColor
|
|
56
|
-
} : void 0,
|
|
57
|
-
defaultOpen: expanded.has(item.id),
|
|
59
|
+
defaultExpanded: expanded.has(item.id),
|
|
58
60
|
children: item.children?.length ? toDisclosureItems(item.children, expanded) : void 0
|
|
59
61
|
}));
|
|
60
62
|
}
|
|
@@ -87,9 +89,12 @@ function TreeMessageRendererComponent({ message }) {
|
|
|
87
89
|
});
|
|
88
90
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
89
91
|
"data-slot": "wind-chat-tree",
|
|
90
|
-
className: "min-w-0 text-sm text-muted-foreground",
|
|
91
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
92
|
-
items: items
|
|
92
|
+
className: "min-w-0 text-sm text-muted-foreground in-data-[density=compact]:text-xs",
|
|
93
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.DisclosureTree, {
|
|
94
|
+
items: items,
|
|
95
|
+
"aria-label": _({
|
|
96
|
+
id: 'autopilot-chat.tree.label'
|
|
97
|
+
})
|
|
93
98
|
})
|
|
94
99
|
});
|
|
95
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-renderer.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/renderers/tree-renderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tree-renderer.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/renderers/tree-renderer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AA0B1D,iBAAS,4BAA4B,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,oBAAoB,CAAA;CAAE,kDAsCnF;AAED,eAAO,MAAM,mBAAmB,gEAA2C,CAAC"}
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useLingui } from "@lingui/react";
|
|
3
|
+
import { DisclosureTree } from "@uipath/apollo-wind";
|
|
3
4
|
import react from "react";
|
|
4
5
|
import { getExpandedTreeIds, toChatTreeItem } from "../../headless/tree/chat-tree.js";
|
|
5
6
|
import { ServiceIcon } from "../common/service-icon.js";
|
|
6
|
-
import { DisclosureTree } from "./disclosure-tree.js";
|
|
7
7
|
function toDisclosureItems(items, expanded) {
|
|
8
8
|
return items.map((item)=>({
|
|
9
9
|
id: item.id,
|
|
10
|
-
label: item.
|
|
10
|
+
label: item.titleColor ? /*#__PURE__*/ jsx("span", {
|
|
11
|
+
style: {
|
|
12
|
+
color: item.titleColor
|
|
13
|
+
},
|
|
14
|
+
children: item.title
|
|
15
|
+
}) : item.title,
|
|
11
16
|
icon: item.icon ? /*#__PURE__*/ jsx(ServiceIcon, {
|
|
12
17
|
icon: item.icon
|
|
13
18
|
}) : void 0,
|
|
14
19
|
description: item.description,
|
|
15
20
|
trailing: item.additionalInfo,
|
|
16
|
-
|
|
17
|
-
color: item.titleColor
|
|
18
|
-
} : void 0,
|
|
19
|
-
defaultOpen: expanded.has(item.id),
|
|
21
|
+
defaultExpanded: expanded.has(item.id),
|
|
20
22
|
children: item.children?.length ? toDisclosureItems(item.children, expanded) : void 0
|
|
21
23
|
}));
|
|
22
24
|
}
|
|
@@ -49,9 +51,12 @@ function TreeMessageRendererComponent({ message }) {
|
|
|
49
51
|
});
|
|
50
52
|
return /*#__PURE__*/ jsx("div", {
|
|
51
53
|
"data-slot": "wind-chat-tree",
|
|
52
|
-
className: "min-w-0 text-sm text-muted-foreground",
|
|
54
|
+
className: "min-w-0 text-sm text-muted-foreground in-data-[density=compact]:text-xs",
|
|
53
55
|
children: /*#__PURE__*/ jsx(DisclosureTree, {
|
|
54
|
-
items: items
|
|
56
|
+
items: items,
|
|
57
|
+
"aria-label": _({
|
|
58
|
+
id: 'autopilot-chat.tree.label'
|
|
59
|
+
})
|
|
55
60
|
})
|
|
56
61
|
});
|
|
57
62
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/apollo-react",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.0",
|
|
4
4
|
"description": "Apollo Design System - React component library with Material UI theming",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -245,8 +245,8 @@
|
|
|
245
245
|
"zod": "^4.3.5",
|
|
246
246
|
"zustand": "^5.0.9",
|
|
247
247
|
"@uipath/apollo-core": "5.15.2",
|
|
248
|
-
"@uipath/apollo-
|
|
249
|
-
"@uipath/apollo-
|
|
248
|
+
"@uipath/apollo-ui-icons": "1.2.0",
|
|
249
|
+
"@uipath/apollo-wind": "2.72.2"
|
|
250
250
|
},
|
|
251
251
|
"devDependencies": {
|
|
252
252
|
"@lingui/cli": "^5.6.1",
|