@ant-design/agentic-ui 2.29.21 → 2.29.22
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.
|
@@ -324,9 +324,10 @@ export var LOADING_FLAT = '...';
|
|
|
324
324
|
var locale = useContext(I18nContext).locale;
|
|
325
325
|
var _React_useState = _sliced_to_array(React.useState(false), 2), isExtraNull = _React_useState[0], setIsExtraNull = _React_useState[1];
|
|
326
326
|
var _React_useState1 = _sliced_to_array(React.useState([]), 2), nodeList = _React_useState1[0], setNodeList = _React_useState1[1];
|
|
327
|
-
var _useMessagesContentStyle = useMessagesContentStyle(), hashId = _useMessagesContentStyle.hashId, wrapSSR = _useMessagesContentStyle.wrapSSR;
|
|
328
327
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
329
328
|
var chatCls = getPrefixCls('agentic-ui');
|
|
329
|
+
var baseChatCls = "".concat(chatCls, "-display");
|
|
330
|
+
var _useMessagesContentStyle = useMessagesContentStyle(baseChatCls), hashId = _useMessagesContentStyle.hashId, wrapSSR = _useMessagesContentStyle.wrapSSR;
|
|
330
331
|
var funRender = useRefFunction(function(props) {
|
|
331
332
|
var node = nodeList.find(function(item) {
|
|
332
333
|
return item.placeholder === props.identifier;
|
|
@@ -368,7 +369,7 @@ export var LOADING_FLAT = '...';
|
|
|
368
369
|
var _context_thoughtChain;
|
|
369
370
|
if ((context === null || context === void 0 ? void 0 : (_context_thoughtChain = context.thoughtChain) === null || _context_thoughtChain === void 0 ? void 0 : _context_thoughtChain.alwaysRender) !== true) {
|
|
370
371
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
371
|
-
className: classNames('agent-item-default-content', "".concat(
|
|
372
|
+
className: classNames('agent-item-default-content', "".concat(baseChatCls, "-messages-content-loading"), (context === null || context === void 0 ? void 0 : context.compact) ? "".concat(baseChatCls, "-messages-content-loading-compact") : "".concat(baseChatCls, "-messages-content-loading-default"), hashId),
|
|
372
373
|
"data-testid": "message-content"
|
|
373
374
|
}, (locale === null || locale === void 0 ? void 0 : locale['chat.message.thinking']) || '思考中...'));
|
|
374
375
|
}
|
|
@@ -511,7 +512,7 @@ export var LOADING_FLAT = '...';
|
|
|
511
512
|
if (content === '...' || /*#__PURE__*/ React.isValidElement(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') {
|
|
512
513
|
var _props_originData11, _props_originData12;
|
|
513
514
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
514
|
-
className: classNames('agent-item-default-content', "".concat(
|
|
515
|
+
className: classNames('agent-item-default-content', "".concat(baseChatCls, "-messages-content-message"), hashId),
|
|
515
516
|
"data-testid": "message-box-content",
|
|
516
517
|
onDoubleClick: props.onDoubleClick
|
|
517
518
|
}, /*#__PURE__*/ React.createElement(MarkdownPreview, {
|
|
@@ -532,11 +533,11 @@ export var LOADING_FLAT = '...';
|
|
|
532
533
|
}
|
|
533
534
|
// answerStatus= 'EXCEPTION'时 一定是异常情况
|
|
534
535
|
if (((_props_originData3 = props.originData) === null || _props_originData3 === void 0 ? void 0 : (_props_originData_extra1 = _props_originData3.extra) === null || _props_originData_extra1 === void 0 ? void 0 : _props_originData_extra1.answerStatus) === 'EXCEPTION' || ((_props_originData4 = props.originData) === null || _props_originData4 === void 0 ? void 0 : (_props_originData_extra2 = _props_originData4.extra) === null || _props_originData_extra2 === void 0 ? void 0 : _props_originData_extra2.answerStatus) && !((_props_originData5 = props.originData) === null || _props_originData5 === void 0 ? void 0 : _props_originData5.content)) {
|
|
535
|
-
return /*#__PURE__*/ React.createElement(EXCEPTION, {
|
|
536
|
+
return wrapSSR(/*#__PURE__*/ React.createElement(EXCEPTION, {
|
|
536
537
|
content: props.originData.content,
|
|
537
538
|
originData: props.originData,
|
|
538
539
|
extra: isExtraNull ? null : extra
|
|
539
|
-
});
|
|
540
|
+
}));
|
|
540
541
|
}
|
|
541
542
|
var docInfoList = [
|
|
542
543
|
props === null || props === void 0 ? void 0 : (_props_originData6 = props.originData) === null || _props_originData6 === void 0 ? void 0 : (_props_originData_extra3 = _props_originData6.extra) === null || _props_originData_extra3 === void 0 ? void 0 : _props_originData_extra3.white_box_process
|
|
@@ -558,7 +559,7 @@ export var LOADING_FLAT = '...';
|
|
|
558
559
|
reference_url_info_list: ((_props_docListProps1 = props.docListProps) === null || _props_docListProps1 === void 0 ? void 0 : _props_docListProps1.reference_url_info_list) || ((_props_originData13 = props.originData) === null || _props_originData13 === void 0 ? void 0 : (_props_originData_extra4 = _props_originData13.extra) === null || _props_originData_extra4 === void 0 ? void 0 : _props_originData_extra4.reference_url_info_list) || []
|
|
559
560
|
}));
|
|
560
561
|
}
|
|
561
|
-
return /*#__PURE__*/ React.createElement(MarkdownPreview, {
|
|
562
|
+
return wrapSSR(/*#__PURE__*/ React.createElement(MarkdownPreview, {
|
|
562
563
|
markdownRenderConfig: props.markdownRenderConfig,
|
|
563
564
|
isFinished: (_props_originData7 = props.originData) === null || _props_originData7 === void 0 ? void 0 : _props_originData7.isFinished,
|
|
564
565
|
beforeContent: beforeContent,
|
|
@@ -574,7 +575,7 @@ export var LOADING_FLAT = '...';
|
|
|
574
575
|
if (!(item === null || item === void 0 ? void 0 : item.origin_text)) return null;
|
|
575
576
|
return /*#__PURE__*/ React.createElement(Popover, {
|
|
576
577
|
title: /*#__PURE__*/ React.createElement("div", {
|
|
577
|
-
className: classNames("".concat(
|
|
578
|
+
className: classNames("".concat(baseChatCls, "-messages-content-popover-title"), hashId),
|
|
578
579
|
style: props === null || props === void 0 ? void 0 : (_props_customConfig = props.customConfig) === null || _props_customConfig === void 0 ? void 0 : (_props_customConfig_PopoverProps = _props_customConfig.PopoverProps) === null || _props_customConfig_PopoverProps === void 0 ? void 0 : _props_customConfig_PopoverProps.titleStyle
|
|
579
580
|
}, /*#__PURE__*/ React.createElement("div", null, (locale === null || locale === void 0 ? void 0 : locale['chat.message.referenceDocument']) || '参考文档'), (item === null || item === void 0 ? void 0 : item.origin_url) ? /*#__PURE__*/ React.createElement(ActionIconBox, {
|
|
580
581
|
title: (locale === null || locale === void 0 ? void 0 : locale['chat.message.viewOriginal']) || '查看原文',
|
|
@@ -590,7 +591,7 @@ export var LOADING_FLAT = '...';
|
|
|
590
591
|
}
|
|
591
592
|
}, /*#__PURE__*/ React.createElement(ExportOutlined, null)) : null),
|
|
592
593
|
content: /*#__PURE__*/ React.createElement("div", {
|
|
593
|
-
className: classNames("".concat(
|
|
594
|
+
className: classNames("".concat(baseChatCls, "-messages-content-popover-content"), hashId),
|
|
594
595
|
style: props === null || props === void 0 ? void 0 : (_props_customConfig2 = props.customConfig) === null || _props_customConfig2 === void 0 ? void 0 : (_props_customConfig_PopoverProps1 = _props_customConfig2.PopoverProps) === null || _props_customConfig_PopoverProps1 === void 0 ? void 0 : _props_customConfig_PopoverProps1.contentStyle
|
|
595
596
|
}, /*#__PURE__*/ React.createElement(MarkdownEditor, {
|
|
596
597
|
style: {
|
|
@@ -616,12 +617,12 @@ export var LOADING_FLAT = '...';
|
|
|
616
617
|
}
|
|
617
618
|
}, item.docId)
|
|
618
619
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
619
|
-
className: classNames("".concat(
|
|
620
|
+
className: classNames("".concat(baseChatCls, "-messages-content-doc-tag"), hashId)
|
|
620
621
|
}, /*#__PURE__*/ React.createElement("img", {
|
|
621
|
-
className: classNames("".concat(
|
|
622
|
+
className: classNames("".concat(baseChatCls, "-messages-content-doc-tag-icon"), hashId),
|
|
622
623
|
src: 'https://mdn.alipayobjects.com/huamei_ptjqan/afts/img/A*kF_GTppRbp4AAAAAAAAAAAAADkN6AQ/original'
|
|
623
624
|
}), /*#__PURE__*/ React.createElement("div", {
|
|
624
|
-
className: classNames("".concat(
|
|
625
|
+
className: classNames("".concat(baseChatCls, "-messages-content-doc-name"), hashId)
|
|
625
626
|
}, item === null || item === void 0 ? void 0 : item.doc_name))) : null)
|
|
626
627
|
}, _);
|
|
627
628
|
},
|
|
@@ -636,7 +637,7 @@ export var LOADING_FLAT = '...';
|
|
|
636
637
|
htmlRef: props.bubbleListRef,
|
|
637
638
|
content: ((_props_originData8 = props.originData) === null || _props_originData8 === void 0 ? void 0 : _props_originData8.isFinished) ? ((_props_originData9 = props.originData) === null || _props_originData9 === void 0 ? void 0 : _props_originData9.content) || (locale === null || locale === void 0 ? void 0 : locale['chat.message.generateFailed']) || '生成回答失败,请重试' : ((_props_originData10 = props.originData) === null || _props_originData10 === void 0 ? void 0 : _props_originData10.content) || '',
|
|
638
639
|
originData: props.originData
|
|
639
|
-
});
|
|
640
|
+
}));
|
|
640
641
|
}, [
|
|
641
642
|
content,
|
|
642
643
|
props === null || props === void 0 ? void 0 : (_props_originData5 = props.originData) === null || _props_originData5 === void 0 ? void 0 : _props_originData5.feedback,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare function useMessagesContentStyle(): {
|
|
2
|
+
export declare function useMessagesContentStyle(componentCls: string): {
|
|
3
3
|
hashId: string;
|
|
4
4
|
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
|
|
5
5
|
} | {
|
|
@@ -54,7 +54,7 @@ import { useEditorStyleRegister } from "../../Hooks/useStyle";
|
|
|
54
54
|
var genStyle = function genStyle(token) {
|
|
55
55
|
var _obj;
|
|
56
56
|
return _obj = {}, // 加载状态容器(compact模式)
|
|
57
|
-
_define_property(_obj, "".concat(token.
|
|
57
|
+
_define_property(_obj, "".concat(token.componentCls, "-messages-content-loading"), {
|
|
58
58
|
lineHeight: '24px',
|
|
59
59
|
display: 'flex',
|
|
60
60
|
alignItems: 'center',
|
|
@@ -67,19 +67,19 @@ var genStyle = function genStyle(token) {
|
|
|
67
67
|
padding: 'var(--padding-3x)'
|
|
68
68
|
}
|
|
69
69
|
}), // 消息内容容器
|
|
70
|
-
_define_property(_obj, "".concat(token.
|
|
70
|
+
_define_property(_obj, "".concat(token.componentCls, "-messages-content-message"), {
|
|
71
71
|
lineHeight: '24px'
|
|
72
72
|
}), // 用户消息文本颜色
|
|
73
|
-
_define_property(_obj, "".concat(token.
|
|
73
|
+
_define_property(_obj, "".concat(token.componentCls, "-messages-content-user-text"), {
|
|
74
74
|
color: '#343A45'
|
|
75
75
|
}), // Popover 标题容器
|
|
76
|
-
_define_property(_obj, "".concat(token.
|
|
76
|
+
_define_property(_obj, "".concat(token.componentCls, "-messages-content-popover-title"), {
|
|
77
77
|
display: 'flex',
|
|
78
78
|
justifyContent: 'space-between',
|
|
79
79
|
alignItems: 'center',
|
|
80
80
|
fontSize: '1em'
|
|
81
81
|
}), // Popover 内容容器
|
|
82
|
-
_define_property(_obj, "".concat(token.
|
|
82
|
+
_define_property(_obj, "".concat(token.componentCls, "-messages-content-popover-content"), {
|
|
83
83
|
width: 400,
|
|
84
84
|
display: 'flex',
|
|
85
85
|
maxHeight: 400,
|
|
@@ -87,7 +87,7 @@ var genStyle = function genStyle(token) {
|
|
|
87
87
|
flexDirection: 'column',
|
|
88
88
|
gap: 'var(--padding-3x)'
|
|
89
89
|
}), // MarkdownEditor 容器样式
|
|
90
|
-
_define_property(_obj, "".concat(token.
|
|
90
|
+
_define_property(_obj, "".concat(token.componentCls, "-messages-content-markdown-editor"), {
|
|
91
91
|
padding: 0,
|
|
92
92
|
width: '100%'
|
|
93
93
|
}), // 重新生成按钮容器
|
|
@@ -97,7 +97,7 @@ var genStyle = function genStyle(token) {
|
|
|
97
97
|
cursor: 'pointer',
|
|
98
98
|
alignItems: 'center'
|
|
99
99
|
}), // 文档标签容器
|
|
100
|
-
_define_property(_obj, "".concat(token.
|
|
100
|
+
_define_property(_obj, "".concat(token.componentCls, "-messages-content-doc-tag"), {
|
|
101
101
|
borderRadius: 'var(--padding-5x)',
|
|
102
102
|
opacity: 1,
|
|
103
103
|
display: 'flex',
|
|
@@ -110,10 +110,10 @@ var genStyle = function genStyle(token) {
|
|
|
110
110
|
cursor: 'pointer',
|
|
111
111
|
zIndex: 1
|
|
112
112
|
}), // 文档标签图标
|
|
113
|
-
_define_property(_obj, "".concat(token.
|
|
113
|
+
_define_property(_obj, "".concat(token.componentCls, "-messages-content-doc-tag-icon"), {
|
|
114
114
|
width: 24
|
|
115
115
|
}), // 文档名称文本
|
|
116
|
-
_define_property(_obj, "".concat(token.
|
|
116
|
+
_define_property(_obj, "".concat(token.componentCls, "-messages-content-doc-name"), {
|
|
117
117
|
overflow: 'hidden',
|
|
118
118
|
textOverflow: 'ellipsis',
|
|
119
119
|
WebkitBoxOrient: 'vertical',
|
|
@@ -121,12 +121,10 @@ var genStyle = function genStyle(token) {
|
|
|
121
121
|
display: '-webkit-box'
|
|
122
122
|
}), _obj;
|
|
123
123
|
};
|
|
124
|
-
export function useMessagesContentStyle() {
|
|
124
|
+
export function useMessagesContentStyle(componentCls) {
|
|
125
125
|
return useEditorStyleRegister('BubbleMessageDisplay', function(token) {
|
|
126
126
|
var chatToken = _object_spread_props(_object_spread({}, token), {
|
|
127
|
-
componentCls:
|
|
128
|
-
chatCls: '',
|
|
129
|
-
antCls: ''
|
|
127
|
+
componentCls: componentCls || ''
|
|
130
128
|
});
|
|
131
129
|
return genStyle(chatToken);
|
|
132
130
|
});
|