@ant-design/agentic-ui 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/History/components/HistoryEmpty.d.ts +17 -0
- package/dist/History/components/HistoryEmpty.js +50 -0
- package/dist/History/components/HistoryEmptyIcon.d.ts +5 -0
- package/dist/History/components/HistoryEmptyIcon.js +1214 -0
- package/dist/History/components/HistoryList.d.ts +1 -0
- package/dist/History/components/HistoryList.js +6 -0
- package/dist/History/components/SearchComponent.js +10 -4
- package/dist/History/components/index.d.ts +1 -0
- package/dist/History/components/index.js +2 -0
- package/dist/History/index.js +39 -27
- package/dist/History/style.js +12 -0
- package/dist/History/types/index.d.ts +2 -2
- package/dist/Hooks/useLanguage.d.ts +2 -0
- package/dist/I18n/locales.d.ts +2 -0
- package/dist/I18n/locales.js +4 -0
- package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +31 -3
- package/dist/MarkdownEditor/editor/parser/remarkParse.js +2 -2
- package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +4 -4
- package/dist/MarkdownInputField/MarkdownInputField.js +24 -20
- package/dist/Plugins/chart/ChartRender.js +5 -4
- package/dist/Plugins/katex/InlineKatex.js +3 -2
- package/dist/Plugins/mermaid/Mermaid.js +0 -1
- package/package.json +1 -1
|
@@ -61,6 +61,12 @@ var generateHistoryItems = ({
|
|
|
61
61
|
return {
|
|
62
62
|
key: item.sessionId || `item-${item.id}`,
|
|
63
63
|
type: "item",
|
|
64
|
+
onClick: () => {
|
|
65
|
+
if (!item.sessionId) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
onClick(item.sessionId, item);
|
|
69
|
+
},
|
|
64
70
|
label: /* @__PURE__ */ React.createElement(
|
|
65
71
|
HistoryItem,
|
|
66
72
|
{
|
|
@@ -78,7 +78,9 @@ var HistorySearch = ({
|
|
|
78
78
|
const ref = useRef(null);
|
|
79
79
|
const trigger = (searchOptions == null ? void 0 : searchOptions.trigger) || "change";
|
|
80
80
|
useClickAway(() => {
|
|
81
|
-
|
|
81
|
+
if (!inputValue) {
|
|
82
|
+
setIsExpanded(false);
|
|
83
|
+
}
|
|
82
84
|
}, ref);
|
|
83
85
|
const handleSearchWithLoading = (value) => __async(void 0, null, function* () {
|
|
84
86
|
try {
|
|
@@ -121,16 +123,20 @@ var HistorySearch = ({
|
|
|
121
123
|
justifyContent: "space-between",
|
|
122
124
|
height: 32,
|
|
123
125
|
// 固定高度为32px
|
|
124
|
-
padding: isExpanded ? 0 : "0 6px 0 12px"
|
|
126
|
+
padding: isExpanded ? 0 : "0 6px 0 12px"
|
|
125
127
|
// 输入框状态下移除padding
|
|
126
|
-
marginBottom: 4
|
|
127
128
|
}
|
|
128
129
|
},
|
|
129
130
|
isExpanded ? /* @__PURE__ */ React.createElement(
|
|
130
131
|
Input,
|
|
131
132
|
{
|
|
132
133
|
placeholder: (_a = searchOptions == null ? void 0 : searchOptions.placeholder) != null ? _a : type === "task" ? (locale == null ? void 0 : locale["chat.task.search.placeholder"]) || "搜索任务" : (locale == null ? void 0 : locale["chat.history.search.placeholder"]) || "搜索话题",
|
|
133
|
-
prefix: loading ? /* @__PURE__ */ React.createElement(Spin, { size: "small" }) : /* @__PURE__ */ React.createElement(
|
|
134
|
+
prefix: loading ? /* @__PURE__ */ React.createElement(Spin, { size: "small" }) : /* @__PURE__ */ React.createElement(
|
|
135
|
+
SearchIcon,
|
|
136
|
+
{
|
|
137
|
+
style: { color: "var(--color-gray-text-secondary)" }
|
|
138
|
+
}
|
|
139
|
+
),
|
|
134
140
|
value: inputValue,
|
|
135
141
|
onChange: handleInputChange,
|
|
136
142
|
onKeyDown: handleKeyDown,
|
|
@@ -2,6 +2,7 @@ export { HistoryActionsBox } from './HistoryActionsBox';
|
|
|
2
2
|
export { HistoryItem } from './HistoryItem';
|
|
3
3
|
export { generateHistoryItems } from './HistoryList';
|
|
4
4
|
export { HistoryRunningIcon, HistoryRunningIconContainer, type HistoryRunningIconContainerProps, type HistoryRunningIconProps, } from './HistoryRunningIcon';
|
|
5
|
+
export { HistoryEmpty } from './HistoryEmpty';
|
|
5
6
|
export { HistoryLoadMore } from './LoadMoreComponent';
|
|
6
7
|
export { HistoryNewChat } from './NewChatComponent';
|
|
7
8
|
export { HistorySearch } from './SearchComponent';
|
|
@@ -6,11 +6,13 @@ import {
|
|
|
6
6
|
HistoryRunningIcon,
|
|
7
7
|
HistoryRunningIconContainer
|
|
8
8
|
} from "./HistoryRunningIcon";
|
|
9
|
+
import { HistoryEmpty } from "./HistoryEmpty";
|
|
9
10
|
import { HistoryLoadMore } from "./LoadMoreComponent";
|
|
10
11
|
import { HistoryNewChat } from "./NewChatComponent";
|
|
11
12
|
import { HistorySearch } from "./SearchComponent";
|
|
12
13
|
export {
|
|
13
14
|
HistoryActionsBox,
|
|
15
|
+
HistoryEmpty,
|
|
14
16
|
HistoryItem,
|
|
15
17
|
HistoryLoadMore,
|
|
16
18
|
HistoryNewChat,
|
package/dist/History/index.js
CHANGED
|
@@ -20,13 +20,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
// src/History/index.tsx
|
|
23
|
-
import {
|
|
23
|
+
import { HistoryOutlined } from "@ant-design/icons";
|
|
24
24
|
import { ConfigProvider, Popover } from "antd";
|
|
25
25
|
import classNames from "classnames";
|
|
26
26
|
import React, { useContext, useRef } from "react";
|
|
27
27
|
import useClickAway from "../Hooks/useClickAway";
|
|
28
28
|
import { ActionIconBox, BubbleConfigContext } from "../index";
|
|
29
29
|
import {
|
|
30
|
+
HistoryEmpty,
|
|
30
31
|
HistoryLoadMore,
|
|
31
32
|
HistoryNewChat,
|
|
32
33
|
HistorySearch,
|
|
@@ -70,7 +71,7 @@ var History = (props) => {
|
|
|
70
71
|
onClick: (sessionId, item) => {
|
|
71
72
|
var _a2, _b2;
|
|
72
73
|
(_a2 = props.onClick) == null ? void 0 : _a2.call(props, sessionId, item);
|
|
73
|
-
(_b2 = props.onSelected) == null ? void 0 : _b2.call(props,
|
|
74
|
+
(_b2 = props.onSelected) == null ? void 0 : _b2.call(props, item);
|
|
74
75
|
setOpen(false);
|
|
75
76
|
},
|
|
76
77
|
groupLabelRender: props.groupLabelRender,
|
|
@@ -98,11 +99,11 @@ var History = (props) => {
|
|
|
98
99
|
style: {
|
|
99
100
|
display: "flex",
|
|
100
101
|
flexDirection: "column",
|
|
101
|
-
|
|
102
|
+
height: "100%"
|
|
102
103
|
}
|
|
103
104
|
},
|
|
104
|
-
((_b = props.agent) == null ? void 0 : _b.enabled) && !!((_c = props.agent) == null ? void 0 : _c.onNewChat) && /* @__PURE__ */ React.createElement(HistoryNewChat, { onNewChat: handleNewChat }),
|
|
105
|
-
((_d = props.agent) == null ? void 0 : _d.enabled) && !!((_e = props.agent) == null ? void 0 : _e.onSearch) && /* @__PURE__ */ React.createElement(
|
|
105
|
+
((_b = props.agent) == null ? void 0 : _b.enabled) && !!((_c = props.agent) == null ? void 0 : _c.onNewChat) && /* @__PURE__ */ React.createElement("div", { style: { flexShrink: 0, marginBottom: 12 } }, /* @__PURE__ */ React.createElement(HistoryNewChat, { onNewChat: handleNewChat })),
|
|
106
|
+
((_d = props.agent) == null ? void 0 : _d.enabled) && !!((_e = props.agent) == null ? void 0 : _e.onSearch) && /* @__PURE__ */ React.createElement("div", { style: { flexShrink: 0 } }, /* @__PURE__ */ React.createElement(
|
|
106
107
|
HistorySearch,
|
|
107
108
|
{
|
|
108
109
|
searchKeyword,
|
|
@@ -110,27 +111,38 @@ var History = (props) => {
|
|
|
110
111
|
type: props.type,
|
|
111
112
|
searchOptions: (_f = props.agent) == null ? void 0 : _f.searchOptions
|
|
112
113
|
}
|
|
113
|
-
),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
GroupMenu,
|
|
114
|
+
)),
|
|
115
|
+
/* @__PURE__ */ React.createElement(
|
|
116
|
+
"div",
|
|
117
117
|
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
118
|
+
className: classNames(`${menuPrefixCls}-scroll-container`, hashId),
|
|
119
|
+
style: {
|
|
120
|
+
flex: 1,
|
|
121
|
+
overflow: "auto",
|
|
122
|
+
minHeight: 0
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
(_h = (_g = props.slots) == null ? void 0 : _g.beforeHistoryList) == null ? void 0 : _h.call(_g, filteredList),
|
|
126
|
+
(items == null ? void 0 : items.length) === 0 && !props.loading ? props.emptyRender ? props.emptyRender() : /* @__PURE__ */ React.createElement(HistoryEmpty, null) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
127
|
+
GroupMenu,
|
|
128
|
+
{
|
|
129
|
+
selectedKeys: [props.sessionId],
|
|
130
|
+
inlineIndent: 20,
|
|
131
|
+
items,
|
|
132
|
+
className: menuPrefixCls,
|
|
133
|
+
loading: props.loading
|
|
134
|
+
}
|
|
135
|
+
), ((_i = props.agent) == null ? void 0 : _i.enabled) && !!((_j = props.agent) == null ? void 0 : _j.onLoadMore) && /* @__PURE__ */ React.createElement(
|
|
136
|
+
HistoryLoadMore,
|
|
137
|
+
{
|
|
138
|
+
onLoadMore: handleLoadMore,
|
|
139
|
+
type: props.type,
|
|
140
|
+
className: classNames(`${menuPrefixCls}-load-more`, hashId, {
|
|
141
|
+
chat: props.type !== "task"
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
))
|
|
145
|
+
)
|
|
134
146
|
)
|
|
135
147
|
);
|
|
136
148
|
}
|
|
@@ -149,7 +161,7 @@ var History = (props) => {
|
|
|
149
161
|
border: "1px solid var(--color-gray-border-light)"
|
|
150
162
|
},
|
|
151
163
|
getPopupContainer: (p) => p.parentElement || document.body,
|
|
152
|
-
content: /* @__PURE__ */ React.createElement(React.Fragment, null, (items == null ? void 0 : items.length) === 0 && !(props == null ? void 0 : props.loading)
|
|
164
|
+
content: /* @__PURE__ */ React.createElement(React.Fragment, null, (items == null ? void 0 : items.length) === 0 && !(props == null ? void 0 : props.loading) ? /* @__PURE__ */ React.createElement("div", { "data-testid": "empty-state-popover" }, props.emptyRender ? props.emptyRender() : /* @__PURE__ */ React.createElement(HistoryEmpty, null)) : /* @__PURE__ */ React.createElement(
|
|
153
165
|
GroupMenu,
|
|
154
166
|
{
|
|
155
167
|
selectedKeys: [props.sessionId],
|
|
@@ -187,7 +199,7 @@ var History = (props) => {
|
|
|
187
199
|
key: "history",
|
|
188
200
|
title: (locale == null ? void 0 : locale["chat.history"]) || "历史记录"
|
|
189
201
|
},
|
|
190
|
-
/* @__PURE__ */ React.createElement(
|
|
202
|
+
/* @__PURE__ */ React.createElement(HistoryOutlined, null)
|
|
191
203
|
)
|
|
192
204
|
)
|
|
193
205
|
);
|
package/dist/History/style.js
CHANGED
|
@@ -261,6 +261,18 @@ var genStyle = (token) => {
|
|
|
261
261
|
transition: "transform 0.3s ease-out",
|
|
262
262
|
transform: "translateX(0)",
|
|
263
263
|
animation: "none"
|
|
264
|
+
},
|
|
265
|
+
"&-scroll-container": {
|
|
266
|
+
"&::-webkit-scrollbar": {
|
|
267
|
+
width: "4px"
|
|
268
|
+
},
|
|
269
|
+
"&::-webkit-scrollbar-track": {
|
|
270
|
+
backgroundColor: "transparent"
|
|
271
|
+
},
|
|
272
|
+
"&::-webkit-scrollbar-thumb": {
|
|
273
|
+
backgroundColor: "var(--color-gray-border-light)",
|
|
274
|
+
borderRadius: "4px"
|
|
275
|
+
}
|
|
264
276
|
}
|
|
265
277
|
}
|
|
266
278
|
};
|
|
@@ -13,7 +13,7 @@ export interface HistoryProps {
|
|
|
13
13
|
agentId: string;
|
|
14
14
|
}) => Promise<HistoryDataType[]>;
|
|
15
15
|
/** @deprecated 请使用 onClick 替代 */
|
|
16
|
-
onSelected?: (
|
|
16
|
+
onSelected?: (item: HistoryDataType) => void;
|
|
17
17
|
onClick?: (sessionId: string, item: HistoryDataType) => void;
|
|
18
18
|
onDeleteItem?: (sessionId: string) => void;
|
|
19
19
|
customDateFormatter?: (date: number | string | Date) => string;
|
|
@@ -100,5 +100,5 @@ export interface HistoryActionsBoxProps {
|
|
|
100
100
|
*/
|
|
101
101
|
export interface ActionsBoxProps extends HistoryActionsBoxProps {
|
|
102
102
|
/** @deprecated 请使用 onClick 替代 */
|
|
103
|
-
onSelected?: (
|
|
103
|
+
onSelected?: (item: HistoryDataType) => void;
|
|
104
104
|
}
|
|
@@ -215,6 +215,8 @@ export declare function useLanguage(): {
|
|
|
215
215
|
'chat.history.historyTasks': string;
|
|
216
216
|
'chat.history.historyChats': string;
|
|
217
217
|
'chat.task.search.placeholder': string;
|
|
218
|
+
'chat.history.empty.chat.title': string;
|
|
219
|
+
'chat.history.empty.chat.description': string;
|
|
218
220
|
'taskList.expand': string;
|
|
219
221
|
'taskList.collapse': string;
|
|
220
222
|
'taskList.taskList': string;
|
package/dist/I18n/locales.d.ts
CHANGED
|
@@ -179,6 +179,8 @@ export declare const cnLabels: {
|
|
|
179
179
|
'chat.history.historyTasks': string;
|
|
180
180
|
'chat.history.historyChats': string;
|
|
181
181
|
'chat.task.search.placeholder': string;
|
|
182
|
+
'chat.history.empty.chat.title': string;
|
|
183
|
+
'chat.history.empty.chat.description': string;
|
|
182
184
|
'taskList.expand': string;
|
|
183
185
|
'taskList.collapse': string;
|
|
184
186
|
'taskList.taskList': string;
|
package/dist/I18n/locales.js
CHANGED
|
@@ -174,6 +174,8 @@ var cnLabels = {
|
|
|
174
174
|
"chat.history.historyTasks": "历史任务",
|
|
175
175
|
"chat.history.historyChats": "历史对话",
|
|
176
176
|
"chat.task.search.placeholder": "搜索任务",
|
|
177
|
+
"chat.history.empty.chat.title": "找不到相关结果",
|
|
178
|
+
"chat.history.empty.chat.description": "换个关键词试试吧",
|
|
177
179
|
// TaskList 组件相关
|
|
178
180
|
"taskList.expand": "展开",
|
|
179
181
|
"taskList.collapse": "收起",
|
|
@@ -525,6 +527,8 @@ var enLabels = {
|
|
|
525
527
|
"chat.history.historyTasks": "History Tasks",
|
|
526
528
|
"chat.history.historyChats": "History Chats",
|
|
527
529
|
"chat.task.search.placeholder": "Search Task",
|
|
530
|
+
"chat.history.empty.chat.title": "No related results found",
|
|
531
|
+
"chat.history.empty.chat.description": "Try a different keyword",
|
|
528
532
|
// TaskList component related
|
|
529
533
|
"taskList.expand": "Expand",
|
|
530
534
|
"taskList.collapse": "Collapse",
|
|
@@ -37,6 +37,23 @@ var EMPTY_LINE_DISTANCE_THRESHOLD = 4;
|
|
|
37
37
|
var EMPTY_LINE_CALCULATION_OFFSET = 2;
|
|
38
38
|
var EMPTY_LINE_DIVISOR = 2;
|
|
39
39
|
var MIN_TABLE_CELL_LENGTH = 5;
|
|
40
|
+
var INLINE_MATH_SUFFIX_PATTERN = "(?:%|[kKmMbB]|千|万|亿|兆|万亿|百万|亿万)?";
|
|
41
|
+
var INLINE_MATH_CURRENCY_PATTERN = new RegExp(
|
|
42
|
+
`^[+-]?\\d{1,3}(?:,\\d{3})*(?:\\.\\d+)?${INLINE_MATH_SUFFIX_PATTERN}$`
|
|
43
|
+
);
|
|
44
|
+
var INLINE_MATH_SIMPLE_NUMBER_PATTERN = new RegExp(
|
|
45
|
+
`^[+-]?\\d+(?:\\.\\d+)?${INLINE_MATH_SUFFIX_PATTERN}$`
|
|
46
|
+
);
|
|
47
|
+
var shouldTreatInlineMathAsText = (rawValue) => {
|
|
48
|
+
const trimmedValue = rawValue.trim();
|
|
49
|
+
if (!trimmedValue) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
if (/[=^_\\{}]/.test(trimmedValue)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return INLINE_MATH_CURRENCY_PATTERN.test(trimmedValue) || INLINE_MATH_SIMPLE_NUMBER_PATTERN.test(trimmedValue);
|
|
56
|
+
};
|
|
40
57
|
var processSchemaLanguage = (element, value) => {
|
|
41
58
|
let json = [];
|
|
42
59
|
try {
|
|
@@ -101,7 +118,6 @@ var getColumnAlignment = (data, columns) => {
|
|
|
101
118
|
};
|
|
102
119
|
var stringifyObj = remark().use(remarkParse).use(fixStrongWithSpecialChars).use(remarkMath, {
|
|
103
120
|
singleDollarTextMath: false
|
|
104
|
-
// 暂时禁用单美元符号,只使用双美元符号 $$...$$
|
|
105
121
|
}).use(remarkRehype, { allowDangerousHtml: true }).use(rehypeRaw).use(rehypeKatex).use(remarkGfm).use(remarkFrontmatter, ["yaml"]);
|
|
106
122
|
var myRemark = {
|
|
107
123
|
stringify: (obj) => {
|
|
@@ -268,9 +284,14 @@ var parseText = (els, leaf = {
|
|
|
268
284
|
if (n.type === "inlineCode")
|
|
269
285
|
leafs.push(__spreadProps(__spreadValues({}, leaf), { text: n.value, code: true }));
|
|
270
286
|
if (n.type === "inlineMath") {
|
|
287
|
+
const inlineMathValue = typeof n.value === "string" ? n.value : "";
|
|
288
|
+
if (shouldTreatInlineMathAsText(inlineMathValue)) {
|
|
289
|
+
leafs.push(__spreadProps(__spreadValues({}, leaf), { text: `$${inlineMathValue}$` }));
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
271
292
|
leafs.push(__spreadProps(__spreadValues({}, leaf), {
|
|
272
293
|
type: "inline-katex",
|
|
273
|
-
children: [{ text:
|
|
294
|
+
children: [{ text: inlineMathValue }]
|
|
274
295
|
}));
|
|
275
296
|
continue;
|
|
276
297
|
}
|
|
@@ -585,9 +606,16 @@ var handleImage = (currentElement) => {
|
|
|
585
606
|
);
|
|
586
607
|
};
|
|
587
608
|
var handleInlineMath = (currentElement) => {
|
|
609
|
+
const inlineMathValue = typeof (currentElement == null ? void 0 : currentElement.value) === "string" ? currentElement.value : "";
|
|
610
|
+
if (shouldTreatInlineMathAsText(inlineMathValue)) {
|
|
611
|
+
return {
|
|
612
|
+
type: "paragraph",
|
|
613
|
+
children: [{ text: `$${inlineMathValue}$` }]
|
|
614
|
+
};
|
|
615
|
+
}
|
|
588
616
|
return {
|
|
589
617
|
type: "inline-katex",
|
|
590
|
-
children: [{ text:
|
|
618
|
+
children: [{ text: inlineMathValue }]
|
|
591
619
|
};
|
|
592
620
|
};
|
|
593
621
|
var handleMath = (currentElement) => {
|
|
@@ -108,8 +108,8 @@ function fixStrongWithSpecialChars() {
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
var markdownParser = unified().use(remarkParse).use(remarkHtml).use(remarkGfm).use(fixStrongWithSpecialChars).use(remarkMath, {
|
|
111
|
-
singleDollarTextMath:
|
|
112
|
-
//
|
|
111
|
+
singleDollarTextMath: true
|
|
112
|
+
// 允许单美元符号渲染内联数学公式
|
|
113
113
|
}).use(remarkRehype, { allowDangerousHtml: true }).use(rehypeRaw).use(rehypeKatex).use(remarkFrontmatter, ["yaml"]);
|
|
114
114
|
var remarkParse_default = markdownParser;
|
|
115
115
|
export {
|
|
@@ -33,8 +33,8 @@ import { fixStrongWithSpecialChars } from "../parser/remarkParse";
|
|
|
33
33
|
var markdownToHtml = (markdown) => __async(void 0, null, function* () {
|
|
34
34
|
try {
|
|
35
35
|
const htmlContent = yield unified().use(remarkParse).use(remarkGfm).use(fixStrongWithSpecialChars).use(remarkMath, {
|
|
36
|
-
singleDollarTextMath:
|
|
37
|
-
//
|
|
36
|
+
singleDollarTextMath: true
|
|
37
|
+
// 允许单美元符号渲染内联数学公式
|
|
38
38
|
}).use(remarkFrontmatter, ["yaml"]).use(remarkRehype, { allowDangerousHtml: true }).use(rehypeRaw).use(rehypeKatex).use(rehypeStringify).process(markdown);
|
|
39
39
|
return String(htmlContent);
|
|
40
40
|
} catch (error) {
|
|
@@ -45,8 +45,8 @@ var markdownToHtml = (markdown) => __async(void 0, null, function* () {
|
|
|
45
45
|
var markdownToHtmlSync = (markdown) => {
|
|
46
46
|
try {
|
|
47
47
|
const processor = unified().use(remarkParse).use(remarkGfm).use(fixStrongWithSpecialChars).use(remarkMath, {
|
|
48
|
-
singleDollarTextMath:
|
|
49
|
-
//
|
|
48
|
+
singleDollarTextMath: true
|
|
49
|
+
// 允许单美元符号渲染内联数学公式
|
|
50
50
|
}).use(remarkFrontmatter, ["yaml"]).use(remarkRehype, { allowDangerousHtml: true }).use(rehypeRaw).use(rehypeKatex).use(rehypeStringify);
|
|
51
51
|
const file = processor.processSync(markdown);
|
|
52
52
|
return String(file);
|
|
@@ -141,31 +141,35 @@ var MarkdownInputField = (_a) => {
|
|
|
141
141
|
value: (_e = props.attachment) == null ? void 0 : _e.fileMap,
|
|
142
142
|
onChange: (_f = props.attachment) == null ? void 0 : _f.onFileMapChange
|
|
143
143
|
});
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
144
|
+
const hasEnlargeAction = !!((_g = props == null ? void 0 : props.enlargeable) == null ? void 0 : _g.enable);
|
|
145
|
+
const hasRefineAction = !!((_h = props == null ? void 0 : props.refinePrompt) == null ? void 0 : _h.enable);
|
|
146
|
+
const hasCustomQuickAction = !!(props == null ? void 0 : props.quickActionRender);
|
|
147
|
+
const hasActionsRender = !!(props == null ? void 0 : props.actionsRender);
|
|
148
|
+
const hasToolsRender = !!(props == null ? void 0 : props.toolsRender);
|
|
149
|
+
const quickActionCount = Number(hasEnlargeAction) + Number(hasRefineAction) + Number(hasCustomQuickAction);
|
|
150
|
+
const auxiliaryActionCount = Number(hasActionsRender) + Number(hasToolsRender);
|
|
151
|
+
const totalActionCount = quickActionCount + auxiliaryActionCount;
|
|
152
|
+
const isMultiRowLayout = totalActionCount > 0;
|
|
153
153
|
const computedMinHeight = useMemo(() => {
|
|
154
|
-
var _a3, _b3
|
|
154
|
+
var _a3, _b3;
|
|
155
155
|
if (isEnlarged)
|
|
156
156
|
return "auto";
|
|
157
|
-
if (((_a3 = props
|
|
157
|
+
if (((_a3 = props.style) == null ? void 0 : _a3.minHeight) !== void 0)
|
|
158
|
+
return props.style.minHeight;
|
|
159
|
+
if (hasEnlargeAction && hasRefineAction)
|
|
158
160
|
return 140;
|
|
159
|
-
|
|
161
|
+
if (totalActionCount === 1)
|
|
162
|
+
return 90;
|
|
160
163
|
if (isMultiRowLayout)
|
|
161
164
|
return 106;
|
|
162
|
-
return ((
|
|
165
|
+
return ((_b3 = props.style) == null ? void 0 : _b3.minHeight) || 0;
|
|
163
166
|
}, [
|
|
164
167
|
isEnlarged,
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
hasEnlargeAction,
|
|
169
|
+
hasRefineAction,
|
|
167
170
|
isMultiRowLayout,
|
|
168
|
-
|
|
171
|
+
totalActionCount,
|
|
172
|
+
(_i = props.style) == null ? void 0 : _i.minHeight
|
|
169
173
|
]);
|
|
170
174
|
const {
|
|
171
175
|
fileUploadDone,
|
|
@@ -311,7 +315,7 @@ var MarkdownInputField = (_a) => {
|
|
|
311
315
|
);
|
|
312
316
|
}, [
|
|
313
317
|
fileMap,
|
|
314
|
-
(
|
|
318
|
+
(_j = props.attachment) == null ? void 0 : _j.enable,
|
|
315
319
|
handleFileRemoval,
|
|
316
320
|
handleFileRetry,
|
|
317
321
|
updateAttachmentFiles
|
|
@@ -351,7 +355,7 @@ var MarkdownInputField = (_a) => {
|
|
|
351
355
|
supportedFormat,
|
|
352
356
|
fileMap,
|
|
353
357
|
onFileMapChange: setFileMap,
|
|
354
|
-
upload: ((
|
|
358
|
+
upload: ((_k = props.attachment) == null ? void 0 : _k.upload) ? (file) => props.attachment.upload(file, 0) : void 0
|
|
355
359
|
}),
|
|
356
360
|
voiceRecognizer: props.voiceRecognizer,
|
|
357
361
|
value,
|
|
@@ -406,7 +410,7 @@ var MarkdownInputField = (_a) => {
|
|
|
406
410
|
[`${baseCls}-enlarged`]: isEnlarged
|
|
407
411
|
}),
|
|
408
412
|
style: __spreadProps(__spreadValues(__spreadValues({}, props.style), enlargedStyle), {
|
|
409
|
-
height: isEnlarged ? `${(
|
|
413
|
+
height: isEnlarged ? `${(_m = (_l = props.enlargeable) == null ? void 0 : _l.height) != null ? _m : 980}px` : `min(${collapsedHeightPx}px,100%)`,
|
|
410
414
|
borderRadius: borderRadius || 16,
|
|
411
415
|
minHeight: computedMinHeight,
|
|
412
416
|
cursor: isLoading || props.disabled ? "not-allowed" : "auto",
|
|
@@ -539,7 +543,7 @@ var MarkdownInputField = (_a) => {
|
|
|
539
543
|
),
|
|
540
544
|
sendActionsNode
|
|
541
545
|
) : sendActionsNode,
|
|
542
|
-
(props == null ? void 0 : props.quickActionRender) || ((
|
|
546
|
+
(props == null ? void 0 : props.quickActionRender) || ((_n = props.refinePrompt) == null ? void 0 : _n.enable) || ((_o = props.enlargeable) == null ? void 0 : _o.enable) ? /* @__PURE__ */ React.createElement(
|
|
543
547
|
QuickActions,
|
|
544
548
|
{
|
|
545
549
|
ref: quickActionsRef,
|
|
@@ -103,10 +103,6 @@ var ChartRender = (props) => {
|
|
|
103
103
|
}, [chartData, config == null ? void 0 : config.columns]);
|
|
104
104
|
const shouldLoadRuntime = chartType !== "table" && chartType !== "descriptions" && !renderDescriptionsFallback;
|
|
105
105
|
React.useEffect(() => {
|
|
106
|
-
if (!shouldLoadRuntime)
|
|
107
|
-
return;
|
|
108
|
-
if (!isIntersecting)
|
|
109
|
-
return;
|
|
110
106
|
if (runtime)
|
|
111
107
|
return;
|
|
112
108
|
if (isRuntimeLoading)
|
|
@@ -487,6 +483,11 @@ var ChartRender = (props) => {
|
|
|
487
483
|
})
|
|
488
484
|
);
|
|
489
485
|
}
|
|
486
|
+
console.log(
|
|
487
|
+
"isRuntimeLoading || !isIntersecting",
|
|
488
|
+
isRuntimeLoading || !isIntersecting,
|
|
489
|
+
isIntersecting
|
|
490
|
+
);
|
|
490
491
|
if (!runtime && shouldLoadRuntime) {
|
|
491
492
|
const height = (config == null ? void 0 : config.height) || 240;
|
|
492
493
|
if (runtimeError) {
|
|
@@ -38,7 +38,7 @@ var InlineKatex = ({
|
|
|
38
38
|
useEffect(() => {
|
|
39
39
|
if (!selected) {
|
|
40
40
|
const value = Node.string(element);
|
|
41
|
-
katex.render(value
|
|
41
|
+
katex.render(`${value}`, renderEl.current, {
|
|
42
42
|
strict: false,
|
|
43
43
|
output: "html",
|
|
44
44
|
throwOnError: false,
|
|
@@ -55,6 +55,7 @@ var InlineKatex = ({
|
|
|
55
55
|
return /* @__PURE__ */ React.createElement(
|
|
56
56
|
"span",
|
|
57
57
|
__spreadProps(__spreadValues({}, attributes), {
|
|
58
|
+
className: "katex",
|
|
58
59
|
"data-be": "inline-katex",
|
|
59
60
|
style: {
|
|
60
61
|
position: "relative"
|
|
@@ -97,6 +98,7 @@ var InlineKatex = ({
|
|
|
97
98
|
/* @__PURE__ */ React.createElement(
|
|
98
99
|
"span",
|
|
99
100
|
{
|
|
101
|
+
className: "katex",
|
|
100
102
|
contentEditable: false,
|
|
101
103
|
ref: renderEl,
|
|
102
104
|
onClick: () => {
|
|
@@ -108,7 +110,6 @@ var InlineKatex = ({
|
|
|
108
110
|
style: {
|
|
109
111
|
margin: "0 0.25rem",
|
|
110
112
|
userSelect: "none",
|
|
111
|
-
fontSize: 0,
|
|
112
113
|
visibility: selected ? "hidden" : "visible",
|
|
113
114
|
width: selected ? "0" : "auto",
|
|
114
115
|
height: selected ? "0" : "auto",
|