@ant-design/agentic-ui 2.0.24 → 2.0.25

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.
Files changed (36) hide show
  1. package/dist/AgenticLayout/index.d.ts +2 -0
  2. package/dist/Bubble/List/index.d.ts +6 -1
  3. package/dist/Bubble/List/index.js +3 -1
  4. package/dist/Bubble/type.d.ts +66 -244
  5. package/dist/Bubble/types/BubbleExtra.d.ts +1 -20
  6. package/dist/ChatLayout/types.d.ts +3 -6
  7. package/dist/Components/ActionIconBox/index.d.ts +6 -0
  8. package/dist/Components/ActionIconBox/index.js +8 -7
  9. package/dist/Components/Button/IconButton/index.d.ts +6 -0
  10. package/dist/Components/Button/IconButton/index.js +3 -1
  11. package/dist/Components/LayoutHeader/types.d.ts +1 -4
  12. package/dist/Components/VisualList/index.d.ts +6 -1
  13. package/dist/Components/VisualList/index.js +3 -1
  14. package/dist/History/components/HistoryList.js +10 -1
  15. package/dist/History/index.d.ts +2 -1
  16. package/dist/History/types/index.d.ts +6 -1
  17. package/dist/MarkdownEditor/editor/components/LazyElement/index.d.ts +3 -3
  18. package/dist/MarkdownEditor/types.d.ts +2 -2
  19. package/dist/MarkdownInputField/AttachmentButton/AttachmentButtonPopover.js +1 -1
  20. package/dist/MarkdownInputField/AttachmentButton/index.js +4 -4
  21. package/dist/MarkdownInputField/VoiceInput/index.js +1 -1
  22. package/dist/Plugins/chart/AreaChart/style.js +8 -0
  23. package/dist/Plugins/chart/BarChart/style.js +8 -0
  24. package/dist/Plugins/chart/RadarChart/index.d.ts +11 -2
  25. package/dist/ThoughtChainList/types.d.ts +8 -3
  26. package/dist/Types/common.d.ts +68 -0
  27. package/dist/Types/common.js +0 -0
  28. package/dist/Types/index.d.ts +6 -0
  29. package/dist/Types/index.js +3 -0
  30. package/dist/Types/message.d.ts +190 -0
  31. package/dist/Types/message.js +0 -0
  32. package/dist/WelcomeMessage/index.d.ts +1 -1
  33. package/dist/Workspace/types.d.ts +7 -2
  34. package/dist/index.d.ts +2 -1
  35. package/dist/index.js +1 -0
  36. package/package.json +1 -1
@@ -19,6 +19,8 @@ export interface AgenticLayoutProps {
19
19
  rightWidth?: number;
20
20
  /** 最小高度 */
21
21
  minHeight?: string | number;
22
+ /** 子元素(用于兼容性,实际内容应使用 center 属性) */
23
+ children?: ReactNode;
22
24
  }
23
25
  /**
24
26
  * AgenticLayout 组件 - 智能体布局组件
@@ -13,9 +13,14 @@ export type BubbleListProps = {
13
13
  bubbleListRef?: MutableRefObject<HTMLDivElement | null>;
14
14
  bubbleRef?: MutableRefObject<any | undefined>;
15
15
  /**
16
- * 是否正在加载
16
+ * @deprecated 请使用 isLoading 代替
17
+ * @description 已废弃,将在未来版本移除
17
18
  */
18
19
  loading?: boolean;
20
+ /**
21
+ * 加载状态
22
+ */
23
+ isLoading?: boolean;
19
24
  pure?: boolean;
20
25
  /**
21
26
  * 组件的类名
@@ -32,7 +32,8 @@ var BubbleList = (props) => {
32
32
  bubbleListRef,
33
33
  bubbleRenderConfig,
34
34
  className,
35
- loading,
35
+ loading: legacyLoading,
36
+ isLoading,
36
37
  styles,
37
38
  classNames,
38
39
  markdownRenderConfig,
@@ -44,6 +45,7 @@ var BubbleList = (props) => {
44
45
  onWheel,
45
46
  onTouchMove
46
47
  } = props;
48
+ const loading = isLoading != null ? isLoading : legacyLoading;
47
49
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
48
50
  const { compact } = useContext(BubbleConfigContext) || {};
49
51
  const prefixClass = getPrefixCls("agentic-bubble-list");
@@ -2,302 +2,124 @@ import { TooltipProps } from 'antd';
2
2
  import { ReactNode } from 'react';
3
3
  import { MarkdownEditorProps } from '../MarkdownEditor/types';
4
4
  import { AttachmentFile } from '../MarkdownInputField/AttachmentButton/types';
5
- import { WhiteBoxProcessInterface } from '../ThoughtChainList/types';
6
5
  import type { UseSpeechAdapter } from './MessagesContent/VoiceButton';
7
6
  import { BubbleExtraProps } from './types/BubbleExtra';
8
7
  import { DocInfoListProps } from './types/DocInfo';
8
+ import { BaseStyleProps, WithFalse, MessageBubbleData, BubbleMetaData, MultiStyleProps, MultiClassNameProps } from '../Types';
9
9
  /**
10
10
  * 基础样式属性
11
+ * @deprecated 请使用 BaseStyleProps from '../Types'
11
12
  */
12
- export interface BubbleStyleProps {
13
- /**
14
- * 自定义 CSS 类名
15
- */
16
- className?: string;
17
- /**
18
- * 自定义 CSS 样式
19
- */
20
- style?: React.CSSProperties;
21
- }
13
+ export type BubbleStyleProps = BaseStyleProps;
22
14
  /**
23
- * 气泡项样式属性
15
+ * 气泡样式配置
16
+ * @description 气泡组件各部分的样式配置
24
17
  */
