@ant-design/agentic-ui 2.30.17 → 2.30.20
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/MessagesContent/MarkdownPreview.js +11 -10
- package/dist/Hooks/useLanguage.d.ts +25 -0
- package/dist/I18n/locales.d.ts +25 -0
- package/dist/I18n/locales.js +58 -2
- package/dist/MarkdownEditor/editor/elements/Code/index.js +12 -0
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/enter.js +5 -0
- package/dist/MarkdownInputField/AttachmentButton/index.js +55 -5
- package/dist/MarkdownInputField/style.js +1 -2
- package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +50 -0
- package/dist/Plugins/code/components/CodeToolbar.js +1 -1
- package/dist/Schema/SchemaForm/index.js +18 -9
- package/dist/TaskList/TaskList.js +6 -2
- package/dist/ThoughtChainList/ThoughtChainListItem.js +28 -3
- package/dist/ThoughtChainList/index.js +19 -3
- package/dist/ThoughtChainList/style.js +4 -2
- package/dist/ToolUseBar/BarItem/Content.js +26 -49
- package/dist/ToolUseBar/style.js +13 -4
- package/dist/Workspace/Browser/index.js +1 -2
- package/dist/Workspace/File/FileTypeProcessor.js +1 -4
- package/dist/Workspace/File/PreviewComponent.js +6 -6
- package/dist/Workspace/File/index.d.ts +1 -0
- package/dist/Workspace/File/index.js +1 -0
- package/dist/Workspace/File/utils.js +4 -2
- package/dist/Workspace/types.d.ts +8 -1
- package/dist/Workspace/types.js +74 -35
- package/package.json +1 -1
|
@@ -94,8 +94,8 @@ import { MessagesContext } from "./BubbleContext";
|
|
|
94
94
|
* />
|
|
95
95
|
* ```
|
|
96
96
|
*/ export var MarkdownPreview = function MarkdownPreview(props) {
|
|
97
|
-
var _ref, _ref1;
|
|
98
|
-
var _props_markdownRenderConfig, _props_markdownRenderConfig1, _props_originData, _props_originData1;
|
|
97
|
+
var _ref, _ref1, _ref2;
|
|
98
|
+
var _props_markdownRenderConfig, _props_markdownRenderConfig1, _props_originData, _props_originData1, _props_originData2;
|
|
99
99
|
var content = props.content, extra = props.extra, typing = props.typing, htmlRef = props.htmlRef, fncProps = props.fncProps, docListNode = props.docListNode, beforeContent = props.beforeContent, afterContent = props.afterContent;
|
|
100
100
|
var MarkdownEditorRef = React.useRef(undefined);
|
|
101
101
|
var hidePadding = (useContext(MessagesContext) || {}).hidePadding;
|
|
@@ -105,6 +105,7 @@ import { MessagesContext } from "./BubbleContext";
|
|
|
105
105
|
var extraShowOnHover = config === null || config === void 0 ? void 0 : config.extraShowOnHover;
|
|
106
106
|
var token = theme.useToken().token;
|
|
107
107
|
var renderMode = (_ref = (_ref1 = (_props_markdownRenderConfig = props.markdownRenderConfig) === null || _props_markdownRenderConfig === void 0 ? void 0 : _props_markdownRenderConfig.renderMode) !== null && _ref1 !== void 0 ? _ref1 : (_props_markdownRenderConfig1 = props.markdownRenderConfig) === null || _props_markdownRenderConfig1 === void 0 ? void 0 : _props_markdownRenderConfig1.renderType) !== null && _ref !== void 0 ? _ref : 'slate';
|
|
108
|
+
var shouldAnimateMarkdown = Boolean(typing) && ((_ref2 = (_props_originData = props.originData) === null || _props_originData === void 0 ? void 0 : _props_originData.isLast) !== null && _ref2 !== void 0 ? _ref2 : true);
|
|
108
109
|
var isPaddingHidden = useMemo(function() {
|
|
109
110
|
return !!extra;
|
|
110
111
|
}, [
|
|
@@ -121,15 +122,15 @@ import { MessagesContext } from "./BubbleContext";
|
|
|
121
122
|
renderMode
|
|
122
123
|
]);
|
|
123
124
|
var markdown = useMemo(function() {
|
|
124
|
-
var _ref;
|
|
125
|
-
var _content_includes, _htmlRef_current, _htmlRef_current1, _props_markdownRenderConfig, _props_originData, _props_originData1, _props_originData2, _props_markdownRenderConfig1, _props_markdownRenderConfig2, _props_markdownRenderConfig3;
|
|
125
|
+
var _ref, _ref1;
|
|
126
|
+
var _content_includes, _htmlRef_current, _htmlRef_current1, _props_markdownRenderConfig, _props_originData, _props_originData1, _props_originData2, _props_markdownRenderConfig1, _props_markdownRenderConfig2, _props_originData3, _props_markdownRenderConfig3;
|
|
126
127
|
// MarkdownRenderer 渲染路径——轻量,不创建 Slate 实例
|
|
127
128
|
if (renderMode === 'markdown') {
|
|
128
|
-
var
|
|
129
|
+
var _props_originData4, _props_markdownRenderConfig4, _props_markdownRenderConfig5, _props_markdownRenderConfig6, _props_markdownRenderConfig7, _props_markdownRenderConfig8, _props_markdownRenderConfig9, _props_markdownRenderConfig10;
|
|
129
130
|
return /*#__PURE__*/ React.createElement(MarkdownRenderer, {
|
|
130
131
|
content: content,
|
|
131
|
-
streaming:
|
|
132
|
-
isFinished: (
|
|
132
|
+
streaming: shouldAnimateMarkdown,
|
|
133
|
+
isFinished: (_props_originData4 = props.originData) === null || _props_originData4 === void 0 ? void 0 : _props_originData4.isFinished,
|
|
133
134
|
plugins: (_props_markdownRenderConfig4 = props.markdownRenderConfig) === null || _props_markdownRenderConfig4 === void 0 ? void 0 : _props_markdownRenderConfig4.plugins,
|
|
134
135
|
queueOptions: (_props_markdownRenderConfig5 = props.markdownRenderConfig) === null || _props_markdownRenderConfig5 === void 0 ? void 0 : _props_markdownRenderConfig5.queueOptions,
|
|
135
136
|
streamingParagraphAnimation: (_props_markdownRenderConfig6 = props.markdownRenderConfig) === null || _props_markdownRenderConfig6 === void 0 ? void 0 : _props_markdownRenderConfig6.streamingParagraphAnimation,
|
|
@@ -168,7 +169,7 @@ import { MessagesContext } from "./BubbleContext";
|
|
|
168
169
|
editorStyle: _object_spread({
|
|
169
170
|
fontSize: 14
|
|
170
171
|
}, ((_props_markdownRenderConfig1 = props.markdownRenderConfig) === null || _props_markdownRenderConfig1 === void 0 ? void 0 : _props_markdownRenderConfig1.editorStyle) || {}),
|
|
171
|
-
typewriter: (_ref = (_props_markdownRenderConfig2 = props.markdownRenderConfig) === null || _props_markdownRenderConfig2 === void 0 ? void 0 : _props_markdownRenderConfig2.typewriter) !== null && _ref !== void 0 ? _ref :
|
|
172
|
+
typewriter: ((_ref = (_props_markdownRenderConfig2 = props.markdownRenderConfig) === null || _props_markdownRenderConfig2 === void 0 ? void 0 : _props_markdownRenderConfig2.typewriter) !== null && _ref !== void 0 ? _ref : shouldAnimateMarkdown) && ((_ref1 = (_props_originData3 = props.originData) === null || _props_originData3 === void 0 ? void 0 : _props_originData3.isLast) !== null && _ref1 !== void 0 ? _ref1 : true),
|
|
172
173
|
style: _object_spread({
|
|
173
174
|
minWidth: minWidth ? "min(".concat(minWidth, "px,100%)") : undefined,
|
|
174
175
|
maxWidth: standalone ? '100%' : undefined,
|
|
@@ -180,8 +181,8 @@ import { MessagesContext } from "./BubbleContext";
|
|
|
180
181
|
}, [
|
|
181
182
|
hidePadding,
|
|
182
183
|
typing,
|
|
183
|
-
(
|
|
184
|
-
(
|
|
184
|
+
(_props_originData1 = props.originData) === null || _props_originData1 === void 0 ? void 0 : _props_originData1.isLast,
|
|
185
|
+
(_props_originData2 = props.originData) === null || _props_originData2 === void 0 ? void 0 : _props_originData2.isFinished,
|
|
185
186
|
isPaddingHidden,
|
|
186
187
|
content,
|
|
187
188
|
renderMode,
|
|
@@ -437,6 +437,31 @@ export declare function useLanguage(): {
|
|
|
437
437
|
'jinja.template.filter.description': string;
|
|
438
438
|
'jinja.template.setVariable.title': string;
|
|
439
439
|
'jinja.template.setVariable.description': string;
|
|
440
|
+
'schemaForm.invalidFormat': string;
|
|
441
|
+
'schemaForm.mustBeNumber': string;
|
|
442
|
+
'schemaForm.minValue': string;
|
|
443
|
+
'schemaForm.maxValue': string;
|
|
444
|
+
'schemaForm.minItems': string;
|
|
445
|
+
'schemaForm.maxItems': string;
|
|
446
|
+
'schemaForm.addItem': string;
|
|
447
|
+
'schemaForm.deleteItem': string;
|
|
448
|
+
'fileType.plainText': string;
|
|
449
|
+
'fileType.image': string;
|
|
450
|
+
'fileType.video': string;
|
|
451
|
+
'fileType.audio': string;
|
|
452
|
+
'fileType.pdf': string;
|
|
453
|
+
'fileType.word': string;
|
|
454
|
+
'fileType.excel': string;
|
|
455
|
+
'fileType.csv': string;
|
|
456
|
+
'fileType.archive': string;
|
|
457
|
+
'fileType.shell': string;
|
|
458
|
+
'fileType.config': string;
|
|
459
|
+
'fileType.powerpoint': string;
|
|
460
|
+
'workspace.file.unsupportedPreview': string;
|
|
461
|
+
'workspace.file.downloadButton': string;
|
|
462
|
+
'workspace.file.videoNotSupported': string;
|
|
463
|
+
'workspace.file.audioNotSupported': string;
|
|
464
|
+
'workspace.file.fileType': string;
|
|
440
465
|
};
|
|
441
466
|
setLanguage: ((language: "zh-CN" | "en-US") => void) | undefined;
|
|
442
467
|
toggleLanguage: () => void;
|
package/dist/I18n/locales.d.ts
CHANGED
|
@@ -399,6 +399,31 @@ export declare const cnLabels: {
|
|
|
399
399
|
'jinja.template.filter.description': string;
|
|
400
400
|
'jinja.template.setVariable.title': string;
|
|
401
401
|
'jinja.template.setVariable.description': string;
|
|
402
|
+
'schemaForm.invalidFormat': string;
|
|
403
|
+
'schemaForm.mustBeNumber': string;
|
|
404
|
+
'schemaForm.minValue': string;
|
|
405
|
+
'schemaForm.maxValue': string;
|
|
406
|
+
'schemaForm.minItems': string;
|
|
407
|
+
'schemaForm.maxItems': string;
|
|
408
|
+
'schemaForm.addItem': string;
|
|
409
|
+
'schemaForm.deleteItem': string;
|
|
410
|
+
'fileType.plainText': string;
|
|
411
|
+
'fileType.image': string;
|
|
412
|
+
'fileType.video': string;
|
|
413
|
+
'fileType.audio': string;
|
|
414
|
+
'fileType.pdf': string;
|
|
415
|
+
'fileType.word': string;
|
|
416
|
+
'fileType.excel': string;
|
|
417
|
+
'fileType.csv': string;
|
|
418
|
+
'fileType.archive': string;
|
|
419
|
+
'fileType.shell': string;
|
|
420
|
+
'fileType.config': string;
|
|
421
|
+
'fileType.powerpoint': string;
|
|
422
|
+
'workspace.file.unsupportedPreview': string;
|
|
423
|
+
'workspace.file.downloadButton': string;
|
|
424
|
+
'workspace.file.videoNotSupported': string;
|
|
425
|
+
'workspace.file.audioNotSupported': string;
|
|
426
|
+
'workspace.file.fileType': string;
|
|
402
427
|
};
|
|
403
428
|
/**
|
|
404
429
|
* 英文标签映射对象
|
package/dist/I18n/locales.js
CHANGED
|
@@ -426,7 +426,35 @@
|
|
|
426
426
|
'jinja.template.filter.title': '过滤器',
|
|
427
427
|
'jinja.template.filter.description': '{{ value | filter }}',
|
|
428
428
|
'jinja.template.setVariable.title': '设置变量',
|
|
429
|
-
'jinja.template.setVariable.description': '{% set name = value %}'
|
|
429
|
+
'jinja.template.setVariable.description': '{% set name = value %}',
|
|
430
|
+
// SchemaForm validation messages
|
|
431
|
+
'schemaForm.invalidFormat': '格式不正确',
|
|
432
|
+
'schemaForm.mustBeNumber': '必须是数字',
|
|
433
|
+
'schemaForm.minValue': '不能小于 ${min}',
|
|
434
|
+
'schemaForm.maxValue': '不能大于 ${max}',
|
|
435
|
+
'schemaForm.minItems': '至少需要 ${min} 项',
|
|
436
|
+
'schemaForm.maxItems': '最多只能有 ${max} 项',
|
|
437
|
+
'schemaForm.addItem': '添加',
|
|
438
|
+
'schemaForm.deleteItem': '删除',
|
|
439
|
+
// File type names
|
|
440
|
+
'fileType.plainText': '文本文件',
|
|
441
|
+
'fileType.image': '图片',
|
|
442
|
+
'fileType.video': '视频',
|
|
443
|
+
'fileType.audio': '音频',
|
|
444
|
+
'fileType.pdf': 'PDF 文档',
|
|
445
|
+
'fileType.word': 'Word 文档',
|
|
446
|
+
'fileType.excel': 'Excel 表格',
|
|
447
|
+
'fileType.csv': 'CSV 文件',
|
|
448
|
+
'fileType.archive': '压缩文件',
|
|
449
|
+
'fileType.shell': 'Shell 脚本',
|
|
450
|
+
'fileType.config': '配置文件',
|
|
451
|
+
'fileType.powerpoint': 'PowerPoint 演示文稿',
|
|
452
|
+
// PreviewComponent messages
|
|
453
|
+
'workspace.file.unsupportedPreview': '此文件无法预览,请下载查看。',
|
|
454
|
+
'workspace.file.downloadButton': '下载',
|
|
455
|
+
'workspace.file.videoNotSupported': '您的浏览器不支持视频播放',
|
|
456
|
+
'workspace.file.audioNotSupported': '您的浏览器不支持音频播放',
|
|
457
|
+
'workspace.file.fileType': '文件类型:'
|
|
430
458
|
};
|
|
431
459
|
/**
|
|
432
460
|
* 英文标签映射对象
|
|
@@ -856,5 +884,33 @@
|
|
|
856
884
|
'jinja.template.filter.title': 'Filter',
|
|
857
885
|
'jinja.template.filter.description': '{{ value | filter }}',
|
|
858
886
|
'jinja.template.setVariable.title': 'Set variable',
|
|
859
|
-
'jinja.template.setVariable.description': '{% set name = value %}'
|
|
887
|
+
'jinja.template.setVariable.description': '{% set name = value %}',
|
|
888
|
+
// SchemaForm validation messages
|
|
889
|
+
'schemaForm.invalidFormat': 'Invalid format',
|
|
890
|
+
'schemaForm.mustBeNumber': 'Must be a number',
|
|
891
|
+
'schemaForm.minValue': 'Cannot be less than ${min}',
|
|
892
|
+
'schemaForm.maxValue': 'Cannot be greater than ${max}',
|
|
893
|
+
'schemaForm.minItems': 'Must have at least ${min} items',
|
|
894
|
+
'schemaForm.maxItems': 'Cannot have more than ${max} items',
|
|
895
|
+
'schemaForm.addItem': 'Add',
|
|
896
|
+
'schemaForm.deleteItem': 'Delete',
|
|
897
|
+
// File type names
|
|
898
|
+
'fileType.plainText': 'Text file',
|
|
899
|
+
'fileType.image': 'Image',
|
|
900
|
+
'fileType.video': 'Video',
|
|
901
|
+
'fileType.audio': 'Audio',
|
|
902
|
+
'fileType.pdf': 'PDF document',
|
|
903
|
+
'fileType.word': 'Word document',
|
|
904
|
+
'fileType.excel': 'Excel spreadsheet',
|
|
905
|
+
'fileType.csv': 'CSV file',
|
|
906
|
+
'fileType.archive': 'Archive',
|
|
907
|
+
'fileType.shell': 'Shell script',
|
|
908
|
+
'fileType.config': 'Configuration file',
|
|
909
|
+
'fileType.powerpoint': 'PowerPoint presentation',
|
|
910
|
+
// PreviewComponent messages
|
|
911
|
+
'workspace.file.unsupportedPreview': 'This file cannot be previewed, please download to view.',
|
|
912
|
+
'workspace.file.downloadButton': 'Download',
|
|
913
|
+
'workspace.file.videoNotSupported': 'Your browser does not support video playback',
|
|
914
|
+
'workspace.file.audioNotSupported': 'Your browser does not support audio playback',
|
|
915
|
+
'workspace.file.fileType': 'File type: '
|
|
860
916
|
};
|
|
@@ -107,6 +107,18 @@ export var Code = function Code(param) {
|
|
|
107
107
|
background: '#FFFFFF',
|
|
108
108
|
boxShadow: 'var(--shadow-control-base)',
|
|
109
109
|
position: 'relative'
|
|
110
|
+
},
|
|
111
|
+
onKeyDown: function onKeyDown(e) {
|
|
112
|
+
if (e.key === 'Enter') {
|
|
113
|
+
e.stopPropagation();
|
|
114
|
+
e.preventDefault();
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
onKeyUp: function onKeyUp(e) {
|
|
118
|
+
if (e.key === 'Enter') {
|
|
119
|
+
e.stopPropagation();
|
|
120
|
+
e.preventDefault();
|
|
121
|
+
}
|
|
110
122
|
}
|
|
111
123
|
}), /*#__PURE__*/ React.createElement("div", {
|
|
112
124
|
style: {
|
|
@@ -179,6 +179,11 @@ export var EnterKey = /*#__PURE__*/ function() {
|
|
|
179
179
|
this.empty(e, path);
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
|
+
if (el.type === 'code') {
|
|
183
|
+
Transforms.insertText(this.editor, '\n');
|
|
184
|
+
e.preventDefault();
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
182
187
|
if (el.type === 'break') {
|
|
183
188
|
Transforms.insertNodes(this.editor, {
|
|
184
189
|
type: 'paragraph',
|
|
@@ -47,6 +47,45 @@ function _instanceof(left, right) {
|
|
|
47
47
|
return left instanceof right;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
function _object_spread(target) {
|
|
51
|
+
for(var i = 1; i < arguments.length; i++){
|
|
52
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
53
|
+
var ownKeys = Object.keys(source);
|
|
54
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
55
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
56
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
ownKeys.forEach(function(key) {
|
|
60
|
+
_define_property(target, key, source[key]);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return target;
|
|
64
|
+
}
|
|
65
|
+
function ownKeys(object, enumerableOnly) {
|
|
66
|
+
var keys = Object.keys(object);
|
|
67
|
+
if (Object.getOwnPropertySymbols) {
|
|
68
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
69
|
+
if (enumerableOnly) {
|
|
70
|
+
symbols = symbols.filter(function(sym) {
|
|
71
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
keys.push.apply(keys, symbols);
|
|
75
|
+
}
|
|
76
|
+
return keys;
|
|
77
|
+
}
|
|
78
|
+
function _object_spread_props(target, source) {
|
|
79
|
+
source = source != null ? source : {};
|
|
80
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
81
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
82
|
+
} else {
|
|
83
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
84
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return target;
|
|
88
|
+
}
|
|
50
89
|
function _ts_generator(thisArg, body) {
|
|
51
90
|
var f, y, t, _ = {
|
|
52
91
|
label: 0,
|
|
@@ -357,18 +396,29 @@ var processFile = function processFile(file, index, map, props) {
|
|
|
357
396
|
* @param props.locale - 国际化文案
|
|
358
397
|
*/ export var upLoadFileToServer = function upLoadFileToServer(files, props) {
|
|
359
398
|
return _async_to_generator(function() {
|
|
360
|
-
var map, existingFileCount, hideLoading, fileList, totalCount, isMaxExceeded, isMinNotMet,
|
|
399
|
+
var map, existingFileCount, notifyChange, hideLoading, fileList, totalCount, isMaxExceeded, isMinNotMet, propsWithNotify, _props_onExceedMaxCount, maxCount, rawMessage, errorMessage, i, error;
|
|
361
400
|
return _ts_generator(this, function(_state) {
|
|
362
401
|
switch(_state.label){
|
|
363
402
|
case 0:
|
|
364
403
|
map = props.fileMap || new Map();
|
|
365
404
|
existingFileCount = map.size;
|
|
405
|
+
// Always notify with a new Map reference so React state setters always trigger re-renders,
|
|
406
|
+
// regardless of whether the caller wraps the callback or passes a raw setState directly.
|
|
407
|
+
notifyChange = function notifyChange(m) {
|
|
408
|
+
var _props_onFileMapChange;
|
|
409
|
+
return (_props_onFileMapChange = props.onFileMapChange) === null || _props_onFileMapChange === void 0 ? void 0 : _props_onFileMapChange.call(props, new Map(m));
|
|
410
|
+
};
|
|
366
411
|
hideLoading = function hideLoading() {};
|
|
367
412
|
fileList = Array.from(files);
|
|
368
413
|
fileList.forEach(prepareFile);
|
|
369
414
|
totalCount = fileList.length + existingFileCount;
|
|
370
415
|
isMaxExceeded = typeof props.maxFileCount === 'number' && totalCount > props.maxFileCount;
|
|
371
416
|
isMinNotMet = typeof props.minFileCount === 'number' && totalCount < props.minFileCount;
|
|
417
|
+
// Wrap all internal change notifications to use notifyChange so every update
|
|
418
|
+
// produces a new Map reference that React's state setter will always accept.
|
|
419
|
+
propsWithNotify = _object_spread_props(_object_spread({}, props), {
|
|
420
|
+
onFileMapChange: notifyChange
|
|
421
|
+
});
|
|
372
422
|
if (isMaxExceeded || isMinNotMet) {
|
|
373
423
|
hideLoading();
|
|
374
424
|
if (isMaxExceeded) {
|
|
@@ -382,7 +432,7 @@ var processFile = function processFile(file, index, map, props) {
|
|
|
382
432
|
file.errorMessage = errorMessage;
|
|
383
433
|
if (file.uuid) map.set(file.uuid, file);
|
|
384
434
|
});
|
|
385
|
-
(
|
|
435
|
+
notifyChange(map);
|
|
386
436
|
(_props_onExceedMaxCount = props.onExceedMaxCount) === null || _props_onExceedMaxCount === void 0 ? void 0 : _props_onExceedMaxCount.call(props, {
|
|
387
437
|
maxCount: maxCount,
|
|
388
438
|
currentCount: existingFileCount,
|
|
@@ -395,7 +445,7 @@ var processFile = function processFile(file, index, map, props) {
|
|
|
395
445
|
}
|
|
396
446
|
// 验证通过后再添加到 fileMap
|
|
397
447
|
fileList.forEach(function(file) {
|
|
398
|
-
return updateFileMap(map, file,
|
|
448
|
+
return updateFileMap(map, file, notifyChange);
|
|
399
449
|
});
|
|
400
450
|
_state.label = 1;
|
|
401
451
|
case 1:
|
|
@@ -414,7 +464,7 @@ var processFile = function processFile(file, index, map, props) {
|
|
|
414
464
|
];
|
|
415
465
|
return [
|
|
416
466
|
4,
|
|
417
|
-
processFile(fileList[i], i, map,
|
|
467
|
+
processFile(fileList[i], i, map, propsWithNotify)
|
|
418
468
|
];
|
|
419
469
|
case 3:
|
|
420
470
|
_state.sent();
|
|
@@ -434,7 +484,7 @@ var processFile = function processFile(file, index, map, props) {
|
|
|
434
484
|
error = _state.sent();
|
|
435
485
|
fileList.forEach(function(file) {
|
|
436
486
|
file.status = 'error';
|
|
437
|
-
updateFileMap(map, file,
|
|
487
|
+
updateFileMap(map, file, notifyChange);
|
|
438
488
|
});
|
|
439
489
|
return [
|
|
440
490
|
3,
|
|
@@ -222,8 +222,7 @@ var genStyle = function genStyle(token) {
|
|
|
222
222
|
'&-typing-hint': {
|
|
223
223
|
position: 'absolute',
|
|
224
224
|
left: 'var(--padding-3x)',
|
|
225
|
-
top: '
|
|
226
|
-
transform: 'translateY(-50%)',
|
|
225
|
+
top: '10%',
|
|
227
226
|
pointerEvents: 'none',
|
|
228
227
|
zIndex: 10,
|
|
229
228
|
display: 'flex',
|
|
@@ -438,6 +438,31 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
438
438
|
'jinja.template.filter.description': string;
|
|
439
439
|
'jinja.template.setVariable.title': string;
|
|
440
440
|
'jinja.template.setVariable.description': string;
|
|
441
|
+
'schemaForm.invalidFormat': string;
|
|
442
|
+
'schemaForm.mustBeNumber': string;
|
|
443
|
+
'schemaForm.minValue': string;
|
|
444
|
+
'schemaForm.maxValue': string;
|
|
445
|
+
'schemaForm.minItems': string;
|
|
446
|
+
'schemaForm.maxItems': string;
|
|
447
|
+
'schemaForm.addItem': string;
|
|
448
|
+
'schemaForm.deleteItem': string;
|
|
449
|
+
'fileType.plainText': string;
|
|
450
|
+
'fileType.image': string;
|
|
451
|
+
'fileType.video': string;
|
|
452
|
+
'fileType.audio': string;
|
|
453
|
+
'fileType.pdf': string;
|
|
454
|
+
'fileType.word': string;
|
|
455
|
+
'fileType.excel': string;
|
|
456
|
+
'fileType.csv': string;
|
|
457
|
+
'fileType.archive': string;
|
|
458
|
+
'fileType.shell': string;
|
|
459
|
+
'fileType.config': string;
|
|
460
|
+
'fileType.powerpoint': string;
|
|
461
|
+
'workspace.file.unsupportedPreview': string;
|
|
462
|
+
'workspace.file.downloadButton': string;
|
|
463
|
+
'workspace.file.videoNotSupported': string;
|
|
464
|
+
'workspace.file.audioNotSupported': string;
|
|
465
|
+
'workspace.file.fileType': string;
|
|
441
466
|
};
|
|
442
467
|
language: "zh-CN" | "en-US";
|
|
443
468
|
setLanguage?: ((language: "zh-CN" | "en-US") => void) | undefined;
|
|
@@ -836,6 +861,31 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
836
861
|
'jinja.template.filter.description': string;
|
|
837
862
|
'jinja.template.setVariable.title': string;
|
|
838
863
|
'jinja.template.setVariable.description': string;
|
|
864
|
+
'schemaForm.invalidFormat': string;
|
|
865
|
+
'schemaForm.mustBeNumber': string;
|
|
866
|
+
'schemaForm.minValue': string;
|
|
867
|
+
'schemaForm.maxValue': string;
|
|
868
|
+
'schemaForm.minItems': string;
|
|
869
|
+
'schemaForm.maxItems': string;
|
|
870
|
+
'schemaForm.addItem': string;
|
|
871
|
+
'schemaForm.deleteItem': string;
|
|
872
|
+
'fileType.plainText': string;
|
|
873
|
+
'fileType.image': string;
|
|
874
|
+
'fileType.video': string;
|
|
875
|
+
'fileType.audio': string;
|
|
876
|
+
'fileType.pdf': string;
|
|
877
|
+
'fileType.word': string;
|
|
878
|
+
'fileType.excel': string;
|
|
879
|
+
'fileType.csv': string;
|
|
880
|
+
'fileType.archive': string;
|
|
881
|
+
'fileType.shell': string;
|
|
882
|
+
'fileType.config': string;
|
|
883
|
+
'fileType.powerpoint': string;
|
|
884
|
+
'workspace.file.unsupportedPreview': string;
|
|
885
|
+
'workspace.file.downloadButton': string;
|
|
886
|
+
'workspace.file.videoNotSupported': string;
|
|
887
|
+
'workspace.file.audioNotSupported': string;
|
|
888
|
+
'workspace.file.fileType': string;
|
|
839
889
|
}) => void) | undefined;
|
|
840
890
|
}>;
|
|
841
891
|
context: React.ContextType<typeof I18nContext>;
|
|
@@ -158,7 +158,7 @@ import { LoadImage } from "./LoadImage";
|
|
|
158
158
|
width: '1em'
|
|
159
159
|
},
|
|
160
160
|
src: langIconMap.get(((_element_language1 = element.language) === null || _element_language1 === void 0 ? void 0 : _element_language1.toLowerCase()) || '')
|
|
161
|
-
})), /*#__PURE__*/ React.createElement("div", null, element.language
|
|
161
|
+
})), /*#__PURE__*/ React.createElement("div", null, element.language && element.language !== 'plain text' && /*#__PURE__*/ React.createElement("span", null, element.katex ? 'Formula' : element.language === 'html' && element.render ? 'Html Renderer' : element.language))) : // 非只读模式:显示语言选择器
|
|
162
162
|
/*#__PURE__*/ React.createElement(LanguageSelector, languageSelectorProps)), /*#__PURE__*/ React.createElement("div", {
|
|
163
163
|
style: {
|
|
164
164
|
display: 'flex',
|
|
@@ -101,7 +101,7 @@ import { Plus } from "@sofa-design/icons";
|
|
|
101
101
|
import { Button, Card, Form, Input, InputNumber, Select, Space } from "antd";
|
|
102
102
|
import { merge } from "lodash-es";
|
|
103
103
|
import React, { memo, useCallback, useContext, useEffect, useMemo } from "react";
|
|
104
|
-
import { I18nContext } from "../../I18n";
|
|
104
|
+
import { I18nContext, compileTemplate } from "../../I18n";
|
|
105
105
|
/**
|
|
106
106
|
* SchemaForm 组件 - 基于Schema的表单组件
|
|
107
107
|
*
|
|
@@ -169,26 +169,30 @@ import { I18nContext } from "../../I18n";
|
|
|
169
169
|
if (property.type === 'string' && property.pattern) {
|
|
170
170
|
rules.push({
|
|
171
171
|
pattern: new RegExp(property.pattern),
|
|
172
|
-
message: property.patternMessage || "".concat(property.title || property.description || ''
|
|
172
|
+
message: property.patternMessage || "".concat(property.title || property.description || '').concat((locale === null || locale === void 0 ? void 0 : locale['schemaForm.invalidFormat']) || '格式不正确')
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
if (property.type === 'number') {
|
|
176
176
|
rules.push({
|
|
177
177
|
type: 'number',
|
|
178
|
-
message: "".concat(property.title || property.description || ''
|
|
178
|
+
message: "".concat(property.title || property.description || '').concat((locale === null || locale === void 0 ? void 0 : locale['schemaForm.mustBeNumber']) || '必须是数字')
|
|
179
179
|
});
|
|
180
180
|
if (typeof property.minimum === 'number') {
|
|
181
181
|
rules.push({
|
|
182
182
|
type: 'number',
|
|
183
183
|
min: property.minimum,
|
|
184
|
-
message: "".concat(property.title || property.description || ''
|
|
184
|
+
message: "".concat(property.title || property.description || '').concat(compileTemplate((locale === null || locale === void 0 ? void 0 : locale['schemaForm.minValue']) || '不能小于 ${min}', {
|
|
185
|
+
min: String(property.minimum)
|
|
186
|
+
}))
|
|
185
187
|
});
|
|
186
188
|
}
|
|
187
189
|
if (typeof property.maximum === 'number') {
|
|
188
190
|
rules.push({
|
|
189
191
|
type: 'number',
|
|
190
192
|
max: property.maximum,
|
|
191
|
-
message: "".concat(property.title || property.description || ''
|
|
193
|
+
message: "".concat(property.title || property.description || '').concat(compileTemplate((locale === null || locale === void 0 ? void 0 : locale['schemaForm.maxValue']) || '不能大于 ${max}', {
|
|
194
|
+
max: String(property.maximum)
|
|
195
|
+
}))
|
|
192
196
|
});
|
|
193
197
|
}
|
|
194
198
|
}
|
|
@@ -197,14 +201,18 @@ import { I18nContext } from "../../I18n";
|
|
|
197
201
|
rules.push({
|
|
198
202
|
type: 'array',
|
|
199
203
|
min: property.minItems,
|
|
200
|
-
message: "".concat(property.title || property.description || ''
|
|
204
|
+
message: "".concat(property.title || property.description || '').concat(compileTemplate((locale === null || locale === void 0 ? void 0 : locale['schemaForm.minItems']) || '至少需要 ${min} 项', {
|
|
205
|
+
min: String(property.minItems)
|
|
206
|
+
}))
|
|
201
207
|
});
|
|
202
208
|
}
|
|
203
209
|
if (typeof property.maxItems === 'number') {
|
|
204
210
|
rules.push({
|
|
205
211
|
type: 'array',
|
|
206
212
|
max: property.maxItems,
|
|
207
|
-
message: "".concat(property.title || property.description || ''
|
|
213
|
+
message: "".concat(property.title || property.description || '').concat(compileTemplate((locale === null || locale === void 0 ? void 0 : locale['schemaForm.maxItems']) || '最多只能有 ${max} 项', {
|
|
214
|
+
max: String(property.maxItems)
|
|
215
|
+
}))
|
|
208
216
|
});
|
|
209
217
|
}
|
|
210
218
|
}
|
|
@@ -344,12 +352,13 @@ import { I18nContext } from "../../I18n";
|
|
|
344
352
|
},
|
|
345
353
|
block: true,
|
|
346
354
|
icon: /*#__PURE__*/ React.createElement(Plus, null)
|
|
347
|
-
},
|
|
355
|
+
}, (locale === null || locale === void 0 ? void 0 : locale['schemaForm.addItem']) || '添加', " ", getPropertyTitle(property, key))));
|
|
348
356
|
});
|
|
349
357
|
}, [
|
|
350
358
|
readonly,
|
|
351
359
|
renderArrayItemContent,
|
|
352
|
-
getPropertyTitle
|
|
360
|
+
getPropertyTitle,
|
|
361
|
+
locale
|
|
353
362
|
]);
|
|
354
363
|
// 渲染对象表单项
|
|
355
364
|
var renderObjectFormItem = useCallback(function(key, property, baseName) {
|
|
@@ -139,12 +139,16 @@ export var TaskList = /*#__PURE__*/ memo(function(param) {
|
|
|
139
139
|
items,
|
|
140
140
|
locale
|
|
141
141
|
]), summaryStatus = _useMemo.summaryStatus, summaryText = _useMemo.summaryText, progressText = _useMemo.progressText;
|
|
142
|
+
var isCancelled = items.some(function(i) {
|
|
143
|
+
return i.status === 'error';
|
|
144
|
+
});
|
|
142
145
|
var renderItems = function renderItems() {
|
|
143
|
-
|
|
146
|
+
var visibleItems = isCancelled ? items.slice(-1) : items;
|
|
147
|
+
return visibleItems.map(function(item, index) {
|
|
144
148
|
return /*#__PURE__*/ React.createElement(TaskListItem, {
|
|
145
149
|
key: item.key,
|
|
146
150
|
item: item,
|
|
147
|
-
isLast: index ===
|
|
151
|
+
isLast: index === visibleItems.length - 1,
|
|
148
152
|
prefixCls: prefixCls,
|
|
149
153
|
hashId: hashId,
|
|
150
154
|
expandedKeys: internalExpandedKeys,
|
|
@@ -105,6 +105,7 @@ import { TableSql } from "./TableSql";
|
|
|
105
105
|
import { TitleInfo } from "./TitleInfo";
|
|
106
106
|
import { ToolCall } from "./ToolCall";
|
|
107
107
|
import { WebSearch } from "./WebSearch";
|
|
108
|
+
var DETAIL_COLLAPSE_DURATION_MS = 160;
|
|
108
109
|
/**
|
|
109
110
|
* ThoughtChainItemDetail 组件 - 思维链项详情组件
|
|
110
111
|
*
|
|
@@ -327,6 +328,7 @@ var ThoughtChainItemMotion = /*#__PURE__*/ React.memo(function(param) {
|
|
|
327
328
|
*/ export var ThoughtChainListItem = /*#__PURE__*/ React.memo(function(props) {
|
|
328
329
|
var _props_bubble, _thoughtChainListItem_meta;
|
|
329
330
|
var _React_useState = _sliced_to_array(React.useState(false), 2), collapse = _React_useState[0], setCollapse = _React_useState[1];
|
|
331
|
+
var _React_useState1 = _sliced_to_array(React.useState(true), 2), shouldRenderDetail = _React_useState1[0], setShouldRenderDetail = _React_useState1[1];
|
|
330
332
|
var thoughtChainListItem = props.thoughtChainListItem, prefixCls = props.prefixCls, hashId = props.hashId, setDocMeta = props.setDocMeta;
|
|
331
333
|
var markdownRenderProps = useMemo(function() {
|
|
332
334
|
return props.markdownRenderProps || {
|
|
@@ -352,6 +354,20 @@ var ThoughtChainItemMotion = /*#__PURE__*/ React.memo(function(param) {
|
|
|
352
354
|
var handleCollapseChange = React.useCallback(function(change) {
|
|
353
355
|
setCollapse(change);
|
|
354
356
|
}, []);
|
|
357
|
+
React.useEffect(function() {
|
|
358
|
+
if (!collapse) {
|
|
359
|
+
setShouldRenderDetail(true);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
var timer = window.setTimeout(function() {
|
|
363
|
+
setShouldRenderDetail(false);
|
|
364
|
+
}, DETAIL_COLLAPSE_DURATION_MS);
|
|
365
|
+
return function() {
|
|
366
|
+
window.clearTimeout(timer);
|
|
367
|
+
};
|
|
368
|
+
}, [
|
|
369
|
+
collapse
|
|
370
|
+
]);
|
|
355
371
|
var titleDom = /*#__PURE__*/ React.createElement(TitleInfo, {
|
|
356
372
|
title: thoughtChainListItem.info,
|
|
357
373
|
costMillis: thoughtChainListItem.costMillis,
|
|
@@ -393,13 +409,22 @@ var ThoughtChainItemMotion = /*#__PURE__*/ React.memo(function(param) {
|
|
|
393
409
|
minWidth: 0,
|
|
394
410
|
maxWidth: '100%'
|
|
395
411
|
}
|
|
396
|
-
}, props.titleRender ? props.titleRender(thoughtChainListItem, titleDom) : titleDom, /*#__PURE__*/ React.createElement("div", {
|
|
412
|
+
}, props.titleRender ? props.titleRender(thoughtChainListItem, titleDom) : titleDom, shouldRenderDetail ? /*#__PURE__*/ React.createElement("div", {
|
|
413
|
+
style: {
|
|
414
|
+
display: 'grid',
|
|
415
|
+
gridTemplateRows: collapse ? '0fr' : '1fr',
|
|
416
|
+
opacity: collapse ? 0 : 1,
|
|
417
|
+
transition: 'grid-template-rows 0.16s ease, opacity 0.12s ease',
|
|
418
|
+
pointerEvents: collapse ? 'none' : 'auto'
|
|
419
|
+
},
|
|
420
|
+
"aria-hidden": collapse
|
|
421
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
397
422
|
style: {
|
|
398
423
|
display: 'flex',
|
|
399
424
|
flexDirection: 'column',
|
|
400
|
-
height: !collapse ? 'auto' : '0px',
|
|
401
425
|
overflow: 'hidden',
|
|
426
|
+
minHeight: 0,
|
|
402
427
|
gap: 8
|
|
403
428
|
}
|
|
404
|
-
},
|
|
429
|
+
}, props.contentRender ? props.contentRender(thoughtChainListItem, content) : content)) : null));
|
|
405
430
|
});
|
|
@@ -158,7 +158,7 @@ import dayjs from "dayjs";
|
|
|
158
158
|
import duration from "dayjs/plugin/duration";
|
|
159
159
|
import { motion } from "framer-motion";
|
|
160
160
|
import { merge } from "lodash-es";
|
|
161
|
-
import React, { useContext, useEffect, useMemo } from "react";
|
|
161
|
+
import React, { useContext, useEffect, useMemo, useState } from "react";
|
|
162
162
|
import { ErrorBoundary } from "react-error-boundary";
|
|
163
163
|
import { ActionIconBox } from "../Components/ActionIconBox";
|
|
164
164
|
import { useAutoScroll } from "../Hooks/useAutoScroll";
|
|
@@ -168,6 +168,7 @@ import { FlipText } from "./FlipText";
|
|
|
168
168
|
import { useStyle } from "./style";
|
|
169
169
|
import { ThoughtChainListItem } from "./ThoughtChainListItem";
|
|
170
170
|
import { TitleInfo } from "./TitleInfo";
|
|
171
|
+
var COLLAPSE_ANIMATION_DURATION_MS = 160;
|
|
171
172
|
// Initialize dayjs plugins
|
|
172
173
|
try {
|
|
173
174
|
dayjs.extend(duration);
|
|
@@ -258,8 +259,23 @@ var ThoughtChainContent = /*#__PURE__*/ React.memo(function(_0) {
|
|
|
258
259
|
var containerRef = useAutoScroll({
|
|
259
260
|
SCROLL_TOLERANCE: 30
|
|
260
261
|
}).containerRef;
|
|
262
|
+
var _useState = _sliced_to_array(useState(!collapse), 2), shouldRenderItems = _useState[0], setShouldRenderItems = _useState[1];
|
|
263
|
+
useEffect(function() {
|
|
264
|
+
if (!collapse) {
|
|
265
|
+
setShouldRenderItems(true);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
var timer = window.setTimeout(function() {
|
|
269
|
+
setShouldRenderItems(false);
|
|
270
|
+
}, COLLAPSE_ANIMATION_DURATION_MS);
|
|
271
|
+
return function() {
|
|
272
|
+
window.clearTimeout(timer);
|
|
273
|
+
};
|
|
274
|
+
}, [
|
|
275
|
+
collapse
|
|
276
|
+
]);
|
|
261
277
|
var processedItems = useMemo(function() {
|
|
262
|
-
if (
|
|
278
|
+
if (!shouldRenderItems) return [];
|
|
263
279
|
return thoughtChainList.map(function(item, index) {
|
|
264
280
|
var _item_output, _item_output1, _item_output2, _item_output3, _item_output4;
|
|
265
281
|
var info = item.info;
|
|
@@ -288,7 +304,7 @@ var ThoughtChainContent = /*#__PURE__*/ React.memo(function(_0) {
|
|
|
288
304
|
}, [
|
|
289
305
|
thoughtChainList,
|
|
290
306
|
bubble === null || bubble === void 0 ? void 0 : bubble.isFinished,
|
|
291
|
-
|
|
307
|
+
shouldRenderItems
|
|
292
308
|
]);
|
|
293
309
|
var mergedMarkdownProps = useMemo(function() {
|
|
294
310
|
return merge(markdownRenderProps || {}, {
|