@antscorp/antsomi-ui 1.3.5-beta.571 → 1.3.5-beta.572
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/es/__tests__/fileMock.test.d.ts +2 -0
- package/es/__tests__/fileMock.test.js +2 -0
- package/es/__tests__/styleMock.test.d.ts +1 -0
- package/es/__tests__/styleMock.test.js +2 -0
- package/es/components/atoms/Popover/styled.d.ts +4 -0
- package/es/components/atoms/Popover/styled.js +5 -0
- package/es/components/atoms/SlideBar/SlideBar.js +1 -3
- package/es/components/atoms/Slider/index.js +8 -3
- package/es/components/icons/index.d.ts +4 -5
- package/es/components/icons/index.js +4 -5
- package/es/components/molecules/AccountSelection/index.d.ts +1 -2
- package/es/components/molecules/CalendarSelection/CalendarSelection.js +2 -2
- package/es/components/molecules/ChatBox/ChatBox.js +34 -22
- package/es/components/molecules/ChatBox/MessageItem.js +14 -8
- package/es/components/molecules/ChatBox/QuestionItem.d.ts +7 -0
- package/es/components/molecules/ChatBox/QuestionItem.js +11 -0
- package/es/components/molecules/ChatBox/constants.d.ts +5 -0
- package/es/components/molecules/ChatBox/constants.js +27 -0
- package/es/components/molecules/ChatBox/styled.d.ts +5 -1
- package/es/components/molecules/ChatBox/styled.js +28 -2
- package/es/components/molecules/ChatBox/types.d.ts +3 -0
- package/es/components/molecules/ChatBox/utils.d.ts +2 -0
- package/es/components/molecules/ChatBox/utils.js +18 -0
- package/es/components/molecules/ColorPicker/CustomPicker/index.js +3 -3
- package/es/components/molecules/ColorPicker/index.d.ts +1 -0
- package/es/components/molecules/ColorPicker/index.js +3 -2
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js +1 -1
- package/es/components/molecules/FontSetting/index.js +1 -1
- package/es/components/molecules/RichMenu/RichMenuBlock/constants.js +1 -1
- package/es/components/molecules/TemplateSaveAs/styled.js +1 -1
- package/es/components/molecules/UploadImage/MediaThumb.d.ts +8 -0
- package/es/components/molecules/UploadImage/MediaThumb.js +15 -0
- package/es/components/molecules/UploadImage/VideoThumbnail.d.ts +4 -0
- package/es/components/molecules/UploadImage/VideoThumbnail.js +43 -0
- package/es/components/molecules/UploadImage/index.d.ts +1 -0
- package/es/components/molecules/UploadImage/index.js +38 -4
- package/es/components/molecules/index.d.ts +1 -1
- package/es/components/molecules/index.js +1 -1
- package/es/components/organism/AccountSharing/AccountSharing.js +15 -3
- package/es/components/organism/ContentSources/Settings.d.ts +3 -0
- package/es/components/organism/ContentSources/Settings.js +1 -1
- package/es/components/organism/ContentSources/index.d.ts +3 -0
- package/es/components/organism/ContentSources/index.js +4 -3
- package/es/components/organism/DataTable/components/Toolbar/ToolbarActionButtons.js +0 -13
- package/es/components/organism/DataTable/components/Toolbar/index.js +0 -1
- package/es/components/organism/DataTable/constants/toolbar.d.ts +0 -1
- package/es/components/organism/DataTable/constants/toolbar.js +2 -8
- package/es/components/organism/GenerativeInsights/constants.d.ts +1 -0
- package/es/components/organism/GenerativeInsights/constants.js +1 -0
- package/es/components/organism/GenerativeInsights/index.d.ts +11 -0
- package/es/components/organism/GenerativeInsights/index.js +57 -0
- package/es/components/organism/GenerativeInsights/styled.d.ts +12 -0
- package/es/components/organism/GenerativeInsights/styled.js +66 -0
- package/es/components/organism/GenerativeInsights/utils.d.ts +13 -0
- package/es/components/organism/GenerativeInsights/utils.js +50 -0
- package/es/components/organism/PreviewTemplateModal/components/Banner/index.js +1 -1
- package/es/components/organism/index.d.ts +1 -0
- package/es/components/organism/index.js +1 -0
- package/es/components/template/Layout/Layout.js +6 -0
- package/es/constants/queries.d.ts +1 -0
- package/es/constants/queries.js +1 -0
- package/es/locales/en/translation.json +1 -2
- package/es/locales/i18n.d.ts +0 -2
- package/es/locales/translations.d.ts +0 -1
- package/es/locales/vi/translation.json +1 -2
- package/es/providers/ConfigProvider/GlobalStyle.js +9 -0
- package/es/queries/Media/index.d.ts +1 -0
- package/es/queries/Media/index.js +1 -0
- package/es/queries/Media/useGetListingSavedMedia.d.ts +12 -0
- package/es/queries/Media/useGetListingSavedMedia.js +10 -0
- package/es/queries/index.d.ts +1 -0
- package/es/queries/index.js +1 -0
- package/es/test.d.ts +0 -11
- package/es/test.js +151 -358
- package/package.json +1 -1
- package/es/components/icons/PivotTableChartIcon.d.ts +0 -3
- package/es/components/icons/PivotTableChartIcon.js +0 -11
- package/es/components/organism/DataTable/components/Toolbar/GroupByPopover.d.ts +0 -5
- package/es/components/organism/DataTable/components/Toolbar/GroupByPopover.js +0 -19
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const PopoverWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").PopoverProps & import("react").RefAttributes<unknown>> & {
|
|
3
|
+
_InternalPanelDoNotUseOrYouWillBeFired: import("react").FC<import("antd/es/popover/PurePanel").PurePanelProps>;
|
|
4
|
+
}, any, {}, never>;
|
|
@@ -264,9 +264,7 @@ export const SlideBar = props => {
|
|
|
264
264
|
fontSize: `${BTN_ADD_SIZE}px`,
|
|
265
265
|
cursor: disabledAdd ? 'not-allowed' : 'pointer',
|
|
266
266
|
color: disabledAdd ? (_c = THEME.token) === null || _c === void 0 ? void 0 : _c.colorTextDisabled : (_d = THEME.token) === null || _d === void 0 ? void 0 : _d.colorPrimary,
|
|
267
|
-
},
|
|
268
|
-
// disabled={disabledAdd}
|
|
269
|
-
onClick: (e) => {
|
|
267
|
+
}, onClick: (e) => {
|
|
270
268
|
e.stopPropagation();
|
|
271
269
|
if (!disabledAdd) {
|
|
272
270
|
handleAddSlide();
|
|
@@ -9,15 +9,20 @@ export const Slider = memo(props => {
|
|
|
9
9
|
const { range, value, min = 0, max = 0, className, tooltipVisible } = props;
|
|
10
10
|
const isNegative = useMemo(() => !!(!range && min < 0), [range, min]);
|
|
11
11
|
const calculateWidth = useMemo(() => ((value || 0) * 100) / (Math.abs(max) + Math.abs(min) || 1), [min, max, value]);
|
|
12
|
-
const restProps = tooltipVisible === 'default' ? omit(props, ['tooltipVisible']) : props;
|
|
12
|
+
// const restProps = tooltipVisible === 'default' ? omit(props, ['tooltipVisible']) : props;
|
|
13
|
+
const restProps = omit(props, ['tooltipVisible']);
|
|
13
14
|
if (isNegative) {
|
|
14
15
|
return (React.createElement(SliderWrapper, { isNegative: true, width: calculateWidth, className: className },
|
|
15
|
-
React.createElement(AntdSlider, Object.assign({}, omit(restProps, ['marks', 'className']), {
|
|
16
|
+
React.createElement(AntdSlider, Object.assign({}, omit(restProps, ['marks', 'className']), { tooltip: tooltipVisible !== 'default' && {
|
|
17
|
+
open: tooltipVisible,
|
|
18
|
+
}, marks: {
|
|
16
19
|
0: ' ',
|
|
17
20
|
} }))));
|
|
18
21
|
}
|
|
19
22
|
return (React.createElement(SliderWrapper, { className: className },
|
|
20
|
-
React.createElement(AntdSlider, Object.assign({}, restProps
|
|
23
|
+
React.createElement(AntdSlider, Object.assign({}, restProps, { tooltip: tooltipVisible !== 'default' && {
|
|
24
|
+
open: tooltipVisible,
|
|
25
|
+
} }))));
|
|
21
26
|
});
|
|
22
27
|
Slider.defaultProps = {
|
|
23
28
|
tooltipVisible: false,
|
|
@@ -32,13 +32,13 @@ export { ChatBubbleOutlineIcon } from './ChatBubbleOutlineIcon';
|
|
|
32
32
|
export { ChatConversationCommentAddCommentIcon } from './ChatConversationCommentAddCommentIcon';
|
|
33
33
|
export { ChatMentionIcon } from './ChatMentionIcon';
|
|
34
34
|
export { ChatUnreadIcon } from './ChatUnreadIcon';
|
|
35
|
-
export { CheckSlimIcon } from './CheckSlimIcon';
|
|
36
35
|
export { CheckboxChecked5RadiusIcon } from './CheckboxChecked5RadiusIcon';
|
|
37
36
|
export { CheckboxCheckedIcon } from './CheckboxCheckedIcon';
|
|
38
37
|
export { CheckboxIndeterminate5RadiusIcon } from './CheckboxIndeterminate5RadiusIcon';
|
|
39
38
|
export { CheckboxIndeterminateIcon } from './CheckboxIndeterminateIcon';
|
|
40
39
|
export { CheckboxUnchecked5RadiusIcon } from './CheckboxUnchecked5RadiusIcon';
|
|
41
40
|
export { CheckboxUncheckedIcon } from './CheckboxUncheckedIcon';
|
|
41
|
+
export { CheckSlimIcon } from './CheckSlimIcon';
|
|
42
42
|
export { CircleAddElementIcon } from './CircleAddElementIcon';
|
|
43
43
|
export { CircleNotificationsIcon } from './CircleNotificationsIcon';
|
|
44
44
|
export { CloseIcon } from './CloseIcon';
|
|
@@ -100,9 +100,9 @@ export { ForecastIcon } from './ForecastIcon';
|
|
|
100
100
|
export { ForwardIcon } from './ForwardIcon';
|
|
101
101
|
export { FreeDrawIcon } from './FreeDrawIcon';
|
|
102
102
|
export { FullReviewIcon } from './FullReviewIcon';
|
|
103
|
-
export { GPTIcon } from './GPTIcon';
|
|
104
103
|
export { GenerateAutoWizardIcon } from './GenerateAutoWizardIcon';
|
|
105
104
|
export { GetInsightIcon } from './GetInsightIcon';
|
|
105
|
+
export { GPTIcon } from './GPTIcon';
|
|
106
106
|
export { GridViewIcon } from './GridViewIcon';
|
|
107
107
|
export { GroupIcon } from './GroupIcon';
|
|
108
108
|
export { GroupLayerIcon } from './GroupLayerIcon';
|
|
@@ -145,8 +145,8 @@ export { MoveToIcon } from './MoveToIcon';
|
|
|
145
145
|
export { MuteIcon } from './MuteIcon';
|
|
146
146
|
export { NodeViewIcon } from './NodeViewIcon';
|
|
147
147
|
export { NotificationIcon } from './NotificationIcon';
|
|
148
|
-
export { NotificationSettingIcon } from './NotificationSettingIcon';
|
|
149
148
|
export { NotificationsActiveIcon } from './NotificationsActiveIcon';
|
|
149
|
+
export { NotificationSettingIcon } from './NotificationSettingIcon';
|
|
150
150
|
export { OpenNewTabIcon } from './OpenNewTabIcon';
|
|
151
151
|
export { OpenUrlIcon } from './OpenUrlIcon';
|
|
152
152
|
export { PageArticleIcon } from './PageArticleIcon';
|
|
@@ -156,7 +156,6 @@ export { PenDrawingIcon } from './PenDrawingIcon';
|
|
|
156
156
|
export { PersonAddDisabledIcon } from './PersonAddDisabledIcon';
|
|
157
157
|
export { PersonUserAccountIcon } from './PersonUserAccountIcon';
|
|
158
158
|
export { PhoneCallbackIcon } from './PhoneCallbackIcon';
|
|
159
|
-
export { PivotTableChartIcon } from './PivotTableChartIcon';
|
|
160
159
|
export { PlaneIcon } from './PlaneIcon';
|
|
161
160
|
export { PreviewIcon } from './PreviewIcon';
|
|
162
161
|
export { PreviewVisibilityEyeIcon } from './PreviewVisibilityEyeIcon';
|
|
@@ -232,7 +231,7 @@ export { ViewDetailsInformationIcon } from './ViewDetailsInformationIcon';
|
|
|
232
231
|
export { VisibilityOffEyeIcon } from './VisibilityOffEyeIcon';
|
|
233
232
|
export { WarningIcon } from './WarningIcon';
|
|
234
233
|
export { WebAssetIcon } from './WebAssetIcon';
|
|
235
|
-
export { WebIcon } from './WebIcon';
|
|
236
234
|
export { WebhookIcon } from './WebhookIcon';
|
|
235
|
+
export { WebIcon } from './WebIcon';
|
|
237
236
|
export { WidgetIcon } from './WidgetIcon';
|
|
238
237
|
export { WritingAIAssitantIcon } from './WritingAIAssitantIcon';
|
|
@@ -32,13 +32,13 @@ export { ChatBubbleOutlineIcon } from './ChatBubbleOutlineIcon';
|
|
|
32
32
|
export { ChatConversationCommentAddCommentIcon } from './ChatConversationCommentAddCommentIcon';
|
|
33
33
|
export { ChatMentionIcon } from './ChatMentionIcon';
|
|
34
34
|
export { ChatUnreadIcon } from './ChatUnreadIcon';
|
|
35
|
-
export { CheckSlimIcon } from './CheckSlimIcon';
|
|
36
35
|
export { CheckboxChecked5RadiusIcon } from './CheckboxChecked5RadiusIcon';
|
|
37
36
|
export { CheckboxCheckedIcon } from './CheckboxCheckedIcon';
|
|
38
37
|
export { CheckboxIndeterminate5RadiusIcon } from './CheckboxIndeterminate5RadiusIcon';
|
|
39
38
|
export { CheckboxIndeterminateIcon } from './CheckboxIndeterminateIcon';
|
|
40
39
|
export { CheckboxUnchecked5RadiusIcon } from './CheckboxUnchecked5RadiusIcon';
|
|
41
40
|
export { CheckboxUncheckedIcon } from './CheckboxUncheckedIcon';
|
|
41
|
+
export { CheckSlimIcon } from './CheckSlimIcon';
|
|
42
42
|
export { CircleAddElementIcon } from './CircleAddElementIcon';
|
|
43
43
|
export { CircleNotificationsIcon } from './CircleNotificationsIcon';
|
|
44
44
|
export { CloseIcon } from './CloseIcon';
|
|
@@ -100,9 +100,9 @@ export { ForecastIcon } from './ForecastIcon';
|
|
|
100
100
|
export { ForwardIcon } from './ForwardIcon';
|
|
101
101
|
export { FreeDrawIcon } from './FreeDrawIcon';
|
|
102
102
|
export { FullReviewIcon } from './FullReviewIcon';
|
|
103
|
-
export { GPTIcon } from './GPTIcon';
|
|
104
103
|
export { GenerateAutoWizardIcon } from './GenerateAutoWizardIcon';
|
|
105
104
|
export { GetInsightIcon } from './GetInsightIcon';
|
|
105
|
+
export { GPTIcon } from './GPTIcon';
|
|
106
106
|
export { GridViewIcon } from './GridViewIcon';
|
|
107
107
|
export { GroupIcon } from './GroupIcon';
|
|
108
108
|
export { GroupLayerIcon } from './GroupLayerIcon';
|
|
@@ -145,8 +145,8 @@ export { MoveToIcon } from './MoveToIcon';
|
|
|
145
145
|
export { MuteIcon } from './MuteIcon';
|
|
146
146
|
export { NodeViewIcon } from './NodeViewIcon';
|
|
147
147
|
export { NotificationIcon } from './NotificationIcon';
|
|
148
|
-
export { NotificationSettingIcon } from './NotificationSettingIcon';
|
|
149
148
|
export { NotificationsActiveIcon } from './NotificationsActiveIcon';
|
|
149
|
+
export { NotificationSettingIcon } from './NotificationSettingIcon';
|
|
150
150
|
export { OpenNewTabIcon } from './OpenNewTabIcon';
|
|
151
151
|
export { OpenUrlIcon } from './OpenUrlIcon';
|
|
152
152
|
export { PageArticleIcon } from './PageArticleIcon';
|
|
@@ -156,7 +156,6 @@ export { PenDrawingIcon } from './PenDrawingIcon';
|
|
|
156
156
|
export { PersonAddDisabledIcon } from './PersonAddDisabledIcon';
|
|
157
157
|
export { PersonUserAccountIcon } from './PersonUserAccountIcon';
|
|
158
158
|
export { PhoneCallbackIcon } from './PhoneCallbackIcon';
|
|
159
|
-
export { PivotTableChartIcon } from './PivotTableChartIcon';
|
|
160
159
|
export { PlaneIcon } from './PlaneIcon';
|
|
161
160
|
export { PreviewIcon } from './PreviewIcon';
|
|
162
161
|
export { PreviewVisibilityEyeIcon } from './PreviewVisibilityEyeIcon';
|
|
@@ -232,7 +231,7 @@ export { ViewDetailsInformationIcon } from './ViewDetailsInformationIcon';
|
|
|
232
231
|
export { VisibilityOffEyeIcon } from './VisibilityOffEyeIcon';
|
|
233
232
|
export { WarningIcon } from './WarningIcon';
|
|
234
233
|
export { WebAssetIcon } from './WebAssetIcon';
|
|
235
|
-
export { WebIcon } from './WebIcon';
|
|
236
234
|
export { WebhookIcon } from './WebhookIcon';
|
|
235
|
+
export { WebIcon } from './WebIcon';
|
|
237
236
|
export { WidgetIcon } from './WidgetIcon';
|
|
238
237
|
export { WritingAIAssitantIcon } from './WritingAIAssitantIcon';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { AccountSelection, type AccountSelectionProps } from './AccountSelection';
|
|
2
|
-
export { AccountListing } from './AccountListing';
|
|
3
|
-
export type { AccountListingHandle } from './AccountListing';
|
|
2
|
+
export { AccountListing, type AccountListingHandle } from './AccountListing';
|
|
4
3
|
export { useAccountSelection } from './hooks';
|
|
@@ -13,9 +13,9 @@ export const CalendarSelection = props => {
|
|
|
13
13
|
const { value, rangeLimit = RANGE_LIMIT, timezone = LOCAL_TIMEZONE, timeDisplayProps, popoverProps, rangePickerProps, onChange, } = props;
|
|
14
14
|
const [state, dispatch] = useReducer(reducer, INITIAL_STATE);
|
|
15
15
|
useLayoutEffect(() => {
|
|
16
|
-
if (!value)
|
|
16
|
+
if (!value || initialed.current)
|
|
17
17
|
return;
|
|
18
|
-
dispatch(initState(value,
|
|
18
|
+
dispatch(initState(value, initialed.current));
|
|
19
19
|
initialed.current = true;
|
|
20
20
|
}, [value]);
|
|
21
21
|
useLayoutEffect(() => {
|
|
@@ -13,18 +13,23 @@ import React, { useEffect, useState, useRef, useCallback } from 'react';
|
|
|
13
13
|
import clsx from 'clsx';
|
|
14
14
|
import axios from 'axios';
|
|
15
15
|
// Atoms
|
|
16
|
-
import { Button, Typography } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
16
|
+
import { Button, Popover, Typography } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
17
17
|
import { Input as AntdInput } from 'antd';
|
|
18
18
|
// Components
|
|
19
19
|
import MessageItem from './MessageItem';
|
|
20
20
|
import { CloseIcon, PlaneIcon, WarningIcon } from '@antscorp/antsomi-ui/es/components/icons';
|
|
21
|
+
import { QuestionItem } from './QuestionItem';
|
|
21
22
|
// Styled
|
|
22
|
-
import { ChatBoxWrapper, ChatBoxHeader, ChatBoxBody, ChatBoxFooter, WarningWrapper, InputWrapper, } from './styled';
|
|
23
|
+
import { ChatBoxWrapper, ChatBoxHeader, ChatBoxBody, ChatBoxFooter, WarningWrapper, InputWrapper, WrapperContentSuggest, } from './styled';
|
|
24
|
+
// Utils
|
|
25
|
+
import { buildConversation } from './utils';
|
|
26
|
+
// Constants
|
|
27
|
+
import { SUGGESTED_QUESTIONS } from './constants';
|
|
23
28
|
const { TextArea } = AntdInput;
|
|
24
29
|
const { Text } = Typography;
|
|
25
30
|
export const ChatBox = props => {
|
|
26
31
|
var _a;
|
|
27
|
-
const { onClose, domain, userId, token, withoutBox, avatar, style } = props;
|
|
32
|
+
const { onClose, domain, userId, token, withoutBox, avatar, style, isGenerativeMode = false, conversationData = [], } = props;
|
|
28
33
|
const [question, setQuestion] = useState('');
|
|
29
34
|
const [isClosed, setIsClosed] = useState(false);
|
|
30
35
|
const [limitMessage, setLimitMessage] = useState('');
|
|
@@ -35,6 +40,7 @@ export const ChatBox = props => {
|
|
|
35
40
|
const inputRef = useRef(null);
|
|
36
41
|
const initRef = useRef(false);
|
|
37
42
|
const answeringRef = useRef(false);
|
|
43
|
+
const [isOpenSuggestedQuestion, setIsOpenSuggestedQuestions] = useState(false);
|
|
38
44
|
const scrollBody = useCallback(() => {
|
|
39
45
|
if (bodyRef.current) {
|
|
40
46
|
bodyRef.current.scrollTo(0, bodyRef.current.scrollHeight);
|
|
@@ -69,24 +75,16 @@ export const ChatBox = props => {
|
|
|
69
75
|
},
|
|
70
76
|
});
|
|
71
77
|
if (result && result.data && result.data.data && result.data.data.rows) {
|
|
72
|
-
const initConversation =
|
|
73
|
-
result.data.data.rows
|
|
74
|
-
.sort((a, b) => a.message_id - b.message_id)
|
|
75
|
-
.forEach(mess => {
|
|
76
|
-
initConversation.push({
|
|
77
|
-
id: mess.message_id,
|
|
78
|
-
role: "user" /* Role.User */,
|
|
79
|
-
content: mess.message,
|
|
80
|
-
});
|
|
81
|
-
initConversation.push({
|
|
82
|
-
id: `gpt_${mess.message_id}`,
|
|
83
|
-
role: "assistant" /* Role.Assistant */,
|
|
84
|
-
content: mess.response_message,
|
|
85
|
-
});
|
|
86
|
-
});
|
|
78
|
+
const initConversation = buildConversation(result.data.data.rows);
|
|
87
79
|
setConversation(initConversation);
|
|
88
80
|
}
|
|
89
81
|
});
|
|
82
|
+
const handleClickQuestion = question => {
|
|
83
|
+
const { message } = question;
|
|
84
|
+
setQuestion(message);
|
|
85
|
+
setIsOpenSuggestedQuestions(false);
|
|
86
|
+
};
|
|
87
|
+
const renderContentSuggested = () => (React.createElement(WrapperContentSuggest, null, SUGGESTED_QUESTIONS.map((question) => (React.createElement(QuestionItem, Object.assign({}, question, { message: question.message, onClickItem: question => handleClickQuestion(question) }))))));
|
|
90
88
|
const request = (question) => __awaiter(void 0, void 0, void 0, function* () {
|
|
91
89
|
if (!question)
|
|
92
90
|
return;
|
|
@@ -108,9 +106,17 @@ export const ChatBox = props => {
|
|
|
108
106
|
}
|
|
109
107
|
});
|
|
110
108
|
useEffect(() => {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
if (conversationData && conversationData.length) {
|
|
110
|
+
const conversations = buildConversation(conversationData);
|
|
111
|
+
setConversation(conversations);
|
|
112
|
+
}
|
|
113
|
+
}, [conversationData]);
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (!isGenerativeMode) {
|
|
116
|
+
loadConversation();
|
|
117
|
+
if (inputRef.current) {
|
|
118
|
+
inputRef.current.focus();
|
|
119
|
+
}
|
|
114
120
|
}
|
|
115
121
|
}, []);
|
|
116
122
|
useEffect(() => {
|
|
@@ -139,7 +145,7 @@ export const ChatBox = props => {
|
|
|
139
145
|
onClose();
|
|
140
146
|
}
|
|
141
147
|
};
|
|
142
|
-
const renderMessage = (message, idx, isPlaceholder = false) => (React.createElement(MessageItem, Object.assign({ key: idx, idx: idx }, message, { scrollBody: scrollBody, renderDone: renderDone, doAnimation: initRef.current && idx === conversation.length - 1, avatar: avatar, isPlaceholder: isPlaceholder })));
|
|
148
|
+
const renderMessage = (message, idx, isPlaceholder = false) => (React.createElement(MessageItem, Object.assign({ key: idx, idx: idx }, message, { scrollBody: scrollBody, renderDone: renderDone, doAnimation: initRef.current && idx === conversation.length - 1, avatar: avatar, isPlaceholder: isPlaceholder, isGenerativeMode: isGenerativeMode })));
|
|
143
149
|
const handleKeyDown = e => {
|
|
144
150
|
if (e.key === 'Enter') {
|
|
145
151
|
e.preventDefault();
|
|
@@ -177,6 +183,12 @@ export const ChatBox = props => {
|
|
|
177
183
|
limitMessage && (React.createElement(WarningWrapper, null,
|
|
178
184
|
React.createElement(WarningIcon, { className: clsx('icon') }),
|
|
179
185
|
React.createElement(Text, null, limitMessage))),
|
|
186
|
+
isGenerativeMode && (React.createElement(Popover, { arrow: false, title: "Suggested Questions", placement: "bottom", content: renderContentSuggested(), trigger: "click", open: isOpenSuggestedQuestion, getPopupContainer: triggerNode => triggerNode, onOpenChange: isOpen => setIsOpenSuggestedQuestions(isOpen), overlayInnerStyle: {
|
|
187
|
+
padding: '12px 16px',
|
|
188
|
+
minWidth: '330px',
|
|
189
|
+
overflow: 'auto',
|
|
190
|
+
} },
|
|
191
|
+
React.createElement(Button, { onClick: () => setIsOpenSuggestedQuestions(true), type: "text" }, "Suggested Questions"))),
|
|
180
192
|
React.createElement(InputWrapper, null,
|
|
181
193
|
React.createElement(TextArea, { ref: inputRef, value: question, onChange: e => setQuestion(e.target.value), className: clsx('input'), placeholder: "Type your question...", onKeyDown: handleKeyDown, autoSize: true }),
|
|
182
194
|
React.createElement(Button, { disabled: isAnswering, className: clsx('submit-btn', { disabled: isAnswering }), onClick: () => handleKeyDown({ key: 'Enter', preventDefault: () => null }) },
|
|
@@ -9,9 +9,10 @@ import { Typography } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
|
9
9
|
// Components
|
|
10
10
|
import { GPTIcon, UserIcon } from '@antscorp/antsomi-ui/es/components/icons';
|
|
11
11
|
// Style
|
|
12
|
-
import { MessageItemWrapper } from './styled';
|
|
12
|
+
import { MessageItemWrapper, WrapperIsHelpful } from './styled';
|
|
13
|
+
import Icon from '@antscorp/icons';
|
|
13
14
|
const { Text } = Typography;
|
|
14
|
-
const MessageItem = ({ role, content, scrollBody, renderDone, doAnimation, avatar, idx, isPlaceholder, renderType, }) => {
|
|
15
|
+
const MessageItem = ({ role, content, scrollBody, renderDone, doAnimation, avatar, idx, isPlaceholder, renderType, isGenerativeMode, }) => {
|
|
15
16
|
const isBot = role === "assistant" /* Role.Assistant */;
|
|
16
17
|
const [text, setText] = useState(isBot && doAnimation ? '' : content);
|
|
17
18
|
const contentRef = useRef();
|
|
@@ -46,7 +47,7 @@ const MessageItem = ({ role, content, scrollBody, renderDone, doAnimation, avata
|
|
|
46
47
|
const newContent = isPlaceholder ? (React.createElement("div", { className: "reactMarkDown" },
|
|
47
48
|
React.createElement("pre", null,
|
|
48
49
|
React.createElement("code", null,
|
|
49
|
-
React.createElement("span", null))))) : (React.createElement(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeHighlight], className:
|
|
50
|
+
React.createElement("span", null))))) : (React.createElement(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeHighlight], className: clsx('reactMarkDown', role === "user" /* Role.User */ && 'user') }, text));
|
|
50
51
|
contentRef.current = newContent;
|
|
51
52
|
return contentRef.current;
|
|
52
53
|
}
|
|
@@ -54,11 +55,16 @@ const MessageItem = ({ role, content, scrollBody, renderDone, doAnimation, avata
|
|
|
54
55
|
return contentRef.current;
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
|
-
return (React.createElement(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
return (React.createElement(React.Fragment, null,
|
|
59
|
+
React.createElement(MessageItemWrapper, { className: clsx({ greyBg: isBot }), isGenerativeMode: isGenerativeMode },
|
|
60
|
+
MAP_ICON[role],
|
|
61
|
+
renderType === 'markdown' ? (React.createElement("div", { className: isPlaceholder || (isBot && doAnimation && text.length < content.length)
|
|
62
|
+
? 'ants-text-streaming'
|
|
63
|
+
: '' }, renderMarkdown())) : (React.createElement(Text, { className: isPlaceholder || (isBot && doAnimation && text !== content) ? 'ants-text-streaming' : '' }, isPlaceholder ? '' : text))),
|
|
64
|
+
isGenerativeMode && role === "assistant" /* Role.Assistant */ && (React.createElement(WrapperIsHelpful, null,
|
|
65
|
+
React.createElement("span", null, "Was this answer helful?"),
|
|
66
|
+
React.createElement(Icon, { className: 'icon-vote', type: 'icon-ants-angle-up' }),
|
|
67
|
+
React.createElement(Icon, { className: 'icon-vote', type: 'icon-ants-angle-down' })))));
|
|
62
68
|
};
|
|
63
69
|
MessageItem.defaultProps = {
|
|
64
70
|
renderType: 'markdown',
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
const Item = styled.div `
|
|
4
|
+
padding: 10px;
|
|
5
|
+
background-color: #f3f9ff;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
`;
|
|
8
|
+
export const QuestionItem = props => {
|
|
9
|
+
const { message, onClickItem } = props;
|
|
10
|
+
return React.createElement(Item, { onClick: () => onClickItem(Object.assign({}, props)) }, message);
|
|
11
|
+
};
|
|
@@ -49,3 +49,30 @@ export const CONVERSATION = [
|
|
|
49
49
|
},
|
|
50
50
|
];
|
|
51
51
|
export const LIMIT_MESSAGE = 10;
|
|
52
|
+
export const SUGGESTED_QUESTIONS = [
|
|
53
|
+
{
|
|
54
|
+
message_id: 54000,
|
|
55
|
+
message: `How many users did I have last week?`,
|
|
56
|
+
ctime: '2023-05-30T08:58:42.017Z',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
message_id: 54001,
|
|
60
|
+
message: `What are my top pages and screens by weeks?`,
|
|
61
|
+
ctime: '2023-05-30T08:58:42.017Z',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
message_id: 54002,
|
|
65
|
+
message: `On what days I get the most users?`,
|
|
66
|
+
ctime: '2023-05-30T08:58:42.017Z',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
message_id: 54003,
|
|
70
|
+
message: `How many new users this year?`,
|
|
71
|
+
ctime: '2023-05-30T08:58:42.017Z',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
message_id: 54004,
|
|
75
|
+
message: `What are my top events by users?`,
|
|
76
|
+
ctime: '2023-05-30T08:58:42.017Z',
|
|
77
|
+
},
|
|
78
|
+
];
|
|
@@ -4,7 +4,11 @@ export declare const ChatBoxWrapper: import("styled-components").StyledComponent
|
|
|
4
4
|
export declare const ChatBoxHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
5
|
export declare const ChatBoxBody: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
6
|
export declare const ChatBoxFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
-
export declare const MessageItemWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
export declare const MessageItemWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
+
isGenerativeMode?: boolean | undefined;
|
|
9
|
+
}, never>;
|
|
8
10
|
export declare const WarningWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
11
|
export declare const InputWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
12
|
export declare const TypingCursor: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
13
|
+
export declare const WrapperIsHelpful: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
14
|
+
export declare const WrapperContentSuggest: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
// Libraries
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
// Constantsim
|
|
@@ -98,7 +97,7 @@ export const MessageItemWrapper = styled.div `
|
|
|
98
97
|
// text-align: justify;
|
|
99
98
|
|
|
100
99
|
&.greyBg {
|
|
101
|
-
background: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.bw2};
|
|
100
|
+
background: ${props => { var _a; return (props.isGenerativeMode ? '' : (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.bw2); }};
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
.icon {
|
|
@@ -119,6 +118,14 @@ export const MessageItemWrapper = styled.div `
|
|
|
119
118
|
}
|
|
120
119
|
.reactMarkDown {
|
|
121
120
|
white-space: pre-wrap;
|
|
121
|
+
|
|
122
|
+
&.user {
|
|
123
|
+
${({ isGenerativeMode }) => isGenerativeMode &&
|
|
124
|
+
`
|
|
125
|
+
padding: 5px;
|
|
126
|
+
background-color: #F3F9FF;
|
|
127
|
+
`}
|
|
128
|
+
}
|
|
122
129
|
}
|
|
123
130
|
.reactMarkDown * {
|
|
124
131
|
font-size: 12px;
|
|
@@ -278,3 +285,22 @@ export const TypingCursor = styled.div `
|
|
|
278
285
|
// typing 3.5s steps(40, end),
|
|
279
286
|
// blink-caret .75s step-end infinite;
|
|
280
287
|
`;
|
|
288
|
+
export const WrapperIsHelpful = styled.div `
|
|
289
|
+
font-size: 11px;
|
|
290
|
+
color: #949494;
|
|
291
|
+
padding: 0 60px;
|
|
292
|
+
|
|
293
|
+
.icon-vote {
|
|
294
|
+
font-size: 18px;
|
|
295
|
+
margin-left: 10px;
|
|
296
|
+
cursor: pointer;
|
|
297
|
+
&:hover {
|
|
298
|
+
background-color: #e8e8e8;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
`;
|
|
302
|
+
export const WrapperContentSuggest = styled.div `
|
|
303
|
+
display: flex;
|
|
304
|
+
flex-direction: column;
|
|
305
|
+
gap: 10px;
|
|
306
|
+
`;
|
|
@@ -20,6 +20,7 @@ export interface IChatBoxMessageProps extends Message {
|
|
|
20
20
|
avatar?: string;
|
|
21
21
|
idx?: number;
|
|
22
22
|
renderType: 'text' | 'markdown';
|
|
23
|
+
isGenerativeMode?: boolean;
|
|
23
24
|
}
|
|
24
25
|
export interface IChatBoxProps {
|
|
25
26
|
onClose?: Function;
|
|
@@ -29,4 +30,6 @@ export interface IChatBoxProps {
|
|
|
29
30
|
token: string;
|
|
30
31
|
avatar?: string;
|
|
31
32
|
style?: Record<string, any>;
|
|
33
|
+
isGenerativeMode?: boolean;
|
|
34
|
+
conversationData?: Record<string, any>[];
|
|
32
35
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const buildConversation = rows => {
|
|
2
|
+
const initConversation = [];
|
|
3
|
+
rows
|
|
4
|
+
.sort((a, b) => a.message_id - b.message_id)
|
|
5
|
+
.forEach(mess => {
|
|
6
|
+
initConversation.push({
|
|
7
|
+
id: mess.message_id,
|
|
8
|
+
role: "user" /* Role.User */,
|
|
9
|
+
content: mess.message,
|
|
10
|
+
});
|
|
11
|
+
initConversation.push({
|
|
12
|
+
id: `gpt_${mess.message_id}`,
|
|
13
|
+
role: "assistant" /* Role.Assistant */,
|
|
14
|
+
content: mess.response_message,
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
return initConversation;
|
|
18
|
+
};
|
|
@@ -53,7 +53,7 @@ const styleContainAlpha = {
|
|
|
53
53
|
const CustomPicker = props => {
|
|
54
54
|
var _a, _b, _c, _d;
|
|
55
55
|
// Props
|
|
56
|
-
const { className, style, children, onChange, onChangeComplete, presetColors } = props, restOf = __rest(props, ["className", "style", "children", "onChange", "onChangeComplete", "presetColors"]);
|
|
56
|
+
const { className, style, children, isHideAlpha, onChange, onChangeComplete, presetColors } = props, restOf = __rest(props, ["className", "style", "children", "isHideAlpha", "onChange", "onChangeComplete", "presetColors"]);
|
|
57
57
|
// State
|
|
58
58
|
const [isShowRgbaInput, setShowRgbaInput] = useState(true);
|
|
59
59
|
const onChangeRgbaColor = (key, value) => {
|
|
@@ -101,9 +101,9 @@ const CustomPicker = props => {
|
|
|
101
101
|
React.createElement("div", { style: rgbaStyling },
|
|
102
102
|
React.createElement(InputNumberWrapper, { value: (_c = props.rgb) === null || _c === void 0 ? void 0 : _c.b, controls: false, onChange: value => onChangeRgbaColor('b', value) }),
|
|
103
103
|
React.createElement(Text, { style: { position: 'absolute', bottom: '-20px' } }, "B")),
|
|
104
|
-
React.createElement("div", { style: rgbaStyling },
|
|
104
|
+
!isHideAlpha && (React.createElement("div", { style: rgbaStyling },
|
|
105
105
|
React.createElement(InputNumberWrapper, { value: (_d = props.rgb) === null || _d === void 0 ? void 0 : _d.a, controls: false, onChange: value => onChangeRgbaColor('a', value) }),
|
|
106
|
-
React.createElement(Text, { style: { position: 'absolute', bottom: '-20px' } }, "A")))) : (React.createElement(EditableInputWrapper, null,
|
|
106
|
+
React.createElement(Text, { style: { position: 'absolute', bottom: '-20px' } }, "A"))))) : (React.createElement(EditableInputWrapper, null,
|
|
107
107
|
React.createElement(EditableInput, { value: props.color, onChange: onChange }),
|
|
108
108
|
React.createElement(Text, { style: { position: 'absolute', bottom: '-20px' } }, "HEX"))),
|
|
109
109
|
React.createElement(Button, { onClick: () => {
|
|
@@ -21,7 +21,7 @@ const styleBtnColor = {
|
|
|
21
21
|
};
|
|
22
22
|
export const ColorPicker = props => {
|
|
23
23
|
// Props
|
|
24
|
-
const { className = '', defaultColor = '#000000', presetColors, positionInput = 'left', icon, showInput = true, style = {}, } = props;
|
|
24
|
+
const { className = '', defaultColor = '#000000', presetColors, positionInput = 'left', icon, showInput = true, style = {}, isHideAlpha, } = props;
|
|
25
25
|
const { onChange = () => { } } = props;
|
|
26
26
|
// States
|
|
27
27
|
const [color, setColor] = useState(defaultColor);
|
|
@@ -74,7 +74,7 @@ export const ColorPicker = props => {
|
|
|
74
74
|
};
|
|
75
75
|
return (React.createElement(ColorPickerWrapper, { className: `antsomi-color-picker ${className || ''}`, style: style },
|
|
76
76
|
showInput && positionInput === 'left' && (React.createElement(Input, { style: { textTransform: 'uppercase' }, value: color, onChange: onChangeColorInput })),
|
|
77
|
-
React.createElement(Popover, { arrow: true, content: React.createElement(CustomPicker, { color: color, presetColors: presetColors, onChange: onChangeColorPicker, onChangeComplete: onChangeComplete }), trigger: "click", open: popoverVisible, getPopupContainer: triggerNode => triggerNode, onOpenChange: onPopoverVisibleChange },
|
|
77
|
+
React.createElement(Popover, { arrow: true, content: React.createElement(CustomPicker, { color: color, presetColors: presetColors, isHideAlpha: isHideAlpha, onChange: onChangeColorPicker, onChangeComplete: onChangeComplete }), trigger: "click", open: popoverVisible, getPopupContainer: triggerNode => triggerNode, onOpenChange: onPopoverVisibleChange },
|
|
78
78
|
React.createElement("div", { className: "antsomi-popover-button", style: styleBtnColor }, iconNode || (React.createElement("span", { style: {
|
|
79
79
|
backgroundColor: color,
|
|
80
80
|
display: 'block',
|
|
@@ -88,6 +88,7 @@ ColorPicker.defaultProps = {
|
|
|
88
88
|
className: '',
|
|
89
89
|
color: '#000000',
|
|
90
90
|
defaultColor: '#000000',
|
|
91
|
+
isHideAlpha: false,
|
|
91
92
|
onChange: () => { },
|
|
92
93
|
showInput: true,
|
|
93
94
|
positionInput: 'left',
|
package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js
CHANGED
|
@@ -57,7 +57,7 @@ export const AdvancedRangePicker = props => {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
return (React.createElement(Space, { size:
|
|
60
|
+
return (React.createElement(Space, { size: 15, align: "end", className: className || '' },
|
|
61
61
|
React.createElement(AdvancedPicker, { valueType: valueType, disabled: disabled, label: showLabel ? t(translations.datePicker.startDate) || '' : '', date: timeRange.startDate.date, option: omit(timeRange.startDate, 'date'), operatorKey: "between", type: "startDate", format: useFormatMapping
|
|
62
62
|
? getFormatDisplayFromValueType('startDate', valueType)
|
|
63
63
|
: ADVANCED_RANGE_PICKER_FORMAT.startDate,
|
|
@@ -37,7 +37,7 @@ export const FontSettingEdit = ({ settings, styles, showSettings, onChange, }) =
|
|
|
37
37
|
[settings]);
|
|
38
38
|
const filteredSetting = useMemo(() => {
|
|
39
39
|
if (!showSettings || (showSettings === null || showSettings === void 0 ? void 0 : showSettings.length) === 0) {
|
|
40
|
-
return Object.keys(settingMap).map(keySetting => settingMap[keySetting]);
|
|
40
|
+
return Object.keys(settingMap).map(keySetting => (React.createElement(React.Fragment, { key: keySetting }, settingMap[keySetting])));
|
|
41
41
|
}
|
|
42
42
|
return showSettings.map(keySetting => settingMap[keySetting]);
|
|
43
43
|
}, [showSettings, settingMap]);
|
|
@@ -721,7 +721,7 @@ export const SAMPLE_RICHMENU = {
|
|
|
721
721
|
displayDefault: true,
|
|
722
722
|
},
|
|
723
723
|
image: {
|
|
724
|
-
imageUrl: 'https://
|
|
724
|
+
imageUrl: 'https://s.cystack.net/portal/organizations/487b0f9dd9d8543312dc25e32ac71e4f/logo.jpg',
|
|
725
725
|
imageStyles: {
|
|
726
726
|
borderTopLeftRadius: '0px',
|
|
727
727
|
borderTopRightRadius: '0px',
|
|
@@ -131,8 +131,8 @@ export const TemplateSaveAsStyled = styled(Flex) `
|
|
|
131
131
|
width: 250px;
|
|
132
132
|
height: 36px;
|
|
133
133
|
border: 1px solid #b8cfe6;
|
|
134
|
-
padding: 0 5px;
|
|
135
134
|
border-radius: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.borderRadiusXL}px;
|
|
135
|
+
padding: 0 10px;
|
|
136
136
|
|
|
137
137
|
& > .remove-btn {
|
|
138
138
|
cursor: pointer;
|