@ant-design/agentic-ui 2.30.3 → 2.30.4
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.
|
@@ -77,7 +77,8 @@ var DEFAULT_BACKGROUND_BATCH_MULTIPLIER = 10;
|
|
|
77
77
|
speed: (_ref2 = options === null || options === void 0 ? void 0 : options.speed) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_SPEED,
|
|
78
78
|
flushOnComplete: (_ref3 = options === null || options === void 0 ? void 0 : options.flushOnComplete) !== null && _ref3 !== void 0 ? _ref3 : true,
|
|
79
79
|
backgroundInterval: (_ref4 = options === null || options === void 0 ? void 0 : options.backgroundInterval) !== null && _ref4 !== void 0 ? _ref4 : DEFAULT_BACKGROUND_INTERVAL,
|
|
80
|
-
backgroundBatchMultiplier: (_ref5 = options === null || options === void 0 ? void 0 : options.backgroundBatchMultiplier) !== null && _ref5 !== void 0 ? _ref5 : DEFAULT_BACKGROUND_BATCH_MULTIPLIER
|
|
80
|
+
backgroundBatchMultiplier: (_ref5 = options === null || options === void 0 ? void 0 : options.backgroundBatchMultiplier) !== null && _ref5 !== void 0 ? _ref5 : DEFAULT_BACKGROUND_BATCH_MULTIPLIER,
|
|
81
|
+
animateTailChars: options === null || options === void 0 ? void 0 : options.animateTailChars
|
|
81
82
|
};
|
|
82
83
|
this.handleVisibilityChange = this.handleVisibilityChange.bind(this);
|
|
83
84
|
if (typeof document !== 'undefined') {
|
|
@@ -94,6 +95,13 @@ var DEFAULT_BACKGROUND_BATCH_MULTIPLIER = 10;
|
|
|
94
95
|
this.onFlush(content);
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
98
|
+
// 仅对末尾 N 字做动画:立即展示前面内容
|
|
99
|
+
var tail = this.options.animateTailChars;
|
|
100
|
+
if (tail !== undefined && tail > 0 && content.length > tail) {
|
|
101
|
+
var staticLength = content.length - tail;
|
|
102
|
+
this.displayedLength = Math.max(this.displayedLength, staticLength);
|
|
103
|
+
this.onFlush(content.slice(0, this.displayedLength));
|
|
104
|
+
}
|
|
97
105
|
this.ensureTicking();
|
|
98
106
|
}
|
|
99
107
|
},
|
|
@@ -263,7 +263,15 @@ var SCHEMA_LANGUAGES = new Set([
|
|
|
263
263
|
}, [
|
|
264
264
|
plugins
|
|
265
265
|
]);
|
|
266
|
-
//
|
|
266
|
+
// 字符队列管理:流式时仅对最后 50 字做动画,避免每段逐字输出
|
|
267
|
+
var resolvedQueueOptions = useMemo(function() {
|
|
268
|
+
return streaming ? _object_spread({
|
|
269
|
+
animateTailChars: 50
|
|
270
|
+
}, queueOptions) : queueOptions;
|
|
271
|
+
}, [
|
|
272
|
+
streaming,
|
|
273
|
+
queueOptions
|
|
274
|
+
]);
|
|
267
275
|
useEffect(function() {
|
|
268
276
|
if (!streaming) {
|
|
269
277
|
// 非流式:直接展示全部内容
|
|
@@ -273,14 +281,14 @@ var SCHEMA_LANGUAGES = new Set([
|
|
|
273
281
|
if (!queueRef.current) {
|
|
274
282
|
queueRef.current = new CharacterQueue(function(displayed) {
|
|
275
283
|
return setDisplayedContent(displayed);
|
|
276
|
-
},
|
|
284
|
+
}, resolvedQueueOptions);
|
|
277
285
|
}
|
|
278
286
|
queueRef.current.push(content || '');
|
|
279
287
|
return undefined;
|
|
280
288
|
}, [
|
|
281
289
|
content,
|
|
282
290
|
streaming,
|
|
283
|
-
|
|
291
|
+
resolvedQueueOptions
|
|
284
292
|
]);
|
|
285
293
|
// 流式完成时 flush 所有剩余内容
|
|
286
294
|
useEffect(function() {
|
|
@@ -6,6 +6,12 @@ export interface CharacterQueueOptions {
|
|
|
6
6
|
charsPerFrame?: number;
|
|
7
7
|
/** 是否启用打字动画,默认 true(流式时) */
|
|
8
8
|
animate?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 仅对末尾 N 个字符做动画,前面内容立即展示。
|
|
11
|
+
* 设为 50 时,每次 push 只对最后 50 字逐字输出,避免整段逐字动画。
|
|
12
|
+
* 默认 undefined 表示整段动画(原有行为)。
|
|
13
|
+
*/
|
|
14
|
+
animateTailChars?: number;
|
|
9
15
|
/** 动画速度因子,1.0 为标准速度 */
|
|
10
16
|
speed?: number;
|
|
11
17
|
/** 内容完成后立即 flush 全部剩余 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ant-design/agentic-ui",
|
|
3
|
-
"version": "2.30.
|
|
3
|
+
"version": "2.30.4",
|
|
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": "npm run build && npm run test",
|
|
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",
|