@ant-design/agentic-ui 2.30.15 → 2.30.19
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 +3 -2
- package/dist/Bubble/ContentFilemapView.d.ts +2 -0
- package/dist/Bubble/ContentFilemapView.js +9 -6
- package/dist/Bubble/MessagesContent/index.js +7 -7
- package/dist/Bubble/UserBubble.js +2 -1
- package/dist/Hooks/useLanguage.d.ts +28 -1
- package/dist/I18n/locales.d.ts +28 -1
- package/dist/I18n/locales.js +64 -4
- 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/FileMapView/index.js +1 -7
- package/dist/MarkdownInputField/FileMapView/style.js +1 -2
- package/dist/MarkdownInputField/MarkdownInputField.js +16 -5
- package/dist/MarkdownInputField/SendActions/index.js +2 -2
- package/dist/MarkdownInputField/hooks/useMarkdownInputFieldHandlers.js +1 -0
- package/dist/MarkdownInputField/style.js +24 -1
- package/dist/MarkdownInputField/types/MarkdownInputFieldProps.d.ts +3 -3
- package/dist/MarkdownInputField/types/MarkdownInputFieldProps.js +1 -1
- package/dist/Plugins/chart/ChartRender.js +3 -1
- package/dist/Plugins/chart/DonutChart/index.js +1 -1
- package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +56 -2
- package/dist/Plugins/code/components/CodeToolbar.js +1 -1
- package/dist/Schema/SchemaForm/index.js +18 -9
- package/dist/Workspace/File/FileComponent.js +178 -103
- 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/style.js +20 -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 -2
package/dist/Bubble/AIBubble.js
CHANGED
|
@@ -274,7 +274,7 @@ var getTaskList = function getTaskList(originData) {
|
|
|
274
274
|
* ```
|
|
275
275
|
*/ export var AIBubble = /*#__PURE__*/ memo(function(props) {
|
|
276
276
|
var _ref, _messageDisplayKeyRef_current, _props_readonly;
|
|
277
|
-
var _props_originData, _props_originData1, _props_originData2, _props_originData3, _props_originData4, _props_originData5, _props_bubbleRenderConfig, _props_originData_fileMap, _props_originData6, _props_bubbleRenderConfig1, _props_styles, _props_bubbleRenderConfig2, _bubbleRenderConfig_render;
|
|
277
|
+
var _props_originData, _props_originData1, _props_originData2, _props_originData3, _props_originData4, _props_originData5, _props_bubbleRenderConfig, _props_originData_fileMap, _props_originData6, _props_markdownRenderConfig, _props_bubbleRenderConfig1, _props_styles, _props_bubbleRenderConfig2, _bubbleRenderConfig_render;
|
|
278
278
|
var onAvatarClick = props.onAvatarClick, className = props.className, style = props.style, bubbleRenderConfig = props.bubbleRenderConfig, classNames = props.classNames, styles = props.styles, originData = props.originData, preMessage = props.preMessage;
|
|
279
279
|
var _React_useState = _sliced_to_array(React.useState(false), 2), hidePadding = _React_useState[0], setHidePadding = _React_useState[1];
|
|
280
280
|
var messageDisplayKeyRef = useRef(null);
|
|
@@ -318,7 +318,7 @@ var getTaskList = function getTaskList(originData) {
|
|
|
318
318
|
}, [
|
|
319
319
|
rawContent
|
|
320
320
|
]), filemapBlocks = _useMemo.blocks, strippedContent = _useMemo.stripped;
|
|
321
|
-
var contentForDisplay = filemapBlocks.length > 0 ? strippedContent : rawContent;
|
|
321
|
+
var contentForDisplay = filemapBlocks.length > 0 ? strippedContent : typeof rawContent === 'string' ? rawContent : strippedContent;
|
|
322
322
|
var messageContent = /*#__PURE__*/ React.createElement(BubbleMessageDisplay, {
|
|
323
323
|
markdownRenderConfig: props.markdownRenderConfig,
|
|
324
324
|
docListProps: props.docListProps,
|
|
@@ -415,6 +415,7 @@ var getTaskList = function getTaskList(originData) {
|
|
|
415
415
|
blocks: filemapBlocks,
|
|
416
416
|
fileViewConfig: props.fileViewConfig,
|
|
417
417
|
fileViewEvents: props.fileViewEvents,
|
|
418
|
+
fileMapConfig: (_props_markdownRenderConfig = props.markdownRenderConfig) === null || _props_markdownRenderConfig === void 0 ? void 0 : _props_markdownRenderConfig.fileMapConfig,
|
|
418
419
|
placement: placement
|
|
419
420
|
}))));
|
|
420
421
|
if ((bubbleRenderConfig === null || bubbleRenderConfig === void 0 ? void 0 : bubbleRenderConfig.render) === false) return null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { FileMapConfig } from '../MarkdownRenderer/types';
|
|
2
3
|
import type { FilemapBlock } from './extractFilemapBlocks';
|
|
3
4
|
import type { BubbleProps } from './type';
|
|
4
5
|
/**
|
|
@@ -9,6 +10,7 @@ export declare const ContentFilemapView: React.FC<{
|
|
|
9
10
|
blocks: FilemapBlock[];
|
|
10
11
|
fileViewConfig?: BubbleProps['fileViewConfig'];
|
|
11
12
|
fileViewEvents?: BubbleProps['fileViewEvents'];
|
|
13
|
+
fileMapConfig?: FileMapConfig;
|
|
12
14
|
placement?: 'left' | 'right';
|
|
13
15
|
style?: React.CSSProperties;
|
|
14
16
|
}>;
|
|
@@ -15,16 +15,18 @@ var parseBody = function parseBody(body) {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
var FilemapItem = function FilemapItem(param) {
|
|
18
|
-
var body = param.body, fileViewConfig = param.fileViewConfig, fileViewEvents = param.fileViewEvents, placement = param.placement;
|
|
18
|
+
var body = param.body, fileViewConfig = param.fileViewConfig, fileViewEvents = param.fileViewEvents, fileMapConfig = param.fileMapConfig, placement = param.placement;
|
|
19
|
+
var _ref, _ref1, _ref2;
|
|
19
20
|
var parsed = useMemo(function() {
|
|
20
21
|
return parseBody(body);
|
|
21
22
|
}, [
|
|
22
23
|
body
|
|
23
24
|
]);
|
|
24
25
|
var _useMemo = useMemo(function() {
|
|
25
|
-
return normalizeFileMapPropsFromJson(parsed);
|
|
26
|
+
return normalizeFileMapPropsFromJson(parsed, fileMapConfig === null || fileMapConfig === void 0 ? void 0 : fileMapConfig.normalizeFile);
|
|
26
27
|
}, [
|
|
27
|
-
parsed
|
|
28
|
+
parsed,
|
|
29
|
+
fileMapConfig === null || fileMapConfig === void 0 ? void 0 : fileMapConfig.normalizeFile
|
|
28
30
|
]), fileList = _useMemo.fileList, className = _useMemo.className;
|
|
29
31
|
var fileMap = useMemo(function() {
|
|
30
32
|
return new Map(fileList.map(function(f) {
|
|
@@ -65,9 +67,9 @@ var FilemapItem = function FilemapItem(param) {
|
|
|
65
67
|
className: className !== null && className !== void 0 ? className : fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.className,
|
|
66
68
|
style: fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.style,
|
|
67
69
|
placement: placement,
|
|
68
|
-
onPreview: events === null || events === void 0 ? void 0 : events.onPreview,
|
|
70
|
+
onPreview: (_ref = (_ref1 = events === null || events === void 0 ? void 0 : events.onPreview) !== null && _ref1 !== void 0 ? _ref1 : fileMapConfig === null || fileMapConfig === void 0 ? void 0 : fileMapConfig.onPreview) !== null && _ref !== void 0 ? _ref : defaultHandlers.onPreview,
|
|
69
71
|
onDownload: events === null || events === void 0 ? void 0 : events.onDownload,
|
|
70
|
-
itemRender: fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.itemRender,
|
|
72
|
+
itemRender: (_ref2 = fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.itemRender) !== null && _ref2 !== void 0 ? _ref2 : fileMapConfig === null || fileMapConfig === void 0 ? void 0 : fileMapConfig.itemRender,
|
|
71
73
|
maxDisplayCount: fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.maxDisplayCount,
|
|
72
74
|
showMoreButton: fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.showMoreButton,
|
|
73
75
|
customSlot: fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.customSlot,
|
|
@@ -78,7 +80,7 @@ var FilemapItem = function FilemapItem(param) {
|
|
|
78
80
|
* 将从 markdown content 中提取出的 agentic-ui-filemap 块渲染为 FileMapView 列表。
|
|
79
81
|
* 渲染在气泡内容框外部,避免图片被包在带样式的气泡背景里。
|
|
80
82
|
*/ export var ContentFilemapView = function ContentFilemapView(param) {
|
|
81
|
-
var blocks = param.blocks, fileViewConfig = param.fileViewConfig, fileViewEvents = param.fileViewEvents, placement = param.placement, style = param.style;
|
|
83
|
+
var blocks = param.blocks, fileViewConfig = param.fileViewConfig, fileViewEvents = param.fileViewEvents, fileMapConfig = param.fileMapConfig, placement = param.placement, style = param.style;
|
|
82
84
|
if (blocks.length === 0) return null;
|
|
83
85
|
return /*#__PURE__*/ React.createElement("div", {
|
|
84
86
|
style: style,
|
|
@@ -89,6 +91,7 @@ var FilemapItem = function FilemapItem(param) {
|
|
|
89
91
|
body: block.body,
|
|
90
92
|
fileViewConfig: fileViewConfig,
|
|
91
93
|
fileViewEvents: fileViewEvents,
|
|
94
|
+
fileMapConfig: fileMapConfig,
|
|
92
95
|
placement: placement
|
|
93
96
|
});
|
|
94
97
|
}));
|
|
@@ -370,7 +370,7 @@ var THINKING_DOT_INDICES = [
|
|
|
370
370
|
contentAfterDom
|
|
371
371
|
]);
|
|
372
372
|
var messageContent = useMemo(function() {
|
|
373
|
-
var _props_originData, _props_bubbleRenderConfig, _props_bubbleRenderConfig1, _props_bubbleRenderConfig2, _props_bubbleRenderConfig3, _props_bubbleRenderConfig_extraRender, _props_bubbleRenderConfig4, _props_originData_extra_tags_includes, _props_originData_extra_tags, _props_originData_extra, _props_originData1, _props_originData2, _props_originData_extra1, _props_originData3, _props_originData_extra2, _props_originData4, _props_originData5, _props_originData_extra3, _props_originData6, _props_docListProps, _props_originData7, _props_markdownRenderConfig, _props_originData8, _props_originData_extra4, _props_originData9
|
|
373
|
+
var _props_originData, _props_bubbleRenderConfig, _props_bubbleRenderConfig1, _props_bubbleRenderConfig2, _props_bubbleRenderConfig3, _props_bubbleRenderConfig_extraRender, _props_bubbleRenderConfig4, _props_originData_extra_tags_includes, _props_originData_extra_tags, _props_originData_extra, _props_originData1, _props_originData2, _props_originData_extra1, _props_originData3, _props_originData_extra2, _props_originData4, _props_originData5, _props_originData_extra3, _props_originData6, _props_docListProps, _props_originData7, _props_markdownRenderConfig, _props_originData8, _props_originData_extra4, _props_originData9;
|
|
374
374
|
if (content === LOADING_FLAT || !((_props_originData = props.originData) === null || _props_originData === void 0 ? void 0 : _props_originData.isFinished) && !content) {
|
|
375
375
|
var _context_thoughtChain;
|
|
376
376
|
if ((context === null || context === void 0 ? void 0 : (_context_thoughtChain = context.thoughtChain) === null || _context_thoughtChain === void 0 ? void 0 : _context_thoughtChain.alwaysRender) !== true) {
|
|
@@ -539,7 +539,7 @@ var THINKING_DOT_INDICES = [
|
|
|
539
539
|
}, beforeContent, content, afterContent, extra));
|
|
540
540
|
}
|
|
541
541
|
if (content === '...' || props.placement !== 'left' || (props === null || props === void 0 ? void 0 : (_props_originData1 = props.originData) === null || _props_originData1 === void 0 ? void 0 : (_props_originData_extra = _props_originData1.extra) === null || _props_originData_extra === void 0 ? void 0 : (_props_originData_extra_tags = _props_originData_extra.tags) === null || _props_originData_extra_tags === void 0 ? void 0 : (_props_originData_extra_tags_includes = _props_originData_extra_tags.includes) === null || _props_originData_extra_tags_includes === void 0 ? void 0 : _props_originData_extra_tags_includes.call(_props_originData_extra_tags, 'REJECT_TO_ANSWER')) || ((_props_originData2 = props.originData) === null || _props_originData2 === void 0 ? void 0 : _props_originData2.role) === 'bot') {
|
|
542
|
-
var
|
|
542
|
+
var _props_originData10;
|
|
543
543
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
544
544
|
className: classNames('agent-item-default-content', "".concat(baseChatCls, "-messages-content-message"), hashId),
|
|
545
545
|
"data-testid": "message-box-content",
|
|
@@ -550,14 +550,14 @@ var THINKING_DOT_INDICES = [
|
|
|
550
550
|
placement: props.placement,
|
|
551
551
|
markdownRenderConfig: props.markdownRenderConfig,
|
|
552
552
|
isFinished: true,
|
|
553
|
-
style: ((
|
|
553
|
+
style: ((_props_originData10 = props.originData) === null || _props_originData10 === void 0 ? void 0 : _props_originData10.role) === 'bot' ? {} : {
|
|
554
554
|
color: '#343A45'
|
|
555
555
|
} // 使用类名方式需要传递className,这里保留style以兼容现有API
|
|
556
556
|
,
|
|
557
557
|
extra: extra,
|
|
558
558
|
typing: false,
|
|
559
559
|
originData: props.originData,
|
|
560
|
-
content:
|
|
560
|
+
content: content
|
|
561
561
|
})));
|
|
562
562
|
}
|
|
563
563
|
// answerStatus= 'EXCEPTION'时 一定是异常情况
|
|
@@ -576,7 +576,7 @@ var THINKING_DOT_INDICES = [
|
|
|
576
576
|
var _item_output_chunks, _item_output;
|
|
577
577
|
return ((item === null || item === void 0 ? void 0 : (_item_output = item.output) === null || _item_output === void 0 ? void 0 : (_item_output_chunks = _item_output.chunks) === null || _item_output_chunks === void 0 ? void 0 : _item_output_chunks.length) || 0) > 0;
|
|
578
578
|
})) && ((_props_docListProps = props.docListProps) === null || _props_docListProps === void 0 ? void 0 : _props_docListProps.enable) !== false) {
|
|
579
|
-
var _props_docListProps1, _props_originData_extra5,
|
|
579
|
+
var _props_docListProps1, _props_originData_extra5, _props_originData11;
|
|
580
580
|
docInfoDom = /*#__PURE__*/ React.createElement(DocInfoList, _object_spread_props(_object_spread({
|
|
581
581
|
options: docInfoList.map(function(item) {
|
|
582
582
|
var _item_output;
|
|
@@ -585,7 +585,7 @@ var THINKING_DOT_INDICES = [
|
|
|
585
585
|
return item;
|
|
586
586
|
})
|
|
587
587
|
}, props.docListProps), {
|
|
588
|
-
reference_url_info_list: ((_props_docListProps1 = props.docListProps) === null || _props_docListProps1 === void 0 ? void 0 : _props_docListProps1.reference_url_info_list) || ((
|
|
588
|
+
reference_url_info_list: ((_props_docListProps1 = props.docListProps) === null || _props_docListProps1 === void 0 ? void 0 : _props_docListProps1.reference_url_info_list) || ((_props_originData11 = props.originData) === null || _props_originData11 === void 0 ? void 0 : (_props_originData_extra5 = _props_originData11.extra) === null || _props_originData_extra5 === void 0 ? void 0 : _props_originData_extra5.reference_url_info_list) || []
|
|
589
589
|
}));
|
|
590
590
|
}
|
|
591
591
|
return wrapSSR(/*#__PURE__*/ React.createElement(MarkdownPreview, {
|
|
@@ -664,7 +664,7 @@ var THINKING_DOT_INDICES = [
|
|
|
664
664
|
docListNode: docInfoDom,
|
|
665
665
|
extra: isExtraNull ? null : extra,
|
|
666
666
|
htmlRef: props.bubbleListRef,
|
|
667
|
-
content: ((_props_originData8 = props.originData) === null || _props_originData8 === void 0 ? void 0 : _props_originData8.isFinished) && (props === null || props === void 0 ? void 0 : (_props_originData9 = props.originData) === null || _props_originData9 === void 0 ? void 0 : (_props_originData_extra4 = _props_originData9.extra) === null || _props_originData_extra4 === void 0 ? void 0 : _props_originData_extra4.answerStatus) === 'EXCEPTION' ?
|
|
667
|
+
content: ((_props_originData8 = props.originData) === null || _props_originData8 === void 0 ? void 0 : _props_originData8.isFinished) && (props === null || props === void 0 ? void 0 : (_props_originData9 = props.originData) === null || _props_originData9 === void 0 ? void 0 : (_props_originData_extra4 = _props_originData9.extra) === null || _props_originData_extra4 === void 0 ? void 0 : _props_originData_extra4.answerStatus) === 'EXCEPTION' ? content || (locale === null || locale === void 0 ? void 0 : locale['chat.message.generateFailed']) || '生成回答失败,请重试' : content || '',
|
|
668
668
|
originData: props.originData
|
|
669
669
|
}));
|
|
670
670
|
}, [
|
|
@@ -149,7 +149,7 @@ var getContentStyle = function getContentStyle(standalone, customStyle) {
|
|
|
149
149
|
* ```
|
|
150
150
|
*/ export var UserBubble = /*#__PURE__*/ memo(function(props) {
|
|
151
151
|
var _props_readonly;
|
|
152
|
-
var _originData_fileMap, _props_bubbleRenderConfig, _props_styles, _props_bubbleRenderConfig1, _bubbleRenderConfig_render;
|
|
152
|
+
var _originData_fileMap, _props_markdownRenderConfig, _props_bubbleRenderConfig, _props_styles, _props_bubbleRenderConfig1, _bubbleRenderConfig_render;
|
|
153
153
|
var className = props.className, style = props.style, bubbleRenderConfig = props.bubbleRenderConfig, classNames = props.classNames, styles = props.styles, originData = props.originData, quote = props.quote;
|
|
154
154
|
var _React_useState = _sliced_to_array(React.useState(false), 2), hidePadding = _React_useState[0], setHidePadding = _React_useState[1];
|
|
155
155
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
@@ -257,6 +257,7 @@ var getContentStyle = function getContentStyle(standalone, customStyle) {
|
|
|
257
257
|
blocks: filemapBlocks,
|
|
258
258
|
fileViewConfig: props.fileViewConfig,
|
|
259
259
|
fileViewEvents: props.fileViewEvents,
|
|
260
|
+
fileMapConfig: (_props_markdownRenderConfig = props.markdownRenderConfig) === null || _props_markdownRenderConfig === void 0 ? void 0 : _props_markdownRenderConfig.fileMapConfig,
|
|
260
261
|
placement: placement,
|
|
261
262
|
style: {
|
|
262
263
|
alignSelf: 'flex-end'
|
|
@@ -307,6 +307,8 @@ export declare function useLanguage(): {
|
|
|
307
307
|
'workspace.fileProcessError': string;
|
|
308
308
|
'workspace.download': string;
|
|
309
309
|
'workspace.empty': string;
|
|
310
|
+
'workspace.file.showMore': string;
|
|
311
|
+
'workspace.file.showMoreFiles': string;
|
|
310
312
|
'workspace.title': string;
|
|
311
313
|
'workspace.searchPlaceholder': string;
|
|
312
314
|
'workspace.noResultsFor': string;
|
|
@@ -351,7 +353,6 @@ export declare function useLanguage(): {
|
|
|
351
353
|
'suggestion.followUp': string;
|
|
352
354
|
'input.fileUpload': string;
|
|
353
355
|
'input.attachmentListTitle': string;
|
|
354
|
-
'chat.fileMapTitle': string;
|
|
355
356
|
'input.voiceInput': string;
|
|
356
357
|
'input.voiceInputting': string;
|
|
357
358
|
'input.placeholder': string;
|
|
@@ -363,6 +364,7 @@ export declare function useLanguage(): {
|
|
|
363
364
|
'input.sendButtonTooltip.newline': string;
|
|
364
365
|
'input.sendButtonTooltip.send.mod': string;
|
|
365
366
|
'input.sendButtonTooltip.newline.mod': string;
|
|
367
|
+
'input.typing.hint': string;
|
|
366
368
|
'common.name': string;
|
|
367
369
|
'common.updateTime': string;
|
|
368
370
|
'common.type': string;
|
|
@@ -435,6 +437,31 @@ export declare function useLanguage(): {
|
|
|
435
437
|
'jinja.template.filter.description': string;
|
|
436
438
|
'jinja.template.setVariable.title': string;
|
|
437
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;
|
|
438
465
|
};
|
|
439
466
|
setLanguage: ((language: "zh-CN" | "en-US") => void) | undefined;
|
|
440
467
|
toggleLanguage: () => void;
|
package/dist/I18n/locales.d.ts
CHANGED
|
@@ -269,6 +269,8 @@ export declare const cnLabels: {
|
|
|
269
269
|
'workspace.fileProcessError': string;
|
|
270
270
|
'workspace.download': string;
|
|
271
271
|
'workspace.empty': string;
|
|
272
|
+
'workspace.file.showMore': string;
|
|
273
|
+
'workspace.file.showMoreFiles': string;
|
|
272
274
|
'workspace.title': string;
|
|
273
275
|
'workspace.searchPlaceholder': string;
|
|
274
276
|
'workspace.noResultsFor': string;
|
|
@@ -313,7 +315,6 @@ export declare const cnLabels: {
|
|
|
313
315
|
'suggestion.followUp': string;
|
|
314
316
|
'input.fileUpload': string;
|
|
315
317
|
'input.attachmentListTitle': string;
|
|
316
|
-
'chat.fileMapTitle': string;
|
|
317
318
|
'input.voiceInput': string;
|
|
318
319
|
'input.voiceInputting': string;
|
|
319
320
|
'input.placeholder': string;
|
|
@@ -325,6 +326,7 @@ export declare const cnLabels: {
|
|
|
325
326
|
'input.sendButtonTooltip.newline': string;
|
|
326
327
|
'input.sendButtonTooltip.send.mod': string;
|
|
327
328
|
'input.sendButtonTooltip.newline.mod': string;
|
|
329
|
+
'input.typing.hint': string;
|
|
328
330
|
'common.name': string;
|
|
329
331
|
'common.updateTime': string;
|
|
330
332
|
'common.type': string;
|
|
@@ -397,6 +399,31 @@ export declare const cnLabels: {
|
|
|
397
399
|
'jinja.template.filter.description': string;
|
|
398
400
|
'jinja.template.setVariable.title': string;
|
|
399
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;
|
|
400
427
|
};
|
|
401
428
|
/**
|
|
402
429
|
* 英文标签映射对象
|
package/dist/I18n/locales.js
CHANGED
|
@@ -281,6 +281,8 @@
|
|
|
281
281
|
'workspace.download': '下载',
|
|
282
282
|
// 新增:默认空态文案
|
|
283
283
|
'workspace.empty': '暂无数据',
|
|
284
|
+
'workspace.file.showMore': '查看更多(还有 ${count} 个)',
|
|
285
|
+
'workspace.file.showMoreFiles': '查看更多文件',
|
|
284
286
|
// 新增:Workspace 标题与搜索相关
|
|
285
287
|
'workspace.title': '工作空间',
|
|
286
288
|
'workspace.searchPlaceholder': '搜索文件名',
|
|
@@ -333,7 +335,6 @@
|
|
|
333
335
|
// MarkdownInputField related
|
|
334
336
|
'input.fileUpload': '文件上传',
|
|
335
337
|
'input.attachmentListTitle': '上传附件',
|
|
336
|
-
'chat.fileMapTitle': '结果文件',
|
|
337
338
|
'input.voiceInput': '语音输入',
|
|
338
339
|
'input.voiceInputting': '语音输入中,点击可停止。',
|
|
339
340
|
'input.placeholder': '请输入',
|
|
@@ -345,6 +346,7 @@
|
|
|
345
346
|
'input.sendButtonTooltip.newline': '按 Shift+Enter 键换行',
|
|
346
347
|
'input.sendButtonTooltip.send.mod': '按 Cmd/Ctrl+Enter 键发送',
|
|
347
348
|
'input.sendButtonTooltip.newline.mod': '按 Enter 键换行',
|
|
349
|
+
'input.typing.hint': 'AI 正在回复中,请稍候...',
|
|
348
350
|
// Other translations
|
|
349
351
|
'common.name': '名称',
|
|
350
352
|
'common.updateTime': '更新时间',
|
|
@@ -424,7 +426,35 @@
|
|
|
424
426
|
'jinja.template.filter.title': '过滤器',
|
|
425
427
|
'jinja.template.filter.description': '{{ value | filter }}',
|
|
426
428
|
'jinja.template.setVariable.title': '设置变量',
|
|
427
|
-
'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': '文件类型:'
|
|
428
458
|
};
|
|
429
459
|
/**
|
|
430
460
|
* 英文标签映射对象
|
|
@@ -709,6 +739,8 @@
|
|
|
709
739
|
'workspace.download': 'Download',
|
|
710
740
|
// New: default empty text
|
|
711
741
|
'workspace.empty': 'No data',
|
|
742
|
+
'workspace.file.showMore': 'Show more (${count} remaining)',
|
|
743
|
+
'workspace.file.showMoreFiles': 'Show more files',
|
|
712
744
|
// New: Workspace title & search
|
|
713
745
|
'workspace.title': 'Workspace',
|
|
714
746
|
'workspace.searchPlaceholder': 'Search file name',
|
|
@@ -761,7 +793,6 @@
|
|
|
761
793
|
// MarkdownInputField related
|
|
762
794
|
'input.fileUpload': 'Upload attachments',
|
|
763
795
|
'input.attachmentListTitle': 'Uploaded attachments',
|
|
764
|
-
'chat.fileMapTitle': 'Result files',
|
|
765
796
|
'input.voiceInput': 'Voice input',
|
|
766
797
|
'input.voiceInputting': 'Voice input in progress, click to stop.',
|
|
767
798
|
'input.placeholder': 'Please input',
|
|
@@ -773,6 +804,7 @@
|
|
|
773
804
|
'input.sendButtonTooltip.newline': 'Press Shift+Enter for new line',
|
|
774
805
|
'input.sendButtonTooltip.send.mod': 'Press Cmd/Ctrl+Enter to send',
|
|
775
806
|
'input.sendButtonTooltip.newline.mod': 'Press Enter for new line',
|
|
807
|
+
'input.typing.hint': 'AI is replying, please wait...',
|
|
776
808
|
// Other translations
|
|
777
809
|
'common.name': 'Name',
|
|
778
810
|
'common.updateTime': 'Update Time',
|
|
@@ -852,5 +884,33 @@
|
|
|
852
884
|
'jinja.template.filter.title': 'Filter',
|
|
853
885
|
'jinja.template.filter.description': '{{ value | filter }}',
|
|
854
886
|
'jinja.template.setVariable.title': 'Set variable',
|
|
855
|
-
'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: '
|
|
856
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,
|
|
@@ -190,7 +190,6 @@ import { ConfigProvider, Image, Modal } from "antd";
|
|
|
190
190
|
import classNames from "clsx";
|
|
191
191
|
import { motion } from "framer-motion";
|
|
192
192
|
import React, { useContext, useMemo, useState } from "react";
|
|
193
|
-
import { I18nContext } from "../../I18n";
|
|
194
193
|
import { FileMetaPlaceholder } from "../AttachmentButton/AttachmentFileList/AttachmentFileIcon";
|
|
195
194
|
import { isFileMetaPlaceholderState, isImageFile, isVideoFile } from "../AttachmentButton/utils";
|
|
196
195
|
import { FileMapViewItem } from "./FileMapViewItem";
|
|
@@ -249,7 +248,6 @@ var getMediaPlaceholderStyle = function getMediaPlaceholderStyle(size) {
|
|
|
249
248
|
var _props_style;
|
|
250
249
|
var _props_placement = props.placement, placement = _props_placement === void 0 ? 'left' : _props_placement;
|
|
251
250
|
var context = useContext(ConfigProvider.ConfigContext);
|
|
252
|
-
var locale = useContext(I18nContext).locale;
|
|
253
251
|
var prefix = context === null || context === void 0 ? void 0 : context.getPrefixCls('agentic-md-editor-file-view-list');
|
|
254
252
|
var _useStyle = useStyle(prefix), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
255
253
|
var _useState = _sliced_to_array(useState(false), 2), showAllFiles = _useState[0], setShowAllFiles = _useState[1];
|
|
@@ -351,7 +349,6 @@ var getMediaPlaceholderStyle = function getMediaPlaceholderStyle(size) {
|
|
|
351
349
|
width: IMAGE_THUMBNAIL_SIZE,
|
|
352
350
|
height: IMAGE_THUMBNAIL_SIZE
|
|
353
351
|
});
|
|
354
|
-
var hasAnyFiles = fileList.length > 0;
|
|
355
352
|
var _obj;
|
|
356
353
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
357
354
|
"data-testid": "file-view-list",
|
|
@@ -364,10 +361,7 @@ var getMediaPlaceholderStyle = function getMediaPlaceholderStyle(size) {
|
|
|
364
361
|
alignItems: placement === 'left' ? 'flex-start' : 'flex-end',
|
|
365
362
|
width: 'max-content'
|
|
366
363
|
}
|
|
367
|
-
},
|
|
368
|
-
className: classNames("".concat(prefix, "-title"), hashId),
|
|
369
|
-
"data-testid": "file-view-title"
|
|
370
|
-
}, (locale === null || locale === void 0 ? void 0 : locale['chat.fileMapTitle']) || '结果文件') : null, imgList.length > 0 && /*#__PURE__*/ React.createElement(motion.div, {
|
|
364
|
+
}, imgList.length > 0 && /*#__PURE__*/ React.createElement(motion.div, {
|
|
371
365
|
variants: {
|
|
372
366
|
visible: {
|
|
373
367
|
opacity: 1,
|
|
@@ -73,11 +73,10 @@ var genStyle = function genStyle(token) {
|
|
|
73
73
|
},
|
|
74
74
|
'&-vertical': {
|
|
75
75
|
display: 'flex',
|
|
76
|
-
flexDirection: 'row',
|
|
77
76
|
flexWrap: 'wrap',
|
|
78
77
|
alignItems: 'flex-start',
|
|
79
78
|
gap: 4,
|
|
80
|
-
padding:
|
|
79
|
+
padding: 2,
|
|
81
80
|
maxWidth: 'calc(285px * 3 + 4px * 2)',
|
|
82
81
|
'& > :only-child': {
|
|
83
82
|
marginTop: 8,
|