@ant-design/agentic-ui 2.0.0 → 2.0.2

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/README.md CHANGED
@@ -27,6 +27,43 @@
27
27
 
28
28
  ---
29
29
 
30
+ ## 🔄 交互范式演进
31
+
32
+ ### GUI vs LUI
33
+
34
+ **GUI**:用可视化控件逐步完成操作
35
+ **LUI**:用自然语言表达意图,系统解析并执行(常见为对话/命令式语言界面)
36
+
37
+ | 对比维度 | GUI(传统界面) | LUI(语言界面) |
38
+ | ------------------ | ---------------------------------------- | ---------------------------------------------------------------- |
39
+ | **怎么操作** | 点按钮、选菜单、填表单 | 像聊天一样用自然语言说出你的需求 |
40
+ | **交互方式** | 一步步点,系统照做 | 告诉目标,系统理解并帮你完成 |
41
+ | **上手难度** | 看得见的功能容易学,但界面复杂时难掌握 | 说话就行,但要说得清楚(比如"帮我订明天的会议室"比"订个会"更好) |
42
+ | **功能好不好找** | 功能都摆在界面上,一目了然 | 功能藏在对话里,需要提示或例子才知道能做什么 |
43
+ | **结果准不准** | 点哪打哪,结果确定 | 有时理解有偏差,可能需要你再解释一下 |
44
+ | **适合什么任务** | 简单、明确的操作(如上传文件、开关设置) | 复杂或多条件的任务(如"找上周类似但更便宜的方案") |
45
+ | **出错了怎么办** | 可撤销、重试,操作步骤清晰 | 系统会问你确认,或让你修改说法 |
46
+ | **能不能自动干活** | 得自己一步步点 | 一句话就能触发一连串自动操作(比如查数据+发邮件) |
47
+
48
+ > **关键洞察**:GUI 的操作"翻译"为自然语言,仍是"人主导、系统执行一步"。
49
+
50
+ ### LUI vs Agentic UI
51
+
52
+ **LUI** 侧重"用自然语言操控界面"
53
+ **Agentic UI** 侧重"给目标,由智能体规划并执行,过程可见可控"
54
+
55
+ | 维度 | LUI(语言用户界面) | Agentic UI(智能体用户界面) |
56
+ | -------------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
57
+ | **核心理念** | "你说话,我照做"——把你的指令用自然语言说出来,系统帮你完成一步操作 | "你定目标,我来搞定"——你告诉它要达成什么目标,它自己想办法、分步骤完成,还能随时让你知道进展 |
58
+ | **谁在干活?** | 主要是你在操作,系统只是帮你"翻译"语言成点击或填写。比如你说"发邮件",它弹出草稿,但还得你点"发送" | 主要是智能体(AI助手)在干活,它会自己查资料、填表格、发消息、调工具……但关键步骤会问你:"这样行吗?" |
59
+ | **适合做什么?** | 简单、一次性的任务:比如"总结这篇文章""把这段话改得更正式""查一下明天天气" | 复杂、多步骤的任务:比如"帮我策划一场线上活动,包括写文案、找场地、发邀请、跟踪报名情况" |
60
+ | **怎么用工具?** | 一次用一个工具,比如你说"翻译",它就调翻译功能;你说"查数据",它就查。不会自己组合多个工具 | 能自己决定用哪些工具、什么时候用、怎么组合。比如先查日历空闲时间,再写邮件,再发日程邀请,一气呵成 |
61
+ | **你能看到过程吗?** | 通常只看到结果:"好了,这是你要的摘要。"中间怎么做的?不太清楚 | 你能看到它"怎么想的""做了什么""卡在哪了"。比如:"第一步我查了客户名单,第二步准备发邮件,但需要你确认模板" |
62
+
63
+ > **核心升级**:从"语言控制界面"升级为"目标驱动的智能体协作者"。
64
+
65
+ ---
66
+
30
67
  ## 🚀 快速开始
31
68
 
32
69
  ### 安装
@@ -54,7 +91,7 @@ import { Bubble } from '@ant-design/agentic-ui';
54
91
 
55
92
  ### 任务列表组件
56
93
 
57
- ```tsx
94
+ ```tsx | pure
58
95
  import { TaskList } from '@ant-design/agentic-ui';
59
96
 
60
97
  <TaskList
@@ -68,7 +105,7 @@ import { TaskList } from '@ant-design/agentic-ui';
68
105
 
