@ant-design/agentic-ui 2.4.0 → 2.5.0
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/List/PureBubbleList.d.ts +32 -0
- package/dist/Bubble/List/PureBubbleList.js +143 -0
- package/dist/Bubble/List/index.d.ts +1 -0
- package/dist/Bubble/List/index.js +2 -0
- package/dist/Bubble/PureBubble.d.ts +15 -0
- package/dist/Bubble/PureBubble.js +350 -0
- package/dist/Bubble/index.d.ts +2 -0
- package/dist/Bubble/index.js +6 -0
- package/dist/History/components/HistoryEmpty.js +3 -3
- package/dist/History/components/LoadMoreComponent.js +7 -3
- package/dist/History/components/SearchComponent.js +8 -13
- package/dist/History/hooks/useHistory.js +1 -1
- package/dist/History/index.d.ts +1 -0
- package/dist/History/index.js +26 -23
- package/dist/History/types/index.d.ts +2 -0
- package/dist/Hooks/useLanguage.d.ts +1 -0
- package/dist/I18n/locales.d.ts +1 -0
- package/dist/I18n/locales.js +2 -0
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +6 -2
- package/dist/MarkdownEditor/editor/store.d.ts +4 -2
- package/dist/MarkdownEditor/editor/store.js +8 -3
- package/dist/MarkdownEditor/editor/utils/markdownToHtml.d.ts +6 -2
- package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +44 -11
- package/dist/MarkdownEditor/types.d.ts +5 -0
- package/dist/MarkdownInputField/AttachmentButton/index.js +6 -4
- package/dist/MarkdownInputField/FileUploadManager/index.js +9 -0
- package/dist/Workspace/File/FileComponent.d.ts +3 -50
- package/dist/Workspace/File/FileComponent.js +52 -9
- package/dist/Workspace/File/PreviewComponent.d.ts +2 -9
- package/dist/Workspace/File/PreviewComponent.js +14 -0
- package/dist/Workspace/File/style.js +13 -0
- package/dist/Workspace/RealtimeFollow/index.js +2 -1
- package/dist/Workspace/RealtimeFollow/style.js +15 -4
- package/dist/Workspace/index.d.ts +2 -42
- package/dist/Workspace/index.js +1 -4
- package/dist/Workspace/types.d.ts +9 -0
- package/package.json +3 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import type { BubbleMetaData, BubbleProps, MessageBubbleData } from '../type';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface PureBubbleListProps {
|
|
5
|
+
bubbleList: MessageBubbleData[];
|
|
6
|
+
readonly?: boolean;
|
|
7
|
+
bubbleListRef?: MutableRefObject<HTMLDivElement | null>;
|
|
8
|
+
bubbleRef?: MutableRefObject<any | undefined>;
|
|
9
|
+
isLoading?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
bubbleRenderConfig?: BubbleProps['bubbleRenderConfig'];
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
userMeta?: BubbleMetaData;
|
|
14
|
+
assistantMeta?: BubbleMetaData;
|
|
15
|
+
styles?: BubbleProps['styles'];
|
|
16
|
+
classNames?: BubbleProps['classNames'];
|
|
17
|
+
markdownRenderConfig?: BubbleProps['markdownRenderConfig'];
|
|
18
|
+
docListProps?: BubbleProps['docListProps'];
|
|
19
|
+
onDisLike?: BubbleProps['onDisLike'];
|
|
20
|
+
onLike?: BubbleProps['onLike'];
|
|
21
|
+
onCancelLike?: BubbleProps['onCancelLike'];
|
|
22
|
+
onReply?: BubbleProps['onReply'];
|
|
23
|
+
onAvatarClick?: BubbleProps['onAvatarClick'];
|
|
24
|
+
onDoubleClick?: BubbleProps['onDoubleClick'];
|
|
25
|
+
shouldShowCopy?: BubbleProps['shouldShowCopy'];
|
|
26
|
+
shouldShowVoice?: BubbleProps['shouldShowVoice'];
|
|
27
|
+
onScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
|
|
28
|
+
onWheel?: (event: React.WheelEvent<HTMLDivElement>, bubbleListRef: HTMLDivElement | null) => void;
|
|
29
|
+
onTouchMove?: (event: React.TouchEvent<HTMLDivElement>, bubbleListRef: HTMLDivElement | null) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare const PureBubbleList: React.FC<PureBubbleListProps>;
|
|
32
|
+
export default PureBubbleList;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
|
|
21
|
+
// src/Bubble/List/PureBubbleList.tsx
|
|
22
|
+
import SkeletonList from "./SkeletonList";
|
|
23
|
+
import { useContext, useMemo } from "react";
|
|
24
|
+
import { ConfigProvider } from "antd";
|
|
25
|
+
import cx from "classnames";
|
|
26
|
+
import React from "react";
|
|
27
|
+
import { PureAIBubble, PureUserBubble } from "../PureBubble";
|
|
28
|
+
import { BubbleConfigContext } from "../BubbleConfigProvide";
|
|
29
|
+
import { useStyle } from "./style";
|
|
30
|
+
var PureBubbleList = (props) => {
|
|
31
|
+
const {
|
|
32
|
+
bubbleList,
|
|
33
|
+
bubbleListRef,
|
|
34
|
+
bubbleRenderConfig,
|
|
35
|
+
className,
|
|
36
|
+
classNames,
|
|
37
|
+
docListProps,
|
|
38
|
+
isLoading,
|
|
39
|
+
markdownRenderConfig,
|
|
40
|
+
onAvatarClick,
|
|
41
|
+
onCancelLike,
|
|
42
|
+
onDisLike,
|
|
43
|
+
onDoubleClick,
|
|
44
|
+
onLike,
|
|
45
|
+
onReply,
|
|
46
|
+
onScroll,
|
|
47
|
+
onTouchMove,
|
|
48
|
+
onWheel,
|
|
49
|
+
shouldShowCopy,
|
|
50
|
+
shouldShowVoice,
|
|
51
|
+
style,
|
|
52
|
+
styles,
|
|
53
|
+
userMeta,
|
|
54
|
+
assistantMeta
|
|
55
|
+
} = props;
|
|
56
|
+
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
57
|
+
const { compact } = useContext(BubbleConfigContext) || {};
|
|
58
|
+
const prefixClass = getPrefixCls("agentic-bubble-list");
|
|
59
|
+
const { wrapSSR, hashId } = useStyle(prefixClass);
|
|
60
|
+
const deps = useMemo(() => [props.style], [JSON.stringify(props.style)]);
|
|
61
|
+
const listDom = useMemo(() => {
|
|
62
|
+
return bubbleList.map((item, index) => {
|
|
63
|
+
const placement = item.role === "user" ? "right" : "left";
|
|
64
|
+
const BubbleComponent = placement === "right" ? PureUserBubble : PureAIBubble;
|
|
65
|
+
const isLast = index === bubbleList.length - 1;
|
|
66
|
+
item.isLatest = isLast;
|
|
67
|
+
item.isLast = isLast;
|
|
68
|
+
return /* @__PURE__ */ React.createElement(
|
|
69
|
+
BubbleComponent,
|
|
70
|
+
{
|
|
71
|
+
key: item.id,
|
|
72
|
+
"data-id": item.id,
|
|
73
|
+
avatar: __spreadValues(__spreadValues({}, placement === "right" ? userMeta : assistantMeta), item.meta),
|
|
74
|
+
preMessage: bubbleList[index - 1],
|
|
75
|
+
id: item.id,
|
|
76
|
+
style: __spreadValues({}, styles == null ? void 0 : styles.bubbleListItemStyle),
|
|
77
|
+
originData: item,
|
|
78
|
+
placement,
|
|
79
|
+
time: item.updateAt || item.createAt,
|
|
80
|
+
deps,
|
|
81
|
+
pure: true,
|
|
82
|
+
bubbleListRef,
|
|
83
|
+
bubbleRenderConfig,
|
|
84
|
+
classNames,
|
|
85
|
+
bubbleRef: props.bubbleRef,
|
|
86
|
+
markdownRenderConfig,
|
|
87
|
+
docListProps,
|
|
88
|
+
styles: __spreadProps(__spreadValues({}, styles), {
|
|
89
|
+
bubbleListItemContentStyle: __spreadValues(__spreadValues({}, styles == null ? void 0 : styles.bubbleListItemContentStyle), placement === "right" ? styles == null ? void 0 : styles.bubbleListRightItemContentStyle : styles == null ? void 0 : styles.bubbleListLeftItemContentStyle)
|
|
90
|
+
}),
|
|
91
|
+
readonly: props.readonly,
|
|
92
|
+
onReply,
|
|
93
|
+
onDisLike,
|
|
94
|
+
onLike,
|
|
95
|
+
onCancelLike,
|
|
96
|
+
onAvatarClick,
|
|
97
|
+
onDoubleClick,
|
|
98
|
+
customConfig: bubbleRenderConfig == null ? void 0 : bubbleRenderConfig.customConfig,
|
|
99
|
+
shouldShowCopy,
|
|
100
|
+
shouldShowVoice
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
});
|
|
104
|
+
}, [bubbleList, props.style]);
|
|
105
|
+
if (isLoading) {
|
|
106
|
+
return wrapSSR(
|
|
107
|
+
/* @__PURE__ */ React.createElement(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
className: cx(prefixClass, `${prefixClass}-loading`, className, hashId),
|
|
111
|
+
ref: bubbleListRef,
|
|
112
|
+
style: {
|
|
113
|
+
padding: 24
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
/* @__PURE__ */ React.createElement(SkeletonList, null)
|
|
117
|
+
)
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
return wrapSSR(
|
|
121
|
+
/* @__PURE__ */ React.createElement(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
className: cx(`${prefixClass}`, className, hashId, {
|
|
125
|
+
[`${prefixClass}-readonly`]: props.readonly,
|
|
126
|
+
[`${prefixClass}-compact`]: compact
|
|
127
|
+
}),
|
|
128
|
+
"data-chat-list": bubbleList.length,
|
|
129
|
+
style,
|
|
130
|
+
ref: bubbleListRef,
|
|
131
|
+
onScroll,
|
|
132
|
+
onWheel: (event) => onWheel == null ? void 0 : onWheel(event, (bubbleListRef == null ? void 0 : bubbleListRef.current) || null),
|
|
133
|
+
onTouchMove: (event) => onTouchMove == null ? void 0 : onTouchMove(event, (bubbleListRef == null ? void 0 : bubbleListRef.current) || null)
|
|
134
|
+
},
|
|
135
|
+
listDom
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
var PureBubbleList_default = PureBubbleList;
|
|
140
|
+
export {
|
|
141
|
+
PureBubbleList,
|
|
142
|
+
PureBubbleList_default as default
|
|
143
|
+
};
|
|
@@ -20,6 +20,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20
20
|
|
|
21
21
|
// src/Bubble/List/index.tsx
|
|
22
22
|
import SkeletonList from "./SkeletonList";
|
|
23
|
+
import { PureBubbleList } from "./PureBubbleList";
|
|
23
24
|
import { useContext, useMemo } from "react";
|
|
24
25
|
import { ConfigProvider } from "antd";
|
|
25
26
|
import cx from "classnames";
|
|
@@ -131,5 +132,6 @@ var BubbleList = (props) => {
|
|
|
131
132
|
var List_default = BubbleList;
|
|
132
133
|
export {
|
|
133
134
|
BubbleList,
|
|
135
|
+
PureBubbleList,
|
|
134
136
|
List_default as default
|
|
135
137
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { BubbleProps } from './type';
|
|
4
|
+
export declare const PureBubble: React.FC<BubbleProps & {
|
|
5
|
+
deps?: any[];
|
|
6
|
+
bubbleRef?: MutableRefObject<any | undefined>;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const PureAIBubble: React.FC<BubbleProps & {
|
|
9
|
+
deps?: any[];
|
|
10
|
+
bubbleRef?: MutableRefObject<any | undefined>;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const PureUserBubble: React.FC<BubbleProps & {
|
|
13
|
+
deps?: any[];
|
|
14
|
+
bubbleRef?: MutableRefObject<any | undefined>;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
var __async = (__this, __arguments, generator) => {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
var fulfilled = (value) => {
|
|
35
|
+
try {
|
|
36
|
+
step(generator.next(value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var rejected = (value) => {
|
|
42
|
+
try {
|
|
43
|
+
step(generator.throw(value));
|
|
44
|
+
} catch (e) {
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// src/Bubble/PureBubble.tsx
|
|
54
|
+
import { memo, useContext } from "react";
|
|
55
|
+
import { ConfigProvider, Flex } from "antd";
|
|
56
|
+
import cx from "classnames";
|
|
57
|
+
import React from "react";
|
|
58
|
+
import { BaseMarkdownEditor } from "../MarkdownEditor/BaseMarkdownEditor";
|
|
59
|
+
import { runRender } from "./AIBubble";
|
|
60
|
+
import { BubbleAvatar } from "./Avatar";
|
|
61
|
+
import { BubbleConfigContext } from "./BubbleConfigProvide";
|
|
62
|
+
import { MessagesContext } from "./MessagesContent/BubbleContext";
|
|
63
|
+
import { BubbleExtra } from "./MessagesContent/BubbleExtra";
|
|
64
|
+
import { useStyle } from "./style";
|
|
65
|
+
import { BubbleTitle } from "./Title";
|
|
66
|
+
var PureBubble = memo((props) => {
|
|
67
|
+
var _a, _c, _d, _e, _f;
|
|
68
|
+
const {
|
|
69
|
+
onAvatarClick,
|
|
70
|
+
className,
|
|
71
|
+
style,
|
|
72
|
+
bubbleRenderConfig,
|
|
73
|
+
classNames,
|
|
74
|
+
styles,
|
|
75
|
+
originData
|
|
76
|
+
} = props;
|
|
77
|
+
const [hidePadding, setHidePadding] = React.useState(false);
|
|
78
|
+
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
79
|
+
const context = useContext(BubbleConfigContext);
|
|
80
|
+
const { compact, standalone, locale } = context || {};
|
|
81
|
+
const prefixClass = getPrefixCls("agentic");
|
|
82
|
+
const { wrapSSR, hashId } = useStyle(prefixClass);
|
|
83
|
+
const placement = (_a = props.placement) != null ? _a : "left";
|
|
84
|
+
const isRightPlacement = placement === "right";
|
|
85
|
+
const time = (originData == null ? void 0 : originData.createAt) || props.time;
|
|
86
|
+
const avatar = (originData == null ? void 0 : originData.meta) || props.avatar;
|
|
87
|
+
const defaultMarkdown = typeof (originData == null ? void 0 : originData.content) === "string" ? originData.content : "";
|
|
88
|
+
const _b = props.markdownRenderConfig || {}, {
|
|
89
|
+
initValue: configInitValue,
|
|
90
|
+
readonly: configReadonly
|
|
91
|
+
} = _b, markdownConfig = __objRest(_b, [
|
|
92
|
+
"initValue",
|
|
93
|
+
"readonly"
|
|
94
|
+
]);
|
|
95
|
+
const editorInitValue = configInitValue != null ? configInitValue : defaultMarkdown;
|
|
96
|
+
const editorReadonly = (_d = (_c = props.readonly) != null ? _c : configReadonly) != null ? _d : false;
|
|
97
|
+
const titleDom = runRender(
|
|
98
|
+
bubbleRenderConfig == null ? void 0 : bubbleRenderConfig.titleRender,
|
|
99
|
+
props,
|
|
100
|
+
/* @__PURE__ */ React.createElement(
|
|
101
|
+
BubbleTitle,
|
|
102
|
+
{
|
|
103
|
+
bubbleNameClassName: classNames == null ? void 0 : classNames.bubbleNameClassName,
|
|
104
|
+
className: classNames == null ? void 0 : classNames.bubbleListItemTitleClassName,
|
|
105
|
+
style: styles == null ? void 0 : styles.bubbleListItemTitleStyle,
|
|
106
|
+
prefixClass: cx(`${prefixClass}-bubble-title`),
|
|
107
|
+
title: (avatar == null ? void 0 : avatar.title) || (avatar == null ? void 0 : avatar.name),
|
|
108
|
+
placement,
|
|
109
|
+
time
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
);
|
|
113
|
+
const avatarDom = runRender(
|
|
114
|
+
bubbleRenderConfig == null ? void 0 : bubbleRenderConfig.avatarRender,
|
|
115
|
+
props,
|
|
116
|
+
/* @__PURE__ */ React.createElement(
|
|
117
|
+
BubbleAvatar,
|
|
118
|
+
{
|
|
119
|
+
className: classNames == null ? void 0 : classNames.bubbleListItemAvatarClassName,
|
|
120
|
+
avatar: avatar == null ? void 0 : avatar.avatar,
|
|
121
|
+
background: avatar == null ? void 0 : avatar.backgroundColor,
|
|
122
|
+
title: (avatar == null ? void 0 : avatar.title) || (avatar == null ? void 0 : avatar.name),
|
|
123
|
+
onClick: onAvatarClick,
|
|
124
|
+
prefixCls: `${prefixClass}-bubble-avatar`,
|
|
125
|
+
style: styles == null ? void 0 : styles.bubbleListItemAvatarStyle
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
const markdownEditorDom = /* @__PURE__ */ React.createElement(
|
|
130
|
+
BaseMarkdownEditor,
|
|
131
|
+
__spreadProps(__spreadValues({}, markdownConfig), {
|
|
132
|
+
initValue: editorInitValue,
|
|
133
|
+
readonly: editorReadonly
|
|
134
|
+
})
|
|
135
|
+
);
|
|
136
|
+
const contentBeforeDom = runRender(
|
|
137
|
+
bubbleRenderConfig == null ? void 0 : bubbleRenderConfig.contentBeforeRender,
|
|
138
|
+
props,
|
|
139
|
+
null
|
|
140
|
+
);
|
|
141
|
+
const contentAfterDom = runRender(
|
|
142
|
+
bubbleRenderConfig == null ? void 0 : bubbleRenderConfig.contentAfterRender,
|
|
143
|
+
props,
|
|
144
|
+
null
|
|
145
|
+
);
|
|
146
|
+
const messageContent = runRender(
|
|
147
|
+
bubbleRenderConfig == null ? void 0 : bubbleRenderConfig.contentRender,
|
|
148
|
+
props,
|
|
149
|
+
markdownEditorDom
|
|
150
|
+
);
|
|
151
|
+
const extraDom = (bubbleRenderConfig == null ? void 0 : bubbleRenderConfig.extraRender) === false ? null : /* @__PURE__ */ React.createElement(
|
|
152
|
+
BubbleExtra,
|
|
153
|
+
{
|
|
154
|
+
pure: true,
|
|
155
|
+
style: styles == null ? void 0 : styles.bubbleListItemExtraStyle,
|
|
156
|
+
readonly: props.readonly,
|
|
157
|
+
rightRender: (_e = props == null ? void 0 : props.bubbleRenderConfig) == null ? void 0 : _e.extraRightRender,
|
|
158
|
+
onReply: props.onReply,
|
|
159
|
+
onCancelLike: props.onCancelLike,
|
|
160
|
+
shouldShowCopy: props.shouldShowCopy,
|
|
161
|
+
useSpeech: props.useSpeech,
|
|
162
|
+
shouldShowVoice: props.shouldShowVoice,
|
|
163
|
+
onDisLike: props.onDisLike ? () => __async(void 0, null, function* () {
|
|
164
|
+
var _a2, _b2, _c2, _d2;
|
|
165
|
+
try {
|
|
166
|
+
yield (_a2 = props.onDisLike) == null ? void 0 : _a2.call(props, props.originData);
|
|
167
|
+
(_d2 = (_c2 = (_b2 = props.bubbleRef) == null ? void 0 : _b2.current) == null ? void 0 : _c2.setMessageItem) == null ? void 0 : _d2.call(_c2, props.id, {
|
|
168
|
+
feedback: "thumbsDown"
|
|
169
|
+
});
|
|
170
|
+
} catch (error) {
|
|
171
|
+
}
|
|
172
|
+
}) : void 0,
|
|
173
|
+
bubble: props,
|
|
174
|
+
onLike: props.onLike ? () => __async(void 0, null, function* () {
|
|
175
|
+
var _a2, _b2, _c2, _d2;
|
|
176
|
+
try {
|
|
177
|
+
yield (_a2 = props.onLike) == null ? void 0 : _a2.call(props, props.originData);
|
|
178
|
+
(_d2 = (_c2 = (_b2 = props.bubbleRef) == null ? void 0 : _b2.current) == null ? void 0 : _c2.setMessageItem) == null ? void 0 : _d2.call(_c2, props.id, {
|
|
179
|
+
feedback: "thumbsUp"
|
|
180
|
+
});
|
|
181
|
+
} catch (error) {
|
|
182
|
+
}
|
|
183
|
+
}) : void 0
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
const itemDom = wrapSSR(
|
|
187
|
+
/* @__PURE__ */ React.createElement(
|
|
188
|
+
BubbleConfigContext.Provider,
|
|
189
|
+
{
|
|
190
|
+
value: {
|
|
191
|
+
compact,
|
|
192
|
+
standalone: !!standalone,
|
|
193
|
+
locale,
|
|
194
|
+
bubble: props
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
/* @__PURE__ */ React.createElement(
|
|
198
|
+
Flex,
|
|
199
|
+
{
|
|
200
|
+
className: cx(
|
|
201
|
+
hashId,
|
|
202
|
+
className,
|
|
203
|
+
`${prefixClass}-bubble`,
|
|
204
|
+
`${prefixClass}-bubble-${placement}`,
|
|
205
|
+
`${prefixClass}-bubble-pure`,
|
|
206
|
+
{
|
|
207
|
+
[`${prefixClass}-bubble-compact`]: compact
|
|
208
|
+
},
|
|
209
|
+
classNames == null ? void 0 : classNames.bubbleClassName
|
|
210
|
+
),
|
|
211
|
+
style,
|
|
212
|
+
vertical: true,
|
|
213
|
+
id: props.id,
|
|
214
|
+
"data-id": props.id,
|
|
215
|
+
gap: 12
|
|
216
|
+
},
|
|
217
|
+
/* @__PURE__ */ React.createElement(
|
|
218
|
+
"div",
|
|
219
|
+
{
|
|
220
|
+
style,
|
|
221
|
+
className: cx(
|
|
222
|
+
`${prefixClass}-bubble-container`,
|
|
223
|
+
`${prefixClass}-bubble-container-${placement}`,
|
|
224
|
+
{
|
|
225
|
+
[`${prefixClass}-bubble-container-pure`]: props.pure
|
|
226
|
+
},
|
|
227
|
+
hashId
|
|
228
|
+
)
|
|
229
|
+
},
|
|
230
|
+
/* @__PURE__ */ React.createElement(
|
|
231
|
+
"div",
|
|
232
|
+
{
|
|
233
|
+
className: cx(
|
|
234
|
+
`${prefixClass}-bubble-avatar-title`,
|
|
235
|
+
`${prefixClass}-bubble-avatar-title-${placement}`,
|
|
236
|
+
`${prefixClass}-bubble-avatar-title-pure`,
|
|
237
|
+
classNames == null ? void 0 : classNames.bubbleAvatarTitleClassName,
|
|
238
|
+
hashId,
|
|
239
|
+
{
|
|
240
|
+
[`${prefixClass}-bubble-avatar-title-compact`]: compact
|
|
241
|
+
}
|
|
242
|
+
)
|
|
243
|
+
},
|
|
244
|
+
isRightPlacement ? titleDom : avatarDom,
|
|
245
|
+
isRightPlacement ? avatarDom : titleDom
|
|
246
|
+
),
|
|
247
|
+
/* @__PURE__ */ React.createElement(
|
|
248
|
+
"div",
|
|
249
|
+
{
|
|
250
|
+
style: __spreadValues({
|
|
251
|
+
display: "flex",
|
|
252
|
+
gap: 4,
|
|
253
|
+
flexDirection: "column",
|
|
254
|
+
alignItems: isRightPlacement ? "flex-end" : "flex-start"
|
|
255
|
+
}, styles == null ? void 0 : styles.bubbleListItemContentStyle),
|
|
256
|
+
className: cx(
|
|
257
|
+
`${prefixClass}-bubble-content-wrapper`,
|
|
258
|
+
hashId,
|
|
259
|
+
classNames == null ? void 0 : classNames.bubbleContainerClassName
|
|
260
|
+
),
|
|
261
|
+
"data-testid": "chat-message"
|
|
262
|
+
},
|
|
263
|
+
contentBeforeDom ? /* @__PURE__ */ React.createElement(
|
|
264
|
+
"div",
|
|
265
|
+
{
|
|
266
|
+
style: styles == null ? void 0 : styles.bubbleListItemExtraStyle,
|
|
267
|
+
className: cx(
|
|
268
|
+
`${prefixClass}-bubble-before`,
|
|
269
|
+
`${prefixClass}-bubble-before-${placement}`,
|
|
270
|
+
hashId
|
|
271
|
+
),
|
|
272
|
+
"data-testid": "message-before"
|
|
273
|
+
},
|
|
274
|
+
contentBeforeDom
|
|
275
|
+
) : null,
|
|
276
|
+
/* @__PURE__ */ React.createElement(
|
|
277
|
+
"div",
|
|
278
|
+
{
|
|
279
|
+
className: cx(
|
|
280
|
+
`${prefixClass}-bubble-content`,
|
|
281
|
+
`${prefixClass}-bubble-content-${placement}`,
|
|
282
|
+
`${prefixClass}-bubble-content-pure`,
|
|
283
|
+
classNames == null ? void 0 : classNames.bubbleListItemContentClassName,
|
|
284
|
+
hashId
|
|
285
|
+
),
|
|
286
|
+
onDoubleClick: props.onDoubleClick,
|
|
287
|
+
"data-testid": "message-content"
|
|
288
|
+
},
|
|
289
|
+
messageContent
|
|
290
|
+
),
|
|
291
|
+
contentAfterDom
|
|
292
|
+
)
|
|
293
|
+
)
|
|
294
|
+
)
|
|
295
|
+
)
|
|
296
|
+
);
|
|
297
|
+
if ((bubbleRenderConfig == null ? void 0 : bubbleRenderConfig.render) === false)
|
|
298
|
+
return null;
|
|
299
|
+
return /* @__PURE__ */ React.createElement(
|
|
300
|
+
MessagesContext.Provider,
|
|
301
|
+
{
|
|
302
|
+
value: {
|
|
303
|
+
message: props.originData,
|
|
304
|
+
hidePadding,
|
|
305
|
+
setHidePadding,
|
|
306
|
+
setMessage: (message) => {
|
|
307
|
+
var _a2, _b2, _c2;
|
|
308
|
+
(_c2 = (_b2 = (_a2 = props == null ? void 0 : props.bubbleRef) == null ? void 0 : _a2.current) == null ? void 0 : _b2.setMessageItem) == null ? void 0 : _c2.call(
|
|
309
|
+
_b2,
|
|
310
|
+
props.id,
|
|
311
|
+
message
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
/* @__PURE__ */ React.createElement(React.Fragment, null, ((_f = bubbleRenderConfig == null ? void 0 : bubbleRenderConfig.render) == null ? void 0 : _f.call(
|
|
317
|
+
bubbleRenderConfig,
|
|
318
|
+
props,
|
|
319
|
+
{
|
|
320
|
+
avatar: avatarDom,
|
|
321
|
+
title: titleDom,
|
|
322
|
+
header: /* @__PURE__ */ React.createElement(
|
|
323
|
+
"div",
|
|
324
|
+
{
|
|
325
|
+
className: cx(
|
|
326
|
+
`${prefixClass}-bubble-avatar-title`,
|
|
327
|
+
`${prefixClass}-bubble-avatar-title-${placement}`,
|
|
328
|
+
`${prefixClass}-bubble-avatar-title-pure`,
|
|
329
|
+
classNames == null ? void 0 : classNames.bubbleAvatarTitleClassName,
|
|
330
|
+
hashId
|
|
331
|
+
)
|
|
332
|
+
},
|
|
333
|
+
isRightPlacement ? titleDom : avatarDom,
|
|
334
|
+
isRightPlacement ? avatarDom : titleDom
|
|
335
|
+
),
|
|
336
|
+
extra: extraDom,
|
|
337
|
+
messageContent,
|
|
338
|
+
itemDom
|
|
339
|
+
},
|
|
340
|
+
itemDom
|
|
341
|
+
)) || itemDom)
|
|
342
|
+
);
|
|
343
|
+
});
|
|
344
|
+
var PureAIBubble = memo((props) => /* @__PURE__ */ React.createElement(PureBubble, __spreadProps(__spreadValues({}, props), { placement: "left" })));
|
|
345
|
+
var PureUserBubble = memo((props) => /* @__PURE__ */ React.createElement(PureBubble, __spreadProps(__spreadValues({}, props), { placement: "right" })));
|
|
346
|
+
export {
|
|
347
|
+
PureAIBubble,
|
|
348
|
+
PureBubble,
|
|
349
|
+
PureUserBubble
|
|
350
|
+
};
|
package/dist/Bubble/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
export { AIBubble, runRender } from './AIBubble';
|
|
8
8
|
export { Bubble } from './Bubble';
|
|
9
9
|
export * from './BubbleConfigProvide';
|
|
10
|
+
export { PureBubbleList } from './List/PureBubbleList';
|
|
11
|
+
export { PureAIBubble, PureBubble, PureUserBubble } from './PureBubble';
|
|
10
12
|
export * from './MessagesContent/BubbleContext';
|
|
11
13
|
export * from './type';
|
|
12
14
|
export { UserBubble } from './UserBubble';
|
package/dist/Bubble/index.js
CHANGED
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
import { AIBubble, runRender } from "./AIBubble";
|
|
3
3
|
import { Bubble } from "./Bubble";
|
|
4
4
|
export * from "./BubbleConfigProvide";
|
|
5
|
+
import { PureBubbleList } from "./List/PureBubbleList";
|
|
6
|
+
import { PureAIBubble, PureBubble, PureUserBubble } from "./PureBubble";
|
|
5
7
|
export * from "./MessagesContent/BubbleContext";
|
|
6
8
|
export * from "./type";
|
|
7
9
|
import { UserBubble } from "./UserBubble";
|
|
8
10
|
export {
|
|
9
11
|
AIBubble,
|
|
10
12
|
Bubble,
|
|
13
|
+
PureAIBubble,
|
|
14
|
+
PureBubble,
|
|
15
|
+
PureBubbleList,
|
|
16
|
+
PureUserBubble,
|
|
11
17
|
UserBubble,
|
|
12
18
|
runRender
|
|
13
19
|
};
|
|
@@ -24,9 +24,9 @@ var HistoryEmpty = () => {
|
|
|
24
24
|
"div",
|
|
25
25
|
{
|
|
26
26
|
style: {
|
|
27
|
-
font: "var(--font-text-
|
|
28
|
-
color: "var(--color-gray-text-
|
|
29
|
-
letterSpacing: "var(--letter-spacing-
|
|
27
|
+
font: "var(--font-text-h6-base)",
|
|
28
|
+
color: "var(--color-gray-text-secondary)",
|
|
29
|
+
letterSpacing: "var(--letter-spacing-h6-base, normal)",
|
|
30
30
|
marginBottom: 2
|
|
31
31
|
}
|
|
32
32
|
},
|
|
@@ -57,8 +57,7 @@ var MoreTaskIcon = (props) => {
|
|
|
57
57
|
{
|
|
58
58
|
d: "M1.3333333730697632,5.333333373069763L1.3333333730697632,2.000000373069763C1.3333333730697632,1.6318103730697633,1.6318103730697633,1.3333333730697632,2.000000373069763,1.3333333730697632C2.3681933730697633,1.3333333730697632,2.6666633730697633,1.6318103730697633,2.6666633730697633,2.000000373069763L2.6666633730697633,3.723853373069763L3.035263373069763,3.3552533730697633Q5.115433373069763,1.344175573069763,7.997493373069763,1.3333333730697632Q10.761423373069762,1.3333286046997632,12.714033373069762,3.285953373069763Q14.666633373069763,5.238573373069763,14.666633373069763,7.999993373069763Q14.666633373069763,10.761423373069762,12.714033373069762,12.714033373069762Q10.761423373069762,14.666633373069763,7.999993373069763,14.666633373069763Q5.238573373069763,14.666633373069763,3.285953373069763,12.714033373069762Q1.3336035810697633,10.761683373069763,1.3333333730697632,8.000753373069763L1.3333333730697632,7.999993373069763C1.3333333730697632,7.631803373069763,1.6318103730697633,7.333333373069763,2.000000373069763,7.333333373069763C2.3681933730697633,7.333333373069763,2.6666633730697633,7.631803373069763,2.6666633730697633,7.999993373069763Q2.6666633730697633,10.209133373069763,4.228763373069763,11.771233373069764Q5.790863373069763,13.333333373069763,7.999993373069763,13.333333373069763Q10.209143373069763,13.333333373069763,11.771233373069764,11.771233373069764Q13.333333373069763,10.209133373069763,13.333333373069763,7.999993373069763Q13.333333373069763,5.790853373069763,11.771233373069764,4.228763373069763Q10.209143373069763,2.6666633730697633,8.002513373069764,2.6666533730697632Q5.656643373069763,2.6754833730697634,3.9780733730697633,4.298063373069763L3.609473373069763,4.666663373069763L5.333333373069763,4.666663373069763C5.701523373069763,4.666663373069763,6.000003373069763,4.965143373069763,6.000003373069763,5.333333373069763C6.000003373069763,5.701523373069763,5.701523373069763,6.000003373069763,5.333333373069763,6.000003373069763L2.000000373069763,5.999993373069763C1.9079523730697632,5.999993373069763,1.8202613730697632,5.981343373069763,1.7405023730697633,5.9476033730697635C1.6514743730697632,5.909953373069763,1.5723283730697633,5.853503373069763,1.508035373069763,5.783243373069763C1.3995321730697632,5.6646633730697635,1.3333333730697632,5.506723373069764,1.3333333730697632,5.333333373069763ZM7.333333373069763,4.666663373069763C7.333333373069763,4.298473373069763,7.631813373069763,4.000003373069763,8.000003373069763,4.000003373069763C8.368193373069763,4.000003373069763,8.666663373069763,4.298473373069763,8.666663373069763,4.666663373069763L8.666663373069763,7.587973373069763L10.964813373069763,8.737053373069763C11.190663373069762,8.849973373069762,11.333333373069763,9.080823373069762,11.333333373069763,9.333333373069763C11.333333373069763,9.701523373069763,11.034853373069764,10.000003373069763,10.666663373069763,10.000003373069763C10.563173373069763,10.000003373069763,10.461093373069764,9.975903373069762,10.368523373069763,9.929613373069763L7.701853373069763,8.596283373069763C7.476003373069763,8.483353373069763,7.333333373069763,8.252513373069764,7.333333373069763,8.000003373069763L7.333333373069763,4.666663373069763Z",
|
|
59
59
|
fillRule: "evenodd",
|
|
60
|
-
fill: "currentColor"
|
|
61
|
-
fillOpacity: "0.41999998688697815"
|
|
60
|
+
fill: "currentColor"
|
|
62
61
|
}
|
|
63
62
|
)))
|
|
64
63
|
);
|
|
@@ -103,7 +102,12 @@ var HistoryLoadMore = ({
|
|
|
103
102
|
onClick: onClickFn,
|
|
104
103
|
onKeyDown: handleKeyDown
|
|
105
104
|
},
|
|
106
|
-
type === "task" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", null, loading ? /* @__PURE__ */ React.createElement(LoadingOutlined, null) : /* @__PURE__ */ React.createElement(
|
|
105
|
+
type === "task" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", null, loading ? /* @__PURE__ */ React.createElement(LoadingOutlined, null) : /* @__PURE__ */ React.createElement(
|
|
106
|
+
EllipsisOutlined,
|
|
107
|
+
{
|
|
108
|
+
style: { color: "var(--color-gray-text-secondary)" }
|
|
109
|
+
}
|
|
110
|
+
)), (locale == null ? void 0 : locale["task.history.loadMore"]) || "查看更多历史") : /* @__PURE__ */ React.createElement(React.Fragment, null, loading ? /* @__PURE__ */ React.createElement(LoadingOutlined, null) : /* @__PURE__ */ React.createElement(MoreTaskIcon, null), (locale == null ? void 0 : locale["chat.history.loadMore"]) || "查看更多")
|
|
107
111
|
));
|
|
108
112
|
};
|
|
109
113
|
export {
|
|
@@ -59,8 +59,7 @@ function SearchIcon(props) {
|
|
|
59
59
|
{
|
|
60
60
|
d: "M9.693555458984376,10.518662270507813C8.795425458984376,11.237102270507812,7.656175458984375,11.666702270507812,6.416595458984375,11.666702270507812C3.517095458984375,11.666702270507812,1.166595458984375,9.316202270507812,1.166595458984375,6.4167022705078125C1.166595458984375,3.5172022705078123,3.517095458984375,1.1667022705078125,6.416595458984375,1.1667022705078125C9.316095458984375,1.1667022705078125,11.666595458984375,3.5172022705078123,11.666595458984375,6.4167022705078125C11.666595458984375,7.656302270507813,11.236995458984374,8.795562270507812,10.518515458984375,9.693702270507812L12.662395458984374,11.837602270507812C12.771795458984375,11.947002270507813,12.833195458984376,12.095302270507812,12.833195458984376,12.250002270507812C12.833195458984376,12.572202270507812,12.572095458984375,12.833402270507813,12.249895458984374,12.833402270507813C12.095195458984374,12.833402270507813,11.946795458984376,12.771902270507812,11.837395458984375,12.662502270507812L9.693555458984376,10.518662270507813ZM10.499925458984375,6.4167022705078125C10.499925458984375,4.1615422705078124,8.671755458984375,2.3333722705078124,6.416595458984375,2.3333722705078124C4.161435458984375,2.3333722705078124,2.333265458984375,4.1615422705078124,2.333265458984375,6.4167022705078125C2.333265458984375,8.671862270507813,4.161435458984375,10.500032270507813,6.416595458984375,10.500032270507813C8.671755458984375,10.500032270507813,10.499925458984375,8.671862270507813,10.499925458984375,6.4167022705078125Z",
|
|
61
61
|
fillRule: "evenodd",
|
|
62
|
-
fill: "currentColor"
|
|
63
|
-
fillOpacity: "0.3199999928474426"
|
|
62
|
+
fill: "currentColor"
|
|
64
63
|
}
|
|
65
64
|
)))
|
|
66
65
|
);
|
|
@@ -145,6 +144,10 @@ var HistorySearch = ({
|
|
|
145
144
|
height: 32,
|
|
146
145
|
background: "var(--color-gray-bg-card-light)"
|
|
147
146
|
},
|
|
147
|
+
onClear: () => {
|
|
148
|
+
setInputValue("");
|
|
149
|
+
handleSearchWithLoading("");
|
|
150
|
+
},
|
|
148
151
|
allowClear: true,
|
|
149
152
|
variant: "filled",
|
|
150
153
|
autoFocus: true
|
|
@@ -167,19 +170,11 @@ var HistorySearch = ({
|
|
|
167
170
|
title: (locale == null ? void 0 : locale["chat.history.search"]) || "搜索",
|
|
168
171
|
style: {
|
|
169
172
|
width: 28,
|
|
170
|
-
height: 28
|
|
173
|
+
height: 28,
|
|
174
|
+
color: "var(--color-gray-text-secondary)"
|
|
171
175
|
}
|
|
172
176
|
},
|
|
173
|
-
/* @__PURE__ */ React.createElement(
|
|
174
|
-
SearchIcon,
|
|
175
|
-
{
|
|
176
|
-
style: {
|
|
177
|
-
width: 14,
|
|
178
|
-
height: 14,
|
|
179
|
-
color: "var(--color-gray-text-secondary)"
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
)
|
|
177
|
+
/* @__PURE__ */ React.createElement(SearchIcon, null)
|
|
183
178
|
))
|
|
184
179
|
);
|
|
185
180
|
};
|