@ant-design/agentic-ui 2.27.8 → 2.27.10
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/AgenticLayout/index.d.ts +0 -46
- package/dist/AgenticLayout/index.js +149 -8
- package/dist/AgenticLayout/style.js +31 -3
- package/dist/Bubble/AIBubble.js +1 -11
- package/dist/Bubble/schema-editor/useRefState.js +1 -1
- package/dist/ChatLayout/index.js +17 -7
- package/dist/ChatLayout/style.js +5 -4
- package/dist/ChatLayout/types.d.ts +5 -0
- package/dist/Components/effects/CreativeRecommendationEffect/creativeRecommendation.json +485 -540
- package/dist/Components/lotties/CreativeSparkLottie/creativeSpark.json +4246 -5558
- package/dist/Components/lotties/LoadingLottie/loading.json +3072 -4020
- package/dist/Hooks/useAutoScroll.d.ts +13 -1
- package/dist/Hooks/useAutoScroll.js +19 -6
- package/dist/Plugins/code/components/ThinkBlock.js +8 -2
- package/dist/Plugins/mermaid/MermaidRendererImpl.js +1 -1
- package/dist/TaskList/index.js +1 -1
- package/package.json +1 -1
|
@@ -13,18 +13,29 @@ declare const SCROLL_TOLERANCE = 20;
|
|
|
13
13
|
* @param {(size: {width: number, height: number}) => void} [props.onResize] - 容器尺寸变化回调
|
|
14
14
|
* @param {any[]} [props.deps] - 依赖数组,用于重新初始化 MutationObserver
|
|
15
15
|
* @param {number} [props.timeout=160] - 节流时间间隔(毫秒)
|
|
16
|
+
* @param {'smooth' | 'auto'} [props.scrollBehavior='smooth'] - 自动滚动行为,'smooth' 为平滑滚动,'auto' 为立即滚动(仅影响自动滚动,手动滚动默认为立即滚动)
|
|
16
17
|
*
|
|
17
18
|
* @example
|
|
18
19
|
* ```tsx
|
|
20
|
+
* // 基本用法(默认平滑滚动)
|
|
19
21
|
* const { containerRef, scrollToBottom } = useAutoScroll({
|
|
20
22
|
* SCROLL_TOLERANCE: 30,
|
|
21
23
|
* onResize: () => {},
|
|
22
24
|
* timeout: 200
|
|
23
25
|
* });
|
|
24
26
|
*
|
|
27
|
+
* // 立即滚动
|
|
28
|
+
* const { containerRef, scrollToBottom } = useAutoScroll({
|
|
29
|
+
* scrollBehavior: 'auto',
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // 手动滚动默认为立即滚动,无需平滑滚动
|
|
33
|
+
* scrollToBottom(); // 立即滚动
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
25
36
|
* @returns {Object} Hook 返回值
|
|
26
37
|
* @returns {React.RefObject<T>} returns.containerRef - 容器引用
|
|
27
|
-
* @returns {() => void} returns.scrollToBottom -
|
|
38
|
+
* @returns {() => void} returns.scrollToBottom - 手动滚动到底部方法(立即滚动,无动画)
|
|
28
39
|
*
|
|
29
40
|
* @remarks
|
|
30
41
|
* - 自动检测内容变化并滚动到底部
|
|
@@ -43,6 +54,7 @@ export declare const useAutoScroll: <T extends HTMLDivElement>(props?: {
|
|
|
43
54
|
}) => void) | undefined;
|
|
44
55
|
deps?: any[] | undefined;
|
|
45
56
|
timeout?: number | undefined;
|
|
57
|
+
scrollBehavior?: "auto" | "smooth" | undefined;
|
|
46
58
|
}) => {
|
|
47
59
|
readonly containerRef: import("react").MutableRefObject<T | null>;
|
|
48
60
|
readonly scrollToBottom: () => void;
|
|
@@ -163,18 +163,29 @@ var SCROLL_TOLERANCE = 20; // 滚动到底部的容差阈值
|
|
|
163
163
|
* @param {(size: {width: number, height: number}) => void} [props.onResize] - 容器尺寸变化回调
|
|
164
164
|
* @param {any[]} [props.deps] - 依赖数组,用于重新初始化 MutationObserver
|
|
165
165
|
* @param {number} [props.timeout=160] - 节流时间间隔(毫秒)
|
|
166
|
+
* @param {'smooth' | 'auto'} [props.scrollBehavior='smooth'] - 自动滚动行为,'smooth' 为平滑滚动,'auto' 为立即滚动(仅影响自动滚动,手动滚动默认为立即滚动)
|
|
166
167
|
*
|
|
167
168
|
* @example
|
|
168
169
|
* ```tsx
|
|
170
|
+
* // 基本用法(默认平滑滚动)
|
|
169
171
|
* const { containerRef, scrollToBottom } = useAutoScroll({
|
|
170
172
|
* SCROLL_TOLERANCE: 30,
|
|
171
173
|
* onResize: () => {},
|
|
172
174
|
* timeout: 200
|
|
173
175
|
* });
|
|
174
176
|
*
|
|
177
|
+
* // 立即滚动
|
|
178
|
+
* const { containerRef, scrollToBottom } = useAutoScroll({
|
|
179
|
+
* scrollBehavior: 'auto',
|
|
180
|
+
* });
|
|
181
|
+
*
|
|
182
|
+
* // 手动滚动默认为立即滚动,无需平滑滚动
|
|
183
|
+
* scrollToBottom(); // 立即滚动
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
175
186
|
* @returns {Object} Hook 返回值
|
|
176
187
|
* @returns {React.RefObject<T>} returns.containerRef - 容器引用
|
|
177
|
-
* @returns {() => void} returns.scrollToBottom -
|
|
188
|
+
* @returns {() => void} returns.scrollToBottom - 手动滚动到底部方法(立即滚动,无动画)
|
|
178
189
|
*
|
|
179
190
|
* @remarks
|
|
180
191
|
* - 自动检测内容变化并滚动到底部
|
|
@@ -195,10 +206,10 @@ var SCROLL_TOLERANCE = 20; // 滚动到底部的容差阈值
|
|
|
195
206
|
// 主滚动逻辑
|
|
196
207
|
var _checkScroll = /*#__PURE__*/ function() {
|
|
197
208
|
var _ref = _async_to_generator(function() {
|
|
198
|
-
var force, _props_onResize, container, currentScrollHeight, prevScrollHeight, isNearBottom, shouldScroll, _container_scrollTo;
|
|
209
|
+
var force, behavior, _props_onResize, container, currentScrollHeight, prevScrollHeight, isNearBottom, shouldScroll, _container_scrollTo, scrollBehavior;
|
|
199
210
|
var _arguments = arguments;
|
|
200
211
|
return _ts_generator(this, function(_state) {
|
|
201
|
-
force = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : false;
|
|
212
|
+
force = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : false, behavior = _arguments.length > 1 ? _arguments[1] : void 0;
|
|
202
213
|
container = containerRef.current;
|
|
203
214
|
if (!container) return [
|
|
204
215
|
2
|
|
@@ -217,9 +228,11 @@ var SCROLL_TOLERANCE = 20; // 滚动到底部的容差阈值
|
|
|
217
228
|
shouldScroll = force || currentScrollHeight > prevScrollHeight && (isNearBottom || isLocked.current);
|
|
218
229
|
if (shouldScroll && container.scrollTo) {
|
|
219
230
|
;
|
|
231
|
+
// 如果传入了 behavior,使用传入的值;否则使用配置的 scrollBehavior;最后默认为 'smooth'
|
|
232
|
+
scrollBehavior = behavior !== undefined ? behavior : props.scrollBehavior || 'smooth';
|
|
220
233
|
(_container_scrollTo = container.scrollTo) === null || _container_scrollTo === void 0 ? void 0 : _container_scrollTo.call(container, {
|
|
221
234
|
top: currentScrollHeight,
|
|
222
|
-
behavior:
|
|
235
|
+
behavior: scrollBehavior
|
|
223
236
|
});
|
|
224
237
|
isLocked.current = false; // 滚动后解除锁定
|
|
225
238
|
}
|
|
@@ -256,9 +269,9 @@ var SCROLL_TOLERANCE = 20; // 滚动到底部的容差阈值
|
|
|
256
269
|
return (_observer_current = observer.current) === null || _observer_current === void 0 ? void 0 : _observer_current.disconnect();
|
|
257
270
|
};
|
|
258
271
|
}, _to_consumable_array(props.deps || []));
|
|
259
|
-
//
|
|
272
|
+
// 暴露手动滚动方法(默认为立即滚动,无需平滑滚动)
|
|
260
273
|
var scrollToBottom = function() {
|
|
261
|
-
checkScroll === null || checkScroll === void 0 ? void 0 : checkScroll(true);
|
|
274
|
+
checkScroll === null || checkScroll === void 0 ? void 0 : checkScroll(true, 'auto');
|
|
262
275
|
};
|
|
263
276
|
return {
|
|
264
277
|
containerRef: containerRef,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @fileoverview 思考块组件
|
|
3
3
|
* 只读模式下渲染思考类型的代码块
|
|
4
4
|
*/ import React, { useContext } from "react";
|
|
5
|
+
import { MessagesContext } from "../../../Bubble/MessagesContent/BubbleContext";
|
|
5
6
|
import { I18nContext } from "../../../I18n";
|
|
6
7
|
import { EditorStoreContext } from "../../../MarkdownEditor/editor/store";
|
|
7
8
|
import { ToolUseBarThink } from "../../../ToolUseBarThink";
|
|
@@ -22,9 +23,13 @@ export function ThinkBlock(param) {
|
|
|
22
23
|
var _editorProps_codeProps;
|
|
23
24
|
var locale = useContext(I18nContext).locale;
|
|
24
25
|
var editorProps = (useContext(EditorStoreContext) || {}).editorProps;
|
|
26
|
+
var message = useContext(MessagesContext).message;
|
|
25
27
|
var rawContent = (element === null || element === void 0 ? void 0 : element.value) !== null && (element === null || element === void 0 ? void 0 : element.value) !== undefined ? String(element.value).trim() : '';
|
|
26
28
|
// 恢复内容中被转义的代码块
|
|
27
29
|
var content = restoreCodeBlocks(rawContent);
|
|
30
|
+
// 获取当前 Bubble 的 isFinished 状态
|
|
31
|
+
var bubbleIsFinished = message === null || message === void 0 ? void 0 : message.isFinished;
|
|
32
|
+
// 判断是否正在加载:内容以...结尾 或者 bubble 还未完成
|
|
28
33
|
var isLoading = content.endsWith('...');
|
|
29
34
|
var toolNameText = isLoading ? (locale === null || locale === void 0 ? void 0 : locale['think.deepThinkingInProgress']) || '深度思考...' : (locale === null || locale === void 0 ? void 0 : locale['think.deepThinking']) || '深度思考';
|
|
30
35
|
return /*#__PURE__*/ React.createElement(ToolUseBarThink, {
|
|
@@ -32,10 +37,11 @@ export function ThinkBlock(param) {
|
|
|
32
37
|
styles: {
|
|
33
38
|
root: {
|
|
34
39
|
boxSizing: 'border-box',
|
|
35
|
-
maxWidth: '680px'
|
|
40
|
+
maxWidth: '680px',
|
|
41
|
+
marginTop: 8
|
|
36
42
|
}
|
|
37
43
|
},
|
|
38
|
-
expanded: (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_codeProps = editorProps.codeProps) === null || _editorProps_codeProps === void 0 ? void 0 : _editorProps_codeProps.alwaysExpandedDeepThink) ? true : undefined,
|
|
44
|
+
expanded: (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_codeProps = editorProps.codeProps) === null || _editorProps_codeProps === void 0 ? void 0 : _editorProps_codeProps.alwaysExpandedDeepThink) ? true : bubbleIsFinished ? false : undefined,
|
|
39
45
|
toolName: toolNameText,
|
|
40
46
|
thinkContent: content,
|
|
41
47
|
status: isLoading ? 'loading' : 'success'
|
|
@@ -2,8 +2,8 @@ import { ConfigProvider } from "antd";
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import React, { useContext, useMemo, useRef } from "react";
|
|
4
4
|
import { useIntersectionOnce } from "../../Hooks/useIntersectionOnce";
|
|
5
|
-
import { useMermaidRender } from "./useMermaidRender";
|
|
6
5
|
import { useStyle } from "./style";
|
|
6
|
+
import { useMermaidRender } from "./useMermaidRender";
|
|
7
7
|
/**
|
|
8
8
|
* Mermaid 渲染器组件实现
|
|
9
9
|
* 负责实际的图表渲染逻辑
|
package/dist/TaskList/index.js
CHANGED
|
@@ -62,9 +62,9 @@ import classNames from "classnames";
|
|
|
62
62
|
import { AnimatePresence, motion } from "framer-motion";
|
|
63
63
|
import { useMergedState } from "rc-util";
|
|
64
64
|
import React, { memo, useContext, useMemo } from "react";
|
|
65
|
-
import { useRefFunction } from "../Hooks/useRefFunction";
|
|
66
65
|
import { ActionIconBox } from "../Components/ActionIconBox";
|
|
67
66
|
import { Loading } from "../Components/Loading";
|
|
67
|
+
import { useRefFunction } from "../Hooks/useRefFunction";
|
|
68
68
|
import { I18nContext } from "../I18n";
|
|
69
69
|
import { useStyle } from "./style";
|
|
70
70
|
var LOADING_SIZE = 16;
|