25
- export interface BubbleItemStyleProps extends BubbleStyleProps {
26
- styles?: {
27
- /**
28
- * 气泡根容器的自定义样式
29
- */
30
- bubbleStyle?: React.CSSProperties;
31
- /**
32
- * 头像标题区域的自定义样式
33
- */
34
- bubbleAvatarTitleStyle?: React.CSSProperties;
35
- /**
36
- * 主容器的自定义样式
37
- */
38
- bubbleContainerStyle?: React.CSSProperties;
39
- /**
40
- * 加载图标的自定义样式
41
- */
42
- bubbleLoadingIconStyle?: React.CSSProperties;
43
- /**
44
- * 名称区域的自定义样式
45
- */
46
- bubbleNameStyle?: React.CSSProperties;
47
- /**
48
- * 内容的自定义样式
49
- */
50
- bubbleListItemContentStyle?: React.CSSProperties;
51
- /**
52
- * 内容前置区域的自定义样式
53
- */
54
- bubbleListItemBeforeStyle?: React.CSSProperties;
55
- /**
56
- * 内容后置区域的自定义样式
57
- */
58
- bubbleListItemAfterStyle?: React.CSSProperties;
59
- /**
60
- * 标题的自定义样式
61
- */
62
- bubbleListItemTitleStyle?: React.CSSProperties;
63
- /**
64
- * 头像的自定义样式
65
- */
66
- bubbleListItemAvatarStyle?: React.CSSProperties;
67
- /**
68
- * 额外内容的自定义样式
69
- */
70
- bubbleListItemExtraStyle?: React.CSSProperties;
71
- };
72
- classNames?: {
73
- /**
74
- * 气泡根容器的自定义类名
75
- */
76
- bubbleClassName?: string;
77
- /**
78
- * 头像标题区域的自定义类名
79
- */
80
- bubbleAvatarTitleClassName?: string;
81
- /**
82
- * 主容器的自定义类名
83
- */
84
- bubbleContainerClassName?: string;
85
- /**
86
- * 加载图标的自定义类名
87
- */
88
- bubbleLoadingIconClassName?: string;
89
- /**
90
- * 名称区域的自定义类名
91
- */
92
- bubbleNameClassName?: string;
93
- /**
94
- * 内容的自定义类名
95
- */
96
- bubbleListItemContentClassName?: string;
97
- /**
98
- * 内容前置区域的自定义类名
99
- */
100
- bubbleListItemBeforeClassName?: string;
101
- /**
102
- * 内容后置区域的自定义类名
103
- */
104
- bubbleListItemAfterClassName?: string;
105
- /**
106
- * 标题的自定义类名
107
- */
108
- bubbleListItemTitleClassName?: string;
109
- /**
110
- * 头像的自定义类名
111
- */
112
- bubbleListItemAvatarClassName?: string;
113
- bubbleListItemExtraClassName?: string;
114
- };
115
- }
116
- /**
117
- * 气泡元数据
118
- */
119
- export interface BubbleMetaData {
120
- /**
121
- * 角色头像
122
- */
123
- avatar?: string;
124
- /**
125
- * 背景色
126
- */
127
- backgroundColor?: string;
18
+ export interface BubbleStyles {
19
+ [key: string]: React.CSSProperties | undefined;
128
20
  /**
129
- * 名称
21
+ * 气泡根容器的自定义样式
130
22
  */
131
- title?: string;
23
+ bubbleStyle?: React.CSSProperties;
132
24
  /**
133
- * 其他元数据
25
+ * 头像标题区域的自定义样式
134
26
  */
135
- [key: string]: any;
136
- }
137
- /**
138
- * 消息数据
139
- */
140
- export interface MessageBubbleData<T extends Record<string, any> = Record<string, any>> {
27
+ bubbleAvatarTitleStyle?: React.CSSProperties;
141
28
  /**
142
- * @title 内容
143
- * @description 消息的显示内容,可以是React元素
144
- * @example <div>Hello, world!</div>
29
+ * 主容器的自定义样式
145
30
  */
146
- content?: React.ReactNode;
31
+ bubbleContainerStyle?: React.CSSProperties;
147
32
  /**
148
- * @title 原始内容
149
- * @description 消息的原始文本内容,通常用于存储未经处理的文本
150
- * @example "Hello, world!"
33
+ * 加载图标的自定义样式
151
34
  */
152
- originContent?: string;
35
+ bubbleLoadingIconStyle?: React.CSSProperties;
153
36
  /**
154
- * @title 错误信息
155
- * @description 消息处理过程中可能出现的错误
156
- * @example { code: "ERROR_CODE", message: "发生了错误" }
37
+ * 名称区域的自定义样式
157
38
  */
158
- error?: any;
39
+ bubbleNameStyle?: React.CSSProperties;
159
40
  /**
160
- * @title 模型标识
161
- * @description 生成此消息的AI模型标识符
162
- * @example "gpt-4"
41
+ * 内容的自定义样式
163
42
  */
164
- model?: string;
43
+ bubbleListItemContentStyle?: React.CSSProperties;
165
44
  /**
166
- * @title 名称
167
- * @description 消息发送者的名称
168
- * @example "用户小明"
45
+ * 内容前置区域的自定义样式
169
46
  */
170
- name?: string;
47
+ bubbleListItemBeforeStyle?: React.CSSProperties;
171
48
  /**
172
- * @title 父消息ID
173
- * @description 当前消息回复的消息ID,用于构建消息树结构
174
- * @example "msg_123456"
49
+ * 内容后置区域的自定义样式
175
50
  */
176
- parentId?: string;
51
+ bubbleListItemAfterStyle?: React.CSSProperties;
177
52
  /**
178
- * @title 角色
179
- * @description 消息发送者的角色,如用户、助手等
180
- * @example "user" 或 "assistant"
53
+ * 标题的自定义样式
181
54
  */
182
- role: 'user' | 'system' | 'assistant' | 'agent' | 'bot';
55
+ bubbleListItemTitleStyle?: React.CSSProperties;
183
56
  /**
184
- * @title 创建时间
185
- * @description 消息创建的时间戳(毫秒)
186
- * @example 1625097600000
57
+ * 头像的自定义样式
187
58
  */
188
- createAt: number;
59
+ bubbleListItemAvatarStyle?: React.CSSProperties;
189
60
  /**
190
- * @title 消息结束时间
191
- * @description 消息生成或接收完成的时间戳(毫秒)
192
- * @example 1625097605000
61
+ * 额外内容的自定义样式
193
62
  */
194
- endTime?: number;
63
+ bubbleListItemExtraStyle?: React.CSSProperties;
64
+ }
65
+ /**
66
+ * 气泡类名配置
67
+ * @description 气泡组件各部分的类名配置
68
+ */
69
+ export interface BubbleClassNames {
70
+ [key: string]: string | undefined;
195
71
  /**
196
- * @title 唯一标识
197
- * @description 消息的唯一标识符
198
- * @example "msg_abcdef123456"
72
+ * 气泡根容器的自定义类名
199
73
  */
200
- id: string;
74
+ bubbleClassName?: string;
201
75
  /**
202
- * @title 修改时间
203
- * @description 消息最后修改的时间戳(毫秒)
204
- * @example 1625097610000
76
+ * 头像标题区域的自定义类名
205
77
  */
206
- updateAt: number;
78
+ bubbleAvatarTitleClassName?: string;
207
79
  /**
208
- * @title 附加数据
209
- * @description 消息的额外信息,可以包含多种自定义数据
80
+ * 主容器的自定义类名
210
81
  */
211
- extra?: T & {
212
- /**
213
- * @title 白盒处理过程
214
- * @description 模型处理过程的可解释性数据
215
- */
216
- white_box_process?: WhiteBoxProcessInterface[] | WhiteBoxProcessInterface;
217
- /**
218
- * @title 聊天跟踪ID
219
- * @description 用于追踪整个对话流程的ID
220
- * @example "trace_xyz789"
221
- */
222
- chat_trace_id?: string;
223
- /**
224
- * @title 会话ID
225
- * @description 当前会话的唯一标识符
226
- * @example "session_123abc"
227
- */
228
- sessionId?: string;
229
- /**
230
- * @title 消息UUID
231
- * @description 消息的全局唯一标识符
232
- * @example "uuid_456def"
233
- */
234
- uuid?: string;
235
- /**
236
- * @title 客户端ID
237
- * @description 问答对的客户端标识符
238
- * @example "client_789ghi"
239
- */
240
- clientId?: string;
241
- /**
242
- * @title 标签列表
243
- * @description 消息的分类标签
244
- * @example ["NORMAL", "ABOUT_YOU"]
245
- */
246
- tags?: ('REJECT_TO_ANSWER' | 'ABOUT_YOU' | 'NORMAL')[];
247
- };
82
+ bubbleContainerClassName?: string;
248
83
  /**
249
- * @title 模型元数据
250
- * @description 有关生成此消息的模型的额外信息
251
- * @example { model: "gpt-4", temperature: 0.7, tokens: { total: 150, prompt: 50, completion: 100 } }
84
+ * 加载图标的自定义类名
252
85
  */
253
- meta?: BubbleMetaData;
86
+ bubbleLoadingIconClassName?: string;
254
87
  /**
255
- * @title 是否完成
256
- * @description 标识消息是否已完全生成或接收完成
257
- * @example true
88
+ * 名称区域的自定义类名
258
89
  */
259
- isFinished?: boolean;
90
+ bubbleNameClassName?: string;
260
91
  /**
261
- * @title 是否被终止
262
- * @description 标识消息生成是否被中途终止
263
- * @example false
92
+ * 内容的自定义类名
264
93
  */
265
- isAborted?: boolean;
94
+ bubbleListItemContentClassName?: string;
266
95
  /**
267
- * @title 用户反馈
268
- * @description 用户对消息的评价反馈
269
- * - thumbsUp: 点赞,表示满意
270
- * - thumbsDown: 点踩,表示不满意
271
- * - none: 无反馈
272
- * @example "thumbsUp"
96
+ * 内容前置区域的自定义类名
273
97
  */
274
- feedback?: 'thumbsUp' | 'thumbsDown' | 'none';
98
+ bubbleListItemBeforeClassName?: string;
275
99
  /**
276
- * @title 是否重试
277
- * @description 标识当前消息是否是之前消息的重试
278
- * @example false
100
+ * 内容后置区域的自定义类名
279
101
  */
280
- isRetry?: boolean;
102
+ bubbleListItemAfterClassName?: string;
281
103
  /**
282
- * @title 文件映射
283
- * @description 消息相关的附件文件映射
284
- * @example new Map([["file1", { name: "示例.pdf", size: 1024, type: "application/pdf" }]])
104
+ * 标题的自定义类名
285
105
  */
286
- fileMap?: Map<string, AttachmentFile>;
106
+ bubbleListItemTitleClassName?: string;
287
107
  /**
288
- * @deprecated 已废弃,请使用 isLast 代替
289
- * @description 已废弃,请使用 isLast 代替
290
- * @example true
108
+ * 头像的自定义类名
291
109
  */
292
- isLatest?: boolean;
110
+ bubbleListItemAvatarClassName?: string;
293
111
  /**
294
- * @title 是否为最后一个节点
295
- * @description 用于标识当前消息是否为对话中的最新消息
296
- * @default false
297
- * @optional
112
+ * 额外内容的自定义类名
298
113
  */
299
- isLast?: boolean;
114
+ bubbleListItemExtraClassName?: string;
115
+ }
116
+ /**
117
+ * 气泡项样式属性
118
+ * @description 包含单一根样式和多个子元素样式的完整配置
119
+ */
120
+ export interface BubbleItemStyleProps extends BubbleStyleProps, MultiStyleProps<BubbleStyles>, MultiClassNameProps<BubbleClassNames> {
300
121
  }
122
+ export type { BubbleMetaData, MessageBubbleData } from '../Types';
301
123
  /**
302
124
  * 自定义配置
303
125
  */
@@ -314,7 +136,7 @@ export interface CustomConfig {
314
136
  contentStyle?: React.CSSProperties;
315
137
  };
316
138
  }