69
106
  ### 工具调用展示
70
107
 
71
- ```tsx
108
+ ```tsx | pure
72
109
  import { ToolUseBar } from '@ant-design/agentic-ui';
73
110
 
74
111
  <ToolUseBar
@@ -81,7 +118,7 @@ import { ToolUseBar } from '@ant-design/agentic-ui';
81
118
 
82
119
  ### Markdown 编辑器(支持流式输出)
83
120
 
84
- ```tsx
121
+ ```tsx | pure
85
122
  import { MarkdownEditor } from '@ant-design/agentic-ui';
86
123
 
87
124
  <MarkdownEditor
@@ -93,18 +130,76 @@ import { MarkdownEditor } from '@ant-design/agentic-ui';
93
130
 
94
131
  ---
95
132
 
96
- ## 🧩 核心组件
97
-
98
- | 组件 | 描述 | 适用场景 |
99
- | ------------------ | --------------- | ----------------- |
100
- | `Bubble` | AI/用户对话气泡 | 对话界面 |
101
- | `ThoughtChainList` | 思维链可视化 | 展示推理过程 |
102
- | `TaskList` | 任务列表与进度 | 多步骤任务 |
103
- | `ToolUseBar` | 工具调用展示 | 展示 API/工具调用 |
104
- | `MarkdownEditor` | 富文本编辑器 | 内容编辑与展示 |
105
- | `AgenticLayout` | 智能体布局容器 | 整体页面布局 |
106
- | `Workspace` | 工作空间 | 文件管理 |
107
- | `History` | 历史记录 | 会话历史 |
133
+ ## 🧩 完整组件列表
134
+
135
+ ### 🤖 核心智能体组件
136
+
137
+ | 组件 | 描述 | 主要功能 |
138
+ | ------------------ | ------------------ | -------------------------------------------- |
139
+ | `AgenticLayout` | 智能体布局容器 | 提供统一的智能体应用布局结构 |
140
+ | `AgentRunBar` | 智能体运行状态栏 | 显示运行、暂停、停止等状态控制 |
141
+ | `Bubble` | AI/用户对话气泡 | 展示对话内容,支持 AI 和用户消息的差异化展示 |
142
+ | `ThoughtChainList` | 思维链可视化 | 展示"思考—行动—观察"的完整推理过程 |
143
+ | `TaskList` | 任务列表与进度跟踪 | 多步骤任务的状态管理与展示 |
144
+ | `ToolUseBar` | 工具调用展示 | 可视化 API 调用、参数、状态与结果 |
145
+ | `Workspace` | 智能体工作空间 | 文件管理、浏览器、实时跟踪等功能 |
146
+
147
+ ### ✍️ 编辑与输入组件
148
+
149
+ | 组件 | 描述 | 主要功能 |
150
+ | -------------------- | ---------------------- | -------------------------------------------- |
151
+ | `MarkdownEditor` | 富文本 Markdown 编辑器 | 支持流式输出、打字机效果、完整 Markdown 语法 |
152
+ | `MarkdownInputField` | Markdown 输入框 | 支持多模态输入、文件上传、语音输入 |
153
+
154
+ ### 📋 布局与容器组件
155
+
156
+ | 组件 | 描述 | 主要功能 |
157
+ | ------------ | ------------ | ------------------------------------ |
158
+ | `ChatLayout` | 聊天布局容器 | 标准聊天界面布局,支持左右栏、全屏等 |
159
+ | `History` | 历史记录组件 | 会话历史管理,支持搜索、筛选、导出 |
160
+ | `Welcome` | 欢迎页组件 | 应用启动欢迎页,展示功能介绍 |
161
+ | `Quote` | 引用组件 | 引用消息或内容 |
162
+
163
+ ### 🎯 交互与反馈组件
164
+
165
+ | 组件 | 描述 | 主要功能 |
166
+ | ---------------- | ------------- | -------------------------------- |
167
+ | `AnswerAlert` | 答案提醒组件 | 显示成功、错误、警告、加载等状态 |
168
+ | `BackTo` | 返回顶部/底部 | 快速滚动到页面顶部或底部 |
169
+ | `Loading` | 加载动画 | 多种样式的加载状态展示 |
170
+ | `SuggestionList` | 建议列表 | 智能推荐问题或操作 |
171
+ | `ActionIconBox` | 操作图标容器 | 统一的操作按钮样式 |
172
+
173
+ ### 🧠 智能体专属组件
174
+
175
+ | 组件 | 描述 | 主要功能 |
176
+ | ---------------- | ------------- | ---------------------------- |
177
+ | `ChatBoot` | 聊天引导组件 | 快速回复、案例推荐等引导功能 |
178
+ | `SchemaEditor` | Schema 编辑器 | 结构化数据编辑 |
179
+ | `SchemaForm` | Schema 表单 | 基于 Schema 自动生成表单 |
180
+ | `SchemaRenderer` | Schema 渲染器 | 渲染结构化数据 |
181
+
182
+ ### 🔌 插件组件
183
+
184
+ | 插件类型 | 描述 | 支持功能 |
185
+ | ----------- | -------------- | ------------------------------- |
186
+ | `code` | 代码高亮插件 | 支持 100+ 编程语言语法高亮 |
187
+ | `katex` | 数学公式插件 | 支持 LaTeX 数学公式渲染 |
188
+ | `mermaid` | 图表插件 | 支持流程图、时序图、甘特图等 |
189
+ | `chart` | 数据图表插件 | 支持 ECharts 各类数据可视化图表 |
190
+ | `formatter` | 代码格式化插件 | 自动格式化代码 |
191
+
192
+ ### 🛠️ 工具函数与 Hooks
193
+
194
+ | 名称 | 类型 | 描述 |
195
+ | -------------------- | ---- | ---------------------- |
196
+ | `useAutoScroll` | Hook | 自动滚动到底部 |
197
+ | `useCopied` | Hook | 复制到剪贴板 |
198
+ | `useLanguage` | Hook | 国际化语言切换 |
199
+ | `useSpeechSynthesis` | Hook | 语音合成(文字转语音) |
200
+ | `useClickAway` | Hook | 点击外部区域 |
201
+ | `useDebounceFn` | Hook | 防抖函数 |
202
+ | `useThrottleFn` | Hook | 节流函数 |
108
203
 
