@ant-design/agentic-ui 2.27.10 → 2.28.1
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/MarkdownEditor/editor/elements/Blockquote/index.js +11 -1
- package/dist/MarkdownEditor/editor/elements/Break/index.js +2 -0
- package/dist/MarkdownEditor/editor/elements/Card/index.js +11 -0
- package/dist/MarkdownEditor/editor/elements/Code/index.js +22 -7
- package/dist/MarkdownEditor/editor/elements/FootnoteDefinition/index.js +15 -1
- package/dist/MarkdownEditor/editor/elements/FootnoteReference/index.js +11 -1
- package/dist/MarkdownEditor/editor/elements/Head/index.d.ts +1 -1
- package/dist/MarkdownEditor/editor/elements/Head/index.js +17 -1
- package/dist/MarkdownEditor/editor/elements/Hr/index.js +2 -0
- package/dist/MarkdownEditor/editor/elements/Image/index.js +75 -34
- package/dist/MarkdownEditor/editor/elements/InlineKatex/index.js +5 -0
- package/dist/MarkdownEditor/editor/elements/Katex/index.js +5 -0
- package/dist/MarkdownEditor/editor/elements/LinkCard/index.js +13 -1
- package/dist/MarkdownEditor/editor/elements/List/List.js +16 -1
- package/dist/MarkdownEditor/editor/elements/List/ListItem.js +16 -4
- package/dist/MarkdownEditor/editor/elements/Mermaid/index.js +7 -2
- package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +14 -2
- package/dist/MarkdownEditor/editor/elements/Schema/index.js +13 -0
- package/dist/MarkdownEditor/editor/elements/Table/SimpleTable.js +43 -88
- package/dist/MarkdownEditor/editor/elements/index.js +131 -16
- package/dist/MarkdownEditor/editor/parser/parse/parseBlockElements.js +84 -17
- package/dist/MarkdownEditor/editor/parser/parse/parseCode.js +39 -2
- package/dist/MarkdownEditor/editor/parser/parse/parseElements.js +27 -2
- package/dist/MarkdownEditor/editor/parser/parse/parseFootnote.js +11 -1
- package/dist/MarkdownEditor/editor/parser/parse/parseMath.js +31 -4
- package/dist/MarkdownEditor/editor/parser/parse/parseMedia.js +41 -6
- package/dist/MarkdownEditor/editor/parser/parse/parseTable.js +9 -2
- package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +141 -24
- package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +127 -6
- package/dist/MarkdownEditor/editor/plugins/insertParsedHtmlNodes.js +109 -2
- package/dist/Plugins/chart/AreaChart/index.js +3 -0
- package/dist/Plugins/chart/BarChart/index.js +3 -0
- package/dist/Plugins/chart/DonutChart/index.js +1 -1
- package/dist/Plugins/chart/FunnelChart/index.js +3 -0
- package/dist/Plugins/chart/LineChart/index.js +3 -0
- package/dist/Plugins/chart/RadarChart/index.js +3 -0
- package/dist/Plugins/chart/ScatterChart/index.js +3 -0
- package/dist/Plugins/code/components/ThinkBlock.js +66 -5
- package/package.json +1 -1
|
@@ -235,6 +235,7 @@ function _ts_generator(thisArg, body) {
|
|
|
235
235
|
import { message } from "antd";
|
|
236
236
|
import { Editor, Element, Node, Path, Range, Transforms } from "slate";
|
|
237
237
|
import { jsx } from "slate-hyperscript";
|
|
238
|
+
import { debugInfo } from "../../../Utils/debugUtils";
|
|
238
239
|
import { debugLog, EditorUtils } from "../utils";
|
|
239
240
|
import { docxDeserializer } from "../utils/docx/docxDeserializer";
|
|
240
241
|
import { BackspaceKey } from "./hotKeyCommands/backspace";
|
|
@@ -866,12 +867,25 @@ var blobToFile = /*#__PURE__*/ function() {
|
|
|
866
867
|
* 优化的HTML解析函数,支持分段处理
|
|
867
868
|
*/ var parseHtmlOptimized = /*#__PURE__*/ function() {
|
|
868
869
|
var _ref = _async_to_generator(function(html, rtf) {
|
|
870
|
+
var result;
|
|
869
871
|
return _ts_generator(this, function(_state) {
|
|
872
|
+
debugInfo('parseHtmlOptimized - 开始解析', {
|
|
873
|
+
htmlLength: html.length,
|
|
874
|
+
rtfLength: rtf.length,
|
|
875
|
+
useSync: html.length < MAX_SYNC_SIZE
|
|
876
|
+
});
|
|
870
877
|
// 对于小内容,使用同步处理
|
|
871
878
|
if (html.length < MAX_SYNC_SIZE) {
|
|
879
|
+
result = docxDeserializer(rtf, html.trim());
|
|
880
|
+
debugInfo('parseHtmlOptimized - 同步解析完成', {
|
|
881
|
+
resultLength: result === null || result === void 0 ? void 0 : result.length,
|
|
882
|
+
resultTypes: result === null || result === void 0 ? void 0 : result.map(function(r) {
|
|
883
|
+
return r === null || r === void 0 ? void 0 : r.type;
|
|
884
|
+
})
|
|
885
|
+
});
|
|
872
886
|
return [
|
|
873
887
|
2,
|
|
874
|
-
|
|
888
|
+
result
|
|
875
889
|
];
|
|
876
890
|
}
|
|
877
891
|
// 对于大内容,使用异步处理
|
|
@@ -881,10 +895,20 @@ var blobToFile = /*#__PURE__*/ function() {
|
|
|
881
895
|
// 使用 requestIdleCallback 在空闲时间处理
|
|
882
896
|
var processInIdle = function() {
|
|
883
897
|
try {
|
|
898
|
+
debugInfo('parseHtmlOptimized - 异步解析开始');
|
|
884
899
|
var result = docxDeserializer(rtf, html.trim());
|
|
900
|
+
debugInfo('parseHtmlOptimized - 异步解析完成', {
|
|
901
|
+
resultLength: result === null || result === void 0 ? void 0 : result.length,
|
|
902
|
+
resultTypes: result === null || result === void 0 ? void 0 : result.map(function(r) {
|
|
903
|
+
return r === null || r === void 0 ? void 0 : r.type;
|
|
904
|
+
})
|
|
905
|
+
});
|
|
885
906
|
resolve(result);
|
|
886
907
|
} catch (error) {
|
|
887
908
|
console.error('HTML解析失败:', error);
|
|
909
|
+
debugInfo('parseHtmlOptimized - 解析失败', {
|
|
910
|
+
error: error
|
|
911
|
+
});
|
|
888
912
|
resolve([]);
|
|
889
913
|
}
|
|
890
914
|
};
|
|
@@ -910,8 +934,18 @@ var blobToFile = /*#__PURE__*/ function() {
|
|
|
910
934
|
* @param html
|
|
911
935
|
* @returns
|
|
912
936
|
*/ export var htmlToFragmentList = function(html, rtl) {
|
|
937
|
+
debugInfo('htmlToFragmentList - 开始转换', {
|
|
938
|
+
htmlLength: html.length,
|
|
939
|
+
rtlLength: rtl.length
|
|
940
|
+
});
|
|
913
941
|
var fragmentList = docxDeserializer(rtl, html.trim());
|
|
914
|
-
|
|
942
|
+
debugInfo('htmlToFragmentList - 反序列化完成', {
|
|
943
|
+
fragmentListLength: fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.length,
|
|
944
|
+
fragmentTypes: fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.map(function(f) {
|
|
945
|
+
return f === null || f === void 0 ? void 0 : f.type;
|
|
946
|
+
})
|
|
947
|
+
});
|
|
948
|
+
var result = fragmentList.map(function(fragment) {
|
|
915
949
|
if (fragment.type === 'table') {
|
|
916
950
|
return EditorUtils.wrapperCardNode(fragment);
|
|
917
951
|
}
|
|
@@ -923,6 +957,13 @@ var blobToFile = /*#__PURE__*/ function() {
|
|
|
923
957
|
}
|
|
924
958
|
return fragment;
|
|
925
959
|
});
|
|
960
|
+
debugInfo('htmlToFragmentList - 转换完成', {
|
|
961
|
+
resultLength: result.length,
|
|
962
|
+
resultTypes: result.map(function(r) {
|
|
963
|
+
return r === null || r === void 0 ? void 0 : r.type;
|
|
964
|
+
})
|
|
965
|
+
});
|
|
966
|
+
return result;
|
|
926
967
|
};
|
|
927
968
|
export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
|
|
928
969
|
var _ref = _async_to_generator(function(editor, html, editorProps, rtl) {
|
|
@@ -930,8 +971,15 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
|
|
|
930
971
|
return _ts_generator(this, function(_state) {
|
|
931
972
|
switch(_state.label){
|
|
932
973
|
case 0:
|
|
974
|
+
debugInfo('insertParsedHtmlNodes - 开始插入 HTML 节点', {
|
|
975
|
+
htmlLength: html === null || html === void 0 ? void 0 : html.length,
|
|
976
|
+
htmlPreview: html === null || html === void 0 ? void 0 : html.substring(0, 200),
|
|
977
|
+
rtlLength: rtl === null || rtl === void 0 ? void 0 : rtl.length,
|
|
978
|
+
hasEditorProps: !!editorProps
|
|
979
|
+
});
|
|
933
980
|
// 1. 基础检查
|
|
934
981
|
if (html.startsWith('<html>\r\n<body>\r\n\x3C!--StartFragment--><img src="')) {
|
|
982
|
+
debugInfo('insertParsedHtmlNodes - 跳过特殊格式的 HTML');
|
|
935
983
|
return [
|
|
936
984
|
2,
|
|
937
985
|
false
|
|
@@ -947,13 +995,22 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
|
|
|
947
995
|
,
|
|
948
996
|
18
|
|
949
997
|
]);
|
|
998
|
+
// 3. 异步解析 HTML
|
|
999
|
+
debugInfo('insertParsedHtmlNodes - 开始解析 HTML');
|
|
950
1000
|
return [
|
|
951
1001
|
4,
|
|
952
1002
|
parseHtmlOptimized(html, rtl)
|
|
953
1003
|
];
|
|
954
1004
|
case 2:
|
|
955
1005
|
fragmentList = _state.sent();
|
|
1006
|
+
debugInfo('insertParsedHtmlNodes - HTML 解析完成', {
|
|
1007
|
+
fragmentListLength: fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.length,
|
|
1008
|
+
fragmentTypes: fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.map(function(f) {
|
|
1009
|
+
return f === null || f === void 0 ? void 0 : f.type;
|
|
1010
|
+
})
|
|
1011
|
+
});
|
|
956
1012
|
if (!(fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.length)) {
|
|
1013
|
+
debugInfo('insertParsedHtmlNodes - 解析结果为空');
|
|
957
1014
|
hideLoading();
|
|
958
1015
|
return [
|
|
959
1016
|
2,
|
|
@@ -961,12 +1018,14 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
|
|
|
961
1018
|
];
|
|
962
1019
|
}
|
|
963
1020
|
// 4. 异步处理文件上传
|
|
1021
|
+
debugInfo('insertParsedHtmlNodes - 开始处理文件上传');
|
|
964
1022
|
return [
|
|
965
1023
|
4,
|
|
966
1024
|
upLoadFileBatch(fragmentList, editorProps)
|
|
967
1025
|
];
|
|
968
1026
|
case 3:
|
|
969
1027
|
_state.sent();
|
|
1028
|
+
debugInfo('insertParsedHtmlNodes - 文件上传完成');
|
|
970
1029
|
debugLog('wordFragmentList', fragmentList);
|
|
971
1030
|
hideLoading();
|
|
972
1031
|
// 5. 获取当前节点
|
|
@@ -980,6 +1039,7 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
|
|
|
980
1039
|
3,
|
|
981
1040
|
5
|
|
982
1041
|
];
|
|
1042
|
+
debugInfo('insertParsedHtmlNodes - 无有效选区,直接插入');
|
|
983
1043
|
processedNodes = fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.map(function(item) {
|
|
984
1044
|
if (!item.type) {
|
|
985
1045
|
return {
|
|
@@ -991,12 +1051,19 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
|
|
|
991
1051
|
}
|
|
992
1052
|
return item;
|
|
993
1053
|
});
|
|
1054
|
+
debugInfo('insertParsedHtmlNodes - 处理后的节点', {
|
|
1055
|
+
processedNodesLength: processedNodes === null || processedNodes === void 0 ? void 0 : processedNodes.length,
|
|
1056
|
+
processedTypes: processedNodes === null || processedNodes === void 0 ? void 0 : processedNodes.map(function(n) {
|
|
1057
|
+
return n === null || n === void 0 ? void 0 : n.type;
|
|
1058
|
+
})
|
|
1059
|
+
});
|
|
994
1060
|
return [
|
|
995
1061
|
4,
|
|
996
1062
|
insertNodesBatch(editor, processedNodes)
|
|
997
1063
|
];
|
|
998
1064
|
case 4:
|
|
999
1065
|
_state.sent();
|
|
1066
|
+
debugInfo('insertParsedHtmlNodes - 节点插入完成');
|
|
1000
1067
|
return [
|
|
1001
1068
|
2,
|
|
1002
1069
|
true
|
|
@@ -1004,6 +1071,12 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
|
|
|
1004
1071
|
case 5:
|
|
1005
1072
|
// 7. 处理非折叠选区
|
|
1006
1073
|
if (!Range.isCollapsed(selection)) {
|
|
1074
|
+
debugInfo('insertParsedHtmlNodes - 处理非折叠选区', {
|
|
1075
|
+
selectionRange: {
|
|
1076
|
+
anchor: selection.anchor,
|
|
1077
|
+
focus: selection.focus
|
|
1078
|
+
}
|
|
1079
|
+
});
|
|
1007
1080
|
back = new BackspaceKey(editor);
|
|
1008
1081
|
back.range();
|
|
1009
1082
|
Transforms.select(editor, Range.start(selection));
|
|
@@ -1039,16 +1112,34 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
|
|
|
1039
1112
|
// 9. 处理代码块和表格单元格
|
|
1040
1113
|
parsed = new DOMParser().parseFromString(html, 'text/html').body;
|
|
1041
1114
|
inner = !!parsed.querySelector('[data-be]');
|
|
1115
|
+
debugInfo('insertParsedHtmlNodes - DOM 解析完成', {
|
|
1116
|
+
hasDataBe: inner,
|
|
1117
|
+
parsedBodyChildren: parsed.children.length
|
|
1118
|
+
});
|
|
1042
1119
|
// 对于代码块,检查是否包含代码相关的标签
|
|
1043
1120
|
if ((node === null || node === void 0 ? void 0 : node[0].type) === 'code') {
|
|
1121
|
+
debugInfo('insertParsedHtmlNodes - 当前节点是代码块', {
|
|
1122
|
+
nodeType: node[0].type
|
|
1123
|
+
});
|
|
1044
1124
|
hasCodeTags = html.includes('<pre>') || html.includes('<code>') || inner;
|
|
1125
|
+
debugInfo('insertParsedHtmlNodes - 代码块检查', {
|
|
1126
|
+
hasPreTag: html.includes('<pre>'),
|
|
1127
|
+
hasCodeTag: html.includes('<code>'),
|
|
1128
|
+
hasDataBe: inner,
|
|
1129
|
+
hasCodeTags: hasCodeTags
|
|
1130
|
+
});
|
|
1045
1131
|
if (hasCodeTags) {
|
|
1046
1132
|
// 从 HTML 中提取纯文本内容
|
|
1047
1133
|
textContent = parsed.textContent || '';
|
|
1134
|
+
debugInfo('insertParsedHtmlNodes - 提取文本内容', {
|
|
1135
|
+
textContentLength: textContent.length,
|
|
1136
|
+
textContentPreview: textContent.substring(0, 100)
|
|
1137
|
+
});
|
|
1048
1138
|
if (textContent.trim()) {
|
|
1049
1139
|
Transforms.insertText(editor, textContent.trim(), {
|
|
1050
1140
|
at: selection
|
|
1051
1141
|
});
|
|
1142
|
+
debugInfo('insertParsedHtmlNodes - 代码块文本插入完成');
|
|
1052
1143
|
return [
|
|
1053
1144
|
2,
|
|
1054
1145
|
true
|
|
@@ -1067,8 +1158,16 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
|
|
|
1067
1158
|
3,
|
|
1068
1159
|
12
|
|
1069
1160
|
];
|
|
1161
|
+
debugInfo('insertParsedHtmlNodes - 处理列表项', {
|
|
1162
|
+
currentNodeType: node[0].type,
|
|
1163
|
+
fragmentListType: fragmentList[0].type
|
|
1164
|
+
});
|
|
1070
1165
|
children = fragmentList[0].children || [];
|
|
1166
|
+
debugInfo('insertParsedHtmlNodes - 列表项子节点', {
|
|
1167
|
+
childrenCount: children.length
|
|
1168
|
+
});
|
|
1071
1169
|
if (!children.length) {
|
|
1170
|
+
debugInfo('insertParsedHtmlNodes - 列表项无子节点');
|
|
1072
1171
|
return [
|
|
1073
1172
|
2,
|
|
1074
1173
|
false
|
|
@@ -1228,6 +1327,7 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
|
|
|
1228
1327
|
}
|
|
1229
1328
|
}
|
|
1230
1329
|
// 14. 默认情况:替换选中节点
|
|
1330
|
+
debugInfo('insertParsedHtmlNodes - 使用默认处理方式');
|
|
1231
1331
|
processedNodes1 = fragmentList === null || fragmentList === void 0 ? void 0 : fragmentList.map(function(item) {
|
|
1232
1332
|
if (!item.type) {
|
|
1233
1333
|
return {
|
|
@@ -1246,12 +1346,19 @@ export var insertParsedHtmlNodes = /*#__PURE__*/ function() {
|
|
|
1246
1346
|
}
|
|
1247
1347
|
return item;
|
|
1248
1348
|
});
|
|
1349
|
+
debugInfo('insertParsedHtmlNodes - 默认处理节点准备完成', {
|
|
1350
|
+
processedNodesLength: processedNodes1 === null || processedNodes1 === void 0 ? void 0 : processedNodes1.length,
|
|
1351
|
+
processedTypes: processedNodes1 === null || processedNodes1 === void 0 ? void 0 : processedNodes1.map(function(n) {
|
|
1352
|
+
return n === null || n === void 0 ? void 0 : n.type;
|
|
1353
|
+
})
|
|
1354
|
+
});
|
|
1249
1355
|
return [
|
|
1250
1356
|
4,
|
|
1251
1357
|
insertNodesBatch(editor, processedNodes1)
|
|
1252
1358
|
];
|
|
1253
1359
|
case 16:
|
|
1254
1360
|
_state.sent();
|
|
1361
|
+
debugInfo('insertParsedHtmlNodes - 默认处理完成');
|
|
1255
1362
|
return [
|
|
1256
1363
|
2,
|
|
1257
1364
|
true
|
|
@@ -1,7 +1,54 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview 思考块组件
|
|
3
3
|
* 只读模式下渲染思考类型的代码块
|
|
4
|
-
*/
|
|
4
|
+
*/ function _array_like_to_array(arr, len) {
|
|
5
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
6
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
7
|
+
return arr2;
|
|
8
|
+
}
|
|
9
|
+
function _array_with_holes(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return arr;
|
|
11
|
+
}
|
|
12
|
+
function _iterable_to_array_limit(arr, i) {
|
|
13
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
14
|
+
if (_i == null) return;
|
|
15
|
+
var _arr = [];
|
|
16
|
+
var _n = true;
|
|
17
|
+
var _d = false;
|
|
18
|
+
var _s, _e;
|
|
19
|
+
try {
|
|
20
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
21
|
+
_arr.push(_s.value);
|
|
22
|
+
if (i && _arr.length === i) break;
|
|
23
|
+
}
|
|
24
|
+
} catch (err) {
|
|
25
|
+
_d = true;
|
|
26
|
+
_e = err;
|
|
27
|
+
} finally{
|
|
28
|
+
try {
|
|
29
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
30
|
+
} finally{
|
|
31
|
+
if (_d) throw _e;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return _arr;
|
|
35
|
+
}
|
|
36
|
+
function _non_iterable_rest() {
|
|
37
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
38
|
+
}
|
|
39
|
+
function _sliced_to_array(arr, i) {
|
|
40
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
41
|
+
}
|
|
42
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
43
|
+
if (!o) return;
|
|
44
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
45
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
46
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
47
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
48
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
49
|
+
}
|
|
50
|
+
import { useMergedState } from "rc-util";
|
|
51
|
+
import React, { useContext, useEffect } from "react";
|
|
5
52
|
import { MessagesContext } from "../../../Bubble/MessagesContent/BubbleContext";
|
|
6
53
|
import { I18nContext } from "../../../I18n";
|
|
7
54
|
import { EditorStoreContext } from "../../../MarkdownEditor/editor/store";
|
|
@@ -20,15 +67,28 @@ import { ToolUseBarThink } from "../../../ToolUseBarThink";
|
|
|
20
67
|
};
|
|
21
68
|
export function ThinkBlock(param) {
|
|
22
69
|
var element = param.element;
|
|
23
|
-
var _editorProps_codeProps;
|
|
70
|
+
var _editorProps_codeProps, _editorProps_codeProps1;
|
|
24
71
|
var locale = useContext(I18nContext).locale;
|
|
25
72
|
var editorProps = (useContext(EditorStoreContext) || {}).editorProps;
|
|
26
73
|
var message = useContext(MessagesContext).message;
|
|
74
|
+
// 获取当前 Bubble 的 isFinished 状态
|
|
75
|
+
var bubbleIsFinished = message === null || message === void 0 ? void 0 : message.isFinished;
|
|
76
|
+
var _useMergedState = _sliced_to_array(useMergedState(function() {
|
|
77
|
+
return bubbleIsFinished ? undefined : false;
|
|
78
|
+
}, {
|
|
79
|
+
value: editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_codeProps = editorProps.codeProps) === null || _editorProps_codeProps === void 0 ? void 0 : _editorProps_codeProps.alwaysExpandedDeepThink,
|
|
80
|
+
defaultValue: editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_codeProps1 = editorProps.codeProps) === null || _editorProps_codeProps1 === void 0 ? void 0 : _editorProps_codeProps1.alwaysExpandedDeepThink
|
|
81
|
+
}), 2), expanded = _useMergedState[0], setExpanded = _useMergedState[1];
|
|
82
|
+
useEffect(function() {
|
|
83
|
+
if (bubbleIsFinished) {
|
|
84
|
+
setExpanded(true);
|
|
85
|
+
}
|
|
86
|
+
}, [
|
|
87
|
+
bubbleIsFinished
|
|
88
|
+
]);
|
|
27
89
|
var rawContent = (element === null || element === void 0 ? void 0 : element.value) !== null && (element === null || element === void 0 ? void 0 : element.value) !== undefined ? String(element.value).trim() : '';
|
|
28
90
|
// 恢复内容中被转义的代码块
|
|
29
91
|
var content = restoreCodeBlocks(rawContent);
|
|
30
|
-
// 获取当前 Bubble 的 isFinished 状态
|
|
31
|
-
var bubbleIsFinished = message === null || message === void 0 ? void 0 : message.isFinished;
|
|
32
92
|
// 判断是否正在加载:内容以...结尾 或者 bubble 还未完成
|
|
33
93
|
var isLoading = content.endsWith('...');
|
|
34
94
|
var toolNameText = isLoading ? (locale === null || locale === void 0 ? void 0 : locale['think.deepThinkingInProgress']) || '深度思考...' : (locale === null || locale === void 0 ? void 0 : locale['think.deepThinking']) || '深度思考';
|
|
@@ -41,7 +101,8 @@ export function ThinkBlock(param) {
|
|
|
41
101
|
marginTop: 8
|
|
42
102
|
}
|
|
43
103
|
},
|
|
44
|
-
expanded:
|
|
104
|
+
expanded: expanded,
|
|
105
|
+
onExpandedChange: setExpanded,
|
|
45
106
|
toolName: toolNameText,
|
|
46
107
|
thinkContent: content,
|
|
47
108
|
status: isLoading ? 'loading' : 'success'
|