@ant-design/agentic-ui 2.30.30 → 2.30.33
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/AILabel/index.d.ts +2 -0
- package/dist/AILabel/index.js +4 -2
- package/dist/AgentRunBar/Robot.js +0 -1
- package/dist/AgentRunBar/index.js +1 -0
- package/dist/AgenticLayout/index.js +1 -0
- package/dist/AnswerAlert/index.js +1 -0
- package/dist/BackTo/ScrollVisibleButton.d.ts +2 -0
- package/dist/BackTo/ScrollVisibleButton.js +4 -2
- package/dist/Bubble/AIBubble.js +6 -3
- package/dist/Bubble/List/PureBubbleList.js +24 -1
- package/dist/Bubble/List/index.js +7 -5
- package/dist/Bubble/MessagesContent/BubbleExtra.js +4 -2
- package/dist/Bubble/style.js +0 -1
- package/dist/ChatBootPage/ButtonTab.js +1 -0
- package/dist/ChatBootPage/ButtonTabGroup.js +1 -0
- package/dist/ChatBootPage/CaseReply.js +1 -0
- package/dist/ChatBootPage/Title.js +1 -0
- package/dist/ChatLayout/index.js +1 -0
- package/dist/Components/ActionIconBox/index.js +8 -8
- package/dist/Components/ActionItemBox/ActionItemBox.js +1 -0
- package/dist/Components/Button/IconButton/index.js +1 -0
- package/dist/Components/Button/SwitchButton/index.js +1 -0
- package/dist/Components/Button/ToggleButton/index.js +1 -0
- package/dist/Components/GradientText/index.js +1 -0
- package/dist/Components/LayoutHeader/index.js +2 -1
- package/dist/Components/Loading/Loading.js +2 -0
- package/dist/Components/Robot/index.js +1 -0
- package/dist/Components/SuggestionList/index.js +1 -0
- package/dist/Components/TextAnimate/index.js +1 -0
- package/dist/Components/TypingAnimation/index.js +2 -1
- package/dist/Components/VisualList/index.js +3 -0
- package/dist/Components/lotties/ThreeThinkingLottie/index.d.ts +68 -0
- package/dist/Components/lotties/ThreeThinkingLottie/index.js +151 -0
- package/dist/Components/lotties/ThreeThinkingLottie/three-thinking.json +130 -0
- package/dist/Components/lotties/index.d.ts +1 -0
- package/dist/Components/lotties/index.js +1 -0
- package/dist/History/index.js +1 -0
- package/dist/Hooks/useLanguage.d.ts +1 -0
- package/dist/I18n/locales.d.ts +1 -0
- package/dist/I18n/locales.js +2 -0
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +2 -0
- package/dist/MarkdownEditor/editor/parser/parse/parseHtml.js +15 -6
- package/dist/MarkdownEditor/style.js +0 -4
- package/dist/MarkdownInputField/SendButton/index.d.ts +2 -2
- package/dist/MarkdownInputField/SendButton/index.js +44 -26
- package/dist/MarkdownInputField/SendButton/sendButtonPalette.d.ts +36 -0
- package/dist/MarkdownInputField/SendButton/sendButtonPalette.js +247 -0
- package/dist/MarkdownInputField/SendButton/style.js +3 -3
- package/dist/MarkdownInputField/style.js +3 -1
- package/dist/MarkdownRenderer/AnimationText.js +1 -2
- package/dist/MarkdownRenderer/CharacterQueue.js +3 -0
- package/dist/MarkdownRenderer/MarkdownRenderer.js +6 -18
- package/dist/MarkdownRenderer/markdownReactShared.d.ts +2 -1
- package/dist/MarkdownRenderer/markdownReactShared.js +57 -19
- package/dist/MarkdownRenderer/streaming/MarkdownBlockPiece.js +14 -10
- package/dist/MarkdownRenderer/streaming/fenceTracker.d.ts +7 -0
- package/dist/MarkdownRenderer/streaming/fenceTracker.js +28 -0
- package/dist/MarkdownRenderer/streaming/lastBlockThrottle.js +3 -1
- package/dist/MarkdownRenderer/streaming/useShallowMemo.d.ts +1 -0
- package/dist/MarkdownRenderer/streaming/useShallowMemo.js +36 -0
- package/dist/MarkdownRenderer/streaming/useStreamingMarkdownReact.js +6 -3
- package/dist/MarkdownRenderer/useStreaming.js +43 -41
- package/dist/Plugins/chart/components/ChartContainer/ChartContainer.d.ts +13 -3
- package/dist/Plugins/chart/components/ChartContainer/ChartContainer.js +19 -4
- package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +2 -0
- package/dist/Plugins/chart/hooks/index.d.ts +2 -0
- package/dist/Plugins/chart/hooks/index.js +1 -0
- package/dist/Plugins/chart/hooks/useDetectTheme.d.ts +46 -0
- package/dist/Plugins/chart/hooks/useDetectTheme.js +222 -0
- package/dist/Schema/SchemaEditor/index.js +1 -0
- package/dist/Schema/SchemaForm/index.js +1 -0
- package/dist/TaskList/TaskList.js +45 -16
- package/dist/TaskList/components/TaskListItem.js +2 -1
- package/dist/TaskList/constants.d.ts +1 -1
- package/dist/TaskList/constants.js +9 -4
- package/dist/TaskList/style.js +30 -12
- package/dist/ThoughtChainList/index.js +1 -0
- package/dist/ToolUseBar/index.js +7 -6
- package/dist/ToolUseBarThink/index.d.ts +0 -23
- package/dist/ToolUseBarThink/index.js +178 -315
- package/dist/ToolUseBarThink/style.js +61 -52
- package/dist/Types/quicklink.d.ts +1 -1
- package/dist/WelcomeMessage/index.js +1 -0
- package/dist/Workspace/File/FileTree/FileTreeComponent.d.ts +4 -0
- package/dist/Workspace/File/FileTree/FileTreeComponent.js +283 -0
- package/dist/Workspace/File/FileTree/index.d.ts +2 -0
- package/dist/Workspace/File/FileTree/index.js +1 -0
- package/dist/Workspace/File/FileTree/style.d.ts +8 -0
- package/dist/Workspace/File/FileTree/style.js +80 -0
- package/dist/Workspace/File/index.d.ts +2 -1
- package/dist/Workspace/File/index.js +1 -0
- package/dist/Workspace/index.d.ts +4 -2
- package/dist/Workspace/index.js +73 -36
- package/dist/Workspace/types.d.ts +70 -2
- package/package.json +2 -1
|
@@ -6,9 +6,6 @@ function _array_like_to_array(arr, len) {
|
|
|
6
6
|
function _array_with_holes(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function _array_without_holes(arr) {
|
|
10
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
|
-
}
|
|
12
9
|
function _define_property(obj, key, value) {
|
|
13
10
|
if (key in obj) {
|
|
14
11
|
Object.defineProperty(obj, key, {
|
|
@@ -22,9 +19,6 @@ function _define_property(obj, key, value) {
|
|
|
22
19
|
}
|
|
23
20
|
return obj;
|
|
24
21
|
}
|
|
25
|
-
function _iterable_to_array(iter) {
|
|
26
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
27
|
-
}
|
|
28
22
|
function _iterable_to_array_limit(arr, i) {
|
|
29
23
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
30
24
|
if (_i == null) return;
|
|
@@ -52,30 +46,9 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
52
46
|
function _non_iterable_rest() {
|
|
53
47
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
54
48
|
}
|
|
55
|
-
function _non_iterable_spread() {
|
|
56
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
57
|
-
}
|
|
58
|
-
function _object_spread(target) {
|
|
59
|
-
for(var i = 1; i < arguments.length; i++){
|
|
60
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
61
|
-
var ownKeys = Object.keys(source);
|
|
62
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
63
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
64
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
ownKeys.forEach(function(key) {
|
|
68
|
-
_define_property(target, key, source[key]);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return target;
|
|
72
|
-
}
|
|
73
49
|
function _sliced_to_array(arr, i) {
|
|
74
50
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
75
51
|
}
|
|
76
|
-
function _to_consumable_array(arr) {
|
|
77
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
78
|
-
}
|
|
79
52
|
function _unsupported_iterable_to_array(o, minLen) {
|
|
80
53
|
if (!o) return;
|
|
81
54
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
@@ -87,141 +60,92 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
87
60
|
import { Brain, ChevronDown, ChevronsDownUp, ChevronsUpDown } from "@sofa-design/icons";
|
|
88
61
|
import { ConfigProvider } from "antd";
|
|
89
62
|
import classNames from "clsx";
|
|
90
|
-
import { motion } from "framer-motion";
|
|
91
63
|
import { useMergedState } from "rc-util";
|
|
92
64
|
import React, { memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
93
65
|
import { useRefFunction } from "../Hooks/useRefFunction";
|
|
94
66
|
import { useLocale } from "../I18n";
|
|
95
67
|
import { useStyle } from "./style";
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
68
|
+
if (typeof CSS !== 'undefined' && CSS.registerProperty) {
|
|
69
|
+
try {
|
|
70
|
+
CSS.registerProperty({
|
|
71
|
+
name: '--think-rotate',
|
|
72
|
+
syntax: '<angle>',
|
|
73
|
+
inherits: true,
|
|
74
|
+
initialValue: '0deg'
|
|
75
|
+
});
|
|
76
|
+
} catch (unused) {
|
|
77
|
+
// already registered
|
|
78
|
+
}
|
|
79
|
+
}
|
|
102
80
|
var FLOATING_ICON_STYLE = {
|
|
103
81
|
fontSize: 16,
|
|
104
82
|
color: 'var(--color-gray-text-light)'
|
|
105
83
|
};
|
|
106
|
-
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
'0deg',
|
|
111
|
-
'360deg'
|
|
112
|
-
]
|
|
113
|
-
},
|
|
114
|
-
transition: {
|
|
115
|
-
'--rotate': {
|
|
116
|
-
duration: 1,
|
|
117
|
-
repeat: Infinity,
|
|
118
|
-
ease: 'linear'
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
style: {
|
|
122
|
-
'--rotation': '360deg'
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
var IDLE_ANIMATION = {
|
|
126
|
-
animate: {},
|
|
127
|
-
transition: {},
|
|
128
|
-
style: {
|
|
129
|
-
'--rotation': '0deg'
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
var HEADER_RIGHT_LOADING_ANIMATION = {
|
|
133
|
-
animate: {
|
|
134
|
-
maskImage: [
|
|
135
|
-
'linear-gradient(to right, rgba(0,0,0,0.99) -50%, rgba(0,0,0,0.15) -50%,rgba(0,0,0,0.99) 150%)',
|
|
136
|
-
'linear-gradient(to right, rgba(0,0,0,0.99) -50%, rgba(0,0,0,0.15) 150%,rgba(0,0,0,0.99) 150%)'
|
|
137
|
-
]
|
|
138
|
-
},
|
|
139
|
-
transition: {
|
|
140
|
-
maskImage: {
|
|
141
|
-
duration: 1,
|
|
142
|
-
repeat: Infinity,
|
|
143
|
-
ease: 'linear'
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
style: {
|
|
147
|
-
maskImage: 'linear-gradient(to right, rgba(0,0,0,0.99) -30%, rgba(0,0,0,0.15) -50%, rgba(0,0,0,0.99) 120%)'
|
|
148
|
-
}
|
|
84
|
+
var CONTENT_COLLAPSE_THRESHOLD = 200;
|
|
85
|
+
var CHEVRON_EXPANDED = {
|
|
86
|
+
transform: 'rotate(0deg)',
|
|
87
|
+
transition: 'transform 0.2s'
|
|
149
88
|
};
|
|
150
|
-
var
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
return classNames.apply(void 0, _to_consumable_array(args));
|
|
89
|
+
var CHEVRON_COLLAPSED = {
|
|
90
|
+
transform: 'rotate(-90deg)',
|
|
91
|
+
transition: 'transform 0.2s'
|
|
155
92
|
};
|
|
156
|
-
var
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
var chevronStyle = getChevronStyle(expandedState);
|
|
160
|
-
var icon = hover ? /*#__PURE__*/ React.createElement(ChevronDown, {
|
|
161
|
-
style: chevronStyle
|
|
162
|
-
}) : /*#__PURE__*/ React.createElement(Brain, null);
|
|
163
|
-
return /*#__PURE__*/ React.createElement("div", {
|
|
164
|
-
className: iconClassName
|
|
165
|
-
}, icon);
|
|
93
|
+
var CONTENT_CLAMPED_STYLE = {
|
|
94
|
+
maxHeight: CONTENT_COLLAPSE_THRESHOLD,
|
|
95
|
+
overflow: 'hidden'
|
|
166
96
|
};
|
|
167
|
-
var
|
|
168
|
-
|
|
169
|
-
var nameClassName = buildClassName("".concat(prefixCls, "-name"), _define_property({}, "".concat(prefixCls, "-name-light"), light), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.name);
|
|
170
|
-
var targetClassName = buildClassName("".concat(prefixCls, "-target"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.target);
|
|
171
|
-
return /*#__PURE__*/ React.createElement(React.Fragment, null, toolName && /*#__PURE__*/ React.createElement("div", {
|
|
172
|
-
className: nameClassName,
|
|
173
|
-
style: styles === null || styles === void 0 ? void 0 : styles.name
|
|
174
|
-
}, toolName), toolTarget ? /*#__PURE__*/ React.createElement("div", {
|
|
175
|
-
className: targetClassName,
|
|
176
|
-
style: styles === null || styles === void 0 ? void 0 : styles.target
|
|
177
|
-
}, toolTarget) : /*#__PURE__*/ React.createElement("div", null));
|
|
97
|
+
var CONTAINER_STYLE = {
|
|
98
|
+
overflow: 'hidden'
|
|
178
99
|
};
|
|
179
|
-
var
|
|
180
|
-
var time = param.time,
|
|
181
|
-
|
|
182
|
-
var
|
|
183
|
-
|
|
184
|
-
className: timeClassName,
|
|
185
|
-
style: styles === null || styles === void 0 ? void 0 : styles.time
|
|
186
|
-
}, time);
|
|
187
|
-
};
|
|
188
|
-
var ExpandButton = function ExpandButton(param) {
|
|
189
|
-
var thinkContent = param.thinkContent, light = param.light, expandedState = param.expandedState, prefixCls = param.prefixCls, hashId = param.hashId, customClassNames = param.classNames, styles = param.styles, onToggleExpand = param.onToggleExpand;
|
|
190
|
-
if (!thinkContent || light) return null;
|
|
191
|
-
var expandClassName = buildClassName("".concat(prefixCls, "-expand"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.expand);
|
|
192
|
-
var expandIcon = expandedState ? /*#__PURE__*/ React.createElement(ChevronsDownUp, null) : /*#__PURE__*/ React.createElement(ChevronsUpDown, null);
|
|
193
|
-
return /*#__PURE__*/ React.createElement("div", {
|
|
194
|
-
className: expandClassName,
|
|
195
|
-
onClick: onToggleExpand,
|
|
196
|
-
style: styles === null || styles === void 0 ? void 0 : styles.expand
|
|
197
|
-
}, expandIcon);
|
|
198
|
-
};
|
|
199
|
-
var ThinkContainer = function ThinkContainer(param) {
|
|
200
|
-
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;
|
|
100
|
+
var ToolUseBarThinkComponent = function ToolUseBarThinkComponent(param) {
|
|
101
|
+
var toolName = param.toolName, toolTarget = param.toolTarget, time = param.time, icon = param.icon, thinkContent = param.thinkContent, status = param.status, testId = param.testId, expanded = param.expanded, _param_defaultExpanded = param.defaultExpanded, defaultExpanded = _param_defaultExpanded === void 0 ? false : _param_defaultExpanded, onExpandedChange = param.onExpandedChange, floatingExpanded = param.floatingExpanded, _param_defaultFloatingExpanded = param.defaultFloatingExpanded, defaultFloatingExpanded = _param_defaultFloatingExpanded === void 0 ? false : _param_defaultFloatingExpanded, onFloatingExpandedChange = param.onFloatingExpandedChange, customClassNames = param.classNames, styles = param.styles, _param_light = param.light, light = _param_light === void 0 ? false : _param_light;
|
|
102
|
+
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
103
|
+
var prefixCls = getPrefixCls('agentic-tool-use-bar-think');
|
|
104
|
+
var _useStyle = useStyle(prefixCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
201
105
|
var locale = useLocale();
|
|
202
|
-
var
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
var
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
106
|
+
var _useMergedState = _sliced_to_array(useMergedState(defaultExpanded, {
|
|
107
|
+
value: expanded,
|
|
108
|
+
onChange: onExpandedChange
|
|
109
|
+
}), 2), expandedState = _useMergedState[0], setExpandedState = _useMergedState[1];
|
|
110
|
+
var _useMergedState1 = _sliced_to_array(useMergedState(defaultFloatingExpanded, {
|
|
111
|
+
value: floatingExpanded,
|
|
112
|
+
onChange: onFloatingExpandedChange
|
|
113
|
+
}), 2), floatingExpandedState = _useMergedState1[0], setFloatingExpandedState = _useMergedState1[1];
|
|
114
|
+
var _useState = _sliced_to_array(useState(false), 2), hover = _useState[0], setHover = _useState[1];
|
|
115
|
+
var onMouseMove = useCallback(function() {
|
|
116
|
+
return setHover(true);
|
|
117
|
+
}, []);
|
|
118
|
+
var onMouseLeave = useCallback(function() {
|
|
119
|
+
return setHover(false);
|
|
120
|
+
}, []);
|
|
121
|
+
var handleToggleExpand = useRefFunction(function() {
|
|
122
|
+
setExpandedState(!expandedState);
|
|
123
|
+
});
|
|
124
|
+
var handleToggleFloatingExpand = useRefFunction(function() {
|
|
125
|
+
setFloatingExpandedState(!floatingExpandedState);
|
|
214
126
|
});
|
|
215
|
-
var
|
|
216
|
-
|
|
127
|
+
var isLoading = status === 'loading';
|
|
128
|
+
useEffect(function() {
|
|
129
|
+
if (isLoading) {
|
|
130
|
+
setExpandedState(true);
|
|
131
|
+
}
|
|
132
|
+
}, [
|
|
133
|
+
isLoading,
|
|
134
|
+
setExpandedState
|
|
135
|
+
]);
|
|
136
|
+
// --- Container overflow detection ---
|
|
137
|
+
// Only active when expanded AND not loading (overflow UI is hidden during loading)
|
|
138
|
+
var contentInnerRef = useRef(null);
|
|
139
|
+
var _useState1 = _sliced_to_array(useState(false), 2), isContentOverflowing = _useState1[0], setIsContentOverflowing = _useState1[1];
|
|
140
|
+
var _useState2 = _sliced_to_array(useState(false), 2), contentExpanded = _useState2[0], setContentExpanded = _useState2[1];
|
|
141
|
+
var needOverflowCheck = expandedState && !isLoading && !!thinkContent;
|
|
217
142
|
var checkOverflow = useCallback(function() {
|
|
218
143
|
var el = contentInnerRef.current;
|
|
219
144
|
if (!el) return;
|
|
220
|
-
|
|
221
|
-
setIsContentOverflowing(scrollHeight > CONTENT_COLLAPSE_THRESHOLD);
|
|
145
|
+
setIsContentOverflowing(el.scrollHeight > CONTENT_COLLAPSE_THRESHOLD);
|
|
222
146
|
}, []);
|
|
223
147
|
useEffect(function() {
|
|
224
|
-
if (!
|
|
148
|
+
if (!needOverflowCheck) return;
|
|
225
149
|
checkOverflow();
|
|
226
150
|
var el = contentInnerRef.current;
|
|
227
151
|
if (!el) return;
|
|
@@ -231,8 +155,7 @@ var ThinkContainer = function ThinkContainer(param) {
|
|
|
231
155
|
return observer.disconnect();
|
|
232
156
|
};
|
|
233
157
|
}, [
|
|
234
|
-
|
|
235
|
-
thinkContent,
|
|
158
|
+
needOverflowCheck,
|
|
236
159
|
checkOverflow
|
|
237
160
|
]);
|
|
238
161
|
var handleContentExpandToggle = useRefFunction(function() {
|
|
@@ -240,195 +163,135 @@ var ThinkContainer = function ThinkContainer(param) {
|
|
|
240
163
|
return !prev;
|
|
241
164
|
});
|
|
242
165
|
});
|
|
243
|
-
var showContentExpand =
|
|
166
|
+
var showContentExpand = needOverflowCheck && isContentOverflowing;
|
|
167
|
+
var showFloatingExpand = isLoading && !light;
|
|
244
168
|
var contentInnerStyle = useMemo(function() {
|
|
245
|
-
|
|
246
|
-
if (contentExpanded) return undefined;
|
|
247
|
-
return {
|
|
248
|
-
maxHeight: CONTENT_COLLAPSE_THRESHOLD,
|
|
249
|
-
overflow: 'hidden'
|
|
250
|
-
};
|
|
169
|
+
return showContentExpand && !contentExpanded ? CONTENT_CLAMPED_STYLE : undefined;
|
|
251
170
|
}, [
|
|
252
171
|
showContentExpand,
|
|
253
172
|
contentExpanded
|
|
254
173
|
]);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
var
|
|
258
|
-
var
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
style: styles === null || styles === void 0 ? void 0 : styles.floatingExpand
|
|
290
|
-
}, floatingIcon, floatingText) : null);
|
|
291
|
-
// 收起时不渲染 thinkContent,无动画避免展开/收起卡顿
|
|
292
|
-
if (expandedState) {
|
|
293
|
-
return /*#__PURE__*/ React.createElement("div", {
|
|
294
|
-
className: containerClassName,
|
|
295
|
-
"data-testid": "tool-use-bar-think-container",
|
|
296
|
-
style: {
|
|
297
|
-
overflow: 'hidden'
|
|
298
|
-
}
|
|
299
|
-
}, innerContent);
|
|
300
|
-
}
|
|
301
|
-
if (showFloatingExpand) {
|
|
302
|
-
return /*#__PURE__*/ React.createElement("div", {
|
|
303
|
-
className: floatingExpandClassName,
|
|
304
|
-
onClick: onToggleFloatingExpand,
|
|
305
|
-
"data-testid": "tool-use-bar-think-floating-expand",
|
|
306
|
-
style: styles === null || styles === void 0 ? void 0 : styles.floatingExpand
|
|
307
|
-
}, floatingIcon, floatingText);
|
|
308
|
-
}
|
|
309
|
-
return null;
|
|
310
|
-
};
|
|
311
|
-
/**
|
|
312
|
-
* ToolUseBarThink 组件
|
|
313
|
-
*
|
|
314
|
-
* 用于显示工具使用过程中的思考内容和状态
|
|
315
|
-
*
|
|
316
|
-
* @example
|
|
317
|
-
* ```tsx
|
|
318
|
-
* <ToolUseBarThink
|
|
319
|
-
* toolName="思考"
|
|
320
|
-
* toolTarget="分析问题"
|
|
321
|
-
* status="loading"
|
|
322
|
-
* thinkContent={<div>思考内容...</div>}
|
|
323
|
-
* />
|
|
324
|
-
* ```
|
|
325
|
-
*/ var ToolUseBarThinkComponent = function ToolUseBarThinkComponent(param) {
|
|
326
|
-
var toolName = param.toolName, toolTarget = param.toolTarget, time = param.time, icon = param.icon, thinkContent = param.thinkContent, status = param.status, testId = param.testId, expanded = param.expanded, _param_defaultExpanded = param.defaultExpanded, defaultExpanded = _param_defaultExpanded === void 0 ? false : _param_defaultExpanded, onExpandedChange = param.onExpandedChange, floatingExpanded = param.floatingExpanded, _param_defaultFloatingExpanded = param.defaultFloatingExpanded, defaultFloatingExpanded = _param_defaultFloatingExpanded === void 0 ? false : _param_defaultFloatingExpanded, onFloatingExpandedChange = param.onFloatingExpandedChange, customClassNames = param.classNames, styles = param.styles, _param_light = param.light, light = _param_light === void 0 ? false : _param_light;
|
|
327
|
-
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
328
|
-
var prefixCls = getPrefixCls('agentic-tool-use-bar-think');
|
|
329
|
-
var _useStyle = useStyle(prefixCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
330
|
-
var _useMergedState = _sliced_to_array(useMergedState(defaultExpanded, {
|
|
331
|
-
value: expanded,
|
|
332
|
-
onChange: onExpandedChange
|
|
333
|
-
}), 2), expandedState = _useMergedState[0], setExpandedState = _useMergedState[1];
|
|
334
|
-
var _useMergedState1 = _sliced_to_array(useMergedState(defaultFloatingExpanded, {
|
|
335
|
-
value: floatingExpanded,
|
|
336
|
-
onChange: onFloatingExpandedChange
|
|
337
|
-
}), 2), floatingExpandedState = _useMergedState1[0], setFloatingExpandedState = _useMergedState1[1];
|
|
338
|
-
var _React_useState = _sliced_to_array(React.useState(false), 2), hover = _React_useState[0], setHover = _React_useState[1];
|
|
339
|
-
var handleToggleExpand = useRefFunction(function() {
|
|
340
|
-
setExpandedState(!expandedState);
|
|
341
|
-
});
|
|
342
|
-
var handleToggleFloatingExpand = useRefFunction(function() {
|
|
343
|
-
setFloatingExpandedState(!floatingExpandedState);
|
|
344
|
-
});
|
|
345
|
-
useEffect(function() {
|
|
346
|
-
if (status === 'loading') {
|
|
347
|
-
setExpandedState(true);
|
|
348
|
-
}
|
|
174
|
+
// --- Class names (memoized) ---
|
|
175
|
+
var cls = useMemo(function() {
|
|
176
|
+
var _obj;
|
|
177
|
+
var root = classNames(prefixCls, hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.root, (_obj = {}, _define_property(_obj, "".concat(prefixCls, "-expanded"), !expandedState), _define_property(_obj, "".concat(prefixCls, "-loading"), isLoading), _define_property(_obj, "".concat(prefixCls, "-active"), expandedState), _define_property(_obj, "".concat(prefixCls, "-success"), status === 'success'), _define_property(_obj, "".concat(prefixCls, "-light"), light), _obj));
|
|
178
|
+
var bar = classNames("".concat(prefixCls, "-bar"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.bar);
|
|
179
|
+
var header = classNames("".concat(prefixCls, "-header"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.header, _define_property({}, "".concat(prefixCls, "-header-light"), light));
|
|
180
|
+
var imageWrapper = classNames("".concat(prefixCls, "-image-wrapper"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.imageWrapper, _define_property({}, "".concat(prefixCls, "-image-wrapper-loading"), isLoading));
|
|
181
|
+
var headerRight = classNames("".concat(prefixCls, "-header-right"), hashId, _define_property({}, "".concat(prefixCls, "-header-right-loading"), isLoading));
|
|
182
|
+
var name = classNames("".concat(prefixCls, "-name"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.name, _define_property({}, "".concat(prefixCls, "-name-light"), light));
|
|
183
|
+
var _obj1;
|
|
184
|
+
var container = classNames("".concat(prefixCls, "-container"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.container, (_obj1 = {}, _define_property(_obj1, "".concat(prefixCls, "-container-expanded"), expandedState), _define_property(_obj1, "".concat(prefixCls, "-container-loading"), isLoading && !floatingExpandedState), _define_property(_obj1, "".concat(prefixCls, "-container-light"), light), _define_property(_obj1, "".concat(prefixCls, "-container-floating-expanded"), floatingExpandedState), _obj1));
|
|
185
|
+
var content = classNames("".concat(prefixCls, "-content"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.content, _define_property({}, "".concat(prefixCls, "-content-light"), light));
|
|
186
|
+
var floatingExpand = classNames("".concat(prefixCls, "-floating-expand"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.floatingExpand);
|
|
187
|
+
var target = classNames("".concat(prefixCls, "-target"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.target);
|
|
188
|
+
var timeEl = classNames("".concat(prefixCls, "-time"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.time);
|
|
189
|
+
var expand = classNames("".concat(prefixCls, "-expand"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.expand);
|
|
190
|
+
var contentExpand = classNames("".concat(prefixCls, "-content-expand"), hashId);
|
|
191
|
+
var lightIcon = classNames("".concat(prefixCls, "-header-left-icon"), "".concat(prefixCls, "-header-left-icon-light"), hashId);
|
|
192
|
+
return {
|
|
193
|
+
root: root,
|
|
194
|
+
bar: bar,
|
|
195
|
+
header: header,
|
|
196
|
+
imageWrapper: imageWrapper,
|
|
197
|
+
headerRight: headerRight,
|
|
198
|
+
name: name,
|
|
199
|
+
container: container,
|
|
200
|
+
content: content,
|
|
201
|
+
floatingExpand: floatingExpand,
|
|
202
|
+
target: target,
|
|
203
|
+
time: timeEl,
|
|
204
|
+
expand: expand,
|
|
205
|
+
contentExpand: contentExpand,
|
|
206
|
+
lightIcon: lightIcon
|
|
207
|
+
};
|
|
349
208
|
}, [
|
|
209
|
+
prefixCls,
|
|
210
|
+
hashId,
|
|
211
|
+
customClassNames,
|
|
212
|
+
expandedState,
|
|
213
|
+
isLoading,
|
|
350
214
|
status,
|
|
351
|
-
|
|
215
|
+
light,
|
|
216
|
+
floatingExpandedState
|
|
352
217
|
]);
|
|
353
|
-
var _obj;
|
|
354
|
-
var rootClassName = buildClassName(prefixCls, hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.root, (_obj = {}, _define_property(_obj, "".concat(prefixCls, "-expanded"), !expandedState), _define_property(_obj, "".concat(prefixCls, "-loading"), status === 'loading'), _define_property(_obj, "".concat(prefixCls, "-active"), expandedState), _define_property(_obj, "".concat(prefixCls, "-success"), status === 'success'), _define_property(_obj, "".concat(prefixCls, "-light"), light), _obj));
|
|
355
|
-
var barClassName = buildClassName("".concat(prefixCls, "-bar"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.bar);
|
|
356
|
-
var headerClassName = buildClassName("".concat(prefixCls, "-header"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.header, _define_property({}, "".concat(prefixCls, "-header-light"), light));
|
|
357
|
-
var headerLeftClassName = buildClassName("".concat(prefixCls, "-header-left"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.headerLeft);
|
|
358
|
-
var imageAnimationProps = status === 'loading' ? LOADING_ANIMATION : IDLE_ANIMATION;
|
|
359
|
-
var headerRightAnimation = status === 'loading' ? HEADER_RIGHT_LOADING_ANIMATION : {};
|
|
360
|
-
var _obj1;
|
|
361
|
-
var imageWrapperClassName = buildClassName("".concat(prefixCls, "-image-wrapper"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.imageWrapper, (_obj1 = {}, _define_property(_obj1, "".concat(prefixCls, "-image-wrapper-rotating"), status === 'loading'), _define_property(_obj1, "".concat(prefixCls, "-image-wrapper-loading"), status === 'loading'), _obj1));
|
|
362
|
-
var imageClassName = buildClassName("".concat(prefixCls, "-image"), hashId, customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.image);
|
|
363
|
-
var headerRightClassName = buildClassName("".concat(prefixCls, "-header-right"), hashId);
|
|
364
218
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
365
219
|
"data-testid": testId || 'ToolUseBarThink',
|
|
366
|
-
className:
|
|
220
|
+
className: cls.root,
|
|
367
221
|
style: styles === null || styles === void 0 ? void 0 : styles.root
|
|
368
222
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
369
|
-
className:
|
|
223
|
+
className: cls.bar,
|
|
370
224
|
"data-testid": "tool-use-bar-think-bar",
|
|
371
225
|
style: styles === null || styles === void 0 ? void 0 : styles.bar,
|
|
372
226
|
onClick: handleToggleExpand
|
|
373
227
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
374
|
-
className:
|
|
228
|
+
className: cls.header,
|
|
375
229
|
"data-testid": "tool-use-bar-think-header",
|
|
376
230
|
style: styles === null || styles === void 0 ? void 0 : styles.header,
|
|
377
|
-
onMouseMove:
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
231
|
+
onMouseMove: onMouseMove,
|
|
232
|
+
onMouseLeave: onMouseLeave
|
|
233
|
+
}, light ? /*#__PURE__*/ React.createElement("div", {
|
|
234
|
+
className: cls.lightIcon
|
|
235
|
+
}, hover ? /*#__PURE__*/ React.createElement(ChevronDown, {
|
|
236
|
+
style: expandedState ? CHEVRON_EXPANDED : CHEVRON_COLLAPSED
|
|
237
|
+
}) : /*#__PURE__*/ React.createElement(Brain, null)) : /*#__PURE__*/ React.createElement("div", {
|
|
238
|
+
className: cls.imageWrapper,
|
|
239
|
+
style: styles === null || styles === void 0 ? void 0 : styles.imageWrapper
|
|
240
|
+
}, icon || /*#__PURE__*/ React.createElement(Brain, null)), /*#__PURE__*/ React.createElement("div", {
|
|
241
|
+
className: cls.headerRight
|
|
242
|
+
}, toolName && /*#__PURE__*/ React.createElement("div", {
|
|
243
|
+
className: cls.name,
|
|
244
|
+
style: styles === null || styles === void 0 ? void 0 : styles.name
|
|
245
|
+
}, toolName), toolTarget && /*#__PURE__*/ React.createElement("div", {
|
|
246
|
+
className: cls.target,
|
|
247
|
+
style: styles === null || styles === void 0 ? void 0 : styles.target
|
|
248
|
+
}, toolTarget))), time && /*#__PURE__*/ React.createElement("div", {
|
|
249
|
+
className: cls.time,
|
|
250
|
+
style: styles === null || styles === void 0 ? void 0 : styles.time
|
|
251
|
+
}, time), thinkContent && !light && /*#__PURE__*/ React.createElement("div", {
|
|
252
|
+
className: cls.expand,
|
|
253
|
+
onClick: handleToggleExpand,
|
|
254
|
+
style: styles === null || styles === void 0 ? void 0 : styles.expand
|
|
255
|
+
}, expandedState ? /*#__PURE__*/ React.createElement(ChevronsDownUp, null) : /*#__PURE__*/ React.createElement(ChevronsUpDown, null))), thinkContent && expandedState && /*#__PURE__*/ React.createElement("div", {
|
|
256
|
+
className: cls.container,
|
|
257
|
+
"data-testid": "tool-use-bar-think-container",
|
|
258
|
+
style: CONTAINER_STYLE
|
|
259
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
260
|
+
ref: contentInnerRef,
|
|
261
|
+
style: contentInnerStyle
|
|
383
262
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
384
|
-
className:
|
|
385
|
-
style: styles === null || styles === void 0 ? void 0 : styles.
|
|
386
|
-
},
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
},
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
styles: styles
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
hashId: hashId,
|
|
418
|
-
classNames: customClassNames,
|
|
419
|
-
styles: styles,
|
|
420
|
-
onToggleExpand: handleToggleExpand
|
|
421
|
-
})), thinkContent ? /*#__PURE__*/ React.createElement(ThinkContainer, {
|
|
422
|
-
thinkContent: thinkContent,
|
|
423
|
-
expandedState: expandedState,
|
|
424
|
-
floatingExpandedState: floatingExpandedState,
|
|
425
|
-
status: status,
|
|
426
|
-
light: light,
|
|
427
|
-
prefixCls: prefixCls,
|
|
428
|
-
hashId: hashId,
|
|
429
|
-
classNames: customClassNames,
|
|
430
|
-
styles: styles,
|
|
431
|
-
onToggleFloatingExpand: handleToggleFloatingExpand
|
|
432
|
-
}) : null));
|
|
263
|
+
className: cls.content,
|
|
264
|
+
style: styles === null || styles === void 0 ? void 0 : styles.content
|
|
265
|
+
}, thinkContent)), showContentExpand && /*#__PURE__*/ React.createElement("div", {
|
|
266
|
+
className: cls.contentExpand,
|
|
267
|
+
onClick: handleContentExpandToggle,
|
|
268
|
+
"data-testid": "tool-use-bar-think-content-expand",
|
|
269
|
+
role: "button",
|
|
270
|
+
tabIndex: 0,
|
|
271
|
+
onKeyDown: function onKeyDown(e) {
|
|
272
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
273
|
+
e.preventDefault();
|
|
274
|
+
handleContentExpandToggle();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}, contentExpanded ? /*#__PURE__*/ React.createElement(ChevronsDownUp, null) : /*#__PURE__*/ React.createElement(ChevronsUpDown, null), contentExpanded ? locale.collapse : locale.expand), showFloatingExpand && /*#__PURE__*/ React.createElement("div", {
|
|
278
|
+
className: cls.floatingExpand,
|
|
279
|
+
onClick: handleToggleFloatingExpand,
|
|
280
|
+
"data-testid": "tool-use-bar-think-floating-expand",
|
|
281
|
+
style: styles === null || styles === void 0 ? void 0 : styles.floatingExpand
|
|
282
|
+
}, floatingExpandedState ? /*#__PURE__*/ React.createElement(ChevronsDownUp, {
|
|
283
|
+
style: FLOATING_ICON_STYLE
|
|
284
|
+
}) : /*#__PURE__*/ React.createElement(ChevronsUpDown, {
|
|
285
|
+
style: FLOATING_ICON_STYLE
|
|
286
|
+
}), floatingExpandedState ? locale.collapse : locale.expand)), thinkContent && !expandedState && showFloatingExpand && /*#__PURE__*/ React.createElement("div", {
|
|
287
|
+
className: cls.floatingExpand,
|
|
288
|
+
onClick: handleToggleFloatingExpand,
|
|
289
|
+
"data-testid": "tool-use-bar-think-floating-expand",
|
|
290
|
+
style: styles === null || styles === void 0 ? void 0 : styles.floatingExpand
|
|
291
|
+
}, floatingExpandedState ? /*#__PURE__*/ React.createElement(ChevronsDownUp, {
|
|
292
|
+
style: FLOATING_ICON_STYLE
|
|
293
|
+
}) : /*#__PURE__*/ React.createElement(ChevronsUpDown, {
|
|
294
|
+
style: FLOATING_ICON_STYLE
|
|
295
|
+
}), floatingExpandedState ? locale.collapse : locale.expand)));
|
|
433
296
|
};
|
|
434
297
|
export var ToolUseBarThink = /*#__PURE__*/ memo(ToolUseBarThinkComponent);
|