@ant-design/agentic-ui 2.29.45 → 2.29.47
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/Bubble/AIBubble.js +5 -4
- package/dist/Bubble/UserBubble.js +5 -4
- package/dist/Components/LayoutHeader/types.d.ts +2 -2
- package/dist/MarkdownEditor/editor/plugins/useKeyboard.js +16 -8
- package/dist/MarkdownEditor/editor/tools/JinjaTemplatePanel/index.js +6 -0
- package/dist/MarkdownInputField/MarkdownInputField.js +1 -0
- package/dist/TaskList/TaskList.d.ts +3 -0
- package/dist/TaskList/TaskList.js +210 -0
- package/dist/TaskList/components/StatusIcon.d.ts +9 -0
- package/dist/TaskList/components/StatusIcon.js +23 -0
- package/dist/TaskList/components/TaskListItem.d.ts +12 -0
- package/dist/TaskList/components/TaskListItem.js +68 -0
- package/dist/TaskList/constants.d.ts +24 -0
- package/dist/TaskList/constants.js +38 -0
- package/dist/TaskList/index.d.ts +2 -50
- package/dist/TaskList/index.js +1 -260
- package/dist/TaskList/style.js +66 -9
- package/dist/TaskList/types.d.ts +29 -0
- package/dist/TaskList/types.js +3 -0
- package/dist/ToolUseBar/BarItem/Content.js +127 -4
- package/dist/ToolUseBar/style.js +25 -5
- package/dist/ToolUseBarThink/index.js +80 -10
- package/dist/ToolUseBarThink/style.js +19 -0
- package/package.json +1 -2
|
@@ -89,7 +89,7 @@ import { ConfigProvider } from "antd";
|
|
|
89
89
|
import classNames from "clsx";
|
|
90
90
|
import { AnimatePresence, motion } from "framer-motion";
|
|
91
91
|
import { useMergedState } from "rc-util";
|
|
92
|
-
import React, { memo, useContext, useEffect, useMemo } from "react";
|
|
92
|
+
import React, { memo, useContext, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
93
93
|
import { useRefFunction } from "../Hooks/useRefFunction";
|
|
94
94
|
import { useStyle } from "./style";
|
|
95
95
|
var getChevronStyle = function getChevronStyle(expanded) {
|
|
@@ -102,6 +102,7 @@ var FLOATING_ICON_STYLE = {
|
|
|
102
102
|
fontSize: 16,
|
|
103
103
|
color: 'var(--color-gray-text-light)'
|
|
104
104
|
};
|
|
105
|
+
/** 内容超出此高度时自动收起 */ var CONTENT_COLLAPSE_THRESHOLD = 200;
|
|
105
106
|
var LOADING_ANIMATION = {
|
|
106
107
|
animate: {
|
|
107
108
|
'--rotate': [
|
|
@@ -196,10 +197,14 @@ var ExpandButton = function ExpandButton(param) {
|
|
|
196
197
|
};
|
|
197
198
|
var ThinkContainer = function ThinkContainer(param) {
|
|
198
199
|
var thinkContent = param.thinkContent, expandedState = param.expandedState, floatingExpandedState = param.floatingExpandedState, status = param.status, light = param.light, prefixCls = param.prefixCls, hashId = param.hashId, customClassNames = param.classNames, styles = param.styles, onToggleFloatingExpand = param.onToggleFloatingExpand;
|
|
200
|
+
var contentInnerRef = useRef(null);
|
|
201
|
+
var _useState = _sliced_to_array(useState(false), 2), isContentOverflowing = _useState[0], setIsContentOverflowing = _useState[1];
|
|
202
|
+
var _useState1 = _sliced_to_array(useState(false), 2), contentExpanded = _useState1[0], setContentExpanded = _useState1[1];
|
|
199
203
|
var _obj;
|
|
200
204
|
var containerClassName = buildClassName("".concat(prefixCls, "-container"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.container, (_obj = {}, _define_property(_obj, "".concat(prefixCls, "-container-expanded"), expandedState), _define_property(_obj, "".concat(prefixCls, "-container-loading"), status === 'loading' && !floatingExpandedState), _define_property(_obj, "".concat(prefixCls, "-container-light"), light), _define_property(_obj, "".concat(prefixCls, "-container-floating-expanded"), floatingExpandedState), _obj));
|
|
201
205
|
var contentClassName = buildClassName("".concat(prefixCls, "-content"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.content);
|
|
202
206
|
var floatingExpandClassName = buildClassName("".concat(prefixCls, "-floating-expand"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.floatingExpand);
|
|
207
|
+
var contentExpandClassName = buildClassName("".concat(prefixCls, "-content-expand"), hashId);
|
|
203
208
|
var floatingIcon = floatingExpandedState ? /*#__PURE__*/ React.createElement(ChevronsDownUp, {
|
|
204
209
|
style: FLOATING_ICON_STYLE
|
|
205
210
|
}) : /*#__PURE__*/ React.createElement(ChevronsUpDown, {
|
|
@@ -207,6 +212,67 @@ var ThinkContainer = function ThinkContainer(param) {
|
|
|
207
212
|
});
|
|
208
213
|
var floatingText = floatingExpandedState ? '收起' : '展开';
|
|
209
214
|
var showFloatingExpand = status === 'loading' && !light;
|
|
215
|
+
var checkOverflow = useCallback(function() {
|
|
216
|
+
var el = contentInnerRef.current;
|
|
217
|
+
if (!el) return;
|
|
218
|
+
var scrollHeight = el.scrollHeight;
|
|
219
|
+
setIsContentOverflowing(scrollHeight > CONTENT_COLLAPSE_THRESHOLD);
|
|
220
|
+
}, []);
|
|
221
|
+
useEffect(function() {
|
|
222
|
+
if (!expandedState || !thinkContent) return;
|
|
223
|
+
checkOverflow();
|
|
224
|
+
var el = contentInnerRef.current;
|
|
225
|
+
if (!el) return;
|
|
226
|
+
var observer = new ResizeObserver(checkOverflow);
|
|
227
|
+
observer.observe(el);
|
|
228
|
+
return function() {
|
|
229
|
+
return observer.disconnect();
|
|
230
|
+
};
|
|
231
|
+
}, [
|
|
232
|
+
expandedState,
|
|
233
|
+
thinkContent,
|
|
234
|
+
checkOverflow
|
|
235
|
+
]);
|
|
236
|
+
var handleContentExpandToggle = useRefFunction(function() {
|
|
237
|
+
setContentExpanded(function(prev) {
|
|
238
|
+
return !prev;
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
var showContentExpand = expandedState && thinkContent && status !== 'loading' && isContentOverflowing;
|
|
242
|
+
var contentInnerStyle = useMemo(function() {
|
|
243
|
+
if (!showContentExpand) return undefined;
|
|
244
|
+
if (contentExpanded) return undefined;
|
|
245
|
+
return {
|
|
246
|
+
maxHeight: CONTENT_COLLAPSE_THRESHOLD,
|
|
247
|
+
overflow: 'hidden'
|
|
248
|
+
};
|
|
249
|
+
}, [
|
|
250
|
+
showContentExpand,
|
|
251
|
+
contentExpanded
|
|
252
|
+
]);
|
|
253
|
+
var contentExpandButton = useMemo(function() {
|
|
254
|
+
if (!showContentExpand) return null;
|
|
255
|
+
var icon = contentExpanded ? /*#__PURE__*/ React.createElement(ChevronsDownUp, null) : /*#__PURE__*/ React.createElement(ChevronsUpDown, null);
|
|
256
|
+
var text = contentExpanded ? '收起' : '展开';
|
|
257
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
258
|
+
className: contentExpandClassName,
|
|
259
|
+
onClick: handleContentExpandToggle,
|
|
260
|
+
"data-testid": "tool-use-bar-think-content-expand",
|
|
261
|
+
role: "button",
|
|
262
|
+
tabIndex: 0,
|
|
263
|
+
onKeyDown: function onKeyDown(e) {
|
|
264
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
265
|
+
e.preventDefault();
|
|
266
|
+
handleContentExpandToggle();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}, icon, text);
|
|
270
|
+
}, [
|
|
271
|
+
showContentExpand,
|
|
272
|
+
contentExpanded,
|
|
273
|
+
contentExpandClassName,
|
|
274
|
+
handleContentExpandToggle
|
|
275
|
+
]);
|
|
210
276
|
// 缓存容器元素
|
|
211
277
|
var contentVariants = useMemo(function() {
|
|
212
278
|
return {
|
|
@@ -237,6 +303,18 @@ var ThinkContainer = function ThinkContainer(param) {
|
|
|
237
303
|
}
|
|
238
304
|
};
|
|
239
305
|
}, []);
|
|
306
|
+
var innerContent = /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("div", {
|
|
307
|
+
ref: contentInnerRef,
|
|
308
|
+
style: contentInnerStyle
|
|
309
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
310
|
+
className: contentClassName,
|
|
311
|
+
style: styles === null || styles === void 0 ? void 0 : styles.content
|
|
312
|
+
}, thinkContent)), contentExpandButton, showFloatingExpand ? /*#__PURE__*/ React.createElement("div", {
|
|
313
|
+
className: floatingExpandClassName,
|
|
314
|
+
onClick: onToggleFloatingExpand,
|
|
315
|
+
"data-testid": "tool-use-bar-think-floating-expand",
|
|
316
|
+
style: styles === null || styles === void 0 ? void 0 : styles.floatingExpand
|
|
317
|
+
}, floatingIcon, floatingText) : null);
|
|
240
318
|
return /*#__PURE__*/ React.createElement(AnimatePresence, {
|
|
241
319
|
initial: false,
|
|
242
320
|
mode: "sync"
|
|
@@ -249,15 +327,7 @@ var ThinkContainer = function ThinkContainer(param) {
|
|
|
249
327
|
transition: contentTransition,
|
|
250
328
|
className: containerClassName,
|
|
251
329
|
"data-testid": "tool-use-bar-think-container"
|
|
252
|
-
}, /*#__PURE__*/ React.createElement("div", {
|
|
253
|
-
className: contentClassName,
|
|
254
|
-
style: styles === null || styles === void 0 ? void 0 : styles.content
|
|
255
|
-
}, thinkContent), showFloatingExpand ? /*#__PURE__*/ React.createElement("div", {
|
|
256
|
-
className: floatingExpandClassName,
|
|
257
|
-
onClick: onToggleFloatingExpand,
|
|
258
|
-
"data-testid": "tool-use-bar-think-floating-expand",
|
|
259
|
-
style: styles === null || styles === void 0 ? void 0 : styles.floatingExpand
|
|
260
|
-
}, floatingIcon, floatingText) : null) : null, !expandedState ? /*#__PURE__*/ React.createElement("div", {
|
|
330
|
+
}, innerContent) : null, !expandedState ? /*#__PURE__*/ React.createElement("div", {
|
|
261
331
|
style: {
|
|
262
332
|
visibility: 'hidden',
|
|
263
333
|
height: 1,
|
|
@@ -319,6 +319,25 @@ var genStyle = function genStyle(token) {
|
|
|
319
319
|
color: 'var(--color-gray-text-light)'
|
|
320
320
|
}
|
|
321
321
|
},
|
|
322
|
+
'&-content-expand': {
|
|
323
|
+
display: 'flex',
|
|
324
|
+
alignItems: 'center',
|
|
325
|
+
justifyContent: 'center',
|
|
326
|
+
gap: 4,
|
|
327
|
+
marginTop: 8,
|
|
328
|
+
padding: '8px 16px',
|
|
329
|
+
fontSize: 'var(--font-size-base)',
|
|
330
|
+
cursor: 'pointer',
|
|
331
|
+
borderRadius: 'var(--radius-control-base)',
|
|
332
|
+
background: 'var(--color-gray-control-fill-active)',
|
|
333
|
+
color: 'var(--color-gray-text-secondary)',
|
|
334
|
+
font: 'var(--font-text-body-emphasized-sm)',
|
|
335
|
+
flexShrink: 0,
|
|
336
|
+
'&:hover': {
|
|
337
|
+
background: 'var(--color-gray-control-fill-hover)',
|
|
338
|
+
color: 'var(--color-gray-text-default)'
|
|
339
|
+
}
|
|
340
|
+
},
|
|
322
341
|
'&-floating-expand': {
|
|
323
342
|
position: 'absolute',
|
|
324
343
|
bottom: '8px',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ant-design/agentic-ui",
|
|
3
|
-
"version": "2.29.
|
|
3
|
+
"version": "2.29.47",
|
|
4
4
|
"description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
|
|
5
5
|
"repository": "git@github.com:ant-design/agentic-ui.git",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
|
25
25
|
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
26
26
|
"prepare": "husky install && dumi setup",
|
|
27
|
-
"prepublishOnly": "father doctor && pnpm run test && pnpm run build",
|
|
28
27
|
"prettier": "prettier --write \"{src,docs,test}/**/*.{js,jsx,ts,tsx,css,less,json,md}\"",
|
|
29
28
|
"preview": "pnpm dumi preview",
|
|
30
29
|
"report:demo": "node scripts/generateDemoReport.js",
|