109
204
  ---
110
205
 
@@ -123,7 +218,7 @@ import { MarkdownEditor } from '@ant-design/agentic-ui';
123
218
 
124
219
  ## 📖 文档与示例
125
220
 
126
- - [在线演示](https://ant-design.github.io/md-editor/)
221
+ - [在线演示](https://ant-design.github.io/agentic-ui/)
127
222
  - [完整文档](./docs/)
128
223
  - [组件 API](./docs/components/)
129
224
  - [设计规范](./docs/design-system/)
@@ -132,10 +227,10 @@ import { MarkdownEditor } from '@ant-design/agentic-ui';
132
227
 
133
228
  ## 🌟 推荐使用场景
134
229
 
135
- - 🤖 企业 Copilot(智能办公助手)
136
- - 💬 智能客服与知识检索
137
- - 📊 数据分析与 BI 助手
138
- - 🔄 流程自动化(RPA)协同智能体
230
+ - 🤖 **企业 Copilot** - 智能办公助手
231
+ - 💬 **智能客服** - 知识检索与自动问答
232
+ - 📊 **数据分析与 BI** - 智能分析助理
233
+ - 🔄 **流程自动化(RPA)** - 协同智能体
139
234
 
140
235
  ---
141
236
 
@@ -1264,9 +1264,9 @@ function isStandardHtmlElement(htmlString) {
1264
1264
  }
1265
1265
  function preprocessSpecialTags(markdown, tagName) {
1266
1266
  const tagRegex = new RegExp(`<${tagName}>([\\s\\S]*?)<\\/${tagName}>`, "g");
1267
- return markdown.replace(tagRegex, (match, content) => {
1267
+ return markdown == null ? void 0 : markdown.replace(tagRegex, (match, content) => {
1268
1268
  const trimmedContent = content.trim();
1269
- const processedContent = trimmedContent.replace(
1269
+ const processedContent = trimmedContent == null ? void 0 : trimmedContent.replace(
1270
1270
  /```(\w*)\n?([\s\S]*?)```/g,
1271
1271
  (_, lang, code) => {
1272
1272
  const marker = "​";
@@ -105,7 +105,8 @@ var AttachmentFileListItem = (props) => {
105
105
  )
106
106
  },
107
107
  "上传中..."
108
- ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
108
+ ) : null,
109
+ file.status === "done" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
109
110
  "div",
110
111
  {
111
112
  className: classNames(
@@ -126,7 +127,18 @@ var AttachmentFileListItem = (props) => {
126
127
  item
127
128
  );
128
129
  })
129
- ))
130
+ )) : null,
131
+ file.status === "error" ? /* @__PURE__ */ React.createElement(
132
+ "div",
133
+ {
134
+ className: classNames(
135
+ `${props.prefixCls}-file-size`,
136
+ `${props.prefixCls}-file-size-error`,
137
+ props.hashId
138
+ )
139
+ },
140
+ "上传失败"
141
+ ) : null
130
142
  ),
131
143
  file.status !== "uploading" ? /* @__PURE__ */ React.createElement(
132
144
  "div",
@@ -31,7 +31,7 @@ var genStyle = (token) => {
31
31
  flexDirection: "row",
32
32
  overflow: "auto",
33
33
  gap: "var(--margin-2x)",
34
- maxHeight: "127px",
34
+ maxHeight: "128px",
35
35
  height: "max-content",
36
36
  marginRight: "40px",
37
37
  borderRadius: "inherit",
@@ -147,6 +147,9 @@ var genStyle = (token) => {
147
147
  display: "flex",
148
148
  alignItems: "center",
149
149
  gap: 4,
150
+ "&-error": {
151
+ color: "var(--color-red-a10)"
152
+ },
150
153
  "&-item:not(:last-child)": {
151
154
  lineHeight: "9px",
152
155
  display: "flex",
@@ -62,6 +62,16 @@ var useFileUploadManager = ({
62
62
  );
63
63
  const uploadImage = useRefFunction(() => __async(void 0, null, function* () {
64
64
  var _a;
65
+ let isUploading = false;
66
+ for (const file of (fileMap == null ? void 0 : fileMap.values()) || []) {
67
+ if (file.status === "uploading") {
68
+ isUploading = true;
69
+ break;
70
+ }
71
+ }
72
+ if (isUploading) {
73
+ return;
74
+ }
65
75
  const input = document.createElement("input");
66
76
  input.id = "uploadImage_" + Math.random();
67
77
  input.type = "file";
@@ -51,6 +51,10 @@ export interface AreaChartProps extends ChartContainerProps {
51
51
  xPosition?: 'top' | 'bottom';
52
52
  /** Y轴位置 */
53
53
  yPosition?: 'left' | 'right';
54
+ /** 是否隐藏X轴,默认false */
55
+ hiddenX?: boolean;
56
+ /** 是否隐藏Y轴,默认false */
57
+ hiddenY?: boolean;
54
58
  /** 头部工具条额外按钮 */
55
59
  toolbarExtra?: React.ReactNode;
56
60
  /** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
@@ -100,6 +100,8 @@ var AreaChart = ({
100
100
  showGrid = true,
101
101
  xPosition = "bottom",
102
102
  yPosition = "left",
103
+ hiddenX = false,
104
+ hiddenY = false,
103
105
  toolbarExtra,
104
106
  statistic: statisticConfig,
105
107
  variant
@@ -260,6 +262,7 @@ var AreaChart = ({
260
262
  },
261
263
  scales: {
262
264
  x: {
265
+ display: !hiddenX,
263
266
  position: xPosition,
264
267
  title: {
265
268
  display: !!xTitle,
@@ -285,6 +288,7 @@ var AreaChart = ({
285
288
  }
286
289
  },
287
290
  y: {
291
+ display: !hiddenY,
288
292
  position: yPosition,
289
293
  beginAtZero: true,
290
294
  title: {
@@ -56,6 +56,10 @@ export interface BarChartProps extends ChartContainerProps {
56
56
  xPosition?: 'top' | 'bottom';
57
57
  /** Y轴位置 */
58
58
  yPosition?: 'left' | 'right';
59
+ /** 是否隐藏X轴,默认false */
60
+ hiddenX?: boolean;
61
+ /** 是否隐藏Y轴,默认false */
62
+ hiddenY?: boolean;
59
63
  /** 是否启用堆叠显示,将多个数据集叠加显示 */
60
64
  stacked?: boolean;
61
65
  /** 图表轴向,'x'为垂直柱状图,'y'为水平柱状图 */
@@ -67,7 +71,13 @@ export interface BarChartProps extends ChartContainerProps {
67
71
  /** 是否显示数据标签,默认false */
68
72
  showDataLabels?: boolean;
69
73
  /** 数据标签格式化函数 */
70
- dataLabelFormatter?: (value: number) => string;
74
+ dataLabelFormatter?: (params: {
75
+ value: number;
76
+ label: string | number;
77
+ datasetLabel: string;
78
+ dataIndex: number;
79
+ datasetIndex: number;
80
+ }) => string;
71
81
  }
72
82
  declare const BarChart: React.FC<BarChartProps>;
73
83
  export default BarChart;
@@ -82,6 +82,8 @@ var BarChart = ({
82
82
  showGrid = true,
83
83
  xPosition = "bottom",
84
84
  yPosition = "left",
85
+ hiddenX = false,
86
+ hiddenY = false,
85
87
  stacked = false,
86
88
  indexAxis = "x",
87
89
  toolbarExtra,
@@ -376,7 +378,31 @@ var BarChart = ({
376
378
  }
377
379
  }, ChartDataLabels && {
378
380
  datalabels: {
379
- display: showDataLabels,
381
+ display: (context2) => {
382
+ var _a, _b, _c, _d, _e, _f;
383
+ if (!showDataLabels)
384
+ return false;
385
+ if (stacked) {
386
+ const chart = context2.chart;
387
+ const dsIndex = context2.datasetIndex;
388
+ const dIndex = context2.dataIndex;
389
+ const currentStack = (_b = (_a = chart.data.datasets) == null ? void 0 : _a[dsIndex]) == null ? void 0 : _b.stack;
390
+ const currentValue = Number((_f = (_e = (_d = (_c = chart.data.datasets) == null ? void 0 : _c[dsIndex]) == null ? void 0 : _d.data) == null ? void 0 : _e[dIndex]) != null ? _f : 0);
391
+ const sameStackIndexes = chart.data.datasets.map((_, i) => i).filter((i) => {
392
+ var _a2, _b2, _c2;
393
+ const ds = (_a2 = chart.data.datasets) == null ? void 0 : _a2[i];
394
+ if (!chart.isDatasetVisible(i))
395
+ return false;
396
+ if (currentStack && (ds == null ? void 0 : ds.stack) !== currentStack)
397
+ return false;
398
+ const v = Number((_c2 = (_b2 = ds == null ? void 0 : ds.data) == null ? void 0 : _b2[dIndex]) != null ? _c2 : 0);
399
+ return v >= 0 && currentValue >= 0 || v < 0 && currentValue < 0;
400
+ });
401
+ const topIndex = sameStackIndexes.length ? Math.max(...sameStackIndexes) : dsIndex;
402
+ return dsIndex === topIndex;
403
+ }
404
+ return true;
405
+ },
380
406
  anchor: indexAxis === "y" ? "end" : "end",
381
407
  align: indexAxis === "y" ? "end" : "top",
382
408
  offset: 4,
@@ -385,11 +411,53 @@ var BarChart = ({
385
411
  size: isMobile ? 10 : 11,
386
412
  weight: "normal"
387
413
  },
388
- formatter: (value) => {
414
+ formatter: (value, context2) => {
415
+ var _a, _b, _c, _d, _e;
389
416
  if (value === null || value === void 0)
390
417
  return "";
418
+ const dataIndex = context2.dataIndex;
419
+ const datasetIndex = context2.datasetIndex;
420
+ const labelValue = (_a = context2.chart.data.labels) == null ? void 0 : _a[dataIndex];
421
+ const label = typeof labelValue === "string" || typeof labelValue === "number" ? labelValue : String(labelValue || "");
422
+ const datasetLabel = String(context2.dataset.label || "");
423
+ if (stacked) {
424
+ const chart = context2.chart;
425
+ const datasets = chart.data.datasets;
426
+ const currentValue = Number((_d = (_c = (_b = datasets == null ? void 0 : datasets[datasetIndex]) == null ? void 0 : _b.data) == null ? void 0 : _c[dataIndex]) != null ? _d : 0);
427
+ const currentStack = (_e = datasets == null ? void 0 : datasets[datasetIndex]) == null ? void 0 : _e.stack;
428
+ let total = 0;
429
+ datasets.forEach((dataset, i) => {
430
+ if (!chart.isDatasetVisible(i))
431
+ return;
432
+ if (currentStack && (dataset == null ? void 0 : dataset.stack) !== currentStack)
433
+ return;
434
+ const val = dataset.data[dataIndex];
435
+ if (val !== null && val !== void 0) {
436
+ const numVal = Number(val);
437
+ if (numVal >= 0 && currentValue >= 0 || numVal < 0 && currentValue < 0) {
438
+ total += numVal;
439
+ }
440
+ }
441
+ });
442
+ if (dataLabelFormatter) {
443
+ return dataLabelFormatter({
444
+ value: total,
445
+ label,
446
+ datasetLabel,
447
+ dataIndex,
448
+ datasetIndex
449
+ });
450
+ }
451
+ return total.toLocaleString();
452
+ }
391
453
  if (dataLabelFormatter) {
392
- return dataLabelFormatter(value);
454
+ return dataLabelFormatter({
455
+ value,
456
+ label,
457
+ datasetLabel,
458
+ dataIndex,
459
+ datasetIndex
460
+ });
393
461
  }
394
462
  return value.toLocaleString();
395
463
  }
@@ -397,6 +465,7 @@ var BarChart = ({
397
465
  }),
398
466
  scales: {
399
467
  x: {
468
+ display: !hiddenX,
400
469
  stacked,
401
470
  position: xPosition,
402
471
  title: {
@@ -423,6 +492,7 @@ var BarChart = ({
423
492
  }
424
493
  },
425
494
  y: {
495
+ display: !hiddenY,
426
496
  stacked,
427
497
  position: yPosition,
428
498
  beginAtZero: true,
@@ -51,6 +51,10 @@ export interface LineChartProps extends ChartContainerProps {
51
51
  xPosition?: 'top' | 'bottom';
52
52
  /** Y轴位置 */
53
53
  yPosition?: 'left' | 'right';
54
+ /** 是否隐藏X轴,默认false */
55
+ hiddenX?: boolean;
56
+ /** 是否隐藏Y轴,默认false */
57
+ hiddenY?: boolean;
54
58
  /** 头部工具条额外按钮 */
55
59
  toolbarExtra?: React.ReactNode;
56
60
  /** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
@@ -95,6 +95,8 @@ var LineChart = (_a) => {
95
95
  showGrid = true,
96
96
  xPosition = "bottom",
97
97
  yPosition = "left",
98
+ hiddenX = false,
99
+ hiddenY = false,
98
100
  toolbarExtra,
99
101
  statistic: statisticConfig
100
102
  } = _b, props = __objRest(_b, [
@@ -112,6 +114,8 @@ var LineChart = (_a) => {
112
114
  "showGrid",
113
115
  "xPosition",
114
116
  "yPosition",
117
+ "hiddenX",
118
+ "hiddenY",
115
119
  "toolbarExtra",
116
120
  "statistic"
117
121
  ]);
@@ -261,6 +265,7 @@ var LineChart = (_a) => {
261
265
  },
262
266
  scales: {
263
267
  x: {
268
+ display: !hiddenX,
264
269
  position: xPosition,
265
270
  title: {
266
271
  display: !!xTitle,
@@ -286,6 +291,7 @@ var LineChart = (_a) => {
286
291
  }
287
292
  },
288
293
  y: {
294
+ display: !hiddenY,
289
295
  position: yPosition,
290
296
  beginAtZero: true,
291
297
  title: {
@@ -20,6 +20,10 @@ export interface ScatterChartProps extends ChartContainerProps {
20
20
  yUnit?: string;
21
21
  xLabel?: string;
22
22
  yLabel?: string;
23
+ /** 是否隐藏X轴,默认false */
24
+ hiddenX?: boolean;
25
+ /** 是否隐藏Y轴,默认false */
26
+ hiddenY?: boolean;
23
27
  borderColor?: string;
24
28
  backgroundColor?: string;
25
29
  /** 统计数据组件配置 */
@@ -80,6 +80,8 @@ var ScatterChart = (_a) => {
80
80
  yUnit,
81
81
  xLabel,
82
82
  yLabel,
83
+ hiddenX = false,
84
+ hiddenY = false,
83
85
  borderColor,
84
86
  backgroundColor,
85
87
  statistic,
@@ -96,6 +98,8 @@ var ScatterChart = (_a) => {
96
98
  "yUnit",
97
99
  "xLabel",
98
100
  "yLabel",
101
+ "hiddenX",
102
+ "hiddenY",
99
103
  "borderColor",
100
104
  "backgroundColor",
101
105
  "statistic",
@@ -455,6 +459,7 @@ var ScatterChart = (_a) => {
455
459
  },
456
460
  scales: {
457
461
  x: {
462
+ display: !hiddenX,
458
463
  type: "linear",
459
464
  position: "bottom",
460
465
  title: {
@@ -488,6 +493,7 @@ var ScatterChart = (_a) => {
488
493
  }
489
494
  },
490
495
  y: {
496
+ display: !hiddenY,
491
497
  type: "linear",
492
498
  position: "right",
493
499
  title: {
@@ -1,5 +1,5 @@
1
1
  // src/plugins/chart/components/ChartFilter/ChartFilter.tsx
2
- import { DownOutlined } from "@ant-design/icons";
2
+ import { ChevronDown } from "@sofa-design/icons";
3
3
  import { Button, ConfigProvider, Dropdown, Segmented } from "antd";
4
4
  import classNames from "classnames";
5
5
  import { default as React, useContext } from "react";
@@ -69,7 +69,7 @@ var ChartFilter = ({
69
69
  },
70
70
  /* @__PURE__ */ React.createElement("span", null, ((_a = customOptions.find((r) => r.key === selectedCustomSelection)) == null ? void 0 : _a.label) || ((_b = i18n == null ? void 0 : i18n.locale) == null ? void 0 : _b.all) || "全部"),
71
71
  /* @__PURE__ */ React.createElement(
72
- DownOutlined,
72
+ ChevronDown,
73
73
  {
74
74
  className: classNames(`${prefixCls}-dropdown-icon`, hashId)
75
75
  }
@@ -6,9 +6,10 @@ var MarkdownFormatter = class {
6
6
  * @returns 格式化后的文本
7
7
  */
8
8
  static normalizeParagraphs(text) {
9
- let normalizedText = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
9
+ var _a, _b;
10
+ let normalizedText = (_a = text == null ? void 0 : text.replace(/\r\n/g, "\n")) == null ? void 0 : _a.replace(/\r/g, "\n");
10
11
  normalizedText = normalizedText.trim();
11
- normalizedText = normalizedText.replace(/\n[\s\n]+/g, "\n");
12
+ normalizedText = normalizedText == null ? void 0 : normalizedText.replace(/\n[\s\n]+/g, "\n");
12
13
  const lines = normalizedText.split("\n");
13
14
  const result = [];
14
15
  for (let i = 0; i < lines.length; i++) {
@@ -24,7 +25,7 @@ var MarkdownFormatter = class {
24
25
  }
25
26
  }
26
27
  }
27
- return result.join("\n").replace(/\n+$/, "");
28
+ return (_b = result.join("\n")) == null ? void 0 : _b.replace(/\n+$/, "");
28
29
  }
29
30
  /**
30
31
  * 在中英文之间添加空格(盘古之白)
@@ -32,42 +33,43 @@ var MarkdownFormatter = class {
32
33
  * @returns 格式化后的文本
33
34
  */
34
35
  static addPanguSpacing(text) {
36
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
35
37
  const placeholders = {};
36
38
  let counter = 0;
37
- const preservedText = text.replace(/```[\s\S]*?```/g, (match) => {
39
+ const preservedText = (_e = (_d = (_c = (_b = (_a = text == null ? void 0 : text.replace(/```[\s\S]*?```/g, (match) => {
38
40
  const placeholder = `__CODEBLOCK_${counter}__`;
39
41
  placeholders[placeholder] = match;
40
42
  counter++;
41
43
  return placeholder;
42
- }).replace(/(<!--[\s\S]*?-->)/g, (match) => {
44
+ })) == null ? void 0 : _a.replace(/(<!--[\s\S]*?-->)/g, (match) => {
43
45
  const placeholder = `__COMMENT_${counter}__`;
44
46
  placeholders[placeholder] = match;
45
47
  counter++;
46
48
  return placeholder;
47
- }).replace(/\[([^\]]*<[^>]+>[^\]]*)\]\([^)]+\)/g, (match) => {
49
+ })) == null ? void 0 : _b.replace(/\[([^\]]*<[^>]+>[^\]]*)\]\([^)]+\)/g, (match) => {
48
50
  const placeholder = `__LINK_HTML_${counter}__`;
49
51
  placeholders[placeholder] = match;
50
52
  counter++;
51
53
  return placeholder;
52
- }).replace(/(<[^>]+>.*?<\/[^>]+>|<[^>]+>)/g, (match) => {
54
+ })) == null ? void 0 : _c.replace(/(<[^>]+>.*?<\/[^>]+>|<[^>]+>)/g, (match) => {
53
55
  const placeholder = `__HTML_${counter}__`;
54
56
  placeholders[placeholder] = match;
55
57
  counter++;
56
58
  return placeholder;
57
- }).replace(/(\[([^\]]+)\]\([^)]+\))/g, (match) => {
59
+ })) == null ? void 0 : _d.replace(/(\[([^\]]+)\]\([^)]+\))/g, (match) => {
58
60
  const placeholder = `__LINK_${counter}__`;
59
61
  placeholders[placeholder] = match;
60
62
  counter++;
61
63
  return placeholder;
62
- }).replace(/(`[^`]+`)/g, (match) => {
64
+ })) == null ? void 0 : _e.replace(/(`[^`]+`)/g, (match) => {
63
65
  const placeholder = `__CODE_${counter}__`;
64
66
  placeholders[placeholder] = match;
65
67
  counter++;
66
68
  return placeholder;
67
69
  });
68
- let spacedText = preservedText.replace(/([\u4e00-\u9fa5])([A-Za-z])/g, "$1 $2").replace(/([A-Za-z])([\u4e00-\u9fa5])/g, "$1 $2").replace(/([\u4e00-\u9fa5])(\d+)/g, "$1 $2").replace(/(\d+)([\u4e00-\u9fa5])/g, "$1 $2").replace(/([\u4e00-\u9fa5])([\(\)])/g, "$1 $2").replace(/([\(\)])([\u4e00-\u9fa5])/g, "$1 $2").replace(/([^\s\n])\s+([^\s\n])/g, "$1 $2");
70
+ let spacedText = (_k = (_j = (_i = (_h = (_g = (_f = preservedText == null ? void 0 : preservedText.replace(/([\u4e00-\u9fa5])([A-Za-z])/g, "$1 $2")) == null ? void 0 : _f.replace(/([A-Za-z])([\u4e00-\u9fa5])/g, "$1 $2")) == null ? void 0 : _g.replace(/([\u4e00-\u9fa5])(\d+)/g, "$1 $2")) == null ? void 0 : _h.replace(/(\d+)([\u4e00-\u9fa5])/g, "$1 $2")) == null ? void 0 : _i.replace(/([\u4e00-\u9fa5])([\(\)])/g, "$1 $2")) == null ? void 0 : _j.replace(/([\(\)])([\u4e00-\u9fa5])/g, "$1 $2")) == null ? void 0 : _k.replace(/([^\s\n])\s+([^\s\n])/g, "$1 $2");
69
71
  Object.entries(placeholders).forEach(([placeholder, original]) => {
70
- spacedText = spacedText.replace(
72
+ spacedText = spacedText == null ? void 0 : spacedText.replace(
71
73
  new RegExp(`(\\s*)${placeholder}(\\s*)`),
72
74
  (_, before, after) => {
73
75
  const needSpaceBefore = before === "" && /[\u4e00-\u9fa5]$/.test(spacedText.split(placeholder)[0]);
@@ -86,7 +88,10 @@ var MarkdownFormatter = class {
86
88
  static format(text) {
87
89
  const codeBlocks = {};
88
90
  let counter = 0;
89
- const textWithoutCodeBlocks = text.replace(/```[\s\S]*?```/g, (match) => {
91
+ if (!text) {
92
+ return "";
93
+ }
94
+ const textWithoutCodeBlocks = text == null ? void 0 : text.replace(/```[\s\S]*?```/g, (match) => {
90
95
  const placeholder = `__CODEBLOCK_${counter}__`;
91
96
  codeBlocks[placeholder] = match;
92
97
  counter++;
@@ -97,9 +102,9 @@ var MarkdownFormatter = class {
97
102
  const formattedLines = lines.map((line) => this.addPanguSpacing(line));
98
103
  let result = formattedLines.join("\n");
99
104
  Object.entries(codeBlocks).forEach(([placeholder, original]) => {
100
- result = result.replace(placeholder, original);
105
+ result = result == null ? void 0 : result.replace(placeholder, original);
101
106
  });
102
- return result;
107
+ return result || "";
103
108
  }
104
109
  };
105
110
  var formatter_default = MarkdownFormatter;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@ant-design/agentic-ui",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
5
- "repository": "git@github.com:ant-design/md-editor.git",
5
+ "repository": "git@github.com:ant-design/agentic-ui.git",
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",