317
- export type WithFalse<T> = T | false;
139
+ export type { WithFalse } from '../Types';
318
140
  /**
319
141
  * 气泡渲染配置
320
142
  */
@@ -1,24 +1,5 @@
1
1
  import React from 'react';
2
- export type WithFalse<T> = T | false;
3
- export interface MessageBubbleData<T = Record<string, any>> {
4
- content?: React.ReactNode;
5
- originContent?: string;
6
- error?: any;
7
- model?: string;
8
- name?: string;
9
- parentId?: string;
10
- role: 'user' | 'system' | 'assistant' | 'agent' | 'bot';
11
- createAt: number;
12
- endTime?: number;
13
- id: string;
14
- updateAt: number;
15
- extra?: T;
16
- isFinished?: boolean;
17
- isAborted?: boolean;
18
- feedback?: 'thumbsUp' | 'thumbsDown' | 'none';
19
- isRetry?: boolean;
20
- isLatest?: boolean;
21
- }
2
+ import { WithFalse, MessageBubbleData } from '../../Types';
22
3
  export interface SimpleBubbleProps<T = Record<string, any>> {
23
4
  originData?: T & MessageBubbleData;
24
5
  [key: string]: any;
@@ -1,19 +1,16 @@
1
- import type { CSSProperties, ReactNode } from 'react';
1
+ import type { ReactNode } from 'react';
2
2
  import type { LayoutHeaderConfig } from '../Components/LayoutHeader';
3
+ import type { BaseStyleProps } from '../Types';
3
4
  /**
4
5
  * ChatLayout 组件的属性接口
5
6
  */
6
- export interface ChatLayoutProps {
7
+ export interface ChatLayoutProps extends BaseStyleProps {
7
8
  /** 头部配置 */
8
9
  header?: LayoutHeaderConfig;
9
10
  /** 内容区域的自定义内容 */
10
11
  children?: ReactNode;
11
12
  /** 底部区域的自定义内容 */
12
13
  footer?: ReactNode;
13
- /** 自定义类名 */
14
- className?: string;
15
- /** 自定义样式 */
16
- style?: CSSProperties;
17
14
  }
18
15
  export interface ChatLayoutRef {
19
16
  scrollContainer: HTMLDivElement | null;
@@ -10,7 +10,13 @@ export type ActionIconBoxProps = {
10
10
  transform?: boolean;
11
11
  className?: string;
12
12
  borderLess?: boolean;
13
+ /**
14
+ * @deprecated 请使用 isLoading 代替
15
+ * @description 已废弃,将在未来版本移除
16
+ */
13
17
  loading?: boolean;
18
+ /** 加载状态 */
19
+ isLoading?: boolean;
14
20
  style?: React.CSSProperties;
15
21
  active?: boolean;
16
22
  onInit?: () => void;
@@ -46,9 +46,10 @@ import { useMergedState } from "rc-util";
46
46
  import React, { useContext, useEffect, useMemo } from "react";
47
47
  import { useStyle } from "./style";
48
48
  var ActionIconBox = (props) => {
49
- var _a, _b, _c, _d;
49
+ var _a, _b, _c, _d, _e;
50
+ const propLoading = (_a = props.isLoading) != null ? _a : props.loading;
50
51
  const [loading, setLoading] = useMergedState(false, {
51
- value: props.loading,
52
+ value: propLoading,
52
53
  onChange: props.onLoadingChange
53
54
  });
54
55
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
@@ -94,16 +95,16 @@ var ActionIconBox = (props) => {
94
95
  __spreadValues({
95
96
  title: props.title,
96
97
  arrow: false,
97
- mouseEnterDelay: 2
98
+ mouseEnterDelay: 1
98
99
  }, props.tooltipProps),
99
100
  /* @__PURE__ */ React.createElement(
100
101
  "span",
101
102
  {
102
- "data-title": (_a = props.title) == null ? void 0 : _a.toString(),
103
+ "data-title": (_b = props.title) == null ? void 0 : _b.toString(),
103
104
  "data-testid": props["data-testid"] || "action-icon-box",
104
105
  role: "button",
105
106
  tabIndex: 0,
106
- "aria-label": (_b = props.title) == null ? void 0 : _b.toString(),
107
+ "aria-label": (_c = props.title) == null ? void 0 : _c.toString(),
107
108
  className: cx(prefixCls, hashId, props.className, {
108
109
  [`${prefixCls}-danger`]: props.type === "danger",
109
110
  [`${prefixCls}-primary`]: props.type === "primary",
@@ -157,8 +158,8 @@ var ActionIconBox = (props) => {
157
158
  "data-testid": props["data-testid"] || "action-icon-box",
158
159
  role: "button",
159
160
  tabIndex: 0,
160
- "aria-label": (_c = props.title) == null ? void 0 : _c.toString(),
161
- title: (_d = props.title) == null ? void 0 : _d.toString(),
161
+ "aria-label": (_d = props.title) == null ? void 0 : _d.toString(),
162
+ title: (_e = props.title) == null ? void 0 : _e.toString(),
162
163
  className: cx(prefixCls, hashId, props.className, {
163
164
  [`${prefixCls}-danger`]: props.type === "danger",
164
165
  [`${prefixCls}-primary`]: props.type === "primary",
@@ -7,7 +7,13 @@ export interface IconButtonProps {
7
7
  active?: boolean;
8
8
  elevated?: boolean;
9
9
  size?: 'base' | 'sm' | 'xs';
10
+ /**
11
+ * @deprecated 请使用 isLoading 代替
12
+ * @description 已废弃,将在未来版本移除
13
+ */
10
14
  loading?: boolean;
15
+ /** 加载状态 */
16
+ isLoading?: boolean;
11
17
  onClick?: () => void | Promise<void>;
12
18
  className?: string;
13
19
  style?: React.CSSProperties;
@@ -12,9 +12,11 @@ var IconButton = ({
12
12
  active,
13
13
  elevated,
14
14
  size = "base",
15
- loading,
15
+ loading: legacyLoading,
16
+ isLoading,
16
17
  onClick
17
18
  }) => {
19
+ const loading = isLoading != null ? isLoading : legacyLoading;
18
20
  const context = useContext(ConfigProvider.ConfigContext);
19
21
  const prefixCls = context == null ? void 0 : context.getPrefixCls("icon-button");
20
22
  const { wrapSSR, hashId } = useStyle(prefixCls);
@@ -35,7 +35,4 @@ export interface LayoutHeaderConfig {
35
35
  /**
36
36
  * 布局头部组件属性接口
37
37
  */
38
- export interface LayoutHeaderProps extends LayoutHeaderConfig {
39
- /** 自定义类名 */
40
- className?: string;
41
- }
38
+ export type LayoutHeaderProps = LayoutHeaderConfig;
@@ -30,8 +30,13 @@ export interface VisualListProps {
30
30
  emptyRender?: () => React.ReactNode;
31
31
  /** 自定义列表项渲染函数 */
32
32
  renderItem?: (item: VisualListItem, index: number) => React.ReactNode;
33
- /** 是否显示加载状态 */
33
+ /**
34
+ * @deprecated 请使用 isLoading 代替
35
+ * @description 已废弃,将在未来版本移除
36
+ */
34
37
  loading?: boolean;
38
+ /** 加载状态 */
39
+ isLoading?: boolean;
35
40
  /** 加载状态自定义渲染函数 */
36
41
  loadingRender?: () => React.ReactNode;
37
42
  /** 列表项自定义样式 */
@@ -31,7 +31,8 @@ var VisualListComponent = ({
31
31
  filter,
32
32
  emptyRender,
33
33
  renderItem,
34
- loading = false,
34
+ loading: legacyLoading = false,
35
+ isLoading,
35
36
  loadingRender,
36
37
  itemStyle,
37
38
  imageStyle,
@@ -41,6 +42,7 @@ var VisualListComponent = ({
41
42
  variant = "default",
42
43
  description
43
44
  }) => {
45
+ const loading = isLoading != null ? isLoading : legacyLoading;
44
46
  const { wrapSSR, hashId } = useStyle(prefixCls);
45
47
  const displayList = useMemo(() => {
46
48
  if (!filter) {
@@ -30,7 +30,16 @@ var generateHistoryItems = ({
30
30
  return formatTime(item.gmtCreate);
31
31
  }
32
32
  );
33
- const items = Object.keys(groupList).map((key) => {
33
+ const groupMaxTimes = Object.fromEntries(
34
+ Object.entries(groupList).map(([key, list]) => [
35
+ key,
36
+ Math.max(...list.map((item) => dayjs(item.gmtCreate).valueOf()))
37
+ ])
38
+ );
39
+ const sortedGroupKeys = Object.keys(groupList).sort(
40
+ (keyA, keyB) => (groupMaxTimes[keyB] || 0) - (groupMaxTimes[keyA] || 0)
41
+ );
42
+ const items = sortedGroupKeys.map((key) => {
34
43
  var _a;
35
44
  const list = groupList[key];
36
45
  const firstItem = list == null ? void 0 : list.at(0);
@@ -15,7 +15,8 @@ export * from './utils';
15
15
  * @param {Function} props.request - 请求函数,用于获取历史数据
16
16
  * @param {Function} [props.onInit] - 组件初始化时的回调函数
17
17
  * @param {Function} [props.onShow] - 组件显示时的回调函数
18
- * @param {Function} [props.onSelected] - 选择历史记录项时的回调函数 (已弃用,请使用 onClick)
18
+ * @param {Function} [props.onSelected] - (已废弃,请使用 onClick) 选择历史记录项时的回调函数
19
+ * @param {Function} [props.onClick] - 点击历史记录项时的回调函数
19
20
  * @param {Function} [props.onDeleteItem] - 删除历史记录项时的回调函数
20
21
  * @param {Function} [props.customDateFormatter] - 日期格式化函数
21
22
  * @param {boolean} [props.standalone] - 是否以独立模式显示,为true时直接显示菜单,否则显示为下拉菜单
@@ -61,8 +61,13 @@ export interface HistoryProps {
61
61
  };
62
62
  /** 空状态渲染函数,当历史记录为空时显示 */
63
63
  emptyRender?: () => React.ReactNode;
64
- /** 加载状态,显示在 GroupMenu 区域 */
64
+ /**
65
+ * @deprecated 请使用 isLoading 代替
66
+ * @description 已废弃,将在未来版本移除
67
+ */
65
68
  loading?: boolean;
69
+ /** 加载状态,显示在 GroupMenu 区域 */
70
+ isLoading?: boolean;
66
71
  }
67
72
  export interface HistoryActionsBoxProps {
68
73
  /** 子组件,通常是时间显示或其他内容 */
@@ -3,8 +3,8 @@ import React from 'react';
3
3
  * LazyElement 组件属性
4
4
  */
5
5
  export interface LazyElementProps {
6
- /** 元素在文档中的位置信息 */
7
- elementInfo: {
6
+ /** 元素在文档中的位置信息(可选,用于自定义占位符渲染) */
7
+ elementInfo?: {
8
8
  /** 元素类型 */
9
9
  type: string;
10
10
  /** 元素在文档中的索引 */
@@ -29,7 +29,7 @@ export interface LazyElementProps {
29
29
  /** 元素是否即将进入视口 */
30
30
  isIntersecting: boolean;
31
31
  /** 元素在文档中的位置信息 */
32
- elementInfo: {
32
+ elementInfo?: {
33
33
  /** 元素类型 */
34
34
  type: string;
35
35
  /** 元素在文档中的索引 */
@@ -192,8 +192,8 @@ export type MarkdownEditorProps = {
192
192
  style: React.CSSProperties;
193
193
  /** 元素是否即将进入视口 */
194
194
  isIntersecting: boolean;
195
- /** 元素在文档中的位置信息 */
196
- elementInfo: {
195
+ /** 元素在文档中的位置信息(可选) */
196
+ elementInfo?: {
197
197
  /** 元素类型 */
198
198
  type: string;
199
199
  /** 元素在文档中的索引 */
@@ -75,7 +75,7 @@ var AttachmentButtonPopover = ({ children, supportedFormat }) => {
75
75
  Tooltip,
76
76
  {
77
77
  arrow: false,
78
- mouseEnterDelay: 2,
78
+ mouseEnterDelay: 1,
79
79
  trigger: ["hover", "click"],
80
80
  title: /* @__PURE__ */ React.createElement(AttachmentSupportedFormatsContent, { supportedFormat })
81
81
  },
@@ -200,8 +200,8 @@ var BUTTON_TITLE_STYLE = {
200
200
  };
201
201
  var ButtonContent = ({ title }) => {
202
202
  if (!title)
203
- return /* @__PURE__ */ React.createElement("div", { style: BUTTON_WITH_TITLE_STYLE }, /* @__PURE__ */ React.createElement(Paperclip, null));
204
- return /* @__PURE__ */ React.createElement("div", { style: BUTTON_WITH_TITLE_STYLE }, /* @__PURE__ */ React.createElement(Paperclip, null), /* @__PURE__ */ React.createElement("div", { style: BUTTON_TITLE_STYLE }, title));
203
+ return /* @__PURE__ */ React.createElement(Paperclip, null);
204
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Paperclip, null), /* @__PURE__ */ React.createElement("div", { style: BUTTON_TITLE_STYLE }, title));
205
205
  };
206
206
  var AttachmentButton = ({ disabled, uploadImage, title, supportedFormat, render }) => {
207
207
  const context = useContext(ConfigProvider.ConfigContext);
@@ -214,9 +214,9 @@ var AttachmentButton = ({ disabled, uploadImage, title, supportedFormat, render
214
214
  uploadImage == null ? void 0 : uploadImage();
215
215
  };
216
216
  const wrapper = render ? render({
217
- children: /* @__PURE__ */ React.createElement(ButtonContent, { title }),
217
+ children: /* @__PURE__ */ React.createElement("div", { style: BUTTON_WITH_TITLE_STYLE }, /* @__PURE__ */ React.createElement(ButtonContent, { title })),
218
218
  supportedFormat: format
219
- }) : /* @__PURE__ */ React.createElement(AttachmentButtonPopover, { supportedFormat: format }, /* @__PURE__ */ React.createElement(ButtonContent, { title }));
219
+ }) : /* @__PURE__ */ React.createElement(AttachmentButtonPopover, { supportedFormat: format }, /* @__PURE__ */ React.createElement("div", { style: BUTTON_WITH_TITLE_STYLE }, /* @__PURE__ */ React.createElement(ButtonContent, { title })));
220
220
  return wrapSSR(
221
221
  /* @__PURE__ */ React.createElement(
222
222
  "div",
@@ -60,7 +60,7 @@ var VoiceInputButton = (props) => {
60
60
  /* @__PURE__ */ React.createElement(
61
61
  Tooltip,
62
62
  {
63
- mouseEnterDelay: 2,
63
+ mouseEnterDelay: 1,
64
64
  arrow: false,
65
65
  title: recording ? (locale == null ? void 0 : locale["input.voiceInputting"]) || "语音输入中,点击可停止。" : (locale == null ? void 0 : locale["input.voiceInput"]) || "语音输入"
66
66
  },
@@ -25,6 +25,14 @@ import {
25
25
  var genStyle = (token) => {
26
26
  return {
27
27
  [token.componentCls]: {
28
+ // 统计数据容器样式
29
+ "&-statistic-container": {
30
+ display: "flex",
31
+ gap: "16px",
32
+ marginBottom: "16px",
33
+ flexWrap: "wrap",
34
+ alignItems: "flex-start"
35
+ },
28
36
  // 面积图容器样式
29
37
  ".chart-wrapper": {
30
38
  width: "100%",
@@ -25,6 +25,14 @@ import {
25
25
  var genStyle = (token) => {
26
26
  return {
27
27
  [token.componentCls]: {
28
+ // 统计数据容器样式
29
+ "&-statistic-container": {
30
+ display: "flex",
31
+ gap: "16px",
32
+ marginBottom: "16px",
33
+ flexWrap: "wrap",
34
+ alignItems: "flex-start"
35
+ },
28
36
  // 柱状图容器样式
29
37
  ".chart-wrapper": {
30
38
  width: "100%",
@@ -3,10 +3,13 @@ import { ChartContainerProps } from '../components';
3
3
  import { StatisticConfigType } from '../hooks/useChartStatistic';
4
4
  export interface RadarChartDataItem {
5
5
  category?: string;
6
- label: string;
6
+ label?: string;
7
7
  type?: string;
8
- score: number | string;
8
+ score?: number | string;
9
9
  filterLabel?: string;
10
+ x?: string;
11
+ y?: number;
12
+ [key: string]: any;
10
13
  }
11
14
  interface RadarChartProps extends ChartContainerProps {
12
15
  /** 扁平化数据数组 */
@@ -17,6 +20,12 @@ interface RadarChartProps extends ChartContainerProps {
17
20
  width?: number | string;
18
21
  /** 图表高度,默认400px */
19
22
  height?: number | string;
23
+ /** 自定义边框颜色 */
24
+ borderColor?: string;
25
+ /** 自定义背景颜色 */
26
+ backgroundColor?: string;
27
+ /** 自定义点背景颜色 */
28
+ pointBackgroundColor?: string;
20
29
  /** 自定义CSS类名 */
21
30
  className?: string;
22
31
  /** 数据时间 */
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { MarkdownEditorProps } from '../MarkdownEditor';
3
+ import { BaseStyleProps } from '../Types';
3
4
  export interface WhiteBoxProcessInterface {
4
5
  /** 分类类型
5
6
  * @example "TableSql"
@@ -126,18 +127,22 @@ export interface DocMeta {
126
127
  origin_text?: string;
127
128
  answer?: string;
128
129
  }
129
- export interface ThoughtChainListProps {
130
+ export interface ThoughtChainListProps extends BaseStyleProps {
130
131
  titleRender?: (props: ThoughtChainListProps, defaultDom: React.ReactNode) => React.ReactNode;
131
132
  thoughtChainList: WhiteBoxProcessInterface[];
133
+ /**
134
+ * @deprecated 请使用 isLoading 代替
135
+ * @description 已废弃,将在未来版本移除
136
+ */
132
137
  loading?: boolean;
138
+ /** 加载状态 */
139
+ isLoading?: boolean;
133
140
  bubble?: {
134
141
  isFinished?: boolean;
135
142
  endTime?: number;
136
143
  createAt?: number;
137
144
  isAborted?: boolean;
138
145
  };
139
- className?: string;
140
- style?: React.CSSProperties;
141
146
  compact?: boolean;
142
147
  markdownRenderProps?: MarkdownEditorProps;
143
148
  finishAutoCollapse?: boolean;
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ /**
3
+ * 基础样式属性
4
+ * @description 用于需要自定义样式和类名的组件
5
+ */
6
+ export interface BaseStyleProps {
7
+ /**
8
+ * 自定义 CSS 类名
9
+ */
10
+ className?: string;
11
+ /**
12
+ * 自定义 CSS 样式
13
+ */
14
+ style?: React.CSSProperties;
15
+ }
16
+ /**
17
+ * 多层级样式属性
18
+ * @description 用于支持多个子元素自定义样式的组件
19
+ */
20
+ export interface MultiStyleProps<T> {
21
+ /**
22
+ * 多个子元素的样式配置
23
+ */
24
+ styles?: T;
25
+ }
26
+ /**
27
+ * 多层级类名属性
28
+ * @description 用于支持多个子元素自定义类名的组件
29
+ */
30
+ export interface MultiClassNameProps<T> {
31
+ /**
32
+ * 多个子元素的类名配置
33
+ */
34
+ classNames?: T;
35
+ }
36
+ /**
37
+ * 工具类型:表示值可以是 T 或 false
38
+ * @description 用于条件渲染函数,false 表示不渲染
39
+ */
40
+ export type WithFalse<T> = T | false;
41
+ /**
42
+ * 角色类型
43
+ * @description 消息发送者的角色类型
44
+ */
45
+ export type RoleType = 'user' | 'system' | 'assistant' | 'agent' | 'bot';
46
+ /**
47
+ * 反馈类型
48
+ * @description 用户对消息的评价反馈类型
49
+ */
50
+ export type FeedbackType = 'thumbsUp' | 'thumbsDown' | 'none';
51
+ /**
52
+ * 基础状态属性
53
+ * @description 组件的常用状态属性
54
+ */
55
+ export interface BaseStateProps {
56
+ /**
57
+ * 加载状态
58
+ */
59
+ isLoading?: boolean;
60
+ /**
61
+ * 禁用状态
62
+ */
63
+ isDisabled?: boolean;
64
+ /**
65
+ * 只读状态
66
+ */
67
+ readonly?: boolean;
68
+ }
File without changes
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 通用类型定义
3
+ * @description 导出项目中共享的类型定义,减少重复
4
+ */
5
+ export * from './common';
6
+ export * from './message';
@@ -0,0 +1,3 @@
1
+ // src/Types/index.ts
2
+ export * from "./common";
3
+ export * from "./message";
@@ -0,0 +1,190 @@
1
+ import React from 'react';
2
+ import { AttachmentFile } from '../MarkdownInputField/AttachmentButton/types';
3
+ import { WhiteBoxProcessInterface } from '../ThoughtChainList/types';
4
+ import { FeedbackType, RoleType } from './common';
5
+ /**
6
+ * 气泡元数据
7
+ */
8
+ export interface BubbleMetaData {
9
+ /**
10
+ * 角色头像
11
+ */
12
+ avatar?: string;
13
+ /**
14
+ * 背景色
15
+ */
16
+ backgroundColor?: string;
17
+ /**
18
+ * 名称
19
+ */
20
+ title?: string;
21
+ /**
22
+ * 其他元数据
23
+ */
24
+ [key: string]: any;
25
+ }
26
+ /**
27
+ * 消息数据
28
+ * @description 聊天消息的完整数据结构
29
+ */
30
+ export interface MessageBubbleData<T extends Record<string, any> = Record<string, any>> {
31
+ /**
32
+ * @title 内容
33
+ * @description 消息的显示内容,可以是React元素
34
+ * @example <div>Hello, world!</div>
35
+ */
36
+ content?: React.ReactNode;
37
+ /**
38
+ * @title 原始内容
39
+ * @description 消息的原始文本内容,通常用于存储未经处理的文本
40
+ * @example "Hello, world!"
41
+ */
42
+ originContent?: string;
43
+ /**
44
+ * @title 错误信息
45
+ * @description 消息处理过程中可能出现的错误
46
+ * @example { code: "ERROR_CODE", message: "发生了错误" }
47
+ */
48
+ error?: any;
49
+ /**
50
+ * @title 模型标识
51
+ * @description 生成此消息的AI模型标识符
52
+ * @example "gpt-4"
53
+ */
54
+ model?: string;
55
+ /**
56
+ * @title 名称
57
+ * @description 消息发送者的名称
58
+ * @example "用户小明"
59
+ */
60
+ name?: string;
61
+ /**
62
+ * @title 父消息ID
63
+ * @description 当前消息回复的消息ID,用于构建消息树结构
64
+ * @example "msg_123456"
65
+ */
66
+ parentId?: string;
67
+ /**
68
+ * @title 角色
69
+ * @description 消息发送者的角色,如用户、助手等
70
+ * @example "user" 或 "assistant"
71
+ */
72
+ role: RoleType;
73
+ /**
74
+ * @title 创建时间
75
+ * @description 消息创建的时间戳(毫秒)
76
+ * @example 1625097600000
77
+ */
78
+ createAt: number;
79
+ /**
80
+ * @title 消息结束时间
81
+ * @description 消息生成或接收完成的时间戳(毫秒)
82
+ * @example 1625097605000
83
+ */
84
+ endTime?: number;
85
+ /**
86
+ * @title 唯一标识
87
+ * @description 消息的唯一标识符
88
+ * @example "msg_abcdef123456"
89
+ */
90
+ id: string;
91
+ /**
92
+ * @title 修改时间
93
+ * @description 消息最后修改的时间戳(毫秒)
94
+ * @example 1625097610000
95
+ */
96
+ updateAt: number;
97
+ /**
98
+ * @title 附加数据
99
+ * @description 消息的额外信息,可以包含多种自定义数据
100
+ */
101
+ extra?: T & {
102
+ /**
103
+ * @title 白盒处理过程
104
+ * @description 模型处理过程的可解释性数据
105
+ */
106
+ white_box_process?: WhiteBoxProcessInterface[] | WhiteBoxProcessInterface;
107
+ /**
108
+ * @title 聊天跟踪ID
109
+ * @description 用于追踪整个对话流程的ID
110
+ * @example "trace_xyz789"
111
+ */
112
+ chat_trace_id?: string;
113
+ /**
114
+ * @title 会话ID
115
+ * @description 当前会话的唯一标识符
116
+ * @example "session_123abc"
117
+ */
118
+ sessionId?: string;
119
+ /**
120
+ * @title 消息UUID
121
+ * @description 消息的全局唯一标识符
122
+ * @example "uuid_456def"
123
+ */
124
+ uuid?: string;
125
+ /**
126
+ * @title 客户端ID
127
+ * @description 问答对的客户端标识符
128
+ * @example "client_789ghi"
129
+ */
130
+ clientId?: string;
131
+ /**
132
+ * @title 标签列表
133
+ * @description 消息的分类标签
134
+ * @example ["NORMAL", "ABOUT_YOU"]
135
+ */
136
+ tags?: ('REJECT_TO_ANSWER' | 'ABOUT_YOU' | 'NORMAL')[];
137
+ };
138
+ /**
139
+ * @title 模型元数据
140
+ * @description 有关生成此消息的模型的额外信息
141
+ * @example { model: "gpt-4", temperature: 0.7, tokens: { total: 150, prompt: 50, completion: 100 } }
142
+ */
143
+ meta?: BubbleMetaData;
144
+ /**
145
+ * @title 是否完成
146
+ * @description 标识消息是否已完全生成或接收完成
147
+ * @example true
148
+ */
149
+ isFinished?: boolean;
150
+ /**
151
+ * @title 是否被终止
152
+ * @description 标识消息生成是否被中途终止
153
+ * @example false
154
+ */
155
+ isAborted?: boolean;
156
+ /**
157
+ * @title 用户反馈
158
+ * @description 用户对消息的评价反馈
159
+ * - thumbsUp: 点赞,表示满意
160
+ * - thumbsDown: 点踩,表示不满意
161
+ * - none: 无反馈
162
+ * @example "thumbsUp"
163
+ */
164
+ feedback?: FeedbackType;
165
+ /**
166
+ * @title 是否重试
167
+ * @description 标识当前消息是否是之前消息的重试
168
+ * @example false
169
+ */
170
+ isRetry?: boolean;
171
+ /**
172
+ * @title 文件映射
173
+ * @description 消息相关的附件文件映射
174
+ * @example new Map([["file1", { name: "示例.pdf", size: 1024, type: "application/pdf" }]])
175
+ */
176
+ fileMap?: Map<string, AttachmentFile>;
177
+ /**
178
+ * @deprecated 已废弃,请使用 isLast 代替
179
+ * @description 已废弃,请使用 isLast 代替
180
+ * @example true
181
+ */
182
+ isLatest?: boolean;
183
+ /**
184
+ * @title 是否为最后一个节点
185
+ * @description 用于标识当前消息是否为对话中的最新消息
186
+ * @default false
187
+ * @optional
188
+ */
189
+ isLast?: boolean;
190
+ }
File without changes
@@ -11,7 +11,7 @@ export interface WelcomeMessageProps {
11
11
  /** 标题 */
12
12
  title?: React.ReactNode;
13
13
  /** 描述 */
14
- description?: string;
14
+ description?: React.ReactNode;
15
15
  /** 自定义样式类名,用于各个提示项的不同部分 */
16
16
  classNames?: {
17
17
  title?: string;
@@ -133,14 +133,19 @@ export interface FileProps extends BaseChildProps {
133
133
  * 对外暴露的操作引用,允许外部主动打开预览或返回列表
134
134
  */
135
135
  actionRef?: React.MutableRefObject<FileActionRef | null>;
136
+ /**
137
+ * @deprecated 请使用 isLoading 代替
138
+ * @description 已废弃,将在未来版本移除
139
+ */
140
+ loading?: boolean;
136
141
  /**
137
142
  * 是否显示加载状态
138
143
  * @description 当为true时,显示加载动画,通常在文件列表数据加载过程中使用
139
144
  */
140
- loading?: boolean;
145
+ isLoading?: boolean;
141
146
  /**
142
147
  * 自定义加载渲染函数
143
- * @description 当loading为true时,如果提供了此函数则使用自定义渲染,否则使用默认的Spin组件
148
+ * @description 当isLoading为true时,如果提供了此函数则使用自定义渲染,否则使用默认的Spin组件
144
149
  */
145
150
  loadingRender?: () => React.ReactNode;
146
151
  /**
package/dist/index.d.ts CHANGED
@@ -30,6 +30,7 @@ export * from './MarkdownEditor/editor/store';
30
30
  export * from './MarkdownEditor/editor/utils';
31
31
  export * from './MarkdownEditor/editor/utils/docx/index';
32
32
  export * from './MarkdownEditor/editor/utils/markdownToHtml';
33
+ export * from './Types';
33
34
  export { default as Workspace } from './Workspace';
34
35
  export * from './AnswerAlert';
35
36
  export * from './BackTo';
@@ -56,7 +57,7 @@ export { default as Quote } from './Quote';
56
57
  export * from './Plugins/chart';
57
58
  export * from './Plugins/mermaid';
58
59
  export * from './MarkdownEditor/types';
59
- export type { BubbleItemStyleProps, BubbleRenderConfig, BubbleStyleProps, CustomConfig, WithFalse, } from './Bubble/type';
60
+ export type { BubbleClassNames, BubbleItemStyleProps, BubbleRenderConfig, BubbleStyles, BubbleStyleProps, CustomConfig, WithFalse, } from './Bubble/type';
60
61
  export type { CustomConfig as BubbleCustomConfig } from './Bubble/type';
61
62
  export * from './Bubble/types/DocInfo';
62
63
  export * from './ThoughtChainList/types';
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ export * from "./MarkdownEditor/editor/store";
30
30
  export * from "./MarkdownEditor/editor/utils";
31
31
  export * from "./MarkdownEditor/editor/utils/docx/index";
32
32
  export * from "./MarkdownEditor/editor/utils/markdownToHtml";
33
+ export * from "./Types";
33
34
  import { default as default2 } from "./Workspace";
34
35
  export * from "./AnswerAlert";
35
36
  export * from "./BackTo";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/agentic-ui",
3
- "version": "2.0.24",
3
+ "version": "2.0.25",
4
4
  "description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
5
5
  "repository": "git@github.com:ant-design/agentic-ui.git",
6
6
  "license": "MIT",