@ant-design/agentic-ui 2.29.38 → 2.29.40
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/BubbleExtra.js +0 -1
- package/dist/Hooks/useLanguage.d.ts +21 -0
- package/dist/I18n/locales.d.ts +22 -3
- package/dist/I18n/locales.js +51 -5
- package/dist/MarkdownEditor/editor/tools/JinjaTemplatePanel/index.js +35 -23
- package/dist/MarkdownEditor/editor/tools/JinjaTemplatePanel/style.js +47 -37
- package/dist/MarkdownEditor/editor/tools/JinjaTemplatePanel/templates.d.ts +13 -1
- package/dist/MarkdownEditor/editor/tools/JinjaTemplatePanel/templates.js +30 -11
- package/dist/MarkdownEditor/style.js +2 -2
- package/dist/MarkdownInputField/RefinePromptButton/index.js +4 -2
- package/dist/Plugins/chart/ChartRender.js +4 -2
- package/dist/Plugins/chart/DonutChart/Legend.js +5 -3
- package/dist/Plugins/chart/DonutChart/index.js +3 -1
- package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +44 -2
- package/dist/Plugins/code/CodeUI/Katex/katex.min.css +1 -3
- package/dist/Plugins/katex/katex.min.css +1 -3
- package/package.json +1 -1
|
@@ -660,7 +660,6 @@ import { VoiceButton } from "./VoiceButton";
|
|
|
660
660
|
]);
|
|
661
661
|
var reSend = useMemo(function() {
|
|
662
662
|
var _originalData_extra_preMessage, _originalData_extra;
|
|
663
|
-
console.log('originalData?.isAborted', originalData, typing);
|
|
664
663
|
if ((originalData === null || originalData === void 0 ? void 0 : originalData.isAborted) && !originalData.isFinished) {
|
|
665
664
|
return /*#__PURE__*/ React.createElement("span", null, (locale === null || locale === void 0 ? void 0 : locale['chat.message.aborted']) || '回答已停止生成');
|
|
666
665
|
}
|
|
@@ -406,6 +406,27 @@ export declare function useLanguage(): {
|
|
|
406
406
|
'comment.jumpTo': string;
|
|
407
407
|
'chart.renderFailed': string;
|
|
408
408
|
'chart.renderFailedSubTitle': string;
|
|
409
|
+
'chart.legend.show': string;
|
|
410
|
+
'chart.legend.hide': string;
|
|
411
|
+
'chart.legend.prevPage': string;
|
|
412
|
+
'chart.legend.nextPage': string;
|
|
413
|
+
'chart.legend.remaining': string;
|
|
414
|
+
'refine.loading': string;
|
|
415
|
+
'refine.oneClickOptimize': string;
|
|
416
|
+
'refine.optimizePrompt': string;
|
|
417
|
+
'jinja.panel.title': string;
|
|
418
|
+
'jinja.panel.docLink': string;
|
|
419
|
+
'jinja.panel.noTemplates': string;
|
|
420
|
+
'jinja.template.variableInterpolation.title': string;
|
|
421
|
+
'jinja.template.variableInterpolation.description': string;
|
|
422
|
+
'jinja.template.condition.title': string;
|
|
423
|
+
'jinja.template.condition.description': string;
|
|
424
|
+
'jinja.template.loop.title': string;
|
|
425
|
+
'jinja.template.loop.description': string;
|
|
426
|
+
'jinja.template.filter.title': string;
|
|
427
|
+
'jinja.template.filter.description': string;
|
|
428
|
+
'jinja.template.setVariable.title': string;
|
|
429
|
+
'jinja.template.setVariable.description': string;
|
|
409
430
|
};
|
|
410
431
|
setLanguage: ((language: "zh-CN" | "en-US") => void) | undefined;
|
|
411
432
|
toggleLanguage: () => void;
|
package/dist/I18n/locales.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 中文标签映射对象
|
|
3
3
|
*
|
|
4
|
-
* 包含所有界面文本的中文翻译,用于国际化
|
|
5
|
-
columns: '列',
|
|
6
|
-
all: '全部',
|
|
4
|
+
* 包含所有界面文本的中文翻译,用于国际化
|
|
7
5
|
* 提供完整的用户界面文本本地化。
|
|
8
6
|
*/
|
|
9
7
|
export declare const cnLabels: {
|
|
@@ -370,6 +368,27 @@ export declare const cnLabels: {
|
|
|
370
368
|
'comment.jumpTo': string;
|
|
371
369
|
'chart.renderFailed': string;
|
|
372
370
|
'chart.renderFailedSubTitle': string;
|
|
371
|
+
'chart.legend.show': string;
|
|
372
|
+
'chart.legend.hide': string;
|
|
373
|
+
'chart.legend.prevPage': string;
|
|
374
|
+
'chart.legend.nextPage': string;
|
|
375
|
+
'chart.legend.remaining': string;
|
|
376
|
+
'refine.loading': string;
|
|
377
|
+
'refine.oneClickOptimize': string;
|
|
378
|
+
'refine.optimizePrompt': string;
|
|
379
|
+
'jinja.panel.title': string;
|
|
380
|
+
'jinja.panel.docLink': string;
|
|
381
|
+
'jinja.panel.noTemplates': string;
|
|
382
|
+
'jinja.template.variableInterpolation.title': string;
|
|
383
|
+
'jinja.template.variableInterpolation.description': string;
|
|
384
|
+
'jinja.template.condition.title': string;
|
|
385
|
+
'jinja.template.condition.description': string;
|
|
386
|
+
'jinja.template.loop.title': string;
|
|
387
|
+
'jinja.template.loop.description': string;
|
|
388
|
+
'jinja.template.filter.title': string;
|
|
389
|
+
'jinja.template.filter.description': string;
|
|
390
|
+
'jinja.template.setVariable.title': string;
|
|
391
|
+
'jinja.template.setVariable.description': string;
|
|
373
392
|
};
|
|
374
393
|
/**
|
|
375
394
|
* 英文标签映射对象
|
package/dist/I18n/locales.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 中文标签映射对象
|
|
3
3
|
*
|
|
4
|
-
* 包含所有界面文本的中文翻译,用于国际化
|
|
5
|
-
columns: '列',
|
|
6
|
-
all: '全部',
|
|
4
|
+
* 包含所有界面文本的中文翻译,用于国际化
|
|
7
5
|
* 提供完整的用户界面文本本地化。
|
|
8
6
|
*/ export var cnLabels = {
|
|
9
7
|
attachmentSingleMax: '单个最大',
|
|
@@ -394,7 +392,31 @@
|
|
|
394
392
|
'comment.jumpTo': '跳转到评论位置',
|
|
395
393
|
// 图表错误相关
|
|
396
394
|
'chart.renderFailed': '图表渲染失败',
|
|
397
|
-
'chart.renderFailedSubTitle': '图表组件遇到了一个错误,请稍后重试'
|
|
395
|
+
'chart.renderFailedSubTitle': '图表组件遇到了一个错误,请稍后重试',
|
|
396
|
+
// DonutChart 图例相关
|
|
397
|
+
'chart.legend.show': '显示',
|
|
398
|
+
'chart.legend.hide': '隐藏',
|
|
399
|
+
'chart.legend.prevPage': '上一页',
|
|
400
|
+
'chart.legend.nextPage': '下一页',
|
|
401
|
+
'chart.legend.remaining': '剩余',
|
|
402
|
+
// RefinePromptButton 相关
|
|
403
|
+
'refine.loading': '优化中',
|
|
404
|
+
'refine.oneClickOptimize': '一键优化提示词',
|
|
405
|
+
'refine.optimizePrompt': '优化提示词',
|
|
406
|
+
// Jinja 模板面板相关
|
|
407
|
+
'jinja.panel.title': 'Jinja 模板',
|
|
408
|
+
'jinja.panel.docLink': '使用说明',
|
|
409
|
+
'jinja.panel.noTemplates': '暂无模板',
|
|
410
|
+
'jinja.template.variableInterpolation.title': '变量插值',
|
|
411
|
+
'jinja.template.variableInterpolation.description': '{{ variable }}',
|
|
412
|
+
'jinja.template.condition.title': '条件语句',
|
|
413
|
+
'jinja.template.condition.description': '{% if condition %}...{% endif %}',
|
|
414
|
+
'jinja.template.loop.title': '循环遍历',
|
|
415
|
+
'jinja.template.loop.description': '{% for item in list %}...{% endfor %}',
|
|
416
|
+
'jinja.template.filter.title': '过滤器',
|
|
417
|
+
'jinja.template.filter.description': '{{ value | filter }}',
|
|
418
|
+
'jinja.template.setVariable.title': '设置变量',
|
|
419
|
+
'jinja.template.setVariable.description': '{% set name = value %}'
|
|
398
420
|
};
|
|
399
421
|
/**
|
|
400
422
|
* 英文标签映射对象
|
|
@@ -790,5 +812,29 @@
|
|
|
790
812
|
'comment.jumpTo': 'Jump to Comment',
|
|
791
813
|
// Chart error related
|
|
792
814
|
'chart.renderFailed': 'Chart Rendering Failed',
|
|
793
|
-
'chart.renderFailedSubTitle': 'The chart component encountered an error, please try again later'
|
|
815
|
+
'chart.renderFailedSubTitle': 'The chart component encountered an error, please try again later',
|
|
816
|
+
// DonutChart legend related
|
|
817
|
+
'chart.legend.show': 'Show',
|
|
818
|
+
'chart.legend.hide': 'Hide',
|
|
819
|
+
'chart.legend.prevPage': 'Previous page',
|
|
820
|
+
'chart.legend.nextPage': 'Next page',
|
|
821
|
+
'chart.legend.remaining': 'Remaining',
|
|
822
|
+
// RefinePromptButton related
|
|
823
|
+
'refine.loading': 'Optimizing',
|
|
824
|
+
'refine.oneClickOptimize': 'One-click optimize prompt',
|
|
825
|
+
'refine.optimizePrompt': 'Optimize prompt',
|
|
826
|
+
// Jinja template panel related
|
|
827
|
+
'jinja.panel.title': 'Jinja Templates',
|
|
828
|
+
'jinja.panel.docLink': 'Documentation',
|
|
829
|
+
'jinja.panel.noTemplates': 'No templates',
|
|
830
|
+
'jinja.template.variableInterpolation.title': 'Variable interpolation',
|
|
831
|
+
'jinja.template.variableInterpolation.description': '{{ variable }}',
|
|
832
|
+
'jinja.template.condition.title': 'Conditional',
|
|
833
|
+
'jinja.template.condition.description': '{% if condition %}...{% endif %}',
|
|
834
|
+
'jinja.template.loop.title': 'Loop',
|
|
835
|
+
'jinja.template.loop.description': '{% for item in list %}...{% endfor %}',
|
|
836
|
+
'jinja.template.filter.title': 'Filter',
|
|
837
|
+
'jinja.template.filter.description': '{{ value | filter }}',
|
|
838
|
+
'jinja.template.setVariable.title': 'Set variable',
|
|
839
|
+
'jinja.template.setVariable.description': '{% set name = value %}'
|
|
794
840
|
};
|
|
@@ -61,18 +61,20 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
61
61
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
62
62
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
63
63
|
}
|
|
64
|
-
import {
|
|
64
|
+
import { Info } from "@sofa-design/icons";
|
|
65
|
+
import { ConfigProvider } from "antd";
|
|
65
66
|
import classNames from "clsx";
|
|
66
67
|
import isHotkey from "is-hotkey";
|
|
67
|
-
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
68
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
68
69
|
import ReactDOM from "react-dom";
|
|
69
70
|
import { Editor, Transforms } from "slate";
|
|
70
71
|
import { ReactEditor } from "slate-react";
|
|
72
|
+
import { useLocale } from "../../../../I18n";
|
|
71
73
|
import { useEditorStore } from "../../store";
|
|
72
74
|
import { getOffsetLeft } from "../../utils/dom";
|
|
73
75
|
import { EditorUtils } from "../../utils/editorUtils";
|
|
74
76
|
import { JINJA_PANEL_PREFIX_CLS, useJinjaTemplatePanelStyle } from "./style";
|
|
75
|
-
import {
|
|
77
|
+
import { getJinjaTemplateData, JINJA_DOC_LINK } from "./templates";
|
|
76
78
|
var PANEL_MAX_HEIGHT = 320;
|
|
77
79
|
function getPosition(nodeEl) {
|
|
78
80
|
var rect = nodeEl.getBoundingClientRect();
|
|
@@ -101,7 +103,13 @@ export var JinjaTemplatePanel = function JinjaTemplatePanel() {
|
|
|
101
103
|
var docLink = (_ref1 = jinjaConfig === null || jinjaConfig === void 0 ? void 0 : jinjaConfig.docLink) !== null && _ref1 !== void 0 ? _ref1 : JINJA_DOC_LINK;
|
|
102
104
|
var notFoundContent = (_ref2 = templatePanelConfig === null || templatePanelConfig === void 0 ? void 0 : templatePanelConfig.notFoundContent) !== null && _ref2 !== void 0 ? _ref2 : null;
|
|
103
105
|
var itemsConfig = templatePanelConfig === null || templatePanelConfig === void 0 ? void 0 : templatePanelConfig.items;
|
|
104
|
-
var
|
|
106
|
+
var locale = useLocale();
|
|
107
|
+
var defaultItems = useMemo(function() {
|
|
108
|
+
return getJinjaTemplateData(locale);
|
|
109
|
+
}, [
|
|
110
|
+
locale
|
|
111
|
+
]);
|
|
112
|
+
var _useState = _sliced_to_array(useState(defaultItems), 2), items = _useState[0], setItems = _useState[1];
|
|
105
113
|
var _useState1 = _sliced_to_array(useState(false), 2), loading = _useState1[0], setLoading = _useState1[1];
|
|
106
114
|
var _useState2 = _sliced_to_array(useState(0), 2), activeIndex = _useState2[0], setActiveIndex = _useState2[1];
|
|
107
115
|
var _useState3 = _sliced_to_array(useState({
|
|
@@ -135,9 +143,9 @@ export var JinjaTemplatePanel = function JinjaTemplatePanel() {
|
|
|
135
143
|
itemsConfig({
|
|
136
144
|
editor: editor
|
|
137
145
|
}).then(function(list) {
|
|
138
|
-
setItems(Array.isArray(list) ? list :
|
|
146
|
+
setItems(Array.isArray(list) ? list : defaultItems);
|
|
139
147
|
}).catch(function(err) {
|
|
140
|
-
setItems(
|
|
148
|
+
setItems(defaultItems);
|
|
141
149
|
if (process.env.NODE_ENV !== 'production') {
|
|
142
150
|
console.error('[JinjaTemplatePanel] Failed to load template items:', err);
|
|
143
151
|
}
|
|
@@ -147,12 +155,13 @@ export var JinjaTemplatePanel = function JinjaTemplatePanel() {
|
|
|
147
155
|
} else if (Array.isArray(itemsConfig)) {
|
|
148
156
|
setItems(itemsConfig);
|
|
149
157
|
} else {
|
|
150
|
-
setItems(
|
|
158
|
+
setItems(defaultItems);
|
|
151
159
|
}
|
|
152
160
|
}, [
|
|
153
161
|
openJinjaTemplate,
|
|
154
162
|
itemsConfig,
|
|
155
|
-
markdownEditorRef
|
|
163
|
+
markdownEditorRef,
|
|
164
|
+
defaultItems
|
|
156
165
|
]);
|
|
157
166
|
useEffect(function() {
|
|
158
167
|
if (!openJinjaTemplate || !jinjaAnchorPath || !(markdownEditorRef === null || markdownEditorRef === void 0 ? void 0 : markdownEditorRef.current)) return;
|
|
@@ -284,32 +293,35 @@ export var JinjaTemplatePanel = function JinjaTemplatePanel() {
|
|
|
284
293
|
return e.preventDefault();
|
|
285
294
|
}
|
|
286
295
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
287
|
-
className: "".concat(prefixCls, "
|
|
288
|
-
},
|
|
289
|
-
className: "".concat(prefixCls, "
|
|
290
|
-
}, /*#__PURE__*/ React.createElement(
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
296
|
+
className: "".concat(prefixCls, "-content")
|
|
297
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
298
|
+
className: "".concat(prefixCls, "-header")
|
|
299
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
300
|
+
className: "".concat(prefixCls, "-title")
|
|
301
|
+
}, locale['jinja.panel.title']), docLink ? /*#__PURE__*/ React.createElement("div", {
|
|
302
|
+
className: "".concat(prefixCls, "-doc-link"),
|
|
303
|
+
onClick: function onClick(e) {
|
|
304
|
+
e.preventDefault();
|
|
305
|
+
window.open(docLink, '_blank');
|
|
306
|
+
}
|
|
307
|
+
}, /*#__PURE__*/ React.createElement(Info, null), locale['jinja.panel.docLink']) : null), /*#__PURE__*/ React.createElement("div", {
|
|
308
|
+
className: "".concat(prefixCls, "-list-box")
|
|
297
309
|
}, loading ? /*#__PURE__*/ React.createElement("div", {
|
|
298
310
|
style: {
|
|
299
311
|
padding: 12,
|
|
300
312
|
color: 'var(--color-text-secondary)'
|
|
301
313
|
}
|
|
302
|
-
},
|
|
314
|
+
}, locale.loading) : items.length === 0 ? notFoundContent !== null && notFoundContent !== void 0 ? notFoundContent : /*#__PURE__*/ React.createElement("div", {
|
|
303
315
|
style: {
|
|
304
316
|
padding: 12,
|
|
305
317
|
color: 'var(--color-text-secondary)'
|
|
306
318
|
}
|
|
307
|
-
},
|
|
319
|
+
}, locale['jinja.panel.noTemplates']) : items.map(function(item, i) {
|
|
308
320
|
return /*#__PURE__*/ React.createElement("div", {
|
|
309
321
|
key: i,
|
|
310
322
|
role: "option",
|
|
311
323
|
"aria-selected": i === activeIndex,
|
|
312
|
-
className: classNames("".concat(prefixCls, "
|
|
324
|
+
className: classNames("".concat(prefixCls, "-item"), _define_property({}, "".concat(prefixCls, "-item-active"), i === activeIndex)),
|
|
313
325
|
onMouseDown: function onMouseDown(e) {
|
|
314
326
|
e.preventDefault();
|
|
315
327
|
insertTemplate(item);
|
|
@@ -318,9 +330,9 @@ export var JinjaTemplatePanel = function JinjaTemplatePanel() {
|
|
|
318
330
|
return setActiveIndex(i);
|
|
319
331
|
}
|
|
320
332
|
}, /*#__PURE__*/ React.createElement("span", {
|
|
321
|
-
className: "".concat(prefixCls, "
|
|
333
|
+
className: "".concat(prefixCls, "-item-title")
|
|
322
334
|
}, item.title), item.description ? /*#__PURE__*/ React.createElement("span", {
|
|
323
|
-
className: "".concat(prefixCls, "
|
|
335
|
+
className: "".concat(prefixCls, "-item-desc")
|
|
324
336
|
}, item.description) : null);
|
|
325
337
|
})))));
|
|
326
338
|
return /*#__PURE__*/ ReactDOM.createPortal(panel, document.body);
|
|
@@ -57,63 +57,73 @@ var genJinjaPanelStyle = function genJinjaPanelStyle(token) {
|
|
|
57
57
|
boxSizing: 'border-box',
|
|
58
58
|
display: 'flex',
|
|
59
59
|
flexDirection: 'column',
|
|
60
|
+
width: 360,
|
|
61
|
+
height: 200,
|
|
60
62
|
maxHeight: 320,
|
|
61
63
|
minWidth: 240,
|
|
62
64
|
overflow: 'hidden',
|
|
63
|
-
borderRadius:
|
|
64
|
-
backgroundColor:
|
|
65
|
-
boxShadow:
|
|
66
|
-
|
|
67
|
-
'&__content': {
|
|
65
|
+
borderRadius: 'var(--radius-control-sm, var(--ant-border-radius-sm))',
|
|
66
|
+
backgroundColor: 'var(--color-gray-bg-page-light, var(--ant-color-bg-container))',
|
|
67
|
+
boxShadow: 'var(--shadow-control-lg, var(--ant-box-shadow))',
|
|
68
|
+
'&-content': {
|
|
68
69
|
display: 'flex',
|
|
69
70
|
flexDirection: 'column',
|
|
70
71
|
flex: 1,
|
|
71
|
-
overflow: 'hidden'
|
|
72
|
+
overflow: 'hidden',
|
|
73
|
+
padding: 4
|
|
72
74
|
},
|
|
73
|
-
'
|
|
74
|
-
padding: '
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
75
|
+
'&-header': {
|
|
76
|
+
padding: '6px 12px',
|
|
77
|
+
display: 'flex',
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
justifyContent: 'space-between'
|
|
80
|
+
},
|
|
81
|
+
'&-title': {
|
|
82
|
+
font: 'var(--font-text-body-emphasized-sm)',
|
|
83
|
+
letterSpacing: 'var(--letter-spacing-body-emphasized-sm, normal)',
|
|
84
|
+
color: 'var(--color-gray-text-light, var(--ant-color-text-secondary))'
|
|
85
|
+
},
|
|
86
|
+
'&-doc-link': {
|
|
87
|
+
display: 'flex',
|
|
88
|
+
cursor: 'pointer',
|
|
89
|
+
alignItems: 'center',
|
|
90
|
+
gap: 4,
|
|
91
|
+
font: 'var(--font-text-body-emphasized-sm)',
|
|
92
|
+
letterSpacing: 'var(--letter-spacing-body-emphasized-sm, normal)',
|
|
93
|
+
color: 'var(--color-primary-text-default, var(--ant-color-link))'
|
|
90
94
|
},
|
|
91
|
-
'
|
|
95
|
+
'&-list-box': {
|
|
92
96
|
flex: 1,
|
|
93
97
|
overflowY: 'auto',
|
|
94
98
|
padding: '4px 0'
|
|
95
99
|
},
|
|
96
|
-
'
|
|
100
|
+
'&-item': {
|
|
97
101
|
display: 'flex',
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
borderRadius: token.borderRadiusSM,
|
|
103
|
+
flexDirection: 'row',
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
gap: 8,
|
|
100
106
|
padding: '8px 12px',
|
|
101
107
|
cursor: 'pointer',
|
|
102
108
|
'&:hover': {
|
|
103
109
|
backgroundColor: token.colorFillTertiary
|
|
104
|
-
},
|
|
105
|
-
'&--active': {
|
|
106
|
-
backgroundColor: token.controlItemBgHover
|
|
107
110
|
}
|
|
108
111
|
},
|
|
109
|
-
'
|
|
110
|
-
|
|
111
|
-
fontWeight: token.fontWeightStrong,
|
|
112
|
-
color: token.colorText
|
|
112
|
+
'&-item-active': {
|
|
113
|
+
backgroundColor: token.controlItemBgHover
|
|
113
114
|
},
|
|
114
|
-
'
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
'&-item-title': {
|
|
116
|
+
flexShrink: 0,
|
|
117
|
+
font: 'var(--font-text-body-base)',
|
|
118
|
+
letterSpacing: 'var(--letter-spacing-body-base, normal)',
|
|
119
|
+
color: 'var(--color-gray-text-default, var(--ant-color-text))'
|
|
120
|
+
},
|
|
121
|
+
'&-item-desc': {
|
|
122
|
+
flex: 1,
|
|
123
|
+
minWidth: 0,
|
|
124
|
+
font: 'var(--font-text-body-sm)',
|
|
125
|
+
letterSpacing: 'var(--letter-spacing-body-sm, normal)',
|
|
126
|
+
color: 'var(--color-gray-text-light, var(--ant-color-text-secondary))'
|
|
117
127
|
}
|
|
118
128
|
});
|
|
119
129
|
};
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
import type { LocalKeys } from '../../../../I18n';
|
|
1
2
|
import type { JinjaTemplateItem } from '../../../types';
|
|
2
|
-
|
|
3
|
+
declare const JINJA_TEMPLATE_IDS: readonly ["variableInterpolation", "condition", "loop", "filter", "setVariable"];
|
|
4
|
+
/** 内置 Jinja 模板基础数据(不含 i18n 文案) */
|
|
5
|
+
export declare const JINJA_TEMPLATE_BASE: {
|
|
6
|
+
id: (typeof JINJA_TEMPLATE_IDS)[number];
|
|
7
|
+
template: string;
|
|
8
|
+
}[];
|
|
9
|
+
/**
|
|
10
|
+
* 根据 locale 生成带国际化文案的 Jinja 模板列表
|
|
11
|
+
*/
|
|
12
|
+
export declare function getJinjaTemplateData(locale: LocalKeys): JinjaTemplateItem[];
|
|
13
|
+
/** 内置 Jinja 模板数据(默认中文),与 agent-ui-pc JinjaTemplateData 文案一致 */
|
|
3
14
|
export declare const JINJA_TEMPLATE_DATA: JinjaTemplateItem[];
|
|
4
15
|
/** 默认使用说明链接,未配置 jinja.docLink 时使用 */
|
|
5
16
|
export declare const JINJA_DOC_LINK = "https://jinja.palletsprojects.com/";
|
|
17
|
+
export {};
|
|
@@ -1,28 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
import { cnLabels } from "../../../../I18n";
|
|
2
|
+
var JINJA_TEMPLATE_IDS = [
|
|
3
|
+
'variableInterpolation',
|
|
4
|
+
'condition',
|
|
5
|
+
'loop',
|
|
6
|
+
'filter',
|
|
7
|
+
'setVariable'
|
|
8
|
+
];
|
|
9
|
+
/** 内置 Jinja 模板基础数据(不含 i18n 文案) */ export var JINJA_TEMPLATE_BASE = [
|
|
2
10
|
{
|
|
3
|
-
|
|
4
|
-
description: '{{ variable }}',
|
|
11
|
+
id: 'variableInterpolation',
|
|
5
12
|
template: '{{ }}'
|
|
6
13
|
},
|
|
7
14
|
{
|
|
8
|
-
|
|
9
|
-
description: '{% if condition %}...{% endif %}',
|
|
15
|
+
id: 'condition',
|
|
10
16
|
template: '{% if %}\n \n{% endif %}'
|
|
11
17
|
},
|
|
12
18
|
{
|
|
13
|
-
|
|
14
|
-
description: '{% for item in list %}...{% endfor %}',
|
|
19
|
+
id: 'loop',
|
|
15
20
|
template: '{% for in %}\n \n{% endfor %}'
|
|
16
21
|
},
|
|
17
22
|
{
|
|
18
|
-
|
|
19
|
-
description: '{{ value | filter }}',
|
|
23
|
+
id: 'filter',
|
|
20
24
|
template: '{{ | }}'
|
|
21
25
|
},
|
|
22
26
|
{
|
|
23
|
-
|
|
24
|
-
description: '{% set name = value %}',
|
|
27
|
+
id: 'setVariable',
|
|
25
28
|
template: '{% set = %}'
|
|
26
29
|
}
|
|
27
30
|
];
|
|
31
|
+
/**
|
|
32
|
+
* 根据 locale 生成带国际化文案的 Jinja 模板列表
|
|
33
|
+
*/ export function getJinjaTemplateData(locale) {
|
|
34
|
+
return JINJA_TEMPLATE_BASE.map(function(param) {
|
|
35
|
+
var id = param.id, template = param.template;
|
|
36
|
+
var _locale_titleKey, _locale_descKey;
|
|
37
|
+
var titleKey = "jinja.template.".concat(id, ".title");
|
|
38
|
+
var descKey = "jinja.template.".concat(id, ".description");
|
|
39
|
+
return {
|
|
40
|
+
title: (_locale_titleKey = locale[titleKey]) !== null && _locale_titleKey !== void 0 ? _locale_titleKey : id,
|
|
41
|
+
description: (_locale_descKey = locale[descKey]) !== null && _locale_descKey !== void 0 ? _locale_descKey : undefined,
|
|
42
|
+
template: template
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/** 内置 Jinja 模板数据(默认中文),与 agent-ui-pc JinjaTemplateData 文案一致 */ export var JINJA_TEMPLATE_DATA = getJinjaTemplateData(cnLabels);
|
|
28
47
|
/** 默认使用说明链接,未配置 jinja.docLink 时使用 */ export var JINJA_DOC_LINK = 'https://jinja.palletsprojects.com/';
|
|
@@ -451,7 +451,7 @@ var genStyle = function genStyle(token) {
|
|
|
451
451
|
borderBottom: '1px solid var(--table-border-color)',
|
|
452
452
|
textWrap: 'nowrap',
|
|
453
453
|
verticalAlign: 'top',
|
|
454
|
-
padding: '16px 12px',
|
|
454
|
+
padding: 'var(--table-cell-padding, 16px 12px)',
|
|
455
455
|
textAlign: 'left',
|
|
456
456
|
lineHeight: '24px',
|
|
457
457
|
fontSize: '1em',
|
|
@@ -466,7 +466,7 @@ var genStyle = function genStyle(token) {
|
|
|
466
466
|
background: 'inherit'
|
|
467
467
|
}), _define_property(_obj1, 'td:not(.config-td)', {
|
|
468
468
|
verticalAlign: 'top',
|
|
469
|
-
padding: '16px 12px',
|
|
469
|
+
padding: 'var(--table-cell-padding, 16px 12px)',
|
|
470
470
|
textAlign: 'left',
|
|
471
471
|
position: 'relative',
|
|
472
472
|
lineHeight: '24px',
|
|
@@ -2,6 +2,7 @@ import { LoadingOutlined } from "@ant-design/icons";
|
|
|
2
2
|
import { TextOptimize } from "@sofa-design/icons";
|
|
3
3
|
import { ConfigProvider, Tooltip } from "antd";
|
|
4
4
|
import React, { useContext } from "react";
|
|
5
|
+
import { useLocale } from "../../I18n";
|
|
5
6
|
import { ErrorBoundary } from "react-error-boundary";
|
|
6
7
|
import { ActionIconBox } from "../../Components/ActionIconBox";
|
|
7
8
|
import { isBrowserEnv } from "./env";
|
|
@@ -9,6 +10,7 @@ import { useStyle } from "./style";
|
|
|
9
10
|
export var RefinePromptButton = function RefinePromptButton(props) {
|
|
10
11
|
var disabled = props.disabled, status = props.status, onRefine = props.onRefine;
|
|
11
12
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
13
|
+
var locale = useLocale();
|
|
12
14
|
var baseCls = getPrefixCls('agentic-md-input-field-refine-button');
|
|
13
15
|
var wrapSSR = useStyle(baseCls).wrapSSR;
|
|
14
16
|
var handleClick = function handleClick() {
|
|
@@ -24,9 +26,9 @@ export var RefinePromptButton = function RefinePromptButton(props) {
|
|
|
24
26
|
return null;
|
|
25
27
|
}
|
|
26
28
|
return wrapSSR(/*#__PURE__*/ React.createElement(Tooltip, {
|
|
27
|
-
title: status === 'loading' ? '
|
|
29
|
+
title: status === 'loading' ? locale['refine.loading'] : locale['refine.oneClickOptimize']
|
|
28
30
|
}, /*#__PURE__*/ React.createElement(ActionIconBox, {
|
|
29
|
-
title: '
|
|
31
|
+
title: locale['refine.optimizePrompt'],
|
|
30
32
|
onClick: handleClick,
|
|
31
33
|
"data-testid": "refine-prompt-button"
|
|
32
34
|
}, /*#__PURE__*/ React.createElement(ErrorBoundary, {
|
|
@@ -345,6 +345,7 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
345
345
|
* 负责使用已加载的 runtime 渲染图表
|
|
346
346
|
*/ var ChartRuntimeRendererImpl = function ChartRuntimeRendererImpl(param) {
|
|
347
347
|
var chartType = param.chartType, runtime = param.runtime, convertDonutData = param.convertDonutData, convertFlatData = param.convertFlatData, config = param.config, title = param.title, dataTime = param.dataTime, toolBar = param.toolBar, filterBy = param.filterBy, groupBy = param.groupBy, colorLegend = param.colorLegend, chartData = param.chartData, getFieldValue = param.getFieldValue, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading;
|
|
348
|
+
var i18n = useContext(I18nContext);
|
|
348
349
|
var DonutChart = runtime.DonutChart, FunnelChart = runtime.FunnelChart, AreaChart = runtime.AreaChart, BarChart = runtime.BarChart, LineChart = runtime.LineChart, RadarChart = runtime.RadarChart, ScatterChart = runtime.ScatterChart;
|
|
349
350
|
if (chartType === 'pie') {
|
|
350
351
|
return /*#__PURE__*/ React.createElement(DonutChart, {
|
|
@@ -505,6 +506,7 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
505
506
|
});
|
|
506
507
|
}
|
|
507
508
|
if (chartType === 'funnel') {
|
|
509
|
+
var _i18n_locale, _i18n_locale1;
|
|
508
510
|
var funnelData = (chartData || []).map(function(row, i) {
|
|
509
511
|
var filterLabel = getFieldValue(row, filterBy);
|
|
510
512
|
var category = getFieldValue(row, groupBy);
|
|
@@ -532,8 +534,8 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
532
534
|
title: title || '',
|
|
533
535
|
dataTime: dataTime,
|
|
534
536
|
typeNames: {
|
|
535
|
-
rate: '转化率',
|
|
536
|
-
name: colorLegend || '转化'
|
|
537
|
+
rate: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale['common.conversionRate']) || '转化率',
|
|
538
|
+
name: colorLegend || (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale1 = i18n.locale) === null || _i18n_locale1 === void 0 ? void 0 : _i18n_locale1['common.conversion']) || '转化'
|
|
537
539
|
},
|
|
538
540
|
toolbarExtra: toolBar,
|
|
539
541
|
loading: loading
|
|
@@ -73,9 +73,11 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
73
73
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
74
74
|
}
|
|
75
75
|
import React, { useEffect, useState } from "react";
|
|
76
|
+
import { useLocale } from "../../../I18n";
|
|
76
77
|
/** 图例每页显示条数,超过则显示分页 */ var LEGEND_PAGE_SIZE = 12;
|
|
77
78
|
var Legend = function Legend(param) {
|
|
78
79
|
var chartData = param.chartData, backgroundColors = param.backgroundColors, hiddenDataIndicesByChart = param.hiddenDataIndicesByChart, chartIndex = param.chartIndex, onLegendItemClick = param.onLegendItemClick, total = param.total, baseClassName = param.baseClassName, hashId = param.hashId, isMobile = param.isMobile;
|
|
80
|
+
var locale = useLocale();
|
|
79
81
|
var hiddenDataIndices = React.useMemo(function() {
|
|
80
82
|
return hiddenDataIndicesByChart[chartIndex] || new Set();
|
|
81
83
|
}, [
|
|
@@ -151,7 +153,7 @@ var Legend = function Legend(param) {
|
|
|
151
153
|
},
|
|
152
154
|
tabIndex: 0,
|
|
153
155
|
role: "button",
|
|
154
|
-
"aria-label": "".concat(isHidden ? '
|
|
156
|
+
"aria-label": "".concat(isHidden ? locale['chart.legend.show'] : locale['chart.legend.hide'], " ").concat(d.label)
|
|
155
157
|
}, /*#__PURE__*/ React.createElement("span", {
|
|
156
158
|
className: [
|
|
157
159
|
"".concat(baseClassName, "-legend-color"),
|
|
@@ -205,7 +207,7 @@ var Legend = function Legend(param) {
|
|
|
205
207
|
} : undefined
|
|
206
208
|
}, /*#__PURE__*/ React.createElement("button", {
|
|
207
209
|
type: "button",
|
|
208
|
-
"aria-label":
|
|
210
|
+
"aria-label": locale['chart.legend.prevPage'],
|
|
209
211
|
disabled: currentPage <= 0,
|
|
210
212
|
onClick: handlePrevPage,
|
|
211
213
|
style: {
|
|
@@ -224,7 +226,7 @@ var Legend = function Legend(param) {
|
|
|
224
226
|
}
|
|
225
227
|
}, currentPage + 1, "/", totalPages), /*#__PURE__*/ React.createElement("button", {
|
|
226
228
|
type: "button",
|
|
227
|
-
"aria-label":
|
|
229
|
+
"aria-label": locale['chart.legend.nextPage'],
|
|
228
230
|
disabled: currentPage >= totalPages - 1,
|
|
229
231
|
onClick: handleNextPage,
|
|
230
232
|
style: {
|
|
@@ -149,6 +149,7 @@ import { ArcElement, Chart as ChartJS, Legend, Tooltip } from "chart.js";
|
|
|
149
149
|
import ChartDataLabels from "chartjs-plugin-datalabels";
|
|
150
150
|
import classNames from "clsx";
|
|
151
151
|
import React, { useContext, useMemo, useRef, useState } from "react";
|
|
152
|
+
import { useLocale } from "../../../I18n";
|
|
152
153
|
import { Doughnut } from "react-chartjs-2";
|
|
153
154
|
import { ChartContainer, ChartFilter, ChartStatistic, ChartToolBar, downloadChart } from "../components";
|
|
154
155
|
import { isWindowDefined } from "../env";
|
|
@@ -231,6 +232,7 @@ import { useStyle } from "./style";
|
|
|
231
232
|
return undefined;
|
|
232
233
|
}, []);
|
|
233
234
|
var _useMobile = useMobile(), isMobile = _useMobile.isMobile, windowWidth = _useMobile.windowWidth;
|
|
235
|
+
var locale = useLocale();
|
|
234
236
|
// 默认配置:当 configs 不传时,使用默认配置,showLegend 默认为 true
|
|
235
237
|
var defaultConfigs = [
|
|
236
238
|
{
|
|
@@ -455,7 +457,7 @@ import { useStyle } from "./style";
|
|
|
455
457
|
chartData = [
|
|
456
458
|
currentDataItem,
|
|
457
459
|
{
|
|
458
|
-
label: '
|
|
460
|
+
label: locale['chart.legend.remaining'],
|
|
459
461
|
value: remainingValue,
|
|
460
462
|
category: currentDataItem.category
|
|
461
463
|
}
|
|
@@ -45,7 +45,7 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
45
45
|
attachmentSingleMax: string;
|
|
46
46
|
table: string;
|
|
47
47
|
column: string;
|
|
48
|
-
quote: string;
|
|
48
|
+
quote: string;
|
|
49
49
|
code: string;
|
|
50
50
|
attachmentSupportedFormats: string;
|
|
51
51
|
localeImage: string;
|
|
@@ -405,6 +405,27 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
405
405
|
'comment.jumpTo': string;
|
|
406
406
|
'chart.renderFailed': string;
|
|
407
407
|
'chart.renderFailedSubTitle': string;
|
|
408
|
+
'chart.legend.show': string;
|
|
409
|
+
'chart.legend.hide': string;
|
|
410
|
+
'chart.legend.prevPage': string;
|
|
411
|
+
'chart.legend.nextPage': string;
|
|
412
|
+
'chart.legend.remaining': string;
|
|
413
|
+
'refine.loading': string;
|
|
414
|
+
'refine.oneClickOptimize': string;
|
|
415
|
+
'refine.optimizePrompt': string;
|
|
416
|
+
'jinja.panel.title': string;
|
|
417
|
+
'jinja.panel.docLink': string;
|
|
418
|
+
'jinja.panel.noTemplates': string;
|
|
419
|
+
'jinja.template.variableInterpolation.title': string;
|
|
420
|
+
'jinja.template.variableInterpolation.description': string;
|
|
421
|
+
'jinja.template.condition.title': string;
|
|
422
|
+
'jinja.template.condition.description': string;
|
|
423
|
+
'jinja.template.loop.title': string;
|
|
424
|
+
'jinja.template.loop.description': string;
|
|
425
|
+
'jinja.template.filter.title': string;
|
|
426
|
+
'jinja.template.filter.description': string;
|
|
427
|
+
'jinja.template.setVariable.title': string;
|
|
428
|
+
'jinja.template.setVariable.description': string;
|
|
408
429
|
};
|
|
409
430
|
language: "zh-CN" | "en-US";
|
|
410
431
|
setLanguage?: ((language: "zh-CN" | "en-US") => void) | undefined;
|
|
@@ -412,7 +433,7 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
412
433
|
attachmentSingleMax: string;
|
|
413
434
|
table: string;
|
|
414
435
|
column: string;
|
|
415
|
-
quote: string;
|
|
436
|
+
quote: string;
|
|
416
437
|
code: string;
|
|
417
438
|
attachmentSupportedFormats: string;
|
|
418
439
|
localeImage: string;
|
|
@@ -772,6 +793,27 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
772
793
|
'comment.jumpTo': string;
|
|
773
794
|
'chart.renderFailed': string;
|
|
774
795
|
'chart.renderFailedSubTitle': string;
|
|
796
|
+
'chart.legend.show': string;
|
|
797
|
+
'chart.legend.hide': string;
|
|
798
|
+
'chart.legend.prevPage': string;
|
|
799
|
+
'chart.legend.nextPage': string;
|
|
800
|
+
'chart.legend.remaining': string;
|
|
801
|
+
'refine.loading': string;
|
|
802
|
+
'refine.oneClickOptimize': string;
|
|
803
|
+
'refine.optimizePrompt': string;
|
|
804
|
+
'jinja.panel.title': string;
|
|
805
|
+
'jinja.panel.docLink': string;
|
|
806
|
+
'jinja.panel.noTemplates': string;
|
|
807
|
+
'jinja.template.variableInterpolation.title': string;
|
|
808
|
+
'jinja.template.variableInterpolation.description': string;
|
|
809
|
+
'jinja.template.condition.title': string;
|
|
810
|
+
'jinja.template.condition.description': string;
|
|
811
|
+
'jinja.template.loop.title': string;
|
|
812
|
+
'jinja.template.loop.description': string;
|
|
813
|
+
'jinja.template.filter.title': string;
|
|
814
|
+
'jinja.template.filter.description': string;
|
|
815
|
+
'jinja.template.setVariable.title': string;
|
|
816
|
+
'jinja.template.setVariable.description': string;
|
|
775
817
|
}) => void) | undefined;
|
|
776
818
|
}>;
|
|
777
819
|
context: React.ContextType<typeof I18nContext>;
|