@lobehub/ui 1.6.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Chat/const.d.ts +1 -0
- package/es/Chat/const.js +1 -0
- package/es/Chat/index.d.ts +2 -0
- package/es/Chat/index.js +2 -0
- package/es/Chat/store/index.d.ts +20 -0
- package/es/Chat/store/index.js +16 -0
- package/es/Chat/store/initialState.d.ts +28 -0
- package/es/Chat/store/initialState.js +9 -0
- package/es/Chat/store/messageReducer.d.ts +37 -0
- package/es/Chat/store/messageReducer.js +67 -0
- package/es/Chat/store/selectors.d.ts +9 -0
- package/es/Chat/store/selectors.js +44 -0
- package/es/Chat/store/store.d.ts +34 -0
- package/es/Chat/store/store.js +240 -0
- package/es/Chat/types.d.ts +77 -0
- package/es/Chat/types.js +1 -0
- package/es/Chat/utils/fetch.d.ts +11 -0
- package/es/Chat/utils/fetch.js +100 -0
- package/es/Conversation/App.d.ts +13 -0
- package/es/Conversation/App.js +43 -0
- package/es/Conversation/ChatList/MessageItem/Content.d.ts +8 -0
- package/es/Conversation/ChatList/MessageItem/Content.js +103 -0
- package/es/Conversation/ChatList/MessageItem/Toolbar.d.ts +10 -0
- package/es/Conversation/ChatList/MessageItem/Toolbar.js +94 -0
- package/es/Conversation/ChatList/MessageItem/index.d.ts +9 -0
- package/es/Conversation/ChatList/MessageItem/index.js +126 -0
- package/es/Conversation/ChatList/index.d.ts +14 -0
- package/es/Conversation/ChatList/index.js +62 -0
- package/es/Conversation/InputArea/ActionBar.d.ts +4 -0
- package/es/Conversation/InputArea/ActionBar.js +71 -0
- package/es/Conversation/InputArea/index.d.ts +4 -0
- package/es/Conversation/InputArea/index.js +101 -0
- package/es/Conversation/StoreUpdater.d.ts +7 -0
- package/es/Conversation/StoreUpdater.js +27 -0
- package/es/Conversation/index.d.ts +8 -0
- package/es/Conversation/index.js +28 -0
- package/es/EditableMessageList/index.d.ts +9 -0
- package/es/EditableMessageList/index.js +101 -0
- package/es/EditableText/index.d.ts +1 -1
- package/es/EditableText/index.js +1 -1
- package/es/Highlighter/SyntaxHighlighter/style.js +1 -1
- package/es/Highlighter/style.js +1 -1
- package/es/Logo/style.js +1 -1
- package/es/Markdown/style.js +1 -1
- package/es/Snippet/style.js +1 -1
- package/es/StroyBook/style.js +3 -3
- package/es/ThemeProvider/GlobalStyle.js +4 -3
- package/es/Tooltip/style.js +1 -1
- package/es/index.d.ts +3 -0
- package/es/index.js +2 -0
- package/es/styles/customStylish.js +4 -4
- package/es/styles/theme/base.js +6 -2
- package/lib/Chat/const.d.ts +1 -0
- package/lib/Chat/const.js +29 -0
- package/lib/Chat/index.d.ts +2 -0
- package/lib/Chat/index.js +31 -0
- package/lib/Chat/store/index.d.ts +20 -0
- package/lib/Chat/store/index.js +44 -0
- package/lib/Chat/store/initialState.d.ts +28 -0
- package/lib/Chat/store/initialState.js +37 -0
- package/lib/Chat/store/messageReducer.d.ts +37 -0
- package/lib/Chat/store/messageReducer.js +82 -0
- package/lib/Chat/store/selectors.d.ts +9 -0
- package/lib/Chat/store/selectors.js +53 -0
- package/lib/Chat/store/store.d.ts +34 -0
- package/lib/Chat/store/store.js +119 -0
- package/lib/Chat/types.d.ts +77 -0
- package/lib/Chat/types.js +17 -0
- package/lib/Chat/utils/fetch.d.ts +11 -0
- package/lib/Chat/utils/fetch.js +72 -0
- package/lib/Conversation/App.d.ts +13 -0
- package/lib/Conversation/App.js +53 -0
- package/lib/Conversation/ChatList/MessageItem/Content.d.ts +8 -0
- package/lib/Conversation/ChatList/MessageItem/Content.js +104 -0
- package/lib/Conversation/ChatList/MessageItem/Toolbar.d.ts +10 -0
- package/lib/Conversation/ChatList/MessageItem/Toolbar.js +110 -0
- package/lib/Conversation/ChatList/MessageItem/index.d.ts +9 -0
- package/lib/Conversation/ChatList/MessageItem/index.js +164 -0
- package/lib/Conversation/ChatList/index.d.ts +14 -0
- package/lib/Conversation/ChatList/index.js +61 -0
- package/lib/Conversation/InputArea/ActionBar.d.ts +4 -0
- package/lib/Conversation/InputArea/ActionBar.js +97 -0
- package/lib/Conversation/InputArea/index.d.ts +4 -0
- package/lib/Conversation/InputArea/index.js +149 -0
- package/lib/Conversation/StoreUpdater.d.ts +7 -0
- package/lib/Conversation/StoreUpdater.js +54 -0
- package/lib/Conversation/index.d.ts +8 -0
- package/lib/Conversation/index.js +45 -0
- package/lib/EditableMessageList/index.d.ts +9 -0
- package/lib/EditableMessageList/index.js +124 -0
- package/lib/EditableText/index.d.ts +1 -1
- package/lib/EditableText/index.js +1 -1
- package/lib/Highlighter/SyntaxHighlighter/style.js +4 -1
- package/lib/Highlighter/style.js +11 -13
- package/lib/Logo/style.js +1 -1
- package/lib/Markdown/style.js +27 -37
- package/lib/Snippet/style.js +16 -12
- package/lib/StroyBook/style.js +5 -2
- package/lib/ThemeProvider/GlobalStyle.js +23 -9
- package/lib/Tooltip/style.js +8 -5
- package/lib/{EditableText → components}/ControlInput.js +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +6 -0
- package/lib/styles/customStylish.js +6 -5
- package/lib/styles/theme/base.js +6 -2
- package/package.json +16 -3
- /package/es/{EditableText → components}/ControlInput.d.ts +0 -0
- /package/es/{EditableText → components}/ControlInput.js +0 -0
- /package/lib/{EditableText → components}/ControlInput.d.ts +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CSSProperties, FC } from 'react';
|
|
2
|
+
interface ChatListProps {
|
|
3
|
+
/**
|
|
4
|
+
* @title 是否只读
|
|
5
|
+
*/
|
|
6
|
+
readonly?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* @title 是否包含系统消息
|
|
9
|
+
*/
|
|
10
|
+
includeSystem?: boolean;
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
declare const ChatList: FC<ChatListProps>;
|
|
14
|
+
export default ChatList;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
4
|
+
var _templateObject, _templateObject2;
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
import { createStyles } from 'antd-style';
|
|
8
|
+
import isEqual from 'fast-deep-equal';
|
|
9
|
+
import { memo } from 'react';
|
|
10
|
+
import { Center, Flexbox } from 'react-layout-kit';
|
|
11
|
+
import { useStore } from "../../Chat/store";
|
|
12
|
+
import MessageItem from "./MessageItem";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
var useStyles = createStyles(function (_ref) {
|
|
16
|
+
var css = _ref.css,
|
|
17
|
+
token = _ref.token;
|
|
18
|
+
return {
|
|
19
|
+
loading: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 12px;\n background: ", ";\n border-radius: 8px;\n "])), token.colorFillQuaternary),
|
|
20
|
+
btn: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 12px;\n color: ", ";\n background: transparent;\n border: 2px solid ", " !important;\n "])), token.colorTextSecondary, token.colorBorderSecondary)
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
var ChatList = /*#__PURE__*/memo(function (_ref2) {
|
|
24
|
+
var readonly = _ref2.readonly,
|
|
25
|
+
_ref2$includeSystem = _ref2.includeSystem,
|
|
26
|
+
includeSystem = _ref2$includeSystem === void 0 ? false : _ref2$includeSystem,
|
|
27
|
+
style = _ref2.style;
|
|
28
|
+
// const [messages, loading] = useStore((s) => [s.messages, s.loading], isEqual);
|
|
29
|
+
var _useStyles = useStyles(),
|
|
30
|
+
styles = _useStyles.styles;
|
|
31
|
+
var _useStore = useStore(function (s) {
|
|
32
|
+
return [s.messages, s.loading];
|
|
33
|
+
}, isEqual),
|
|
34
|
+
_useStore2 = _slicedToArray(_useStore, 2),
|
|
35
|
+
messages = _useStore2[0],
|
|
36
|
+
loading = _useStore2[1];
|
|
37
|
+
return !messages || messages.length === 0 ? null : /*#__PURE__*/_jsxs(Flexbox, {
|
|
38
|
+
gap: 8,
|
|
39
|
+
style: style,
|
|
40
|
+
children: [messages
|
|
41
|
+
// 根据情况确认是否包含系统
|
|
42
|
+
.filter(function (s) {
|
|
43
|
+
return !includeSystem ? s.role !== 'system' : !!s;
|
|
44
|
+
}).map(function (item, index) {
|
|
45
|
+
return /*#__PURE__*/_jsx(MessageItem, _objectSpread({
|
|
46
|
+
readonly: readonly,
|
|
47
|
+
index: index
|
|
48
|
+
}, item), index);
|
|
49
|
+
}), loading ? /*#__PURE__*/_jsx(Center, {
|
|
50
|
+
id: 'for-loading',
|
|
51
|
+
className: styles.loading,
|
|
52
|
+
children: /*#__PURE__*/_jsxs(Flexbox, {
|
|
53
|
+
horizontal: true,
|
|
54
|
+
distribution: 'space-between',
|
|
55
|
+
align: 'center',
|
|
56
|
+
gap: 24,
|
|
57
|
+
children: [/*#__PURE__*/_jsx("div", {}), "\u6B63\u5728\u751F\u6210...", /*#__PURE__*/_jsx("div", {})]
|
|
58
|
+
})
|
|
59
|
+
}) : null]
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
export default ChatList;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
3
|
+
var _templateObject;
|
|
4
|
+
import { createStyles } from 'antd-style';
|
|
5
|
+
import { memo } from 'react';
|
|
6
|
+
import { Flexbox } from 'react-layout-kit';
|
|
7
|
+
import { shallow } from 'zustand/shallow';
|
|
8
|
+
import IconAction from "../../ActionIcon";
|
|
9
|
+
import { ConfigProvider, Popconfirm, Tooltip } from 'antd';
|
|
10
|
+
import { EraserIcon } from 'lucide-react';
|
|
11
|
+
import { chatSelectors, useStore } from "../../Chat/store";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
var useStyles = createStyles(function (_ref) {
|
|
15
|
+
var css = _ref.css,
|
|
16
|
+
token = _ref.token;
|
|
17
|
+
return {
|
|
18
|
+
extra: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorTextTertiary)
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
export var ActionBar = function ActionBar() {
|
|
22
|
+
var _useStore = useStore(function (s) {
|
|
23
|
+
return [chatSelectors.totalTokenCount(s), chatSelectors.agentTokenCount(s), chatSelectors.messagesTokenCount(s), s.dispatchMessage];
|
|
24
|
+
}, shallow),
|
|
25
|
+
_useStore2 = _slicedToArray(_useStore, 4),
|
|
26
|
+
totalToken = _useStore2[0],
|
|
27
|
+
agentToken = _useStore2[1],
|
|
28
|
+
messagesToken = _useStore2[2],
|
|
29
|
+
dispatchMessage = _useStore2[3];
|
|
30
|
+
var _useStyles = useStyles(),
|
|
31
|
+
styles = _useStyles.styles,
|
|
32
|
+
theme = _useStyles.theme;
|
|
33
|
+
return totalToken > 0 ? /*#__PURE__*/_jsx(ConfigProvider, {
|
|
34
|
+
theme: {
|
|
35
|
+
token: {
|
|
36
|
+
colorText: theme.colorTextSecondary
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
children: /*#__PURE__*/_jsxs(Flexbox, {
|
|
40
|
+
align: 'center',
|
|
41
|
+
direction: 'horizontal-reverse',
|
|
42
|
+
paddingInline: 12,
|
|
43
|
+
className: styles.extra,
|
|
44
|
+
gap: 8,
|
|
45
|
+
children: [/*#__PURE__*/_jsx(Popconfirm, {
|
|
46
|
+
title: '你即将要清空会话,清空后将无法找回。是否清空当前会话?',
|
|
47
|
+
okButtonProps: {
|
|
48
|
+
danger: true
|
|
49
|
+
},
|
|
50
|
+
okText: '清空会话',
|
|
51
|
+
onConfirm: function onConfirm() {
|
|
52
|
+
dispatchMessage({
|
|
53
|
+
type: 'resetMessages'
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
children: /*#__PURE__*/_jsx(IconAction, {
|
|
57
|
+
title: '清空当前会话',
|
|
58
|
+
size: 'small',
|
|
59
|
+
icon: EraserIcon
|
|
60
|
+
})
|
|
61
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
62
|
+
title: [agentToken > 0 ? "\u89D2\u8272\u5B9A\u4E49: ".concat(agentToken) : null, messagesToken > 0 ? "\u4F1A\u8BDD: ".concat(messagesToken) : null].filter(Boolean).join(' | '),
|
|
63
|
+
children: /*#__PURE__*/_jsxs(Flexbox, {
|
|
64
|
+
gap: 4,
|
|
65
|
+
children: [" Tokens: ", totalToken]
|
|
66
|
+
})
|
|
67
|
+
})]
|
|
68
|
+
})
|
|
69
|
+
}) : null;
|
|
70
|
+
};
|
|
71
|
+
export default /*#__PURE__*/memo(ActionBar);
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
|
|
3
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
4
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
5
|
+
import { SendOutlined } from '@ant-design/icons';
|
|
6
|
+
import { Button, ConfigProvider, Input } from 'antd';
|
|
7
|
+
import { createStyles, useResponsive } from 'antd-style';
|
|
8
|
+
import { memo, useRef } from 'react';
|
|
9
|
+
import { Flexbox } from 'react-layout-kit';
|
|
10
|
+
import { shallow } from 'zustand/shallow';
|
|
11
|
+
import { chatSelectors, useStore, useStoreApi } from "../../Chat/store";
|
|
12
|
+
import ActionBar from "./ActionBar";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
var useStyles = createStyles(function (_ref) {
|
|
16
|
+
var css = _ref.css,
|
|
17
|
+
responsive = _ref.responsive,
|
|
18
|
+
token = _ref.token;
|
|
19
|
+
return {
|
|
20
|
+
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: sticky;\n z-index: ", ";\n bottom: 0;\n\n width: ", "px;\n padding-top: 12px;\n padding-bottom: 24px;\n\n background-image: linear-gradient(to top, ", " 88%, transparent 100%);\n\n ", " {\n width: 100%;\n }\n "])), token.zIndexPopupBase, token.contentWidth, token.colorBgLayout, responsive.mobile),
|
|
21
|
+
boxShadow: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n border-radius: 8px;\n box-shadow: ", ";\n "])), token.boxShadowSecondary),
|
|
22
|
+
input: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n border-radius: 8px;\n "]))),
|
|
23
|
+
btn: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 10;\n right: 8px;\n bottom: 8px;\n\n color: ", ";\n &:hover {\n color: ", ";\n }\n "])), token.colorTextTertiary, token.colorTextSecondary),
|
|
24
|
+
extra: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorTextTertiary)
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
export var InputArea = function InputArea(_ref2) {
|
|
28
|
+
_objectDestructuringEmpty(_ref2);
|
|
29
|
+
var _useStore = useStore(function (s) {
|
|
30
|
+
return [s.message, s.sendMessage, s.loading, chatSelectors.disableInput(s)];
|
|
31
|
+
}, shallow),
|
|
32
|
+
_useStore2 = _slicedToArray(_useStore, 4),
|
|
33
|
+
message = _useStore2[0],
|
|
34
|
+
sendMessage = _useStore2[1],
|
|
35
|
+
isLoading = _useStore2[2],
|
|
36
|
+
disabled = _useStore2[3];
|
|
37
|
+
var isChineseInput = useRef(false);
|
|
38
|
+
var _useStyles = useStyles(),
|
|
39
|
+
styles = _useStyles.styles,
|
|
40
|
+
theme = _useStyles.theme;
|
|
41
|
+
var _useResponsive = useResponsive(),
|
|
42
|
+
mobile = _useResponsive.mobile;
|
|
43
|
+
var storeApi = useStoreApi();
|
|
44
|
+
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
45
|
+
theme: {
|
|
46
|
+
token: {
|
|
47
|
+
borderRadius: 4,
|
|
48
|
+
fontSize: 16,
|
|
49
|
+
colorBgContainer: theme.colorBgElevated,
|
|
50
|
+
controlHeightLG: 48,
|
|
51
|
+
colorBorder: 'transparent',
|
|
52
|
+
colorPrimaryHover: 'transparent'
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
children: /*#__PURE__*/_jsxs(Flexbox, {
|
|
56
|
+
gap: 8,
|
|
57
|
+
className: styles.container,
|
|
58
|
+
children: [/*#__PURE__*/_jsx(ActionBar, {}), /*#__PURE__*/_jsxs(Flexbox, {
|
|
59
|
+
horizontal: true,
|
|
60
|
+
gap: 8,
|
|
61
|
+
align: 'center',
|
|
62
|
+
className: styles.boxShadow,
|
|
63
|
+
children: [/*#__PURE__*/_jsx(Input.TextArea, {
|
|
64
|
+
size: 'large',
|
|
65
|
+
value: message,
|
|
66
|
+
placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9...",
|
|
67
|
+
onChange: function onChange(e) {
|
|
68
|
+
storeApi.setState({
|
|
69
|
+
message: e.target.value
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
disabled: disabled,
|
|
73
|
+
autoSize: {
|
|
74
|
+
maxRows: 8
|
|
75
|
+
},
|
|
76
|
+
onCompositionStart: function onCompositionStart() {
|
|
77
|
+
isChineseInput.current = true;
|
|
78
|
+
},
|
|
79
|
+
onCompositionEnd: function onCompositionEnd() {
|
|
80
|
+
isChineseInput.current = false;
|
|
81
|
+
},
|
|
82
|
+
className: styles.input,
|
|
83
|
+
onPressEnter: function onPressEnter(e) {
|
|
84
|
+
if (!isLoading && !e.shiftKey && !isChineseInput.current) {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
sendMessage();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}), mobile ? null : /*#__PURE__*/_jsx(Button, {
|
|
90
|
+
disabled: disabled,
|
|
91
|
+
loading: isLoading,
|
|
92
|
+
type: "text",
|
|
93
|
+
className: styles.btn,
|
|
94
|
+
onClick: sendMessage,
|
|
95
|
+
icon: /*#__PURE__*/_jsx(SendOutlined, {})
|
|
96
|
+
})]
|
|
97
|
+
})]
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
export default /*#__PURE__*/memo(InputArea);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { InternalChatContext } from '../Chat/types';
|
|
3
|
+
import { ChatStore } from '../Chat/store';
|
|
4
|
+
export interface StoreUpdaterProps extends Partial<InternalChatContext>, Pick<ChatStore, 'onMessagesChange' | 'onAgentChange' | 'onResponseFinished' | 'onResponseStart'> {
|
|
5
|
+
}
|
|
6
|
+
declare const StoreUpdater: FC<StoreUpdaterProps>;
|
|
7
|
+
export default StoreUpdater;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createStoreUpdater } from 'zustand-utils';
|
|
2
|
+
import { useStoreApi } from "../Chat/store";
|
|
3
|
+
var StoreUpdater = function StoreUpdater(_ref) {
|
|
4
|
+
var updateAt = _ref.updateAt,
|
|
5
|
+
createAt = _ref.createAt,
|
|
6
|
+
title = _ref.title,
|
|
7
|
+
description = _ref.description,
|
|
8
|
+
agent = _ref.agent,
|
|
9
|
+
messages = _ref.messages,
|
|
10
|
+
onAgentChange = _ref.onAgentChange,
|
|
11
|
+
onMessagesChange = _ref.onMessagesChange,
|
|
12
|
+
onResponseFinished = _ref.onResponseFinished,
|
|
13
|
+
onResponseStart = _ref.onResponseStart;
|
|
14
|
+
var useStoreUpdater = createStoreUpdater(useStoreApi());
|
|
15
|
+
useStoreUpdater('agent', agent);
|
|
16
|
+
useStoreUpdater('onAgentChange', onAgentChange);
|
|
17
|
+
useStoreUpdater('messages', messages);
|
|
18
|
+
useStoreUpdater('onMessagesChange', onMessagesChange);
|
|
19
|
+
useStoreUpdater('onResponseFinished', onResponseFinished);
|
|
20
|
+
useStoreUpdater('onResponseStart', onResponseStart);
|
|
21
|
+
useStoreUpdater('title', title);
|
|
22
|
+
useStoreUpdater('description', description);
|
|
23
|
+
useStoreUpdater('createAt', createAt);
|
|
24
|
+
useStoreUpdater('updateAt', updateAt);
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
27
|
+
export default StoreUpdater;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AppProps } from './App';
|
|
3
|
+
import { StoreUpdaterProps } from './StoreUpdater';
|
|
4
|
+
export interface ConversationProps extends StoreUpdaterProps, AppProps {
|
|
5
|
+
devtools?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const Conversation: import("react").NamedExoticComponent<ConversationProps>;
|
|
8
|
+
export default Conversation;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["readonly", "devtools", "includeSystem"];
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
import { memo, useRef } from 'react';
|
|
7
|
+
import { Provider, createChatStore } from "../Chat/store";
|
|
8
|
+
import ChatContainer from "./App";
|
|
9
|
+
import StoreUpdater from "./StoreUpdater";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
var Conversation = /*#__PURE__*/memo(function (_ref) {
|
|
13
|
+
var readonly = _ref.readonly,
|
|
14
|
+
devtools = _ref.devtools,
|
|
15
|
+
includeSystem = _ref.includeSystem,
|
|
16
|
+
res = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
var ref = useRef(function () {
|
|
18
|
+
return createChatStore(devtools);
|
|
19
|
+
});
|
|
20
|
+
return /*#__PURE__*/_jsxs(Provider, {
|
|
21
|
+
createStore: ref.current,
|
|
22
|
+
children: [/*#__PURE__*/_jsx(ChatContainer, {
|
|
23
|
+
includeSystem: includeSystem,
|
|
24
|
+
readonly: readonly
|
|
25
|
+
}), /*#__PURE__*/_jsx(StoreUpdater, _objectSpread({}, res))]
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
export default Conversation;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ChatMessage } from "../Chat";
|
|
3
|
+
export interface EditableMessageListProps {
|
|
4
|
+
dataSources: ChatMessage[];
|
|
5
|
+
onChange?: (chatMessages: ChatMessage[]) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const EditableMessageList: import("react").NamedExoticComponent<EditableMessageListProps>;
|
|
9
|
+
export default EditableMessageList;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import { PlusOutlined } from '@ant-design/icons';
|
|
3
|
+
import { Button, Select } from 'antd';
|
|
4
|
+
import isEqual from 'fast-deep-equal';
|
|
5
|
+
import { memo, useEffect, useReducer } from 'react';
|
|
6
|
+
import { Flexbox } from 'react-layout-kit';
|
|
7
|
+
import IconAction from "../ActionIcon";
|
|
8
|
+
import { messagesReducer } from "../Chat";
|
|
9
|
+
import { ControlInput } from "../components/ControlInput";
|
|
10
|
+
import { TrashIcon } from 'lucide-react';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
export var EditableMessageList = /*#__PURE__*/memo(function (_ref) {
|
|
14
|
+
var disabled = _ref.disabled,
|
|
15
|
+
dataSources = _ref.dataSources,
|
|
16
|
+
onChange = _ref.onChange;
|
|
17
|
+
var _useReducer = useReducer(messagesReducer, dataSources),
|
|
18
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
19
|
+
chatMessages = _useReducer2[0],
|
|
20
|
+
dispatch = _useReducer2[1];
|
|
21
|
+
useEffect(function () {
|
|
22
|
+
if (!isEqual(dataSources, chatMessages)) {
|
|
23
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(chatMessages);
|
|
24
|
+
}
|
|
25
|
+
}, [chatMessages]);
|
|
26
|
+
return !dataSources ? null : /*#__PURE__*/_jsxs(Flexbox, {
|
|
27
|
+
gap: 12,
|
|
28
|
+
children: [chatMessages.map(function (item, index) {
|
|
29
|
+
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
30
|
+
horizontal: true,
|
|
31
|
+
gap: 8,
|
|
32
|
+
width: '100%',
|
|
33
|
+
align: 'center',
|
|
34
|
+
children: [/*#__PURE__*/_jsx(Select, {
|
|
35
|
+
value: item.role,
|
|
36
|
+
style: {
|
|
37
|
+
width: 120
|
|
38
|
+
},
|
|
39
|
+
dropdownStyle: {
|
|
40
|
+
zIndex: 100
|
|
41
|
+
},
|
|
42
|
+
disabled: disabled,
|
|
43
|
+
onChange: function onChange(value) {
|
|
44
|
+
dispatch({
|
|
45
|
+
type: 'updateMessageRole',
|
|
46
|
+
index: index,
|
|
47
|
+
role: value
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
options: [{
|
|
51
|
+
value: 'system',
|
|
52
|
+
label: '系统'
|
|
53
|
+
}, {
|
|
54
|
+
value: 'user',
|
|
55
|
+
label: '输入'
|
|
56
|
+
}, {
|
|
57
|
+
value: 'assistant',
|
|
58
|
+
label: '输出'
|
|
59
|
+
}]
|
|
60
|
+
}), /*#__PURE__*/_jsx(ControlInput, {
|
|
61
|
+
disabled: disabled,
|
|
62
|
+
value: item.content,
|
|
63
|
+
onChange: function onChange(e) {
|
|
64
|
+
dispatch({
|
|
65
|
+
type: 'updateMessage',
|
|
66
|
+
index: index,
|
|
67
|
+
message: e
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
placeholder: item.role === 'user' ? '请填入输入的样例内容' : '请填入输出的样例'
|
|
71
|
+
}), /*#__PURE__*/_jsx(IconAction, {
|
|
72
|
+
icon: TrashIcon,
|
|
73
|
+
title: '删除',
|
|
74
|
+
size: 'small',
|
|
75
|
+
onClick: function onClick() {
|
|
76
|
+
dispatch({
|
|
77
|
+
type: 'deleteMessage',
|
|
78
|
+
index: index
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
})]
|
|
82
|
+
}, "".concat(index, "-").concat(item.content));
|
|
83
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
84
|
+
block: true,
|
|
85
|
+
disabled: disabled,
|
|
86
|
+
icon: /*#__PURE__*/_jsx(PlusOutlined, {}),
|
|
87
|
+
onClick: function onClick() {
|
|
88
|
+
var lastMeg = chatMessages.at(-1);
|
|
89
|
+
dispatch({
|
|
90
|
+
type: 'addMessage',
|
|
91
|
+
message: {
|
|
92
|
+
role: (lastMeg === null || lastMeg === void 0 ? void 0 : lastMeg.role) === 'user' ? 'assistant' : 'user',
|
|
93
|
+
content: ''
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
children: "\u6DFB\u52A0\u4E00\u9879"
|
|
98
|
+
})]
|
|
99
|
+
});
|
|
100
|
+
}, isEqual);
|
|
101
|
+
export default EditableMessageList;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ControlInputProps } from
|
|
2
|
+
import { ControlInputProps } from "../components/ControlInput";
|
|
3
3
|
export declare type EditableTextProps = ControlInputProps;
|
|
4
4
|
declare const EditableText: import("react").NamedExoticComponent<ControlInputProps>;
|
|
5
5
|
export default EditableText;
|
package/es/EditableText/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { EditOutlined } from '@ant-design/icons';
|
|
|
3
3
|
import { Tooltip } from 'antd';
|
|
4
4
|
import { memo, useState } from 'react';
|
|
5
5
|
import { Flexbox } from 'react-layout-kit';
|
|
6
|
-
import { ControlInput } from "
|
|
6
|
+
import { ControlInput } from "../components/ControlInput";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
var EditableText = /*#__PURE__*/memo(function (_ref) {
|
|
@@ -10,6 +10,6 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
10
10
|
return {
|
|
11
11
|
shiki: cx("".concat(prefix, "-shiki"), css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .shiki {\n overflow-x: scroll;\n background: none !important;\n }\n "])))),
|
|
12
12
|
prism: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n pre {\n overflow-x: scroll;\n font-family: ", " !important;\n }\n "])), token.fontFamilyCode),
|
|
13
|
-
loading: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n
|
|
13
|
+
loading: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n\n padding: 4px 8px;\n\n color: ", ";\n\n backdrop-filter: saturate(180%) blur(10px);\n border-radius: ", ";\n "])), token.colorTextTertiary, token.borderRadiusSM)
|
|
14
14
|
};
|
|
15
15
|
});
|
package/es/Highlighter/style.js
CHANGED
|
@@ -11,7 +11,7 @@ export var useStyles = createStyles(function (_ref, type) {
|
|
|
11
11
|
var buttonHoverCls = "".concat(prefix, "-hover-btn");
|
|
12
12
|
var langHoverCls = "".concat(prefix, "-hover-lang");
|
|
13
13
|
return {
|
|
14
|
-
container: cx(prefix, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
14
|
+
container: cx(prefix, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: auto;\n\n background-color: ", ";\n border-radius: ", "px;\n\n transition: background-color 100ms ", ";\n ", "\n &:hover {\n background-color: ", ";\n .", " {\n opacity: 1;\n }\n\n .", " {\n opacity: 1;\n }\n }\n\n .prism-code {\n background: none !important;\n }\n\n pre {\n margin: 0 !important;\n padding: ", " !important;\n background: none !important;\n }\n\n code {\n background: transparent !important;\n }\n "])), type === 'block' ? rgba(token.colorBgElevated, 0.6) : 'transparent', token.borderRadius, token.motionEaseOut, type === 'ghost' && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n "])), token.colorBorder), type === 'prue' ? 'transparent' : token.colorFillTertiary, buttonHoverCls, langHoverCls, type === 'prue' ? 0 : "16px 24px")),
|
|
15
15
|
button: cx(buttonHoverCls, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 51;\n top: 8px;\n right: 8px;\n\n opacity: 0;\n "])))),
|
|
16
16
|
lang: cx(langHoverCls, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 50;\n right: 8px;\n bottom: 8px;\n\n color: ", ";\n\n opacity: 0;\n\n transition: opacity 0.1s;\n "])), token.colorTextPlaceholder))
|
|
17
17
|
};
|
package/es/Logo/style.js
CHANGED
|
@@ -5,6 +5,6 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
5
5
|
var css = _ref.css;
|
|
6
6
|
return {
|
|
7
7
|
flexCenter: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n "]))),
|
|
8
|
-
extraTitle: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n
|
|
8
|
+
extraTitle: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-weight: 300;\n white-space: nowrap;\n "])))
|
|
9
9
|
};
|
|
10
10
|
});
|
package/es/Markdown/style.js
CHANGED
|
@@ -6,7 +6,7 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
6
6
|
token = _ref.token,
|
|
7
7
|
isDarkMode = _ref.isDarkMode;
|
|
8
8
|
return {
|
|
9
|
-
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
9
|
+
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n\n p {\n margin: 20px auto;\n\n font-size: 14px;\n line-height: 2;\n color: ", ";\n word-wrap: break-word;\n }\n\n blockquote {\n margin: 16px 0;\n padding: 0 12px;\n p {\n font-style: italic;\n color: ", ";\n }\n }\n\n p:not(:last-child) {\n margin-bottom: 1em;\n }\n\n a {\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n\n &:active {\n color: ", ";\n }\n }\n\n img {\n max-width: 100%;\n }\n\n > :not([data-code-type='highlighter']) code {\n padding: 2px 6px;\n color: ", ";\n background: ", ";\n border-radius: 4px;\n }\n\n table {\n border-spacing: 0;\n\n width: 100%;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding: 8px;\n\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n\n th,\n td {\n padding-block-start: 10px;\n padding-block-end: 10px;\n padding-inline-start: 16px;\n padding-inline-end: 16px;\n }\n\n thead {\n tr {\n th {\n background: ", ";\n &:first-child {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n &:last-child {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n }\n }\n\n ul li {\n line-height: 1.8;\n }\n "])), isDarkMode ? token.colorTextSecondary : token.colorText, token.colorText, token.colorTextDescription, token.colorLink, token.colorLinkHover, token.colorLinkActive, isDarkMode ? token['cyan-7'] : token.colorPrimaryText, isDarkMode ? token['cyan-1'] : token.colorPrimaryBg, token.colorBorder, token.borderRadius, token.colorFillTertiary, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius),
|
|
10
10
|
code: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 2px 4px;\n font-family: ", " !important;\n color: ", ";\n border-radius: 4px;\n "])), token.fontFamilyCode, isDarkMode ? token.cyan8 : token.pink7)
|
|
11
11
|
};
|
|
12
12
|
});
|
package/es/Snippet/style.js
CHANGED
|
@@ -5,5 +5,5 @@ import { rgba } from 'polished';
|
|
|
5
5
|
export var useStyles = createStyles(function (_ref, type) {
|
|
6
6
|
var css = _ref.css,
|
|
7
7
|
token = _ref.token;
|
|
8
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
8
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n max-width: 100%;\n height: 36px;\n padding: 0 8px 0 12px;\n\n border-radius: ", "px;\n\n transition: background-color 100ms ", ";\n ", "\n\n &:hover {\n background-color: ", ";\n }\n\n .ant-highlighter-shiki {\n overflow: auto;\n flex: 1;\n }\n .prism-code {\n background: none !important;\n }\n\n pre {\n margin: 0 !important;\n padding-top: 6px !important;\n line-height: 1;\n background: none !important;\n }\n\n code[class*='language-'] {\n background: none !important;\n }\n "])), token.borderRadius, token.motionEaseOut, type === 'block' ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), rgba(token.colorBgElevated, 0.6)) : css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n "])), token.colorBorder), token.colorFillTertiary);
|
|
9
9
|
});
|
package/es/StroyBook/style.js
CHANGED
|
@@ -7,8 +7,8 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
7
7
|
var noPadding = _ref2.noPadding,
|
|
8
8
|
mobile = _ref2.mobile;
|
|
9
9
|
return {
|
|
10
|
-
editor: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n width: inherit;\n min-height: inherit;\n ", "\n "])), mobile && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex-direction: column;\n "])))),
|
|
11
|
-
left: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n
|
|
12
|
-
right: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n --leva-sizes-controlWidth: 66%;\n --leva-colors-elevation1: ", ";\n --leva-colors-elevation2: transparent;\n --leva-colors-elevation3: ", ";\n --leva-colors-accent1: ", ";\n --leva-colors-accent2: ", ";\n --leva-colors-accent3: ", ";\n --leva-colors-highlight1: ", ";\n --leva-colors-highlight2: ", ";\n --leva-colors-highlight3: ", ";\n --leva-colors-vivid1: ", ";\n --leva-shadows-level1: unset;\n --leva-shadows-level2: unset;\n padding: 6px 0;\n background: ", ";\n > div {\n background: transparent;\n > div {\n background: transparent;\n }\n }\n input:checked + label > svg {\n stroke: ", ";\n }\n "])), token.colorFillSecondary, token.colorFillSecondary, token.colorPrimary, token.colorPrimaryHover, token.colorPrimaryActive, token.colorTextTertiary, token.colorTextSecondary, token.colorText, token.colorWarning, token.colorBgLayout, token.colorBorder)
|
|
10
|
+
editor: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n\n width: inherit;\n min-height: inherit;\n ", "\n "])), mobile && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex-direction: column;\n "])))),
|
|
11
|
+
left: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n overflow: auto;\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n\n ", "\n "])), !noPadding && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 40px 24px;\n "])))),
|
|
12
|
+
right: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n --leva-sizes-controlWidth: 66%;\n --leva-colors-elevation1: ", ";\n --leva-colors-elevation2: transparent;\n --leva-colors-elevation3: ", ";\n --leva-colors-accent1: ", ";\n --leva-colors-accent2: ", ";\n --leva-colors-accent3: ", ";\n --leva-colors-highlight1: ", ";\n --leva-colors-highlight2: ", ";\n --leva-colors-highlight3: ", ";\n --leva-colors-vivid1: ", ";\n --leva-shadows-level1: unset;\n --leva-shadows-level2: unset;\n\n padding: 6px 0;\n background: ", ";\n > div {\n background: transparent;\n > div {\n background: transparent;\n }\n }\n input:checked + label > svg {\n stroke: ", ";\n }\n "])), token.colorFillSecondary, token.colorFillSecondary, token.colorPrimary, token.colorPrimaryHover, token.colorPrimaryActive, token.colorTextTertiary, token.colorTextSecondary, token.colorText, token.colorWarning, token.colorBgLayout, token.colorBorder)
|
|
13
13
|
};
|
|
14
14
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { createGlobalStyle } from 'antd-style';
|
|
4
|
-
var GlobalStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n body {\n font-family: ", ";\n font-size: ", "px;\n line-height: 1;\n color: ", ";\n
|
|
4
|
+
var GlobalStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n html,body {\n --font-settings: \"cv01\";\n --font-variations: \"opsz\" auto;\n\n overflow-x: hidden;\n\n margin: 0;\n padding: 0;\n\n font-family: ", ";\n font-size: ", "px;\n font-feature-settings: var(--font-settings);\n font-variation-settings: var(--font-variations);\n line-height: 1;\n color: ", ";\n text-size-adjust: none;\n text-rendering: optimizelegibility;\n vertical-align: baseline;\n\n color-scheme: dark;\n background-color: ", ";\n\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n -webkit-tap-highlight-color: transparent;\n }\n\n\n * {\n box-sizing: border-box;\n vertical-align: baseline;\n }\n\n #root {\n\t min-height: 100vh;\n }\n\n ::-webkit-scrollbar {\n width: 0;\n height: 4px;\n background-color: transparent;\n\n &-thumb {\n background-color: ", ";\n border-radius: 4px;\n }\n\n &-corner {\n display: none;\n }\n }\n"])), function (_ref) {
|
|
5
5
|
var theme = _ref.theme;
|
|
6
6
|
return theme.fontFamily;
|
|
7
7
|
}, function (_ref2) {
|
|
@@ -10,10 +10,11 @@ var GlobalStyle = createGlobalStyle(_templateObject || (_templateObject = _tagge
|
|
|
10
10
|
}, function (_ref3) {
|
|
11
11
|
var theme = _ref3.theme;
|
|
12
12
|
return theme.colorTextBase;
|
|
13
|
-
}, function (p) {
|
|
14
|
-
return p.theme.colorBgLayout;
|
|
15
13
|
}, function (_ref4) {
|
|
16
14
|
var theme = _ref4.theme;
|
|
15
|
+
return theme.colorBgLayout;
|
|
16
|
+
}, function (_ref5) {
|
|
17
|
+
var theme = _ref5.theme;
|
|
17
18
|
return theme.colorFill;
|
|
18
19
|
});
|
|
19
20
|
export default GlobalStyle;
|
package/es/Tooltip/style.js
CHANGED
|
@@ -5,6 +5,6 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
token = _ref.token;
|
|
7
7
|
return {
|
|
8
|
-
tooltip: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-tooltip-inner {\n
|
|
8
|
+
tooltip: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-tooltip-inner {\n display: flex;\n align-items: center;\n justify-content: center;\n\n min-height: unset;\n padding: 4px 8px;\n\n color: ", ";\n\n background-color: ", ";\n border-radius: ", "px;\n }\n .ant-tooltip-arrow {\n &:before,\n &:after {\n background: ", ";\n }\n }\n "])), token.colorBgLayout, token.colorText, token.borderRadiusSM, token.colorText)
|
|
9
9
|
};
|
|
10
10
|
});
|
package/es/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export { default as ActionIcon, type ActionIconProps, type ActionIconSize } from './ActionIcon';
|
|
2
2
|
export { default as Avatar, type AvatarProps } from './Avatar';
|
|
3
|
+
export type { ChatMessage } from './Chat';
|
|
3
4
|
export { default as ContextMenu, type ContextMenuProps } from './ContextMenu';
|
|
5
|
+
export { default as Conversation, type ConversationProps } from './Conversation';
|
|
4
6
|
export { default as CopyButton, type CopyButtonProps } from './CopyButton';
|
|
5
7
|
export { default as DraggablePanel, type DraggablePanelProps } from './DraggablePanel';
|
|
6
8
|
export { default as EditableMessage, type EditableMessageProps } from './EditableMessage';
|
|
9
|
+
export { default as EditableMessageList, type EditableMessageListProps, } from './EditableMessageList';
|
|
7
10
|
export { default as EditableText, type EditableTextProps } from './EditableText';
|
|
8
11
|
export { default as Highlighter, SyntaxHighlighter, type HighlighterProps, type SyntaxHighlighterProps, } from './Highlighter';
|
|
9
12
|
export { default as Icon, type IconProps, type IconSize } from './Icon';
|
package/es/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export { default as ActionIcon } from "./ActionIcon";
|
|
2
2
|
export { default as Avatar } from "./Avatar";
|
|
3
3
|
export { default as ContextMenu } from "./ContextMenu";
|
|
4
|
+
export { default as Conversation } from "./Conversation";
|
|
4
5
|
export { default as CopyButton } from "./CopyButton";
|
|
5
6
|
export { default as DraggablePanel } from "./DraggablePanel";
|
|
6
7
|
export { default as EditableMessage } from "./EditableMessage";
|
|
8
|
+
export { default as EditableMessageList } from "./EditableMessageList";
|
|
7
9
|
export { default as EditableText } from "./EditableText";
|
|
8
10
|
export { default as Highlighter, SyntaxHighlighter } from "./Highlighter";
|
|
9
11
|
export { default as Icon } from "./Icon";
|