@zero-library/chat-copilot 1.0.2 → 1.0.3
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.js +607 -535
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +68 -22
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +31 -5
- package/dist/index.d.ts +31 -5
- package/dist/index.esm.js +543 -471
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -4,27 +4,30 @@ var icons = require('@ant-design/icons');
|
|
|
4
4
|
var xV2 = require('@ant-design/x-v2');
|
|
5
5
|
var common = require('@zero-library/common');
|
|
6
6
|
var antd = require('antd');
|
|
7
|
-
var
|
|
7
|
+
var React7 = require('react');
|
|
8
8
|
var valtio = require('valtio');
|
|
9
9
|
var dayjs = require('dayjs');
|
|
10
|
-
var
|
|
10
|
+
var Latex2 = require('@ant-design/x-markdown/plugins/Latex');
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
|
-
var XMarkdown = require('@ant-design/x-markdown');
|
|
13
12
|
require('@ant-design/x-markdown/themes/light.css');
|
|
14
|
-
var classNames5 = require('classnames');
|
|
15
13
|
var xCard = require('@ant-design/x-card');
|
|
14
|
+
var XMarkdown = require('@ant-design/x-markdown');
|
|
15
|
+
var classNames2 = require('classnames');
|
|
16
16
|
var InfiniteScroll = require('react-infinite-scroll-component');
|
|
17
17
|
|
|
18
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var React7__default = /*#__PURE__*/_interopDefault(React7);
|
|
21
21
|
var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
|
|
22
|
-
var
|
|
22
|
+
var Latex2__default = /*#__PURE__*/_interopDefault(Latex2);
|
|
23
23
|
var XMarkdown__default = /*#__PURE__*/_interopDefault(XMarkdown);
|
|
24
|
-
var
|
|
24
|
+
var classNames2__default = /*#__PURE__*/_interopDefault(classNames2);
|
|
25
25
|
var InfiniteScroll__default = /*#__PURE__*/_interopDefault(InfiniteScroll);
|
|
26
26
|
|
|
27
27
|
// src/components/Attachments.tsx
|
|
28
|
+
|
|
29
|
+
// src/assets/images/logo.png
|
|
30
|
+
var logo_default = "./logo-BX4TAWHK.png";
|
|
28
31
|
function getFileExtension(fileName = "") {
|
|
29
32
|
const ext = fileName.split(".").pop();
|
|
30
33
|
return (ext || "").toLowerCase();
|
|
@@ -38,7 +41,7 @@ function formatFileSize(size) {
|
|
|
38
41
|
}
|
|
39
42
|
var getFileIcon = (extension, fontSize = 24) => {
|
|
40
43
|
const baseStyle = { fontSize };
|
|
41
|
-
const createIcon = (Icon, color) =>
|
|
44
|
+
const createIcon = (Icon, color) => React7__default.default.createElement(Icon, { style: { ...baseStyle, color } });
|
|
42
45
|
if (["png", "jpg", "jpeg", "gif", "bmp", "webp", "svg"].includes(extension)) {
|
|
43
46
|
return createIcon(icons.FileImageOutlined, "#22c55e");
|
|
44
47
|
}
|
|
@@ -62,6 +65,7 @@ var getFileIcon = (extension, fontSize = 24) => {
|
|
|
62
65
|
}
|
|
63
66
|
return createIcon(icons.FileUnknownOutlined, "#94a3b8");
|
|
64
67
|
};
|
|
68
|
+
var getChatCopilotLogo = () => logo_default;
|
|
65
69
|
var classifyTime = (timestamp) => {
|
|
66
70
|
const now = dayjs__default.default();
|
|
67
71
|
const target = dayjs__default.default(timestamp);
|
|
@@ -114,41 +118,15 @@ var variablesToObject = (variables) => {
|
|
|
114
118
|
{}
|
|
115
119
|
);
|
|
116
120
|
};
|
|
117
|
-
var singleTildeExtension = {
|
|
118
|
-
name: "singleTilde",
|
|
119
|
-
level: "inline",
|
|
120
|
-
start(src) {
|
|
121
|
-
return src.match(/(?<!~)~(?!~)/)?.index;
|
|
122
|
-
},
|
|
123
|
-
tokenizer(src) {
|
|
124
|
-
const match = /^(?<!~)~(?!~)/.exec(src);
|
|
125
|
-
if (match) {
|
|
126
|
-
return {
|
|
127
|
-
type: "text",
|
|
128
|
-
raw: match[0],
|
|
129
|
-
text: match[0]
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
return void 0;
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
var getMarkdownConfig = (options) => {
|
|
136
|
-
const latexExtensions = Latex__default.default();
|
|
137
|
-
const extensions = Array.isArray(latexExtensions) ? [...latexExtensions, singleTildeExtension] : [latexExtensions, singleTildeExtension];
|
|
138
|
-
return {
|
|
139
|
-
extensions,
|
|
140
|
-
breaks: options?.breaks ?? false
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
121
|
var getChatSocketUrl = (baseURL, params) => {
|
|
144
122
|
return common.buildUrlParams(params, common.getWebSocketUrl(`${baseURL}/ws`), "comma");
|
|
145
123
|
};
|
|
146
|
-
var ChatContext =
|
|
124
|
+
var ChatContext = React7.createContext(null);
|
|
147
125
|
function ChatProvider({ store, children }) {
|
|
148
|
-
return
|
|
126
|
+
return React7__default.default.createElement(ChatContext.Provider, { value: store }, children);
|
|
149
127
|
}
|
|
150
128
|
function useChatStore() {
|
|
151
|
-
const store =
|
|
129
|
+
const store = React7.useContext(ChatContext);
|
|
152
130
|
if (!store) {
|
|
153
131
|
throw new Error("useChatStore must be used within ChatProvider");
|
|
154
132
|
}
|
|
@@ -159,14 +137,18 @@ function useChatStore() {
|
|
|
159
137
|
var styles_module_default = {
|
|
160
138
|
chatAttachments: "styles_module_chatAttachments",
|
|
161
139
|
chatSender: "styles_module_chatSender",
|
|
162
|
-
runStartedNode: "styles_module_runStartedNode"
|
|
163
|
-
|
|
140
|
+
runStartedNode: "styles_module_runStartedNode",
|
|
141
|
+
chatQuoteMsg: "styles_module_chatQuoteMsg",
|
|
142
|
+
quoteTooltip: "styles_module_quoteTooltip",
|
|
143
|
+
quoteTooltipContainer: "styles_module_quoteTooltipContainer"
|
|
144
|
+
};
|
|
145
|
+
var Attachments_default = React7.forwardRef(({ fileUpload, fileUploadConfig, fileList = [], onChange, extraParams }, ref) => {
|
|
164
146
|
const { message: message3 } = antd.App.useApp();
|
|
165
147
|
const chatStore = useChatStore();
|
|
166
148
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
167
|
-
const fileListRef =
|
|
149
|
+
const fileListRef = React7.useRef([]);
|
|
168
150
|
const [attachedFiles, setAttachedFiles, getAttachedFiles] = common.useRefState([]);
|
|
169
|
-
|
|
151
|
+
React7.useEffect(() => {
|
|
170
152
|
if (JSON.stringify(fileList) !== JSON.stringify(fileListRef.current)) {
|
|
171
153
|
fileListRef.current = fileList;
|
|
172
154
|
const mapped = fileList.map((file) => ({
|
|
@@ -178,7 +160,7 @@ var Attachments_default = React9.forwardRef(({ fileUpload, fileUploadConfig, fil
|
|
|
178
160
|
setAttachedFiles(mapped);
|
|
179
161
|
}
|
|
180
162
|
}, [fileList]);
|
|
181
|
-
|
|
163
|
+
React7.useEffect(() => {
|
|
182
164
|
const files = attachedFiles.filter((file) => file.status === "done").map((file) => {
|
|
183
165
|
const f = { ...file };
|
|
184
166
|
delete f.status;
|
|
@@ -282,7 +264,7 @@ var Attachments_default = React9.forwardRef(({ fileUpload, fileUploadConfig, fil
|
|
|
282
264
|
chatStore.config.params.convMeta?.libraryId;
|
|
283
265
|
file.path;
|
|
284
266
|
};
|
|
285
|
-
|
|
267
|
+
React7.useImperativeHandle(
|
|
286
268
|
ref,
|
|
287
269
|
() => ({
|
|
288
270
|
validateFile: () => {
|
|
@@ -302,7 +284,7 @@ var Attachments_default = React9.forwardRef(({ fileUpload, fileUploadConfig, fil
|
|
|
302
284
|
}),
|
|
303
285
|
[]
|
|
304
286
|
);
|
|
305
|
-
const acceptStr =
|
|
287
|
+
const acceptStr = React7.useMemo(() => {
|
|
306
288
|
const allTypes = fileUploadConfig?.allowedTypes.map((type) => `.${type}`) || [];
|
|
307
289
|
return allTypes.length ? allTypes.join(",") : void 0;
|
|
308
290
|
}, [fileUploadConfig]);
|
|
@@ -332,7 +314,7 @@ var Attachments_default = React9.forwardRef(({ fileUpload, fileUploadConfig, fil
|
|
|
332
314
|
}
|
|
333
315
|
);
|
|
334
316
|
});
|
|
335
|
-
var ChatSender_default =
|
|
317
|
+
var ChatSender_default = React7.forwardRef(
|
|
336
318
|
({
|
|
337
319
|
placeholder,
|
|
338
320
|
content,
|
|
@@ -351,10 +333,10 @@ var ChatSender_default = React9.forwardRef(
|
|
|
351
333
|
sendBtnProps,
|
|
352
334
|
fileUpload
|
|
353
335
|
}, ref) => {
|
|
354
|
-
const senderRef =
|
|
336
|
+
const senderRef = React7.useRef(null);
|
|
355
337
|
const { inputValue, setInputValue } = common.useSyncInput(content || "", onContentChange);
|
|
356
338
|
const attachmentsNode = fileUpload?.config?.enabled && /* @__PURE__ */ jsxRuntime.jsx(antd.Badge, { dot: !!fileList?.length && !headerOpen, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PaperClipOutlined, {}), onClick: () => onHeaderOpenChange(!headerOpen) }) });
|
|
357
|
-
const attachmentsRef =
|
|
339
|
+
const attachmentsRef = React7.useRef();
|
|
358
340
|
const senderHeader = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
359
341
|
/* @__PURE__ */ jsxRuntime.jsx(xV2.Sender.Header, { title: "\u9009\u62E9\u6587\u4EF6", open: headerOpen, onOpenChange: onHeaderOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
360
342
|
Attachments_default,
|
|
@@ -374,14 +356,14 @@ var ChatSender_default = React9.forwardRef(
|
|
|
374
356
|
onSend();
|
|
375
357
|
}
|
|
376
358
|
};
|
|
377
|
-
const isFocusedRef =
|
|
378
|
-
|
|
359
|
+
const isFocusedRef = React7.useRef(false);
|
|
360
|
+
React7.useEffect(() => {
|
|
379
361
|
if (!content) return;
|
|
380
362
|
if (!isFocusedRef.current) {
|
|
381
363
|
senderRef.current?.focus({ cursor: "end" });
|
|
382
364
|
}
|
|
383
365
|
}, [content]);
|
|
384
|
-
|
|
366
|
+
React7.useImperativeHandle(
|
|
385
367
|
ref,
|
|
386
368
|
() => ({
|
|
387
369
|
focus: (options) => {
|
|
@@ -669,7 +651,7 @@ function renderMiniChart(spec, opts) {
|
|
|
669
651
|
] }) });
|
|
670
652
|
}
|
|
671
653
|
|
|
672
|
-
// src/components/
|
|
654
|
+
// src/components/CustomComponents/a2ui-runtime/components/artifacts/export-utils.ts
|
|
673
655
|
function sanitizeFileName(name) {
|
|
674
656
|
return name.replace(/[\\/:*?"<>|\u0000-\u001F]/g, "_").replace(/\s+/g, " ").trim();
|
|
675
657
|
}
|
|
@@ -738,11 +720,11 @@ function exportJsonFile(data, fileName) {
|
|
|
738
720
|
exportTextFile(json, fileName, "application/json;charset=utf-8");
|
|
739
721
|
}
|
|
740
722
|
var ChartViewer = ({ artifactId, title, payload }) => {
|
|
741
|
-
const containerRef =
|
|
742
|
-
const [containerWidth, setContainerWidth] =
|
|
723
|
+
const containerRef = React7__default.default.useRef(null);
|
|
724
|
+
const [containerWidth, setContainerWidth] = React7__default.default.useState(0);
|
|
743
725
|
const spec = payload?.spec;
|
|
744
726
|
const needsContainerWidth = true;
|
|
745
|
-
|
|
727
|
+
React7__default.default.useLayoutEffect(() => {
|
|
746
728
|
const el = containerRef.current;
|
|
747
729
|
if (!el) return;
|
|
748
730
|
let frame = 0;
|
|
@@ -792,39 +774,62 @@ var ChartViewer = ({ artifactId, title, payload }) => {
|
|
|
792
774
|
}
|
|
793
775
|
);
|
|
794
776
|
};
|
|
795
|
-
var
|
|
796
|
-
const [content, setContent] =
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
if (!children) {
|
|
777
|
+
var AgentNavigate_default = React7.memo(({ data }) => {
|
|
778
|
+
const [content, setContent] = React7.useState(null);
|
|
779
|
+
React7.useEffect(() => {
|
|
780
|
+
if (!data) {
|
|
800
781
|
return;
|
|
801
782
|
}
|
|
802
|
-
console.log(typeof
|
|
803
|
-
if (typeof
|
|
783
|
+
console.log(typeof data, data);
|
|
784
|
+
if (typeof data === "string") {
|
|
804
785
|
try {
|
|
805
|
-
setContent(JSON.parse(
|
|
786
|
+
setContent(JSON.parse(data));
|
|
806
787
|
} catch (_error) {
|
|
807
788
|
setContent(null);
|
|
808
789
|
}
|
|
809
790
|
} else {
|
|
810
|
-
setContent(
|
|
791
|
+
setContent(data);
|
|
811
792
|
}
|
|
812
|
-
}, [
|
|
793
|
+
}, [data]);
|
|
813
794
|
const handleClick = () => {
|
|
814
795
|
if (!content?.emit) return;
|
|
815
796
|
};
|
|
816
797
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: handleClick, style: { padding: 0 }, type: "link", children: content?.name || "\u70B9\u51FB\u6B64\u5904" });
|
|
817
798
|
});
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
799
|
+
|
|
800
|
+
// src/components/CustomComponents/XMarkdown/styles.module.less
|
|
801
|
+
var styles_module_default2 = {
|
|
802
|
+
appCard: "styles_module_appCard",
|
|
803
|
+
fileView: "styles_module_fileView",
|
|
804
|
+
fileEdit: "styles_module_fileEdit",
|
|
805
|
+
fileEditHeader: "styles_module_fileEditHeader",
|
|
806
|
+
fileEditContent: "styles_module_fileEditContent",
|
|
807
|
+
mdEdit: "styles_module_mdEdit"
|
|
808
|
+
};
|
|
809
|
+
var AppCard_default = ({ data, loading }) => {
|
|
810
|
+
const chatStore = useChatStore();
|
|
811
|
+
const onClick = async () => {
|
|
812
|
+
if (data.appKey) {
|
|
813
|
+
const canProceed = await chatStore.config.hooks?.onAppRightVerify?.(data.appKey);
|
|
814
|
+
if (canProceed === false) {
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
chatStore.getAgentInfo(data.agentId);
|
|
819
|
+
};
|
|
820
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 4, align: "center", className: styles_module_default2.appCard, onClick, children: [
|
|
821
|
+
/* @__PURE__ */ jsxRuntime.jsx("img", { src: data.iconUrl }),
|
|
822
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ellipsis", title: data.appName, children: data.appName })
|
|
823
|
+
] }) });
|
|
824
|
+
};
|
|
825
|
+
var CodeHighlight_default = ({ className, data }) => {
|
|
821
826
|
const lang = className?.match(/language-(\w+)/)?.[1] || "";
|
|
822
|
-
if (typeof
|
|
827
|
+
if (typeof data !== "string") return null;
|
|
823
828
|
if (!lang) {
|
|
824
|
-
return /* @__PURE__ */ jsxRuntime.jsx("code", { children });
|
|
829
|
+
return /* @__PURE__ */ jsxRuntime.jsx("code", { children: data });
|
|
825
830
|
}
|
|
826
831
|
if (lang === "mermaid") {
|
|
827
|
-
return /* @__PURE__ */ jsxRuntime.jsx(xV2.Mermaid, { children });
|
|
832
|
+
return /* @__PURE__ */ jsxRuntime.jsx(xV2.Mermaid, { children: data });
|
|
828
833
|
}
|
|
829
834
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
830
835
|
"div",
|
|
@@ -835,11 +840,54 @@ var CodeHighlight = (props) => {
|
|
|
835
840
|
overflowX: "auto",
|
|
836
841
|
borderRadius: 8
|
|
837
842
|
},
|
|
838
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minWidth: "max-content" }, children: /* @__PURE__ */ jsxRuntime.jsx(xV2.CodeHighlighter, { lang, style: { margin: 0 }, children }) })
|
|
843
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minWidth: "max-content" }, children: /* @__PURE__ */ jsxRuntime.jsx(xV2.CodeHighlighter, { lang, style: { margin: 0 }, children: data }) })
|
|
839
844
|
}
|
|
840
845
|
);
|
|
841
846
|
};
|
|
842
|
-
var
|
|
847
|
+
var FileEdit_default = ({ data, loading }) => {
|
|
848
|
+
const chatStore = useChatStore();
|
|
849
|
+
const onPreview = () => {
|
|
850
|
+
chatStore.setPreview(data, true);
|
|
851
|
+
};
|
|
852
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: styles_module_default2.fileEdit, children: [
|
|
853
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, align: "center", justify: "space-between", className: styles_module_default2.fileEditHeader, children: [
|
|
854
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, align: "center", className: "flex-1", children: [
|
|
855
|
+
/* @__PURE__ */ jsxRuntime.jsx(common.FileIcon, { suffix: "md", fontSize: 18 }),
|
|
856
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ellipsis", title: data.fileName, children: data.fileName })
|
|
857
|
+
] }),
|
|
858
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
859
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { color: "default", variant: "text", size: "small", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlayCircleOutlined, {}), onClick: onPreview, children: "\u9884\u89C8\u7F16\u8F91" }),
|
|
860
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { color: "default", variant: "text", size: "small", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CopyOutlined, {}), onClick: () => common.copyText(data.content), children: "\u590D\u5236" })
|
|
861
|
+
] }) })
|
|
862
|
+
] }),
|
|
863
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, align: "center", className: styles_module_default2.fileEditContent, children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderMarkdown, { content: data.content }) })
|
|
864
|
+
] });
|
|
865
|
+
};
|
|
866
|
+
var FileView_default = ({ data, loading }) => {
|
|
867
|
+
const chatStore = useChatStore();
|
|
868
|
+
const onClick = () => {
|
|
869
|
+
chatStore.setPreview(data, false);
|
|
870
|
+
};
|
|
871
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, align: "center", className: styles_module_default2.fileView, onClick, children: [
|
|
872
|
+
/* @__PURE__ */ jsxRuntime.jsx(common.FileIcon, { suffix: data.suffix }),
|
|
873
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ellipsis", title: data.fileName, children: data.fileName })
|
|
874
|
+
] }) });
|
|
875
|
+
};
|
|
876
|
+
var MdEdit_default = ({ data, loading }) => {
|
|
877
|
+
const chatStore = useChatStore();
|
|
878
|
+
const [value, setValue] = React7.useState("");
|
|
879
|
+
const btnText = data.btnText || "\u7EE7\u7EED";
|
|
880
|
+
const onOk = () => {
|
|
881
|
+
chatStore.sendMessage(btnText, [], { citation: value });
|
|
882
|
+
};
|
|
883
|
+
React7.useEffect(() => {
|
|
884
|
+
setValue(data.content);
|
|
885
|
+
}, [data.content]);
|
|
886
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default2.mdEdit, children: [
|
|
887
|
+
/* @__PURE__ */ jsxRuntime.jsx(common.MarkdownEditor, { disabled: loading, value, onChange: setValue, fixedToolbar: false, floatToolbar: false }),
|
|
888
|
+
!loading && /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "end", className: "m-t-16", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { color: "primary", variant: "outlined", onClick: onOk, children: btnText }) })
|
|
889
|
+
] });
|
|
890
|
+
};
|
|
843
891
|
var TOKEN_KEY = "NS-TOKEN";
|
|
844
892
|
var tokenManager = common.createTokenManager({
|
|
845
893
|
key: TOKEN_KEY
|
|
@@ -848,20 +896,20 @@ var redirectUrl = () => {
|
|
|
848
896
|
const path = localStorage.getItem("SIGNPATH");
|
|
849
897
|
common.emit("jumpLink", { url: `/uc${path || "/sign-in"}` });
|
|
850
898
|
};
|
|
851
|
-
var
|
|
899
|
+
var PreviewLink_default = ({ data, ...rest }) => {
|
|
852
900
|
const chatStore = useChatStore();
|
|
853
901
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
854
902
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
855
903
|
"a",
|
|
856
904
|
{
|
|
857
|
-
...
|
|
905
|
+
...rest,
|
|
858
906
|
onClick: (e) => {
|
|
859
|
-
if (
|
|
860
|
-
|
|
907
|
+
if (rest.onClick) {
|
|
908
|
+
rest.onClick(e);
|
|
861
909
|
}
|
|
862
910
|
if (!e.defaultPrevented && e.currentTarget.href) {
|
|
863
911
|
e.preventDefault();
|
|
864
|
-
if (
|
|
912
|
+
if (rest.href && String(rest.href).startsWith("/luya") && configState.layout.preview) {
|
|
865
913
|
let fileName = "link";
|
|
866
914
|
let path = e.currentTarget.href;
|
|
867
915
|
const url = new URL(path, window.location.origin);
|
|
@@ -879,16 +927,16 @@ var PreviewLinkComponent = (props) => {
|
|
|
879
927
|
fileName = lastSegment;
|
|
880
928
|
}
|
|
881
929
|
}
|
|
882
|
-
} else if (typeof
|
|
883
|
-
fileName =
|
|
884
|
-
} else if (Array.isArray(
|
|
885
|
-
fileName = String(
|
|
930
|
+
} else if (typeof data === "string") {
|
|
931
|
+
fileName = data;
|
|
932
|
+
} else if (Array.isArray(data) && typeof data[0] === "string") {
|
|
933
|
+
fileName = String(data[0]);
|
|
886
934
|
}
|
|
887
935
|
chatStore.setPreview({ path, fileName });
|
|
888
|
-
} else if (
|
|
889
|
-
window.open(
|
|
890
|
-
} else if (
|
|
891
|
-
const urlObj = new URL(
|
|
936
|
+
} else if (rest.href && !String(rest.href).startsWith("/luya")) {
|
|
937
|
+
window.open(rest.href || e.currentTarget.href, "_blank");
|
|
938
|
+
} else if (rest.href && String(rest.href).startsWith("/luya") && !configState.layout.preview) {
|
|
939
|
+
const urlObj = new URL(rest.href, window.location.origin);
|
|
892
940
|
urlObj.searchParams.set("NS-TOKEN", tokenManager.get() || "");
|
|
893
941
|
window.open(urlObj.toString(), "_blank");
|
|
894
942
|
}
|
|
@@ -897,246 +945,69 @@ var PreviewLinkComponent = (props) => {
|
|
|
897
945
|
}
|
|
898
946
|
);
|
|
899
947
|
};
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
todoText: "index_module_todoText",
|
|
915
|
-
completed: "index_module_completed",
|
|
916
|
-
emptyText: "index_module_emptyText"
|
|
917
|
-
};
|
|
918
|
-
var DefaultToolRender = ({ argsContent, resultContent, errorMessage, item }) => {
|
|
919
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
920
|
-
(item.content || item.arguments) && argsContent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default.sectionBlock, children: [
|
|
921
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default.sectionLabel, children: "\u8F93\u5165\u53C2\u6570" }),
|
|
922
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.markdownContainer, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
923
|
-
XMarkdown__default.default,
|
|
924
|
-
{
|
|
925
|
-
className: "xMarkdownStyle",
|
|
926
|
-
components: { code: code_highlight_default },
|
|
927
|
-
config: getMarkdownConfig(),
|
|
928
|
-
content: argsContent.isJson ? `\`\`\`json
|
|
929
|
-
${argsContent.text}
|
|
930
|
-
\`\`\`` : argsContent.text
|
|
931
|
-
}
|
|
932
|
-
) })
|
|
933
|
-
] }),
|
|
934
|
-
item.result && resultContent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default.sectionBlock, children: [
|
|
935
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default.sectionLabel, children: "\u8FD4\u56DE\u7ED3\u679C" }),
|
|
936
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.markdownContainer, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
937
|
-
XMarkdown__default.default,
|
|
938
|
-
{
|
|
939
|
-
className: "xMarkdownStyle",
|
|
940
|
-
components: { code: code_highlight_default },
|
|
941
|
-
config: getMarkdownConfig(),
|
|
942
|
-
content: resultContent.isJson ? `\`\`\`json
|
|
943
|
-
${resultContent.text}
|
|
944
|
-
\`\`\`` : resultContent.text
|
|
945
|
-
}
|
|
946
|
-
) })
|
|
947
|
-
] }),
|
|
948
|
-
errorMessage && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default.sectionBlock, children: [
|
|
949
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default.sectionLabel, children: "\u9519\u8BEF\u4FE1\u606F" }),
|
|
950
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.markdownContainer, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
951
|
-
XMarkdown__default.default,
|
|
952
|
-
{
|
|
953
|
-
className: "xMarkdownStyle",
|
|
954
|
-
components: { code: code_highlight_default },
|
|
955
|
-
config: getMarkdownConfig(),
|
|
956
|
-
content: `\`\`\`
|
|
957
|
-
${errorMessage}
|
|
958
|
-
\`\`\``
|
|
959
|
-
}
|
|
960
|
-
) })
|
|
961
|
-
] })
|
|
962
|
-
] });
|
|
963
|
-
};
|
|
964
|
-
var default_render_default = DefaultToolRender;
|
|
965
|
-
var TodoWriteRender = ({ args, result }) => {
|
|
966
|
-
const { token } = antd.theme.useToken();
|
|
967
|
-
const todos = Array.isArray(result) ? result : result?.todos || (Array.isArray(args) ? args : args?.todos) || [];
|
|
968
|
-
const getStatusIcon = (status) => {
|
|
969
|
-
switch (status) {
|
|
970
|
-
case "completed":
|
|
971
|
-
return /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircleOutlined, { style: { color: token.colorSuccess } });
|
|
972
|
-
case "in_progress":
|
|
973
|
-
return /* @__PURE__ */ jsxRuntime.jsx(icons.ClockCircleOutlined, { style: { color: token.colorPrimary } });
|
|
974
|
-
case "pending":
|
|
975
|
-
default:
|
|
976
|
-
return /* @__PURE__ */ jsxRuntime.jsx(icons.ClockCircleOutlined, { style: { color: token.colorTextTertiary } });
|
|
977
|
-
}
|
|
978
|
-
};
|
|
979
|
-
if (!todos || todos.length === 0) {
|
|
980
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { type: "secondary", className: index_module_default.emptyText, children: "\u6682\u65E0\u4EFB\u52A1" });
|
|
981
|
-
}
|
|
982
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
983
|
-
antd.List,
|
|
984
|
-
{
|
|
985
|
-
size: "small",
|
|
986
|
-
dataSource: todos,
|
|
987
|
-
renderItem: (item) => /* @__PURE__ */ jsxRuntime.jsxs(antd.List.Item, { className: index_module_default.todoItem, children: [
|
|
988
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.statusIconWrapper, children: getStatusIcon(item.status) }),
|
|
989
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.todoContent, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: `${index_module_default.todoText} ${item.status === "completed" ? index_module_default.completed : ""}`, children: item.title || item.content }) })
|
|
990
|
-
] }),
|
|
991
|
-
className: index_module_default.todoList
|
|
948
|
+
var singleTildeExtension = {
|
|
949
|
+
name: "singleTilde",
|
|
950
|
+
level: "inline",
|
|
951
|
+
start(src) {
|
|
952
|
+
return src.match(/(?<!~)~(?!~)/)?.index;
|
|
953
|
+
},
|
|
954
|
+
tokenizer(src) {
|
|
955
|
+
const match = /^(?<!~)~(?!~)/.exec(src);
|
|
956
|
+
if (match) {
|
|
957
|
+
return {
|
|
958
|
+
type: "text",
|
|
959
|
+
raw: match[0],
|
|
960
|
+
text: match[0]
|
|
961
|
+
};
|
|
992
962
|
}
|
|
993
|
-
|
|
994
|
-
};
|
|
995
|
-
var todo_write_render_default = TodoWriteRender;
|
|
996
|
-
var toolRenders = {
|
|
997
|
-
todo_write: {
|
|
998
|
-
component: todo_write_render_default,
|
|
999
|
-
defaultExpanded: false,
|
|
1000
|
-
alwaysShowContent: (args, result) => {
|
|
1001
|
-
const todos = Array.isArray(result) ? result : result?.todos || (Array.isArray(args) ? args : args?.todos) || [];
|
|
1002
|
-
return todos && todos.length > 0;
|
|
1003
|
-
},
|
|
1004
|
-
hideStatus: true,
|
|
1005
|
-
disableExpandOnError: true
|
|
963
|
+
return void 0;
|
|
1006
964
|
}
|
|
1007
965
|
};
|
|
1008
|
-
var
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
}
|
|
966
|
+
var getMarkdownConfig = (options) => {
|
|
967
|
+
const latexExtensions = Latex2__default.default();
|
|
968
|
+
const extensions = Array.isArray(latexExtensions) ? [...latexExtensions, singleTildeExtension] : [latexExtensions, singleTildeExtension];
|
|
1012
969
|
return {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
alwaysShowContent: false
|
|
970
|
+
extensions,
|
|
971
|
+
breaks: options?.breaks ?? false
|
|
1016
972
|
};
|
|
1017
973
|
};
|
|
1018
|
-
var
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
return { text: JSON.stringify(content, null, 2), isJson: true, parsed: content };
|
|
1023
|
-
}
|
|
1024
|
-
const parsed = JSON.parse(content);
|
|
1025
|
-
if (typeof parsed === "object" && parsed !== null) {
|
|
1026
|
-
return { text: JSON.stringify(parsed, null, 2), isJson: true, parsed };
|
|
1027
|
-
}
|
|
1028
|
-
return { text: content, isJson: false, parsed: null };
|
|
1029
|
-
} catch {
|
|
1030
|
-
return { text: typeof content === "string" ? content : "", isJson: false, parsed: null };
|
|
1031
|
-
}
|
|
974
|
+
var adaptMarkdownComponent = (Component) => {
|
|
975
|
+
const WrappedComponent = ({ children, streamStatus, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, data: common.safeParseJson(children, { repair: true }), loading: streamStatus === "loading" });
|
|
976
|
+
WrappedComponent.displayName = `AdaptedMarkdownComponent(${Component.displayName || Component.name || "Anonymous"})`;
|
|
977
|
+
return WrappedComponent;
|
|
1032
978
|
};
|
|
1033
|
-
var
|
|
1034
|
-
const { token } = antd.theme.useToken();
|
|
1035
|
-
const renderConfig = getToolRenderConfig(item.toolName);
|
|
1036
|
-
const CustomRender = renderConfig.component;
|
|
1037
|
-
const status = React9.useMemo(() => {
|
|
1038
|
-
if (item.status) return item.status;
|
|
1039
|
-
if (item.errorMessage) return "error";
|
|
1040
|
-
if (item.result) return "success";
|
|
1041
|
-
return "running";
|
|
1042
|
-
}, [item.status, item.errorMessage, item.result]);
|
|
1043
|
-
const argsContent = React9.useMemo(() => formatContent(item.arguments || item.content), [item.arguments, item.content]);
|
|
1044
|
-
const resultContent = React9.useMemo(() => item.result ? formatContent(item.result) : null, [item.result]);
|
|
1045
|
-
const hasContent = React9.useMemo(() => {
|
|
1046
|
-
if (renderConfig.disableExpandOnError && status === "error") return false;
|
|
1047
|
-
let alwaysShow = false;
|
|
1048
|
-
if (typeof renderConfig.alwaysShowContent === "function") {
|
|
1049
|
-
alwaysShow = renderConfig.alwaysShowContent(argsContent.parsed, resultContent?.parsed);
|
|
1050
|
-
} else if (renderConfig.alwaysShowContent) {
|
|
1051
|
-
alwaysShow = renderConfig.alwaysShowContent;
|
|
1052
|
-
}
|
|
1053
|
-
if (alwaysShow) return true;
|
|
1054
|
-
return Boolean(item.errorMessage);
|
|
1055
|
-
}, [renderConfig.disableExpandOnError, renderConfig.alwaysShowContent, item.errorMessage, status, argsContent.parsed, resultContent?.parsed]);
|
|
1056
|
-
const isDefaultExpanded = React9.useMemo(() => {
|
|
1057
|
-
if (typeof renderConfig.defaultExpanded === "function") {
|
|
1058
|
-
return renderConfig.defaultExpanded(argsContent.parsed, resultContent?.parsed);
|
|
1059
|
-
}
|
|
1060
|
-
return renderConfig.defaultExpanded;
|
|
1061
|
-
}, [renderConfig.defaultExpanded, argsContent.parsed, resultContent?.parsed]);
|
|
1062
|
-
const statusConfig = {
|
|
1063
|
-
running: {
|
|
1064
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, {}),
|
|
1065
|
-
color: token.colorPrimary
|
|
1066
|
-
},
|
|
1067
|
-
success: {
|
|
1068
|
-
icon: null,
|
|
1069
|
-
color: token.colorSuccess
|
|
1070
|
-
},
|
|
1071
|
-
error: {
|
|
1072
|
-
icon: null,
|
|
1073
|
-
color: token.colorSuccess
|
|
1074
|
-
},
|
|
1075
|
-
pending: {
|
|
1076
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, {}),
|
|
1077
|
-
color: token.colorTextSecondary
|
|
1078
|
-
}
|
|
1079
|
-
}[status] || {
|
|
1080
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, {}),
|
|
1081
|
-
color: token.colorPrimary
|
|
1082
|
-
};
|
|
1083
|
-
const renderIcon = () => {
|
|
1084
|
-
if (!item.toolIcon) {
|
|
1085
|
-
return /* @__PURE__ */ jsxRuntime.jsx(icons.ToolOutlined, { style: { fontSize: 14, color: token.colorTextSecondary } });
|
|
1086
|
-
}
|
|
1087
|
-
const isUrl = /^(http|\/)/.test(item.toolIcon);
|
|
1088
|
-
if (isUrl) {
|
|
1089
|
-
return /* @__PURE__ */ jsxRuntime.jsx("img", { src: item.toolIcon, alt: "tool-icon", style: { width: "100%", height: "100%", objectFit: "contain" } });
|
|
1090
|
-
}
|
|
1091
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 14, lineHeight: 1 }, children: item.toolIcon });
|
|
1092
|
-
};
|
|
1093
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1094
|
-
antd.Collapse,
|
|
1095
|
-
{
|
|
1096
|
-
style: { width: "70%" },
|
|
1097
|
-
collapsible: hasContent ? void 0 : "disabled",
|
|
1098
|
-
defaultActiveKey: isDefaultExpanded && hasContent ? [item.toolCallId || "fallback-key"] : void 0,
|
|
1099
|
-
expandIconPlacement: "end",
|
|
1100
|
-
styles: {
|
|
1101
|
-
header: {
|
|
1102
|
-
padding: "6px 10px"
|
|
1103
|
-
}
|
|
1104
|
-
},
|
|
1105
|
-
items: [
|
|
1106
|
-
{
|
|
1107
|
-
key: item.toolCallId || "fallback-key",
|
|
1108
|
-
showArrow: hasContent,
|
|
1109
|
-
label: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", gap: 8, style: { flex: 1, minWidth: 0 }, children: [
|
|
1110
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.iconContainer, children: renderIcon() }),
|
|
1111
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: index_module_default.toolName, children: item.title || item.toolName || "Unknown Tool" }),
|
|
1112
|
-
(status === "running" || status === "pending") && /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.statusIcon, style: { color: statusConfig.color }, children: statusConfig.icon }),
|
|
1113
|
-
item.duration && /* @__PURE__ */ jsxRuntime.jsxs(antd.Typography.Text, { className: index_module_default.duration, children: [
|
|
1114
|
-
item.duration,
|
|
1115
|
-
"ms"
|
|
1116
|
-
] })
|
|
1117
|
-
] }),
|
|
1118
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1119
|
-
CustomRender,
|
|
1120
|
-
{
|
|
1121
|
-
item,
|
|
1122
|
-
args: argsContent.parsed,
|
|
1123
|
-
result: resultContent?.parsed,
|
|
1124
|
-
argsContent,
|
|
1125
|
-
resultContent,
|
|
1126
|
-
errorMessage: item.errorMessage
|
|
1127
|
-
}
|
|
1128
|
-
)
|
|
1129
|
-
}
|
|
1130
|
-
]
|
|
1131
|
-
}
|
|
1132
|
-
);
|
|
1133
|
-
};
|
|
1134
|
-
var tool_call_item_default = ToolCallItem;
|
|
979
|
+
var adaptMarkdownComponents = (components) => Object.fromEntries(Object.entries(components ?? {}).map(([key, Component]) => [key, adaptMarkdownComponent(Component)]));
|
|
1135
980
|
function formatMixedContent(content) {
|
|
1136
981
|
return content.replace(/<!DOCTYPE html>[\s\S]*?<\/html>/gi, (match) => `\`\`\`html
|
|
1137
982
|
${match}
|
|
1138
983
|
\`\`\``);
|
|
1139
984
|
}
|
|
985
|
+
var XMarkdown_default = ({ components, content, ...rest }) => {
|
|
986
|
+
const config = React7.useMemo(() => getMarkdownConfig(), []);
|
|
987
|
+
const markdownComponents = React7.useMemo(
|
|
988
|
+
() => adaptMarkdownComponents({
|
|
989
|
+
code: CodeHighlight_default,
|
|
990
|
+
agentnavigate: AgentNavigate_default,
|
|
991
|
+
a: PreviewLink_default,
|
|
992
|
+
appcard: AppCard_default,
|
|
993
|
+
fileview: FileView_default,
|
|
994
|
+
// indexquote: IndexQuote,
|
|
995
|
+
mdedit: MdEdit_default,
|
|
996
|
+
fileedit: FileEdit_default,
|
|
997
|
+
...components
|
|
998
|
+
}),
|
|
999
|
+
[components]
|
|
1000
|
+
);
|
|
1001
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1002
|
+
XMarkdown__default.default,
|
|
1003
|
+
{
|
|
1004
|
+
config,
|
|
1005
|
+
...rest,
|
|
1006
|
+
content: formatMixedContent(content),
|
|
1007
|
+
components: markdownComponents
|
|
1008
|
+
}
|
|
1009
|
+
);
|
|
1010
|
+
};
|
|
1140
1011
|
var ReportViewer = ({ artifactId, title, payload }) => {
|
|
1141
1012
|
const markdown = typeof payload?.markdown === "string" ? payload.markdown : null;
|
|
1142
1013
|
if (!markdown) {
|
|
@@ -1153,20 +1024,7 @@ var ReportViewer = ({ artifactId, title, payload }) => {
|
|
|
1153
1024
|
style: { borderRadius: 12 },
|
|
1154
1025
|
title: title || "\u62A5\u544A",
|
|
1155
1026
|
extra: /* @__PURE__ */ jsxRuntime.jsx(antd.Space, { size: 4, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { size: "small", type: "text", onClick: exportMd, children: "\u5BFC\u51FAMD" }) }),
|
|
1156
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { lineHeight: 1.75 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1157
|
-
XMarkdown__default.default,
|
|
1158
|
-
{
|
|
1159
|
-
openLinksInNewTab: true,
|
|
1160
|
-
className: classNames5__default.default("x-markdown-light", "xMarkdownStyle"),
|
|
1161
|
-
components: {
|
|
1162
|
-
code: code_highlight_default,
|
|
1163
|
-
agentnavigate: agent_navigate_default,
|
|
1164
|
-
a: PreviewLinkComponent
|
|
1165
|
-
},
|
|
1166
|
-
config: getMarkdownConfig(),
|
|
1167
|
-
content: formatMixedContent(markdown)
|
|
1168
|
-
}
|
|
1169
|
-
) })
|
|
1027
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { lineHeight: 1.75 }, children: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: markdown }) })
|
|
1170
1028
|
}
|
|
1171
1029
|
);
|
|
1172
1030
|
};
|
|
@@ -1336,8 +1194,8 @@ function useBoundFieldState({
|
|
|
1336
1194
|
const valuePath = decodeBindPathToken(bindPathToken) ?? pathFromValue(value);
|
|
1337
1195
|
const cachedValue = readCachedValue(readPathValue(valuePath));
|
|
1338
1196
|
const externalValue = readExternalValue(value);
|
|
1339
|
-
const dirtyRef =
|
|
1340
|
-
const [localValue, setLocalValue] =
|
|
1197
|
+
const dirtyRef = React7__default.default.useRef(false);
|
|
1198
|
+
const [localValue, setLocalValue] = React7__default.default.useState(() => {
|
|
1341
1199
|
if (valuePath && cachedValue !== void 0) {
|
|
1342
1200
|
return cachedValue;
|
|
1343
1201
|
}
|
|
@@ -1350,10 +1208,10 @@ function useBoundFieldState({
|
|
|
1350
1208
|
if (cachedValue !== void 0) return cachedValue;
|
|
1351
1209
|
return defaultValue;
|
|
1352
1210
|
});
|
|
1353
|
-
|
|
1211
|
+
React7__default.default.useEffect(() => {
|
|
1354
1212
|
dirtyRef.current = false;
|
|
1355
1213
|
}, [valuePath]);
|
|
1356
|
-
|
|
1214
|
+
React7__default.default.useEffect(() => {
|
|
1357
1215
|
if (valuePath && cachedValue !== void 0) {
|
|
1358
1216
|
setLocalValue(cachedValue);
|
|
1359
1217
|
return;
|
|
@@ -1377,10 +1235,10 @@ function useBoundFieldState({
|
|
|
1377
1235
|
setLocalValue(cachedValue);
|
|
1378
1236
|
}
|
|
1379
1237
|
}, [cachedValue, externalValue, preferCachedOverExternal, valuePath]);
|
|
1380
|
-
|
|
1238
|
+
React7__default.default.useEffect(() => {
|
|
1381
1239
|
rememberPathValue(valuePath, localValue);
|
|
1382
1240
|
}, [valuePath, localValue]);
|
|
1383
|
-
const updateLocalValue =
|
|
1241
|
+
const updateLocalValue = React7__default.default.useCallback(
|
|
1384
1242
|
(nextValue) => {
|
|
1385
1243
|
dirtyRef.current = true;
|
|
1386
1244
|
setLocalValue(nextValue);
|
|
@@ -1400,7 +1258,7 @@ function emitFieldChange(nextValue, valuePath, updateLocalValue, onDataChange, o
|
|
|
1400
1258
|
onChange?.(nextValue);
|
|
1401
1259
|
}
|
|
1402
1260
|
function useControlId(id) {
|
|
1403
|
-
const autoId =
|
|
1261
|
+
const autoId = React7__default.default.useId();
|
|
1404
1262
|
return id ?? autoId;
|
|
1405
1263
|
}
|
|
1406
1264
|
function readActionEvent(action) {
|
|
@@ -1487,7 +1345,7 @@ var Switch = ({ id, label, value, bind_path_token, onChange, onDataChange }) =>
|
|
|
1487
1345
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, color: "#555" }, children: label })
|
|
1488
1346
|
] });
|
|
1489
1347
|
};
|
|
1490
|
-
var
|
|
1348
|
+
var Button5 = ({ label, variant = "default", onClick, action, onAction }) => {
|
|
1491
1349
|
const handleClick = () => {
|
|
1492
1350
|
if (onClick) {
|
|
1493
1351
|
onClick();
|
|
@@ -1517,7 +1375,7 @@ var A2uiComponents = {
|
|
|
1517
1375
|
TextField,
|
|
1518
1376
|
Select,
|
|
1519
1377
|
Switch,
|
|
1520
|
-
Button:
|
|
1378
|
+
Button: Button5,
|
|
1521
1379
|
Divider,
|
|
1522
1380
|
Tag,
|
|
1523
1381
|
Progress,
|
|
@@ -1527,7 +1385,7 @@ var A2uiComponents = {
|
|
|
1527
1385
|
ReportViewer
|
|
1528
1386
|
};
|
|
1529
1387
|
|
|
1530
|
-
// src/components/
|
|
1388
|
+
// src/components/CustomComponents/a2ui-runtime/controller/meta.ts
|
|
1531
1389
|
function readProp(current, props, key) {
|
|
1532
1390
|
return current[key] ?? props?.[key];
|
|
1533
1391
|
}
|
|
@@ -1633,7 +1491,7 @@ function collectActionDisplayMeta(commands, surfaceId, context) {
|
|
|
1633
1491
|
return Object.keys(labels).length || Object.keys(valueLabels).length ? { labels, valueLabels } : null;
|
|
1634
1492
|
}
|
|
1635
1493
|
|
|
1636
|
-
// src/components/
|
|
1494
|
+
// src/components/CustomComponents/a2ui-runtime/controller/action.ts
|
|
1637
1495
|
function extractPathFromRef2(value) {
|
|
1638
1496
|
if (typeof value === "string") {
|
|
1639
1497
|
if (value.startsWith("$bind:/")) return value.slice("$bind:".length);
|
|
@@ -1771,7 +1629,7 @@ function buildDispatchContext(surfaceId, rawContext, commands) {
|
|
|
1771
1629
|
};
|
|
1772
1630
|
}
|
|
1773
1631
|
|
|
1774
|
-
// src/components/
|
|
1632
|
+
// src/components/CustomComponents/a2ui-runtime/controller/visibility.ts
|
|
1775
1633
|
function extractSurfaceId(cmd) {
|
|
1776
1634
|
if (!cmd || typeof cmd !== "object") return "";
|
|
1777
1635
|
return cmd.createSurface?.surfaceId ?? cmd.updateComponents?.surfaceId ?? cmd.updateDataModel?.surfaceId ?? cmd.deleteSurface?.surfaceId ?? "";
|
|
@@ -1792,7 +1650,7 @@ function resolveVisibleSurfaceIds(commands, dismissedSurfaceIds = []) {
|
|
|
1792
1650
|
return Array.from(states.entries()).filter(([sid, st]) => !st.deleted && !dismissedSurfaceIds.includes(sid)).map(([sid]) => sid);
|
|
1793
1651
|
}
|
|
1794
1652
|
|
|
1795
|
-
// src/components/
|
|
1653
|
+
// src/components/CustomComponents/a2ui-runtime/controller/wizard.ts
|
|
1796
1654
|
function readString(obj, ...keys) {
|
|
1797
1655
|
for (const k of keys) {
|
|
1798
1656
|
const v = obj?.[k];
|
|
@@ -2001,7 +1859,7 @@ function buildWizardUpdateComponentsCommand(schema, stepId) {
|
|
|
2001
1859
|
};
|
|
2002
1860
|
}
|
|
2003
1861
|
|
|
2004
|
-
// src/components/
|
|
1862
|
+
// src/components/CustomComponents/a2ui-runtime/controller/runtime.ts
|
|
2005
1863
|
function createA2uiRuntimeState() {
|
|
2006
1864
|
return {
|
|
2007
1865
|
processedMessageCursors: [],
|
|
@@ -2201,7 +2059,7 @@ function selectA2uiRuntimeView(state, dismissedSurfaceIds) {
|
|
|
2201
2059
|
};
|
|
2202
2060
|
}
|
|
2203
2061
|
|
|
2204
|
-
// src/components/
|
|
2062
|
+
// src/components/CustomComponents/a2ui-runtime/controller/index.ts
|
|
2205
2063
|
function applyA2uiRuntimeEffects(effects) {
|
|
2206
2064
|
effects.forEach((effect) => {
|
|
2207
2065
|
if (effect.type === "reset-model-store") {
|
|
@@ -2217,23 +2075,23 @@ function applyA2uiRuntimeEffects(effects) {
|
|
|
2217
2075
|
}
|
|
2218
2076
|
function useA2uiController(params) {
|
|
2219
2077
|
const { conversationId, conversationMessages, dismissedSurfaceIds } = params;
|
|
2220
|
-
const runtimeRef =
|
|
2221
|
-
const [runtimeState, setRuntimeState] =
|
|
2222
|
-
|
|
2078
|
+
const runtimeRef = React7.useRef(createA2uiRuntimeState());
|
|
2079
|
+
const [runtimeState, setRuntimeState] = React7.useState(() => createA2uiRuntimeState());
|
|
2080
|
+
React7.useEffect(() => {
|
|
2223
2081
|
const nextState = createA2uiRuntimeState();
|
|
2224
2082
|
runtimeRef.current = nextState;
|
|
2225
2083
|
setRuntimeState(nextState);
|
|
2226
2084
|
clearAllModelValues();
|
|
2227
2085
|
}, [conversationId]);
|
|
2228
|
-
|
|
2086
|
+
React7.useEffect(() => {
|
|
2229
2087
|
const result = reduceA2uiRuntimeMessages(runtimeRef.current, conversationMessages || []);
|
|
2230
2088
|
if (result.state === runtimeRef.current && result.effects.length === 0) return;
|
|
2231
2089
|
runtimeRef.current = result.state;
|
|
2232
2090
|
applyA2uiRuntimeEffects(result.effects);
|
|
2233
2091
|
setRuntimeState(result.state);
|
|
2234
2092
|
}, [conversationMessages, conversationId]);
|
|
2235
|
-
const view =
|
|
2236
|
-
const handleRuntimeAction =
|
|
2093
|
+
const view = React7.useMemo(() => selectA2uiRuntimeView(runtimeState, dismissedSurfaceIds), [runtimeState, dismissedSurfaceIds]);
|
|
2094
|
+
const handleRuntimeAction = React7.useCallback((payload) => {
|
|
2237
2095
|
const surfaceId = String(payload?.surfaceId || payload?.cardId || "");
|
|
2238
2096
|
const name = String(payload?.name || payload?.event?.name || "").trim();
|
|
2239
2097
|
const rawContext = payload?.context || payload?.event?.context || {};
|
|
@@ -2254,15 +2112,15 @@ function useA2uiController(params) {
|
|
|
2254
2112
|
handleRuntimeAction
|
|
2255
2113
|
};
|
|
2256
2114
|
}
|
|
2257
|
-
var A2uiRuntimeContext =
|
|
2115
|
+
var A2uiRuntimeContext = React7__default.default.createContext({
|
|
2258
2116
|
commands: [],
|
|
2259
2117
|
onAction: () => void 0,
|
|
2260
2118
|
surfaceIdsByMessageIndex: {}
|
|
2261
2119
|
});
|
|
2262
2120
|
|
|
2263
|
-
// src/components/
|
|
2121
|
+
// src/components/CustomComponents/a2ui-runtime/renderer/useA2uiRuntimeView.ts
|
|
2264
2122
|
function useA2uiRuntimeView() {
|
|
2265
|
-
return
|
|
2123
|
+
return React7__default.default.useContext(A2uiRuntimeContext);
|
|
2266
2124
|
}
|
|
2267
2125
|
function A2uiMessageCards({ messageIndex }) {
|
|
2268
2126
|
const { surfaceIdsByMessageIndex } = useA2uiRuntimeView();
|
|
@@ -2271,7 +2129,7 @@ function A2uiMessageCards({ messageIndex }) {
|
|
|
2271
2129
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: surfaceIds.map((surfaceId) => /* @__PURE__ */ jsxRuntime.jsx(XCard.Card, { id: surfaceId }, surfaceId)) });
|
|
2272
2130
|
}
|
|
2273
2131
|
|
|
2274
|
-
// src/components/
|
|
2132
|
+
// src/components/CustomComponents/a2ui-runtime/renderer/protocol.ts
|
|
2275
2133
|
function isSubmitLikeActionName2(name) {
|
|
2276
2134
|
const normalized = String(name || "").trim();
|
|
2277
2135
|
return normalized === "submit" || normalized === "confirm" || normalized.startsWith("submit_") || normalized.endsWith(".confirm");
|
|
@@ -2371,11 +2229,6 @@ function shouldHideA2uiPlan(item) {
|
|
|
2371
2229
|
return (kind === "form" || kind === "wizard" || kind === "dashboard") && !!surfaceId;
|
|
2372
2230
|
});
|
|
2373
2231
|
}
|
|
2374
|
-
function formatMixedContent2(content) {
|
|
2375
|
-
return content.replace(/<!DOCTYPE html>[\s\S]*?<\/html>/gi, (match) => `\`\`\`html
|
|
2376
|
-
${match}
|
|
2377
|
-
\`\`\``);
|
|
2378
|
-
}
|
|
2379
2232
|
function extractPlanPayload(plan) {
|
|
2380
2233
|
if (!plan || typeof plan !== "object") return null;
|
|
2381
2234
|
const raw = plan;
|
|
@@ -2424,16 +2277,7 @@ function ViewerPlan({ payload }) {
|
|
|
2424
2277
|
|
|
2425
2278
|
${description || ""}`.trim() : "";
|
|
2426
2279
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
2427
|
-
header ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2428
|
-
XMarkdown__default.default,
|
|
2429
|
-
{
|
|
2430
|
-
openLinksInNewTab: true,
|
|
2431
|
-
className: classNames5__default.default("x-markdown-light", "xMarkdownStyle"),
|
|
2432
|
-
components: { code: code_highlight_default, agentnavigate: agent_navigate_default },
|
|
2433
|
-
config: getMarkdownConfig(),
|
|
2434
|
-
content: formatMixedContent2(header)
|
|
2435
|
-
}
|
|
2436
|
-
) : null,
|
|
2280
|
+
header ? /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: header }) : null,
|
|
2437
2281
|
artifacts.map((artifact, index) => renderArtifact(artifact, index))
|
|
2438
2282
|
] });
|
|
2439
2283
|
}
|
|
@@ -2451,16 +2295,7 @@ function A2uiPlanNode({ item }) {
|
|
|
2451
2295
|
${JSON.stringify(item.plan, null, 2)}
|
|
2452
2296
|
\`\`\`` : "";
|
|
2453
2297
|
if (!title && !content) return null;
|
|
2454
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2455
|
-
XMarkdown__default.default,
|
|
2456
|
-
{
|
|
2457
|
-
openLinksInNewTab: true,
|
|
2458
|
-
className: classNames5__default.default("x-markdown-light", "xMarkdownStyle"),
|
|
2459
|
-
components: { code: code_highlight_default, agentnavigate: agent_navigate_default },
|
|
2460
|
-
config: getMarkdownConfig(),
|
|
2461
|
-
content: formatMixedContent2(`${title}${content}`)
|
|
2462
|
-
}
|
|
2463
|
-
);
|
|
2298
|
+
return /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: `${title}${content}` });
|
|
2464
2299
|
}
|
|
2465
2300
|
function extractSurfaceId3(command) {
|
|
2466
2301
|
if (!command || typeof command !== "object") return "";
|
|
@@ -2499,19 +2334,19 @@ function A2uiRuntimeProvider({ messages, children }) {
|
|
|
2499
2334
|
const chatStore = useChatStore();
|
|
2500
2335
|
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
2501
2336
|
const conversationId = conversationState.active.id;
|
|
2502
|
-
const processedMessageCursorsRef =
|
|
2503
|
-
const latestCommandIndexBySurfaceRef =
|
|
2504
|
-
const commandIndexRef =
|
|
2505
|
-
const [latestCommandIndexBySurface, setLatestCommandIndexBySurface] =
|
|
2506
|
-
const [dismissedAtBySurface, setDismissedAtBySurface] =
|
|
2507
|
-
|
|
2337
|
+
const processedMessageCursorsRef = React7__default.default.useRef([]);
|
|
2338
|
+
const latestCommandIndexBySurfaceRef = React7__default.default.useRef({});
|
|
2339
|
+
const commandIndexRef = React7__default.default.useRef(-1);
|
|
2340
|
+
const [latestCommandIndexBySurface, setLatestCommandIndexBySurface] = React7__default.default.useState({});
|
|
2341
|
+
const [dismissedAtBySurface, setDismissedAtBySurface] = React7__default.default.useState({});
|
|
2342
|
+
React7__default.default.useEffect(() => {
|
|
2508
2343
|
processedMessageCursorsRef.current = [];
|
|
2509
2344
|
latestCommandIndexBySurfaceRef.current = {};
|
|
2510
2345
|
commandIndexRef.current = -1;
|
|
2511
2346
|
setLatestCommandIndexBySurface({});
|
|
2512
2347
|
setDismissedAtBySurface({});
|
|
2513
2348
|
}, [conversationId]);
|
|
2514
|
-
|
|
2349
|
+
React7__default.default.useEffect(() => {
|
|
2515
2350
|
const { shouldReplayAll, nextCursors, pendingItems } = diffMessages(messages, processedMessageCursorsRef.current);
|
|
2516
2351
|
const itemsToProcess = shouldReplayAll ? messages.flatMap((message3) => {
|
|
2517
2352
|
const items = Array.isArray(message3?.content) ? message3.content : [];
|
|
@@ -2534,10 +2369,10 @@ function A2uiRuntimeProvider({ messages, children }) {
|
|
|
2534
2369
|
commandIndexRef.current = nextCommandIndex;
|
|
2535
2370
|
setLatestCommandIndexBySurface(nextLatestCommandIndexBySurface);
|
|
2536
2371
|
}, [messages]);
|
|
2537
|
-
const dismissedSurfaceIds =
|
|
2372
|
+
const dismissedSurfaceIds = React7__default.default.useMemo(() => {
|
|
2538
2373
|
return Object.entries(dismissedAtBySurface).filter(([surfaceId, dismissedAt]) => (latestCommandIndexBySurface[surfaceId] ?? -1) <= dismissedAt).map(([surfaceId]) => surfaceId);
|
|
2539
2374
|
}, [dismissedAtBySurface, latestCommandIndexBySurface]);
|
|
2540
|
-
const dispatchA2uiAction =
|
|
2375
|
+
const dispatchA2uiAction = React7__default.default.useCallback(
|
|
2541
2376
|
async (payload) => {
|
|
2542
2377
|
const actionPayload = normalizeA2uiActionPayload(payload);
|
|
2543
2378
|
if (!actionPayload.name) return;
|
|
@@ -2564,7 +2399,7 @@ function A2uiRuntimeProvider({ messages, children }) {
|
|
|
2564
2399
|
conversationMessages: messages,
|
|
2565
2400
|
dismissedSurfaceIds
|
|
2566
2401
|
});
|
|
2567
|
-
const onAction =
|
|
2402
|
+
const onAction = React7__default.default.useCallback(
|
|
2568
2403
|
(payload) => {
|
|
2569
2404
|
const result = handleRuntimeAction(payload);
|
|
2570
2405
|
if (result.handled || !result.name) return;
|
|
@@ -2577,7 +2412,7 @@ function A2uiRuntimeProvider({ messages, children }) {
|
|
|
2577
2412
|
},
|
|
2578
2413
|
[commands, dispatchA2uiAction, handleRuntimeAction, runtimeState.modelPathBySurface]
|
|
2579
2414
|
);
|
|
2580
|
-
const contextValue =
|
|
2415
|
+
const contextValue = React7__default.default.useMemo(
|
|
2581
2416
|
() => ({ commands, onAction, surfaceIdsByMessageIndex: anchoredSurfaceIdsByMessageIndex }),
|
|
2582
2417
|
[anchoredSurfaceIdsByMessageIndex, commands, onAction]
|
|
2583
2418
|
);
|
|
@@ -2586,12 +2421,218 @@ function A2uiRuntimeProvider({ messages, children }) {
|
|
|
2586
2421
|
function A2uiRenderer(props) {
|
|
2587
2422
|
return /* @__PURE__ */ jsxRuntime.jsx(A2uiRuntimeProvider, { ...props });
|
|
2588
2423
|
}
|
|
2424
|
+
|
|
2425
|
+
// src/components/CustomComponents/tool-renders/index.module.less
|
|
2426
|
+
var index_module_default = {
|
|
2427
|
+
iconContainer: "index_module_iconContainer",
|
|
2428
|
+
toolName: "index_module_toolName",
|
|
2429
|
+
duration: "index_module_duration",
|
|
2430
|
+
statusIcon: "index_module_statusIcon",
|
|
2431
|
+
sectionLabel: "index_module_sectionLabel",
|
|
2432
|
+
markdownContainer: "index_module_markdownContainer",
|
|
2433
|
+
sectionBlock: "index_module_sectionBlock",
|
|
2434
|
+
todoList: "index_module_todoList",
|
|
2435
|
+
todoItem: "index_module_todoItem",
|
|
2436
|
+
statusIconWrapper: "index_module_statusIconWrapper",
|
|
2437
|
+
todoContent: "index_module_todoContent",
|
|
2438
|
+
todoText: "index_module_todoText",
|
|
2439
|
+
completed: "index_module_completed",
|
|
2440
|
+
emptyText: "index_module_emptyText"
|
|
2441
|
+
};
|
|
2442
|
+
var DefaultToolRender = ({ argsContent, resultContent, errorMessage, item }) => {
|
|
2443
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2444
|
+
(item.content || item.arguments) && argsContent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default.sectionBlock, children: [
|
|
2445
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default.sectionLabel, children: "\u8F93\u5165\u53C2\u6570" }),
|
|
2446
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.markdownContainer, children: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: argsContent.isJson ? `\`\`\`json
|
|
2447
|
+
${argsContent.text}
|
|
2448
|
+
\`\`\`` : argsContent.text }) })
|
|
2449
|
+
] }),
|
|
2450
|
+
item.result && resultContent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default.sectionBlock, children: [
|
|
2451
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default.sectionLabel, children: "\u8FD4\u56DE\u7ED3\u679C" }),
|
|
2452
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.markdownContainer, children: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: resultContent.isJson ? `\`\`\`json
|
|
2453
|
+
${resultContent.text}
|
|
2454
|
+
\`\`\`` : resultContent.text }) })
|
|
2455
|
+
] }),
|
|
2456
|
+
errorMessage && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default.sectionBlock, children: [
|
|
2457
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default.sectionLabel, children: "\u9519\u8BEF\u4FE1\u606F" }),
|
|
2458
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.markdownContainer, children: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: `\`\`\`
|
|
2459
|
+
${errorMessage}
|
|
2460
|
+
\`\`\`` }) })
|
|
2461
|
+
] })
|
|
2462
|
+
] });
|
|
2463
|
+
};
|
|
2464
|
+
var default_render_default = DefaultToolRender;
|
|
2465
|
+
var TodoWriteRender = ({ args, result }) => {
|
|
2466
|
+
const { token } = antd.theme.useToken();
|
|
2467
|
+
const todos = Array.isArray(result) ? result : result?.todos || (Array.isArray(args) ? args : args?.todos) || [];
|
|
2468
|
+
const getStatusIcon = (status) => {
|
|
2469
|
+
switch (status) {
|
|
2470
|
+
case "completed":
|
|
2471
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircleOutlined, { style: { color: token.colorSuccess } });
|
|
2472
|
+
case "in_progress":
|
|
2473
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.ClockCircleOutlined, { style: { color: token.colorPrimary } });
|
|
2474
|
+
case "pending":
|
|
2475
|
+
default:
|
|
2476
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.ClockCircleOutlined, { style: { color: token.colorTextTertiary } });
|
|
2477
|
+
}
|
|
2478
|
+
};
|
|
2479
|
+
if (!todos || todos.length === 0) {
|
|
2480
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { type: "secondary", className: index_module_default.emptyText, children: "\u6682\u65E0\u4EFB\u52A1" });
|
|
2481
|
+
}
|
|
2482
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2483
|
+
antd.List,
|
|
2484
|
+
{
|
|
2485
|
+
size: "small",
|
|
2486
|
+
dataSource: todos,
|
|
2487
|
+
renderItem: (item) => /* @__PURE__ */ jsxRuntime.jsxs(antd.List.Item, { className: index_module_default.todoItem, children: [
|
|
2488
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.statusIconWrapper, children: getStatusIcon(item.status) }),
|
|
2489
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.todoContent, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: `${index_module_default.todoText} ${item.status === "completed" ? index_module_default.completed : ""}`, children: item.title || item.content }) })
|
|
2490
|
+
] }),
|
|
2491
|
+
className: index_module_default.todoList
|
|
2492
|
+
}
|
|
2493
|
+
);
|
|
2494
|
+
};
|
|
2495
|
+
var todo_write_render_default = TodoWriteRender;
|
|
2496
|
+
var toolRenders = {
|
|
2497
|
+
todo_write: {
|
|
2498
|
+
component: todo_write_render_default,
|
|
2499
|
+
defaultExpanded: false,
|
|
2500
|
+
alwaysShowContent: (args, result) => {
|
|
2501
|
+
const todos = Array.isArray(result) ? result : result?.todos || (Array.isArray(args) ? args : args?.todos) || [];
|
|
2502
|
+
return todos && todos.length > 0;
|
|
2503
|
+
},
|
|
2504
|
+
hideStatus: true,
|
|
2505
|
+
disableExpandOnError: true
|
|
2506
|
+
}
|
|
2507
|
+
};
|
|
2508
|
+
var getToolRenderConfig = (toolName) => {
|
|
2509
|
+
if (toolName && toolRenders[toolName]) {
|
|
2510
|
+
return toolRenders[toolName];
|
|
2511
|
+
}
|
|
2512
|
+
return {
|
|
2513
|
+
component: default_render_default,
|
|
2514
|
+
defaultExpanded: false,
|
|
2515
|
+
alwaysShowContent: false
|
|
2516
|
+
};
|
|
2517
|
+
};
|
|
2518
|
+
var formatContent = (content) => {
|
|
2519
|
+
try {
|
|
2520
|
+
if (!content) return { text: "", isJson: false, parsed: null };
|
|
2521
|
+
if (typeof content === "object") {
|
|
2522
|
+
return { text: JSON.stringify(content, null, 2), isJson: true, parsed: content };
|
|
2523
|
+
}
|
|
2524
|
+
const parsed = JSON.parse(content);
|
|
2525
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
2526
|
+
return { text: JSON.stringify(parsed, null, 2), isJson: true, parsed };
|
|
2527
|
+
}
|
|
2528
|
+
return { text: content, isJson: false, parsed: null };
|
|
2529
|
+
} catch {
|
|
2530
|
+
return { text: typeof content === "string" ? content : "", isJson: false, parsed: null };
|
|
2531
|
+
}
|
|
2532
|
+
};
|
|
2533
|
+
var ToolCallItem = ({ item }) => {
|
|
2534
|
+
const { token } = antd.theme.useToken();
|
|
2535
|
+
const renderConfig = getToolRenderConfig(item.toolName);
|
|
2536
|
+
const CustomRender = renderConfig.component;
|
|
2537
|
+
const status = React7.useMemo(() => {
|
|
2538
|
+
if (item.status) return item.status;
|
|
2539
|
+
if (item.errorMessage) return "error";
|
|
2540
|
+
if (item.result) return "success";
|
|
2541
|
+
return "running";
|
|
2542
|
+
}, [item.status, item.errorMessage, item.result]);
|
|
2543
|
+
const argsContent = React7.useMemo(() => formatContent(item.arguments || item.content), [item.arguments, item.content]);
|
|
2544
|
+
const resultContent = React7.useMemo(() => item.result ? formatContent(item.result) : null, [item.result]);
|
|
2545
|
+
const hasContent = React7.useMemo(() => {
|
|
2546
|
+
if (renderConfig.disableExpandOnError && status === "error") return false;
|
|
2547
|
+
let alwaysShow = false;
|
|
2548
|
+
if (typeof renderConfig.alwaysShowContent === "function") {
|
|
2549
|
+
alwaysShow = renderConfig.alwaysShowContent(argsContent.parsed, resultContent?.parsed);
|
|
2550
|
+
} else if (renderConfig.alwaysShowContent) {
|
|
2551
|
+
alwaysShow = renderConfig.alwaysShowContent;
|
|
2552
|
+
}
|
|
2553
|
+
if (alwaysShow) return true;
|
|
2554
|
+
return Boolean(item.errorMessage);
|
|
2555
|
+
}, [renderConfig.disableExpandOnError, renderConfig.alwaysShowContent, item.errorMessage, status, argsContent.parsed, resultContent?.parsed]);
|
|
2556
|
+
const isDefaultExpanded = React7.useMemo(() => {
|
|
2557
|
+
if (typeof renderConfig.defaultExpanded === "function") {
|
|
2558
|
+
return renderConfig.defaultExpanded(argsContent.parsed, resultContent?.parsed);
|
|
2559
|
+
}
|
|
2560
|
+
return renderConfig.defaultExpanded;
|
|
2561
|
+
}, [renderConfig.defaultExpanded, argsContent.parsed, resultContent?.parsed]);
|
|
2562
|
+
const statusConfig = {
|
|
2563
|
+
running: {
|
|
2564
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, {}),
|
|
2565
|
+
color: token.colorPrimary
|
|
2566
|
+
},
|
|
2567
|
+
success: {
|
|
2568
|
+
icon: null,
|
|
2569
|
+
color: token.colorSuccess
|
|
2570
|
+
},
|
|
2571
|
+
error: {
|
|
2572
|
+
icon: null,
|
|
2573
|
+
color: token.colorSuccess
|
|
2574
|
+
},
|
|
2575
|
+
pending: {
|
|
2576
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, {}),
|
|
2577
|
+
color: token.colorTextSecondary
|
|
2578
|
+
}
|
|
2579
|
+
}[status] || {
|
|
2580
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, {}),
|
|
2581
|
+
color: token.colorPrimary
|
|
2582
|
+
};
|
|
2583
|
+
const renderIcon = () => {
|
|
2584
|
+
if (!item.toolIcon) {
|
|
2585
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.ToolOutlined, { style: { fontSize: 14, color: token.colorTextSecondary } });
|
|
2586
|
+
}
|
|
2587
|
+
const isUrl = /^(http|\/)/.test(item.toolIcon);
|
|
2588
|
+
if (isUrl) {
|
|
2589
|
+
return /* @__PURE__ */ jsxRuntime.jsx("img", { src: item.toolIcon, alt: "tool-icon", style: { width: "100%", height: "100%", objectFit: "contain" } });
|
|
2590
|
+
}
|
|
2591
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 14, lineHeight: 1 }, children: item.toolIcon });
|
|
2592
|
+
};
|
|
2593
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2594
|
+
antd.Collapse,
|
|
2595
|
+
{
|
|
2596
|
+
style: { width: "70%" },
|
|
2597
|
+
collapsible: hasContent ? void 0 : "disabled",
|
|
2598
|
+
defaultActiveKey: isDefaultExpanded && hasContent ? [item.toolCallId || "fallback-key"] : void 0,
|
|
2599
|
+
expandIconPlacement: "end",
|
|
2600
|
+
styles: {
|
|
2601
|
+
header: {
|
|
2602
|
+
padding: "6px 10px"
|
|
2603
|
+
}
|
|
2604
|
+
},
|
|
2605
|
+
items: [
|
|
2606
|
+
{
|
|
2607
|
+
key: item.toolCallId || "fallback-key",
|
|
2608
|
+
showArrow: hasContent,
|
|
2609
|
+
label: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", gap: 8, style: { flex: 1, minWidth: 0 }, children: [
|
|
2610
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.iconContainer, children: renderIcon() }),
|
|
2611
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: index_module_default.toolName, children: item.title || item.toolName || "Unknown Tool" }),
|
|
2612
|
+
(status === "running" || status === "pending") && /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.statusIcon, style: { color: statusConfig.color }, children: statusConfig.icon }),
|
|
2613
|
+
item.duration && /* @__PURE__ */ jsxRuntime.jsxs(antd.Typography.Text, { className: index_module_default.duration, children: [
|
|
2614
|
+
item.duration,
|
|
2615
|
+
"ms"
|
|
2616
|
+
] })
|
|
2617
|
+
] }),
|
|
2618
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2619
|
+
CustomRender,
|
|
2620
|
+
{
|
|
2621
|
+
item,
|
|
2622
|
+
args: argsContent.parsed,
|
|
2623
|
+
result: resultContent?.parsed,
|
|
2624
|
+
argsContent,
|
|
2625
|
+
resultContent,
|
|
2626
|
+
errorMessage: item.errorMessage
|
|
2627
|
+
}
|
|
2628
|
+
)
|
|
2629
|
+
}
|
|
2630
|
+
]
|
|
2631
|
+
}
|
|
2632
|
+
);
|
|
2633
|
+
};
|
|
2634
|
+
var tool_call_item_default = ToolCallItem;
|
|
2589
2635
|
var RENDERABLE_MESSAGE_TYPES = ["runStarted", "toolCall", "toolResult", "text", "stepError", "files", "plan"];
|
|
2590
|
-
function formatMixedContent3(content) {
|
|
2591
|
-
return content.replace(/<!DOCTYPE html>[\s\S]*?<\/html>/gi, (match) => `\`\`\`html
|
|
2592
|
-
${match}
|
|
2593
|
-
\`\`\``);
|
|
2594
|
-
}
|
|
2595
2636
|
function QuestionSummary({ content }) {
|
|
2596
2637
|
const answer = content.replace(/^Question:\s*/, "").trim() || "\u5DF2\u56DE\u7B54";
|
|
2597
2638
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: 4 }, children: [
|
|
@@ -2599,56 +2640,33 @@ function QuestionSummary({ content }) {
|
|
|
2599
2640
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, color: "#262626", lineHeight: 1.6, whiteSpace: "pre-wrap" }, children: answer })
|
|
2600
2641
|
] });
|
|
2601
2642
|
}
|
|
2602
|
-
var RunStartedNode =
|
|
2643
|
+
var RunStartedNode = React7__default.default.memo(({ loading }) => {
|
|
2603
2644
|
if (!loading) return null;
|
|
2604
2645
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, align: "center", className: styles_module_default.runStartedNode, children: /* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, { style: { color: "#1677ff" } }) });
|
|
2605
2646
|
});
|
|
2606
|
-
var ToolCallNode =
|
|
2647
|
+
var ToolCallNode = React7__default.default.memo(({ item }) => {
|
|
2607
2648
|
return /* @__PURE__ */ jsxRuntime.jsx(tool_call_item_default, { item });
|
|
2608
2649
|
});
|
|
2609
|
-
var TextNode =
|
|
2650
|
+
var TextNode = React7__default.default.memo(({ item, role, customComponents }) => {
|
|
2610
2651
|
const content = toA2uiDisplayText(role, item?.messageContent);
|
|
2611
2652
|
if (typeof content === "string" && content.startsWith("Question:")) {
|
|
2612
2653
|
return /* @__PURE__ */ jsxRuntime.jsx(QuestionSummary, { content });
|
|
2613
2654
|
}
|
|
2614
2655
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2615
2656
|
!!item.reasoningContent && /* @__PURE__ */ jsxRuntime.jsx(xV2.Think, { title: "\u6DF1\u5EA6\u601D\u8003", children: item.reasoningContent }),
|
|
2616
|
-
!!content && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2617
|
-
XMarkdown__default.default,
|
|
2618
|
-
{
|
|
2619
|
-
openLinksInNewTab: true,
|
|
2620
|
-
className: classNames5__default.default("x-markdown-light", "xMarkdownStyle"),
|
|
2621
|
-
components: {
|
|
2622
|
-
code: code_highlight_default,
|
|
2623
|
-
agentnavigate: agent_navigate_default,
|
|
2624
|
-
a: PreviewLinkComponent,
|
|
2625
|
-
...customComponents
|
|
2626
|
-
},
|
|
2627
|
-
config: getMarkdownConfig(),
|
|
2628
|
-
content: formatMixedContent3(content)
|
|
2629
|
-
}
|
|
2630
|
-
)
|
|
2657
|
+
!!content && /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { components: customComponents, content })
|
|
2631
2658
|
] });
|
|
2632
2659
|
});
|
|
2633
|
-
var StepErrorNode =
|
|
2660
|
+
var StepErrorNode = React7__default.default.memo(({ item, customComponents }) => {
|
|
2634
2661
|
if (!item.errorMessage) return null;
|
|
2635
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2636
|
-
XMarkdown__default.default,
|
|
2637
|
-
{
|
|
2638
|
-
openLinksInNewTab: true,
|
|
2639
|
-
className: classNames5__default.default("x-markdown-light", "xMarkdownStyle"),
|
|
2640
|
-
components: { code: code_highlight_default, agentnavigate: agent_navigate_default, ...customComponents },
|
|
2641
|
-
config: getMarkdownConfig(),
|
|
2642
|
-
content: item.errorMessage
|
|
2643
|
-
}
|
|
2644
|
-
);
|
|
2662
|
+
return /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { components: customComponents, content: item.errorMessage });
|
|
2645
2663
|
});
|
|
2646
|
-
var FilesNode =
|
|
2664
|
+
var FilesNode = React7__default.default.memo(({ item }) => {
|
|
2647
2665
|
const chatStore = useChatStore();
|
|
2648
2666
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
2649
2667
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
2650
2668
|
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
2651
|
-
const fileItems =
|
|
2669
|
+
const fileItems = React7.useMemo(() => {
|
|
2652
2670
|
return (item.files || []).map((file) => {
|
|
2653
2671
|
const previewUrl = configState.services.request.getPreviewUrl(agentState.agentInfo.id, conversationState.active.id, file.path);
|
|
2654
2672
|
let fileType = "file";
|
|
@@ -2670,8 +2688,8 @@ var FilesNode = React9__default.default.memo(({ item }) => {
|
|
|
2670
2688
|
}, [item.files]);
|
|
2671
2689
|
return /* @__PURE__ */ jsxRuntime.jsx(xV2.FileCard.List, { items: fileItems });
|
|
2672
2690
|
});
|
|
2673
|
-
var MessageRender_default =
|
|
2674
|
-
const content =
|
|
2691
|
+
var MessageRender_default = React7__default.default.memo(({ role, message: message3, messageIndex = -1, loading, containerRef, customComponents }) => {
|
|
2692
|
+
const content = React7.useMemo(() => {
|
|
2675
2693
|
return (message3.content || []).filter((item) => {
|
|
2676
2694
|
if (!RENDERABLE_MESSAGE_TYPES.includes(item.type)) {
|
|
2677
2695
|
return false;
|
|
@@ -2685,26 +2703,65 @@ var MessageRender_default = React9__default.default.memo(({ role, message: messa
|
|
|
2685
2703
|
return true;
|
|
2686
2704
|
});
|
|
2687
2705
|
}, [loading, message3.content]);
|
|
2706
|
+
const quoteMsg = React7.useMemo(() => {
|
|
2707
|
+
const quoteMsg2 = {};
|
|
2708
|
+
if (message3.params) {
|
|
2709
|
+
try {
|
|
2710
|
+
const citation = JSON.parse(message3.params).citation;
|
|
2711
|
+
if (citation) {
|
|
2712
|
+
quoteMsg2.messageContent = citation;
|
|
2713
|
+
}
|
|
2714
|
+
} catch (e) {
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2717
|
+
return common.isEmptyObj(quoteMsg2) ? null : quoteMsg2;
|
|
2718
|
+
}, [message3.params, message3.quoteMsg]);
|
|
2688
2719
|
if (content.length === 0) return null;
|
|
2689
2720
|
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { ref: containerRef, vertical: true, gap: 8, children: [
|
|
2690
2721
|
content.map((item, index) => {
|
|
2691
2722
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2692
2723
|
xV2.Bubble,
|
|
2693
2724
|
{
|
|
2725
|
+
role: role.user,
|
|
2694
2726
|
className: "m-t-8",
|
|
2695
2727
|
placement: role.placement,
|
|
2696
2728
|
variant: item.type === "files" ? "borderless" : void 0,
|
|
2697
2729
|
content: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2698
2730
|
item.type === "runStarted" && /* @__PURE__ */ jsxRuntime.jsx(RunStartedNode, { loading }, `flow-start-${index}`),
|
|
2699
2731
|
(item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsxRuntime.jsx(ToolCallNode, { item }, `tool-call-${item.toolCallId || index}`),
|
|
2700
|
-
item.type === "text" && /* @__PURE__ */ jsxRuntime.jsx(TextNode, { item, role: message3.role, customComponents }, `message-${index}`),
|
|
2732
|
+
item.type === "text" && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(TextNode, { item, role: message3.role, customComponents }, `message-${index}`) }),
|
|
2701
2733
|
item.type === "stepError" && /* @__PURE__ */ jsxRuntime.jsx(StepErrorNode, { item, customComponents }, `step-error-${index}`),
|
|
2702
2734
|
item.type === "files" && /* @__PURE__ */ jsxRuntime.jsx(FilesNode, { item }, `files-${index}`),
|
|
2703
2735
|
item.type === "plan" && /* @__PURE__ */ jsxRuntime.jsx(A2uiPlanNode, { item }, `plan-${index}`)
|
|
2704
2736
|
] })
|
|
2705
|
-
}
|
|
2737
|
+
},
|
|
2738
|
+
`message-${index}`
|
|
2706
2739
|
);
|
|
2707
2740
|
}),
|
|
2741
|
+
quoteMsg && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2742
|
+
xV2.Bubble,
|
|
2743
|
+
{
|
|
2744
|
+
className: styles_module_default.chatQuoteMsg,
|
|
2745
|
+
placement: role.placement,
|
|
2746
|
+
variant: "borderless",
|
|
2747
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 8, children: quoteMsg.messageContent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2748
|
+
antd.Tooltip,
|
|
2749
|
+
{
|
|
2750
|
+
arrow: false,
|
|
2751
|
+
classNames: {
|
|
2752
|
+
root: styles_module_default.quoteTooltip,
|
|
2753
|
+
container: `${styles_module_default.quoteTooltipContainer} scroll-fade-in`
|
|
2754
|
+
},
|
|
2755
|
+
title: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: quoteMsg.messageContent }),
|
|
2756
|
+
getPopupContainer: (node) => node,
|
|
2757
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
2758
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
2759
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: "text-ellipsis-2", children: quoteMsg.messageContent })
|
|
2760
|
+
] })
|
|
2761
|
+
}
|
|
2762
|
+
) })
|
|
2763
|
+
}
|
|
2764
|
+
),
|
|
2708
2765
|
messageIndex >= 0 ? /* @__PURE__ */ jsxRuntime.jsx(A2uiMessageCards, { messageIndex }) : null
|
|
2709
2766
|
] });
|
|
2710
2767
|
});
|
|
@@ -3526,18 +3583,20 @@ function createChatStore() {
|
|
|
3526
3583
|
}
|
|
3527
3584
|
processMessageContent(newMessage);
|
|
3528
3585
|
};
|
|
3529
|
-
const sendMessage = async (message3,
|
|
3586
|
+
const sendMessage = async (message3, msgFiles = [], params) => {
|
|
3530
3587
|
const conversationId = conversation.active.id;
|
|
3531
3588
|
if (conversation.messages[conversationId].loading) return;
|
|
3532
|
-
let msgContent = "";
|
|
3589
|
+
let msgContent = "", files;
|
|
3533
3590
|
const references = conversation.messages[conversationId].references;
|
|
3534
3591
|
if (message3) {
|
|
3535
3592
|
msgContent = message3;
|
|
3593
|
+
files = msgFiles;
|
|
3536
3594
|
} else {
|
|
3537
3595
|
if (references?.type === 1 && references?.content?.msgContent) {
|
|
3538
|
-
msgContent = references.content.msgContent + "\n";
|
|
3596
|
+
msgContent = references.content.msgContent + "\n\n";
|
|
3539
3597
|
}
|
|
3540
3598
|
msgContent = msgContent + conversation.messages[conversationId].content;
|
|
3599
|
+
files = conversation.messages[conversationId].files;
|
|
3541
3600
|
}
|
|
3542
3601
|
if (!msgContent) return;
|
|
3543
3602
|
const canProceed = await config.hooks?.onBeforeSend?.(msgContent, files || []);
|
|
@@ -3567,7 +3626,7 @@ function createChatStore() {
|
|
|
3567
3626
|
conversationId,
|
|
3568
3627
|
message: msgContent,
|
|
3569
3628
|
convMeta: config.params.convMeta,
|
|
3570
|
-
files
|
|
3629
|
+
files,
|
|
3571
3630
|
params,
|
|
3572
3631
|
spec: {
|
|
3573
3632
|
...conversation.active.spec,
|
|
@@ -3578,7 +3637,7 @@ function createChatStore() {
|
|
|
3578
3637
|
};
|
|
3579
3638
|
const extraParams = common.deepCopy(config.params?.params || {});
|
|
3580
3639
|
const userInputParams = variablesToObject(agent.agentInfo.userInput || []);
|
|
3581
|
-
Object.assign(extraParams, userInputParams);
|
|
3640
|
+
Object.assign(extraParams, userInputParams, message3 ? {} : { ...references?.params, params });
|
|
3582
3641
|
sendParams.params = extraParams;
|
|
3583
3642
|
if (!message3) {
|
|
3584
3643
|
setContent("");
|
|
@@ -3684,7 +3743,7 @@ function createChatStore() {
|
|
|
3684
3743
|
}
|
|
3685
3744
|
|
|
3686
3745
|
// src/ui/common/styles.module.less
|
|
3687
|
-
var
|
|
3746
|
+
var styles_module_default3 = {
|
|
3688
3747
|
chatHeader: "styles_module_chatHeader",
|
|
3689
3748
|
chatTitle: "styles_module_chatTitle",
|
|
3690
3749
|
popover: "styles_module_popover",
|
|
@@ -3713,7 +3772,7 @@ var ConversationList_default = () => {
|
|
|
3713
3772
|
const chatStore = useChatStore();
|
|
3714
3773
|
const conversationsState = valtio.useSnapshot(chatStore.conversations);
|
|
3715
3774
|
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
3716
|
-
const conversationList =
|
|
3775
|
+
const conversationList = React7.useMemo(() => {
|
|
3717
3776
|
return conversationsState.list.items.filter((item) => item.label);
|
|
3718
3777
|
}, [conversationsState.list.items]);
|
|
3719
3778
|
const menuConfig = (conversation) => ({
|
|
@@ -3746,7 +3805,7 @@ var ConversationList_default = () => {
|
|
|
3746
3805
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3747
3806
|
xV2.Conversations,
|
|
3748
3807
|
{
|
|
3749
|
-
className:
|
|
3808
|
+
className: styles_module_default3.conversations,
|
|
3750
3809
|
items: conversationList,
|
|
3751
3810
|
activeKey: conversationState.active.id,
|
|
3752
3811
|
onActiveChange: async (id) => chatStore.switchConversation(id),
|
|
@@ -3761,17 +3820,17 @@ var ChatHeader_default = ({ title = true, avatar = true, closeBtn = false, newCo
|
|
|
3761
3820
|
const chatStore = useChatStore();
|
|
3762
3821
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
3763
3822
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
3764
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", className:
|
|
3823
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", className: classNames2__default.default(styles_module_default3.chatHeader, "zero-chat-header"), children: [
|
|
3765
3824
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, align: "center", children: [
|
|
3766
3825
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3767
3826
|
common.RenderWrapper,
|
|
3768
3827
|
{
|
|
3769
3828
|
control: avatar,
|
|
3770
|
-
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 22, src: agentState.agentInfo.iconUrl, alt: agentState.agentInfo.name })
|
|
3829
|
+
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 22, src: agentState.agentInfo.iconUrl || getChatCopilotLogo(), alt: agentState.agentInfo.name })
|
|
3771
3830
|
}
|
|
3772
3831
|
),
|
|
3773
3832
|
" ",
|
|
3774
|
-
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: title, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
3833
|
+
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: title, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.chatTitle, children: agentState.agentInfo.name }) })
|
|
3775
3834
|
] }),
|
|
3776
3835
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { size: 2, children: [
|
|
3777
3836
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3790,7 +3849,7 @@ var ChatHeader_default = ({ title = true, avatar = true, closeBtn = false, newCo
|
|
|
3790
3849
|
{
|
|
3791
3850
|
getPopupContainer: (e) => e,
|
|
3792
3851
|
placement: "bottom",
|
|
3793
|
-
classNames: { container:
|
|
3852
|
+
classNames: { container: styles_module_default3.popover },
|
|
3794
3853
|
content: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}),
|
|
3795
3854
|
trigger: ["click"],
|
|
3796
3855
|
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { title: "\u5386\u53F2\u4F1A\u8BDD", type: "text", size: "large", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CommentOutlined, {}) })
|
|
@@ -3818,7 +3877,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
3818
3877
|
common.RenderWrapper,
|
|
3819
3878
|
{
|
|
3820
3879
|
control: avatar,
|
|
3821
|
-
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 50, src: agentState.agentInfo?.iconUrl, shape: "square", style: { flexShrink: 0 }, children: (agentState.agentInfo?.name || "AI").slice(0, 1) })
|
|
3880
|
+
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 50, src: agentState.agentInfo?.iconUrl || getChatCopilotLogo(), shape: "square", style: { flexShrink: 0 }, children: (agentState.agentInfo?.name || "AI").slice(0, 1) })
|
|
3822
3881
|
}
|
|
3823
3882
|
),
|
|
3824
3883
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3826,8 +3885,8 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
3826
3885
|
{
|
|
3827
3886
|
control: title,
|
|
3828
3887
|
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 4, flex: 1, style: { minWidth: 0 }, children: [
|
|
3829
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text2, { strong: true, className:
|
|
3830
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text2, { type: "secondary", ellipsis: true, className:
|
|
3888
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text2, { strong: true, className: classNames2__default.default("fz-16"), children: agentState.agentInfo.name }),
|
|
3889
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text2, { type: "secondary", ellipsis: true, className: classNames2__default.default("fz-12"), children: agentState.agentInfo.description })
|
|
3831
3890
|
] }) })
|
|
3832
3891
|
}
|
|
3833
3892
|
)
|
|
@@ -3842,7 +3901,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
3842
3901
|
block: true,
|
|
3843
3902
|
type: "primary",
|
|
3844
3903
|
onClick: () => chatStore.createConversation(),
|
|
3845
|
-
className:
|
|
3904
|
+
className: classNames2__default.default(styles_module_default3.createConversationButton),
|
|
3846
3905
|
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
|
|
3847
3906
|
children: "\u65B0\u5EFA\u4F1A\u8BDD"
|
|
3848
3907
|
}
|
|
@@ -3852,7 +3911,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
3852
3911
|
] });
|
|
3853
3912
|
};
|
|
3854
3913
|
var ConversationListPanel = ({ header }) => {
|
|
3855
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className:
|
|
3914
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("height-full", "zero-chat-conversations", styles_module_default3.conversationListPanel), children: [
|
|
3856
3915
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
|
|
3857
3916
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
|
|
3858
3917
|
] });
|
|
@@ -3861,19 +3920,25 @@ var ConversationListPanel_default = ConversationListPanel;
|
|
|
3861
3920
|
var WelcomeItem_default = ({ icon = true, title = true, description = true, prompts = true }) => {
|
|
3862
3921
|
const chatStore = useChatStore();
|
|
3863
3922
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
3864
|
-
const recommendQuestions =
|
|
3923
|
+
const recommendQuestions = React7.useMemo(() => {
|
|
3865
3924
|
return agentState.agentInfo?.config?.onboarding?.guiding?.map((item, index) => ({
|
|
3866
3925
|
key: String(index),
|
|
3867
3926
|
description: item
|
|
3868
3927
|
}));
|
|
3869
3928
|
}, [agentState.agentInfo?.config?.onboarding?.guiding]);
|
|
3870
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, justify: "center", className:
|
|
3929
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, justify: "center", className: styles_module_default3.chatWelcomeWrap, children: [
|
|
3871
3930
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3872
3931
|
xV2.Welcome,
|
|
3873
3932
|
{
|
|
3874
|
-
className:
|
|
3933
|
+
className: classNames2__default.default(styles_module_default3.chatWelcome, "p-t-32"),
|
|
3875
3934
|
variant: "borderless",
|
|
3876
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3935
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3936
|
+
common.RenderWrapper,
|
|
3937
|
+
{
|
|
3938
|
+
control: icon,
|
|
3939
|
+
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { shape: "square", size: 58, src: agentState.agentInfo?.iconUrl || getChatCopilotLogo() })
|
|
3940
|
+
}
|
|
3941
|
+
),
|
|
3877
3942
|
title: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: title, DefaultComponent: `\u4F60\u597D\uFF0C\u6211\u662F${agentState.agentInfo?.name || ""}` }),
|
|
3878
3943
|
description: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3879
3944
|
common.RenderWrapper,
|
|
@@ -3891,7 +3956,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
|
|
|
3891
3956
|
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3892
3957
|
xV2.Prompts,
|
|
3893
3958
|
{
|
|
3894
|
-
className:
|
|
3959
|
+
className: classNames2__default.default("m-t-16", styles_module_default3.promptItem),
|
|
3895
3960
|
wrap: true,
|
|
3896
3961
|
onItemClick: (info) => chatStore.sendMessage(info.data.description),
|
|
3897
3962
|
items: recommendQuestions
|
|
@@ -3915,7 +3980,7 @@ var BubbleListItems_default = ({
|
|
|
3915
3980
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
3916
3981
|
const isDebug = configState.params.convMeta.mode === CONV_MODE.DEBUG;
|
|
3917
3982
|
const isWorkFlow = agentState.agentInfo.agentType === 1 /* FLOW */;
|
|
3918
|
-
const conversationRoles =
|
|
3983
|
+
const conversationRoles = React7.useMemo(() => {
|
|
3919
3984
|
const roles = {};
|
|
3920
3985
|
if (agentState.agentInfo?.id) {
|
|
3921
3986
|
roles.agent = {
|
|
@@ -3933,7 +3998,7 @@ var BubbleListItems_default = ({
|
|
|
3933
3998
|
};
|
|
3934
3999
|
return roles;
|
|
3935
4000
|
}, [agentState.agentInfo.id]);
|
|
3936
|
-
const chatMessage =
|
|
4001
|
+
const chatMessage = React7.useMemo(
|
|
3937
4002
|
() => conversationState.messages[conversationState.active.id] || {},
|
|
3938
4003
|
[conversationState.messages[conversationState.active.id]]
|
|
3939
4004
|
);
|
|
@@ -3942,8 +4007,8 @@ var BubbleListItems_default = ({
|
|
|
3942
4007
|
const roleKey = Object.keys(conversationRoles).find((key) => conversationRoles[key].role === role);
|
|
3943
4008
|
return conversationRoles[roleKey] || {};
|
|
3944
4009
|
};
|
|
3945
|
-
const messageRefs =
|
|
3946
|
-
const chatRecords =
|
|
4010
|
+
const messageRefs = React7.useRef({});
|
|
4011
|
+
const chatRecords = React7.useMemo(() => {
|
|
3947
4012
|
const chatRecords2 = [];
|
|
3948
4013
|
conversationMessages.forEach((message3, messageIndex) => {
|
|
3949
4014
|
const role = getRole(message3.role);
|
|
@@ -4045,31 +4110,37 @@ var BubbleListItems_default = ({
|
|
|
4045
4110
|
});
|
|
4046
4111
|
return chatRecords2;
|
|
4047
4112
|
}, [agentActions, chatStore, conversationMessages, conversationRoles, conversationState.active.id, isDebug, isWorkFlow]);
|
|
4048
|
-
const firstMessagesRecord =
|
|
4113
|
+
const firstMessagesRecord = React7.useMemo(() => {
|
|
4049
4114
|
return (firstMessages || []).map((firstMessage, index) => {
|
|
4050
|
-
const {
|
|
4051
|
-
const roleObj = getRole(
|
|
4115
|
+
const { member, content, contentRender, ...args } = firstMessage;
|
|
4116
|
+
const roleObj = getRole(member);
|
|
4052
4117
|
return {
|
|
4053
4118
|
key: `firstMessage-${index}`,
|
|
4054
4119
|
role: roleObj.user,
|
|
4055
4120
|
placement: roleObj.placement,
|
|
4056
4121
|
avatar: roleObj.avatar,
|
|
4122
|
+
styles: {
|
|
4123
|
+
body: {
|
|
4124
|
+
width: "auto"
|
|
4125
|
+
}
|
|
4126
|
+
},
|
|
4057
4127
|
variant: "borderless",
|
|
4058
|
-
...args
|
|
4128
|
+
...args,
|
|
4129
|
+
content: contentRender ? contentRender({ index, member }) : content
|
|
4059
4130
|
};
|
|
4060
4131
|
});
|
|
4061
4132
|
}, [firstMessages, conversationRoles]);
|
|
4062
|
-
const welcomeMessageRecord =
|
|
4063
|
-
|
|
4064
|
-
return [
|
|
4133
|
+
const welcomeMessageRecord = React7.useMemo(() => {
|
|
4134
|
+
const isExist = common.shouldRender(welcomeMessage);
|
|
4135
|
+
return isExist ? [
|
|
4065
4136
|
{
|
|
4066
4137
|
key: "welcome-message",
|
|
4067
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4138
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: welcomeMessage, DefaultComponent: WelcomeItem_default }),
|
|
4068
4139
|
variant: "borderless"
|
|
4069
4140
|
}
|
|
4070
|
-
];
|
|
4071
|
-
}, [welcomeMessage]);
|
|
4072
|
-
const bubbleListItems =
|
|
4141
|
+
] : [];
|
|
4142
|
+
}, [welcomeMessage, agentState.agentInfo.id]);
|
|
4143
|
+
const bubbleListItems = React7.useMemo(() => {
|
|
4073
4144
|
const list = [];
|
|
4074
4145
|
list.push(...firstMessagesRecord);
|
|
4075
4146
|
list.push(...chatRecords);
|
|
@@ -4078,21 +4149,21 @@ var BubbleListItems_default = ({
|
|
|
4078
4149
|
}
|
|
4079
4150
|
return [...welcomeMessageRecord];
|
|
4080
4151
|
}, [chatRecords, welcomeMessageRecord, firstMessagesRecord]);
|
|
4081
|
-
const listRef =
|
|
4082
|
-
const autoScrollRef =
|
|
4152
|
+
const listRef = React7.useRef(null);
|
|
4153
|
+
const autoScrollRef = React7.useRef(true);
|
|
4083
4154
|
const handleScroll = (el) => {
|
|
4084
4155
|
const target = el.target;
|
|
4085
4156
|
const distanceToBottom = target.scrollHeight - target.scrollTop - target.clientHeight;
|
|
4086
4157
|
autoScrollRef.current = distanceToBottom < 90;
|
|
4087
4158
|
};
|
|
4088
|
-
|
|
4159
|
+
React7.useEffect(() => {
|
|
4089
4160
|
const latestMessage = conversationMessages[conversationMessages?.length - 1];
|
|
4090
4161
|
if (!latestMessage) return;
|
|
4091
4162
|
if (latestMessage.generating) {
|
|
4092
4163
|
autoScrollRef.current = true;
|
|
4093
4164
|
}
|
|
4094
4165
|
}, [conversationMessages?.length]);
|
|
4095
|
-
|
|
4166
|
+
React7.useEffect(() => {
|
|
4096
4167
|
const el = listRef.current?.nativeElement;
|
|
4097
4168
|
if (!el || !bubbleListItems.length) return;
|
|
4098
4169
|
if (autoScrollRef.current) {
|
|
@@ -4112,7 +4183,7 @@ var BubbleListItems_default = ({
|
|
|
4112
4183
|
autoScroll: false,
|
|
4113
4184
|
ref: listRef,
|
|
4114
4185
|
items: bubbleListItems,
|
|
4115
|
-
className:
|
|
4186
|
+
className: classNames2__default.default(styles_module_default3.bubbleList, "height-full", "scroll-fade-in"),
|
|
4116
4187
|
onScroll: handleScroll
|
|
4117
4188
|
},
|
|
4118
4189
|
conversationState.active.id
|
|
@@ -4159,9 +4230,9 @@ window._iconfont_svg_string_5021436 = '<svg><symbol id="icon-MiniMax" viewBox="0
|
|
|
4159
4230
|
}
|
|
4160
4231
|
})(window);
|
|
4161
4232
|
|
|
4162
|
-
// src/components/
|
|
4233
|
+
// src/components/IconFont/index.ts
|
|
4163
4234
|
var IconFont = icons.createFromIconfontCN({});
|
|
4164
|
-
var
|
|
4235
|
+
var IconFont_default = IconFont;
|
|
4165
4236
|
var { Text: Text4 } = antd.Typography;
|
|
4166
4237
|
var FeaturesRenderer_default = ({ skillsBtn, knowledgeBtn }) => {
|
|
4167
4238
|
const chatStore = useChatStore();
|
|
@@ -4170,10 +4241,10 @@ var FeaturesRenderer_default = ({ skillsBtn, knowledgeBtn }) => {
|
|
|
4170
4241
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4171
4242
|
antd.Flex,
|
|
4172
4243
|
{
|
|
4173
|
-
className:
|
|
4244
|
+
className: classNames2__default.default(styles_module_default3.resourceBtn, { [styles_module_default3.resourceBtnActive]: agentState.model.reasoning }),
|
|
4174
4245
|
onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
|
|
4175
4246
|
children: [
|
|
4176
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4247
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-remark" }),
|
|
4177
4248
|
/* @__PURE__ */ jsxRuntime.jsx(Text4, { style: { color: agentState.model.reasoning ? "#fff" : "#000" }, children: "\u6DF1\u5EA6\u601D\u8003" })
|
|
4178
4249
|
]
|
|
4179
4250
|
}
|
|
@@ -4185,10 +4256,10 @@ var FeaturesRenderer_default = ({ skillsBtn, knowledgeBtn }) => {
|
|
|
4185
4256
|
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4186
4257
|
antd.Flex,
|
|
4187
4258
|
{
|
|
4188
|
-
className:
|
|
4259
|
+
className: classNames2__default.default(styles_module_default3.resourceBtn, { [styles_module_default3.resourceBtnActive]: agentState.model.reasoning }),
|
|
4189
4260
|
onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
|
|
4190
4261
|
children: [
|
|
4191
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4262
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-remark" }),
|
|
4192
4263
|
/* @__PURE__ */ jsxRuntime.jsx(Text4, { style: { color: agentState.model.reasoning ? "#fff" : "#000" }, children: "\u6280\u80FD" })
|
|
4193
4264
|
]
|
|
4194
4265
|
}
|
|
@@ -4202,10 +4273,10 @@ var FeaturesRenderer_default = ({ skillsBtn, knowledgeBtn }) => {
|
|
|
4202
4273
|
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4203
4274
|
antd.Flex,
|
|
4204
4275
|
{
|
|
4205
|
-
className:
|
|
4276
|
+
className: classNames2__default.default(styles_module_default3.resourceBtn, { [styles_module_default3.resourceBtnActive]: agentState.model.reasoning }),
|
|
4206
4277
|
onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
|
|
4207
4278
|
children: [
|
|
4208
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4279
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-remark" }),
|
|
4209
4280
|
/* @__PURE__ */ jsxRuntime.jsx(Text4, { style: { color: agentState.model.reasoning ? "#fff" : "#000" }, children: "\u77E5\u8BC6\u5E93" })
|
|
4210
4281
|
]
|
|
4211
4282
|
}
|
|
@@ -4214,18 +4285,18 @@ var FeaturesRenderer_default = ({ skillsBtn, knowledgeBtn }) => {
|
|
|
4214
4285
|
)
|
|
4215
4286
|
] });
|
|
4216
4287
|
};
|
|
4217
|
-
var ChatSender_default2 =
|
|
4288
|
+
var ChatSender_default2 = React7.forwardRef(
|
|
4218
4289
|
({ placeholder, extraBtn = false, referencesBtn = false, sendBtnProps, footerBelow = false, skillsBtn = false, knowledgeBtn = false }, ref) => {
|
|
4219
4290
|
const chatStore = useChatStore();
|
|
4220
4291
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
4221
4292
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
4222
4293
|
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
4223
4294
|
const fileUploadRequest = (formData, signal) => configState.services.request.chatUpload(agentState.agentInfo.id, formData, conversationState.active.id, signal);
|
|
4224
|
-
const chatMessage =
|
|
4295
|
+
const chatMessage = React7.useMemo(
|
|
4225
4296
|
() => conversationState.messages[conversationState.active.id] || {},
|
|
4226
4297
|
[conversationState.messages[conversationState.active.id]]
|
|
4227
4298
|
);
|
|
4228
|
-
const referenceContent =
|
|
4299
|
+
const referenceContent = React7.useMemo(() => {
|
|
4229
4300
|
const content = chatMessage.references?.content?.name;
|
|
4230
4301
|
if (content) {
|
|
4231
4302
|
return common.markdownToText(content);
|
|
@@ -4271,8 +4342,8 @@ var ChatSender_default2 = React9.forwardRef(
|
|
|
4271
4342
|
open: !!referenceContent,
|
|
4272
4343
|
onOpenChange: () => chatStore.setReferences(),
|
|
4273
4344
|
classNames: {
|
|
4274
|
-
header:
|
|
4275
|
-
content: common.shouldRender(referencesBtn) ? "" :
|
|
4345
|
+
header: styles_module_default3.senderReferenceHeaderTitle,
|
|
4346
|
+
content: common.shouldRender(referencesBtn) ? "" : styles_module_default3.senderReferenceHeaderContent
|
|
4276
4347
|
},
|
|
4277
4348
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4278
4349
|
common.RenderWrapper,
|
|
@@ -4290,35 +4361,32 @@ var ChatSender_default2 = React9.forwardRef(
|
|
|
4290
4361
|
) });
|
|
4291
4362
|
}
|
|
4292
4363
|
);
|
|
4293
|
-
|
|
4294
|
-
// src/assets/images/logo.png
|
|
4295
|
-
var logo_default = "./logo-BX4TAWHK.png";
|
|
4296
4364
|
var ChatSenderHeader = () => {
|
|
4297
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
4298
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
4299
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
4300
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
4365
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default3.logoArea, children: [
|
|
4366
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default3.logoContainer, children: [
|
|
4367
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.staticHalo }),
|
|
4368
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.logoHoverWrapper, children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: getChatCopilotLogo(), alt: "LoLR.AI Logo", className: styles_module_default3.logoImage }) })
|
|
4301
4369
|
] }),
|
|
4302
|
-
/* @__PURE__ */ jsxRuntime.jsxs("h1", { className:
|
|
4370
|
+
/* @__PURE__ */ jsxRuntime.jsxs("h1", { className: styles_module_default3.greetingTitle, children: [
|
|
4303
4371
|
"\u4F60\u597D\uFF0C\u6211\u662F ",
|
|
4304
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className:
|
|
4372
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles_module_default3.gradientText, children: "LoLR.AI" })
|
|
4305
4373
|
] }),
|
|
4306
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className:
|
|
4374
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: styles_module_default3.greetingSubtitle, children: "\u4ECA\u5929\u60F3\u63A2\u7D22\u70B9\u4EC0\u4E48\uFF1F" })
|
|
4307
4375
|
] });
|
|
4308
4376
|
};
|
|
4309
4377
|
var ChatSenderHeader_default = ChatSenderHeader;
|
|
4310
4378
|
var MonacoEditor = ({ value = "", onChange, placeholder, height = 200, readOnly = false, style }) => {
|
|
4311
|
-
const handleKeyDownCapture =
|
|
4379
|
+
const handleKeyDownCapture = React7.useCallback((e) => {
|
|
4312
4380
|
if (e.key === " " || e.code === "Space") {
|
|
4313
4381
|
e.stopPropagation();
|
|
4314
4382
|
}
|
|
4315
4383
|
}, []);
|
|
4316
|
-
const handleKeyUpCapture =
|
|
4384
|
+
const handleKeyUpCapture = React7.useCallback((e) => {
|
|
4317
4385
|
if (e.key === " " || e.code === "Space") {
|
|
4318
4386
|
e.stopPropagation();
|
|
4319
4387
|
}
|
|
4320
4388
|
}, []);
|
|
4321
|
-
const handleScriptChange =
|
|
4389
|
+
const handleScriptChange = React7.useCallback(
|
|
4322
4390
|
(event) => {
|
|
4323
4391
|
onChange?.(event.target.value || "");
|
|
4324
4392
|
},
|
|
@@ -4341,7 +4409,7 @@ var MonacoEditor = ({ value = "", onChange, placeholder, height = 200, readOnly
|
|
|
4341
4409
|
}
|
|
4342
4410
|
) });
|
|
4343
4411
|
};
|
|
4344
|
-
var
|
|
4412
|
+
var MonacoEditor_default = MonacoEditor;
|
|
4345
4413
|
var { Text: Text5 } = antd.Typography;
|
|
4346
4414
|
var START_NODE_TYPE = "start";
|
|
4347
4415
|
var FormFileUpload = ({ value, onChange, multiple = false }) => {
|
|
@@ -4425,25 +4493,25 @@ var FormFileUpload = ({ value, onChange, multiple = false }) => {
|
|
|
4425
4493
|
};
|
|
4426
4494
|
var FormMonacoEditor = ({ value, onChange }) => {
|
|
4427
4495
|
const { token } = antd.theme.useToken();
|
|
4428
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { backgroundColor: token.colorFillAlter, padding: 8, borderRadius: token.borderRadius }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4496
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { backgroundColor: token.colorFillAlter, padding: 8, borderRadius: token.borderRadius }, children: /* @__PURE__ */ jsxRuntime.jsx(MonacoEditor_default, { language: "json", placeholder: "\u8BF7\u8F93\u5165\u503C...", height: 80, value, onChange }) });
|
|
4429
4497
|
};
|
|
4430
4498
|
var UserInputPanel = () => {
|
|
4431
4499
|
const chatStore = useChatStore();
|
|
4432
4500
|
const agentSnap = valtio.useSnapshot(chatStore.agent);
|
|
4433
4501
|
const flowSpecSnap = valtio.useSnapshot(flowSpecState);
|
|
4434
4502
|
const [form] = antd.Form.useForm();
|
|
4435
|
-
const [activeKey, setActiveKey] =
|
|
4503
|
+
const [activeKey, setActiveKey] = React7.useState(["1"]);
|
|
4436
4504
|
const { layout } = valtio.useSnapshot(chatStore.config);
|
|
4437
|
-
const startNode =
|
|
4505
|
+
const startNode = React7.useMemo(() => {
|
|
4438
4506
|
return flowSpecSnap.nodes.find((n) => String(n.type || "").toLowerCase() === START_NODE_TYPE);
|
|
4439
4507
|
}, [flowSpecSnap.nodes]);
|
|
4440
|
-
const inputs =
|
|
4508
|
+
const inputs = React7.useMemo(() => {
|
|
4441
4509
|
if (agentSnap.agentInfo.userInput?.length > 0) {
|
|
4442
4510
|
return agentSnap.agentInfo.userInput.filter((i) => i.enableEdit);
|
|
4443
4511
|
}
|
|
4444
4512
|
return (startNode?.data.input || []).filter((i) => i.enableEdit);
|
|
4445
4513
|
}, [startNode, agentSnap.agentInfo.userInput]);
|
|
4446
|
-
|
|
4514
|
+
React7.useEffect(() => {
|
|
4447
4515
|
if (inputs.length > 0) {
|
|
4448
4516
|
const initialValues = inputs.reduce((acc, cur) => {
|
|
4449
4517
|
const value = cur.value;
|
|
@@ -4602,12 +4670,12 @@ var UserInputPanel = () => {
|
|
|
4602
4670
|
label: "\u53C2\u6570\u8BBE\u7F6E",
|
|
4603
4671
|
extra: genExtra(),
|
|
4604
4672
|
children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4605
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Form, { form, layout: "vertical", onValuesChange: handleValuesChange, style: { maxHeight: 500, overflow: "auto", paddingRight: 16 }, children: inputs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 12, children: inputs.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4673
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Form, { form, layout: "vertical", onValuesChange: handleValuesChange, style: { maxHeight: 500, overflow: "auto", paddingRight: 16 }, children: inputs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 12, children: inputs.map((item) => /* @__PURE__ */ jsxRuntime.jsx(React7__default.default.Fragment, { children: renderFormItem(item) }, item.name)) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "10px", color: "#999", textAlign: "center" }, children: "\u6682\u65E0\u7528\u6237\u8F93\u5165\u5B57\u6BB5" }) }),
|
|
4606
4674
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", justify: "center", className: "m-t-16", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "primary", onClick: handleStartChat, children: "\u5F00\u59CB\u4F1A\u8BDD" }) })
|
|
4607
4675
|
] })
|
|
4608
4676
|
}
|
|
4609
4677
|
];
|
|
4610
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
4678
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.userInputCollapse, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4611
4679
|
antd.Collapse,
|
|
4612
4680
|
{
|
|
4613
4681
|
activeKey,
|
|
@@ -4629,7 +4697,7 @@ var UserInputPanel = () => {
|
|
|
4629
4697
|
var UserInputPanel_default = UserInputPanel;
|
|
4630
4698
|
|
|
4631
4699
|
// src/ui/layouts/components/styles.module.less
|
|
4632
|
-
var
|
|
4700
|
+
var styles_module_default4 = {
|
|
4633
4701
|
bodyWidth: "styles_module_bodyWidth",
|
|
4634
4702
|
inputContainer: "styles_module_inputContainer",
|
|
4635
4703
|
disclaimerNotice: "styles_module_disclaimerNotice",
|
|
@@ -4638,11 +4706,11 @@ var styles_module_default3 = {
|
|
|
4638
4706
|
closeIcon: "styles_module_closeIcon",
|
|
4639
4707
|
rotateIcon: "styles_module_rotateIcon"
|
|
4640
4708
|
};
|
|
4641
|
-
var ChatMainPanel =
|
|
4642
|
-
|
|
4709
|
+
var ChatMainPanel = React7.memo(
|
|
4710
|
+
React7.forwardRef((_props, ref) => {
|
|
4643
4711
|
const chatStore = useChatStore();
|
|
4644
|
-
const senderRef =
|
|
4645
|
-
|
|
4712
|
+
const senderRef = React7.useRef(null);
|
|
4713
|
+
React7.useImperativeHandle(
|
|
4646
4714
|
ref,
|
|
4647
4715
|
() => ({
|
|
4648
4716
|
focus: (options) => {
|
|
@@ -4653,19 +4721,19 @@ var ChatMainPanel = React9.memo(
|
|
|
4653
4721
|
);
|
|
4654
4722
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
4655
4723
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
4656
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className:
|
|
4724
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("height-full"), children: [
|
|
4657
4725
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
|
|
4658
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "center", align: "center", vertical: true, gap: 24, className:
|
|
4726
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "center", align: "center", vertical: true, gap: 24, className: classNames2__default.default("height-full", styles_module_default4.bodyWidth), children: [
|
|
4659
4727
|
common.shouldRender(agentState.agentInfo.userInput && agentState.agentInfo.userInput.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { DefaultComponent: UserInputPanel_default }),
|
|
4660
4728
|
common.shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
|
|
4661
4729
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.senderHeader, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(ChatSenderHeader_default, {}) }),
|
|
4662
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className:
|
|
4730
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: styles_module_default4.inputContainer, vertical: true, gap: 8, children: [
|
|
4663
4731
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { ref: senderRef, DefaultComponent: ChatSender_default2 }),
|
|
4664
4732
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4665
4733
|
common.RenderWrapper,
|
|
4666
4734
|
{
|
|
4667
4735
|
control: configState.layout.disclaimerNotice,
|
|
4668
|
-
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
4736
|
+
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default4.disclaimerNotice, children: "\u5185\u5BB9\u7531AI\u751F\u6210\uFF0C\u4EC5\u4F9B\u53C2\u8003\uFF0C\u8BF7\u4ED4\u7EC6\u7504\u522B" })
|
|
4669
4737
|
}
|
|
4670
4738
|
),
|
|
4671
4739
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.senderFooter })
|
|
@@ -4675,16 +4743,17 @@ var ChatMainPanel = React9.memo(
|
|
|
4675
4743
|
})
|
|
4676
4744
|
);
|
|
4677
4745
|
var ChatMainPanel_default = ChatMainPanel;
|
|
4678
|
-
var
|
|
4746
|
+
var { Text: Text6 } = antd.Typography;
|
|
4747
|
+
var ChatPreviewPanel = React7.memo(({ agentId, conversationId, file }) => {
|
|
4679
4748
|
const chatStore = useChatStore();
|
|
4680
4749
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
4681
|
-
const fileUrl =
|
|
4750
|
+
const fileUrl = React7.useMemo(() => {
|
|
4682
4751
|
if (file?.fileUrl) return file.fileUrl;
|
|
4683
4752
|
if (!file?.path || !agentId || !conversationId) return "";
|
|
4684
4753
|
const previewUrl = configState.services.request.getPreviewUrl(agentId, conversationId, file.path);
|
|
4685
4754
|
return previewUrl;
|
|
4686
4755
|
}, [agentId, conversationId, file]);
|
|
4687
|
-
const suffix =
|
|
4756
|
+
const suffix = React7.useMemo(() => {
|
|
4688
4757
|
const name = file?.fileName || file?.path || "";
|
|
4689
4758
|
return name.split(".").pop() || file?.ext || "";
|
|
4690
4759
|
}, [file]);
|
|
@@ -4701,11 +4770,14 @@ var ChatPreviewPanel = React9.memo(({ agentId, conversationId, file }) => {
|
|
|
4701
4770
|
}
|
|
4702
4771
|
};
|
|
4703
4772
|
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, style: { height: "100%", overflow: "hidden" }, children: [
|
|
4704
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "
|
|
4705
|
-
|
|
4706
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4773
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", className: styles_module_default4.previewHeader, children: [
|
|
4774
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text6, { strong: true, children: file?.fileName || file?.path || "" }),
|
|
4775
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
4776
|
+
file?.path && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default4.previewCloseBtn, onClick: handleDownload, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DownloadOutlined, {}), className: styles_module_default4.closeIcon }) }),
|
|
4777
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default(styles_module_default4.previewCloseBtn, styles_module_default4.rotateIcon), onClick: () => chatStore.setPreview({ path: "", fileName: "" }), children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {}), className: styles_module_default4.closeIcon }) })
|
|
4778
|
+
] })
|
|
4707
4779
|
] }),
|
|
4708
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(common.
|
|
4780
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(common.LuyaFilePreview, { fileUrl, suffix }) })
|
|
4709
4781
|
] });
|
|
4710
4782
|
});
|
|
4711
4783
|
var ChatPreviewPanel_default = ChatPreviewPanel;
|
|
@@ -4717,10 +4789,10 @@ var index_module_default2 = {
|
|
|
4717
4789
|
animatedSplitter: "index_module_animatedSplitter",
|
|
4718
4790
|
hideSplitterBar: "index_module_hideSplitterBar"
|
|
4719
4791
|
};
|
|
4720
|
-
var layouts_default =
|
|
4721
|
-
const chatStore =
|
|
4722
|
-
const senderRef =
|
|
4723
|
-
|
|
4792
|
+
var layouts_default = React7.forwardRef(({ theme: theme4, params, hooks, layout, config, services }, _ref) => {
|
|
4793
|
+
const chatStore = React7.useMemo(() => createChatStore(), []);
|
|
4794
|
+
const senderRef = React7.useRef(null);
|
|
4795
|
+
React7.useImperativeHandle(
|
|
4724
4796
|
_ref,
|
|
4725
4797
|
() => ({
|
|
4726
4798
|
sendMessage: chatStore.sendMessage,
|
|
@@ -4741,20 +4813,20 @@ var layouts_default = React9.forwardRef(({ theme: theme4, params, hooks, layout,
|
|
|
4741
4813
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
4742
4814
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
4743
4815
|
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
4744
|
-
const containerRef =
|
|
4745
|
-
|
|
4816
|
+
const containerRef = React7.useRef(null);
|
|
4817
|
+
React7.useEffect(() => {
|
|
4746
4818
|
chatStore.setHooks(hooks);
|
|
4747
4819
|
}, [hooks]);
|
|
4748
|
-
|
|
4820
|
+
React7.useEffect(() => {
|
|
4749
4821
|
chatStore.setLayout(layout);
|
|
4750
4822
|
}, [layout]);
|
|
4751
|
-
|
|
4823
|
+
React7.useEffect(() => {
|
|
4752
4824
|
chatStore.setParams(params);
|
|
4753
4825
|
}, [params]);
|
|
4754
4826
|
common.useDeepEffect(() => {
|
|
4755
4827
|
chatStore.setServices(services);
|
|
4756
4828
|
}, [services]);
|
|
4757
|
-
|
|
4829
|
+
React7.useEffect(() => {
|
|
4758
4830
|
chatStore.getModels();
|
|
4759
4831
|
}, []);
|
|
4760
4832
|
common.useDeepEffect(() => {
|
|
@@ -4782,14 +4854,14 @@ var layouts_default = React9.forwardRef(({ theme: theme4, params, hooks, layout,
|
|
|
4782
4854
|
chatStore.initConversation(config);
|
|
4783
4855
|
}
|
|
4784
4856
|
}, [agentState.agentInfo.id, config.conversationId]);
|
|
4785
|
-
const hasPreView =
|
|
4857
|
+
const hasPreView = React7.useMemo(() => {
|
|
4786
4858
|
return common.shouldRender(configState.layout.preview) && !!configState.preview.file.path;
|
|
4787
4859
|
}, [configState.layout.preview, configState.preview.file]);
|
|
4788
|
-
const [sizes, setSizes] =
|
|
4860
|
+
const [sizes, setSizes] = React7.useState([0, "100%"]);
|
|
4789
4861
|
const setSplitterSizes = (sizes2) => {
|
|
4790
4862
|
setSizes(sizes2);
|
|
4791
4863
|
};
|
|
4792
|
-
|
|
4864
|
+
React7.useEffect(() => {
|
|
4793
4865
|
if (hasPreView) {
|
|
4794
4866
|
setSplitterSizes(["50%", "50%"]);
|
|
4795
4867
|
} else {
|
|
@@ -4808,15 +4880,15 @@ var layouts_default = React9.forwardRef(({ theme: theme4, params, hooks, layout,
|
|
|
4808
4880
|
clientHeartbeat: false,
|
|
4809
4881
|
reconnectInterval: 1e4
|
|
4810
4882
|
});
|
|
4811
|
-
|
|
4883
|
+
React7.useEffect(() => {
|
|
4812
4884
|
hooks?.onBeforeInit?.();
|
|
4813
4885
|
}, []);
|
|
4814
|
-
return /* @__PURE__ */ jsxRuntime.jsx(xV2.XProvider, { theme: { cssVar: {}, ...theme4 }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: configState.loading, classNames: { root: index_module_default2.spinWrapper }, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className:
|
|
4886
|
+
return /* @__PURE__ */ jsxRuntime.jsx(xV2.XProvider, { theme: { cssVar: {}, ...theme4 }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: configState.loading, classNames: { root: index_module_default2.spinWrapper }, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default(index_module_default2.chatLayout, "zero-chat-layout", "height-full"), children: [
|
|
4815
4887
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
|
|
4816
4888
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { ref: containerRef, className: "full-scroll", children: [
|
|
4817
4889
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.leftPanel }),
|
|
4818
4890
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.conversationList, DefaultComponent: ConversationListPanel_default }),
|
|
4819
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { className:
|
|
4891
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { className: classNames2__default.default("flex-1", index_module_default2.animatedSplitter, { [index_module_default2.hideSplitterBar]: !hasPreView }), children: [
|
|
4820
4892
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxRuntime.jsx(ChatMainPanel_default, { ref: senderRef }) }),
|
|
4821
4893
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4822
4894
|
ChatPreviewPanel_default,
|