@lobehub/ui 1.26.0 → 1.26.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.
Files changed (138) hide show
  1. package/es/ActionIcon/index.d.ts +1 -1
  2. package/es/ActionIcon/index.js +30 -18
  3. package/es/Avatar/index.js +11 -11
  4. package/es/Chat/store/initialState.d.ts +3 -3
  5. package/es/Chat/store/initialState.js +4 -4
  6. package/es/Chat/store/messageReducer.js +71 -49
  7. package/es/Chat/store/selectors.d.ts +3 -3
  8. package/es/Chat/store/selectors.js +3 -3
  9. package/es/Chat/store/store.d.ts +1 -1
  10. package/es/Chat/store/store.js +110 -110
  11. package/es/Chat/types.d.ts +1 -1
  12. package/es/Chat/utils/fetch.d.ts +1 -1
  13. package/es/Chat/utils/fetch.js +4 -4
  14. package/es/ChatInputArea/index.js +2 -1
  15. package/es/ChatInputArea/style.d.ts +3 -3
  16. package/es/ChatInputArea/style.js +5 -5
  17. package/es/ChatItem/index.js +12 -10
  18. package/es/ChatItem/style.d.ts +3 -3
  19. package/es/ChatItem/style.js +7 -7
  20. package/es/ChatList/ActionsBar.d.ts +1 -1
  21. package/es/ChatList/ActionsBar.js +12 -11
  22. package/es/ChatList/index.d.ts +1 -1
  23. package/es/ChatList/index.js +1 -1
  24. package/es/ColorScales/ScaleRow.js +20 -14
  25. package/es/ColorScales/index.js +6 -4
  26. package/es/ColorScales/style.d.ts +2 -2
  27. package/es/ColorScales/style.js +7 -7
  28. package/es/ContextMenu/MenuItem/index.js +14 -14
  29. package/es/ContextMenu/MenuItem/style.d.ts +2 -2
  30. package/es/ContextMenu/MenuItem/style.js +5 -5
  31. package/es/ContextMenu/index.js +42 -42
  32. package/es/ContextMenu/style.d.ts +1 -1
  33. package/es/ContextMenu/style.js +2 -2
  34. package/es/Conversation/App.js +2 -2
  35. package/es/Conversation/ChatList/MessageItem/Content.js +15 -15
  36. package/es/Conversation/ChatList/MessageItem/Toolbar.js +3 -3
  37. package/es/Conversation/ChatList/MessageItem/index.js +14 -14
  38. package/es/Conversation/ChatList/index.js +5 -5
  39. package/es/Conversation/InputArea/ActionBar.d.ts +2 -2
  40. package/es/Conversation/InputArea/ActionBar.js +2 -2
  41. package/es/Conversation/InputArea/index.d.ts +2 -2
  42. package/es/Conversation/InputArea/index.js +10 -12
  43. package/es/Conversation/StoreUpdater.js +1 -1
  44. package/es/Conversation/index.js +2 -2
  45. package/es/CopyButton/index.d.ts +4 -2
  46. package/es/CopyButton/index.js +4 -3
  47. package/es/DraggablePanel/index.d.ts +2 -2
  48. package/es/DraggablePanel/index.js +50 -42
  49. package/es/DraggablePanel/style.d.ts +9 -9
  50. package/es/DraggablePanel/style.js +17 -17
  51. package/es/DraggablePanel/utils.js +12 -4
  52. package/es/EditableMessage/index.js +4 -4
  53. package/es/EditableMessageList/index.js +20 -19
  54. package/es/EditableText/index.js +1 -1
  55. package/es/Features/Item.js +5 -5
  56. package/es/Features/Item.style.d.ts +2 -2
  57. package/es/Features/Item.style.js +4 -4
  58. package/es/Features/index.js +3 -3
  59. package/es/Features/style.js +2 -2
  60. package/es/FontLoader/index.d.ts +6 -0
  61. package/es/FontLoader/index.js +16 -0
  62. package/es/Footer/index.js +2 -2
  63. package/es/GradientButton/style.d.ts +1 -1
  64. package/es/GradientButton/style.js +2 -2
  65. package/es/Header/index.js +2 -2
  66. package/es/Header/style.d.ts +1 -1
  67. package/es/Header/style.js +2 -2
  68. package/es/Hero/style.d.ts +3 -3
  69. package/es/Hero/style.js +14 -13
  70. package/es/Highlighter/SyntaxHighlighter/Prism.js +7 -7
  71. package/es/Highlighter/SyntaxHighlighter/index.js +1 -1
  72. package/es/Highlighter/SyntaxHighlighter/style.d.ts +2 -2
  73. package/es/Highlighter/SyntaxHighlighter/style.js +2 -2
  74. package/es/Highlighter/index.d.ts +1 -2
  75. package/es/Highlighter/index.js +4 -3
  76. package/es/Highlighter/style.d.ts +1 -1
  77. package/es/Highlighter/style.js +2 -2
  78. package/es/Highlighter/theme.js +22 -22
  79. package/es/Icon/index.js +24 -16
  80. package/es/Input/index.js +4 -4
  81. package/es/Layout/index.js +1 -1
  82. package/es/Layout/style.d.ts +5 -5
  83. package/es/Layout/style.js +7 -7
  84. package/es/List/ListItem/index.d.ts +1 -1
  85. package/es/List/ListItem/index.js +21 -42
  86. package/es/List/ListItem/style.d.ts +9 -0
  87. package/es/List/ListItem/style.js +21 -0
  88. package/es/List/index.d.ts +1 -1
  89. package/es/Logo/index.d.ts +2 -2
  90. package/es/Logo/index.js +48 -38
  91. package/es/Logo/style.d.ts +1 -1
  92. package/es/Logo/style.js +2 -2
  93. package/es/Markdown/CodeBlock.d.ts +1 -1
  94. package/es/Markdown/CodeBlock.js +7 -7
  95. package/es/Markdown/index.js +3 -3
  96. package/es/Markdown/style.d.ts +1 -1
  97. package/es/Markdown/style.js +2 -2
  98. package/es/MessageInput/index.d.ts +1 -1
  99. package/es/MessageInput/index.js +5 -5
  100. package/es/MessageModal/index.js +8 -6
  101. package/es/MessageModal/style.d.ts +1 -1
  102. package/es/MessageModal/style.js +2 -2
  103. package/es/SearchBar/index.d.ts +1 -1
  104. package/es/SearchBar/index.js +13 -11
  105. package/es/SearchBar/style.d.ts +2 -2
  106. package/es/SearchBar/style.js +3 -3
  107. package/es/Snippet/index.js +5 -3
  108. package/es/Spotlight/index.js +13 -13
  109. package/es/Spotlight/style.js +1 -1
  110. package/es/StroyBook/index.d.ts +1 -2
  111. package/es/StroyBook/index.js +3 -3
  112. package/es/StroyBook/style.d.ts +1 -1
  113. package/es/StroyBook/style.js +2 -2
  114. package/es/Swatches/index.d.ts +1 -1
  115. package/es/Swatches/index.js +9 -9
  116. package/es/ThemeProvider/index.d.ts +2 -2
  117. package/es/ThemeProvider/index.js +3 -4
  118. package/es/ThemeSwitch/index.js +8 -8
  119. package/es/Toc/TocMobile.d.ts +4 -4
  120. package/es/Toc/TocMobile.js +15 -15
  121. package/es/Toc/style.d.ts +2 -2
  122. package/es/Toc/style.js +3 -3
  123. package/es/TokenTag/style.js +12 -7
  124. package/es/components/ControlInput.d.ts +1 -1
  125. package/es/components/ControlInput.js +7 -6
  126. package/es/hooks/useHighlight.js +14 -14
  127. package/es/index.d.ts +1 -0
  128. package/es/index.js +1 -0
  129. package/es/styles/algorithms/generateColorPalette.js +10 -10
  130. package/es/styles/algorithms/generateCustomStylish.js +5 -5
  131. package/es/styles/algorithms/generateCustomToken.js +42 -17
  132. package/es/styles/algorithms/generateTheme.js +4 -4
  133. package/es/styles/colors.js +65 -65
  134. package/es/styles/theme/base.js +2 -2
  135. package/es/styles/theme/dark.js +16 -16
  136. package/es/styles/theme/light.js +16 -16
  137. package/es/types/llm.d.ts +1 -1
  138. package/package.json +3 -3
@@ -11,7 +11,7 @@ import MenuItem from "./MenuItem";
11
11
  import { useStyles } from "./style";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
- var MenuComponent = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
14
+ var MenuComponent = /*#__PURE__*/forwardRef(function (_ref, forwardedReference) {
15
15
  var items = _ref.items,
16
16
  label = _ref.label,
17
17
  container = _ref.container,
@@ -30,57 +30,57 @@ var MenuComponent = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
30
30
  _useState6 = _slicedToArray(_useState5, 2),
31
31
  allowHover = _useState6[0],
32
32
  setAllowHover = _useState6[1];
33
- var listItemsRef = useRef([]);
34
- var listContentRef = useRef(items.map(function (item) {
33
+ var listItemsReference = useRef([]);
34
+ var listContentReference = useRef(items.map(function (item) {
35
35
  return item.label;
36
36
  }));
37
- var allowMouseUpCloseRef = useRef(false);
37
+ var allowMouseUpCloseReference = useRef(false);
38
38
  var tree = useFloatingTree();
39
39
  var nodeId = useFloatingNodeId();
40
40
  var parentId = useFloatingParentNodeId();
41
41
  var isNested = parentId !== null;
42
42
  var _useFloating = useFloating({
43
+ middleware: [offset({
44
+ alignmentAxis: isNested ? -4 : 0,
45
+ mainAxis: isNested ? 0 : 4
46
+ }), flip(), shift()],
43
47
  nodeId: nodeId,
44
- open: isOpen,
45
48
  onOpenChange: setIsOpen,
49
+ open: isOpen,
46
50
  placement: isNested ? 'right-start' : 'bottom-start',
47
- middleware: [offset({
48
- mainAxis: isNested ? 0 : 4,
49
- alignmentAxis: isNested ? -4 : 0
50
- }), flip(), shift()],
51
51
  whileElementsMounted: autoUpdate
52
52
  }),
53
53
  refs = _useFloating.refs,
54
54
  context = _useFloating.context;
55
55
  var hover = useHover(context, {
56
- enabled: isNested && allowHover,
57
56
  delay: {
58
57
  open: 75
59
58
  },
59
+ enabled: isNested && allowHover,
60
60
  handleClose: safePolygon({
61
61
  blockPointerEvents: true
62
62
  })
63
63
  });
64
64
  var click = useClick(context, {
65
65
  event: 'mousedown',
66
- toggle: !isNested || !allowHover,
67
- ignoreMouse: isNested
66
+ ignoreMouse: isNested,
67
+ toggle: !isNested || !allowHover
68
68
  });
69
69
  var role = useRole(context, {
70
70
  role: 'menu'
71
71
  });
72
72
  var dismiss = useDismiss(context);
73
73
  var listNavigation = useListNavigation(context, {
74
- listRef: listItemsRef,
75
74
  activeIndex: activeIndex,
75
+ listRef: listItemsReference,
76
76
  nested: isNested,
77
77
  onNavigate: setActiveIndex
78
78
  });
79
79
  var typeahead = useTypeahead(context, {
80
+ activeIndex: activeIndex,
80
81
  enabled: isOpen,
81
- listRef: listContentRef,
82
- onMatch: isOpen ? setActiveIndex : undefined,
83
- activeIndex: activeIndex
82
+ listRef: listContentReference,
83
+ onMatch: isOpen ? setActiveIndex : undefined
84
84
  });
85
85
  var _useInteractions = useInteractions([hover, click, role, dismiss, listNavigation, typeahead]),
86
86
  getReferenceProps = _useInteractions.getReferenceProps,
@@ -110,8 +110,8 @@ var MenuComponent = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
110
110
  useEffect(function () {
111
111
  if (isOpen && tree) {
112
112
  tree.events.emit('menuopen', {
113
- parentId: parentId,
114
- nodeId: nodeId
113
+ nodeId: nodeId,
114
+ parentId: parentId
115
115
  });
116
116
  }
117
117
  }, [tree, isOpen, nodeId, parentId]);
@@ -130,8 +130,8 @@ var MenuComponent = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
130
130
  setAllowHover(false);
131
131
  }
132
132
  window.addEventListener('pointermove', onPointerMove, {
133
- once: true,
134
- capture: true
133
+ capture: true,
134
+ once: true
135
135
  });
136
136
  window.addEventListener('keydown', onKeyDown, true);
137
137
  return function () {
@@ -148,26 +148,26 @@ var MenuComponent = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
148
148
  refs.setPositionReference({
149
149
  getBoundingClientRect: function getBoundingClientRect() {
150
150
  return {
151
- width: 0,
151
+ bottom: e.clientY,
152
152
  height: 0,
153
- x: e.clientX,
154
- y: e.clientY,
155
- top: e.clientY,
153
+ left: e.clientX,
156
154
  right: e.clientX,
157
- bottom: e.clientY,
158
- left: e.clientX
155
+ top: e.clientY,
156
+ width: 0,
157
+ x: e.clientX,
158
+ y: e.clientY
159
159
  };
160
160
  }
161
161
  });
162
162
  setIsOpen(true);
163
163
  clearTimeout(timeout);
164
- allowMouseUpCloseRef.current = false;
164
+ allowMouseUpCloseReference.current = false;
165
165
  timeout = window.setTimeout(function () {
166
- allowMouseUpCloseRef.current = true;
166
+ allowMouseUpCloseReference.current = true;
167
167
  }, 300);
168
168
  }
169
169
  function onMouseUp() {
170
- if (allowMouseUpCloseRef.current) {
170
+ if (allowMouseUpCloseReference.current) {
171
171
  setIsOpen(false);
172
172
  }
173
173
  }
@@ -190,15 +190,12 @@ var MenuComponent = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
190
190
  });
191
191
  var data = item;
192
192
  var props = _objectSpread({
193
- label: data.label,
194
- key: data.key,
193
+ active: activeIndex === index,
195
194
  icon: data.icon,
196
- shortcut: data.shortcut,
197
- active: activeIndex === index
195
+ key: data.key,
196
+ label: data.label,
197
+ shortcut: data.shortcut
198
198
  }, getItemProps({
199
- ref: function ref(node) {
200
- listItemsRef.current[index] = node;
201
- },
202
199
  onClick: function onClick() {
203
200
  var _data$onClick;
204
201
  (_data$onClick = data.onClick) === null || _data$onClick === void 0 ? void 0 : _data$onClick.call(data);
@@ -208,6 +205,9 @@ var MenuComponent = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
208
205
  var _data$onClick2;
209
206
  (_data$onClick2 = data.onClick) === null || _data$onClick2 === void 0 ? void 0 : _data$onClick2.call(data);
210
207
  setIsOpen(false);
208
+ },
209
+ ref: function ref(node) {
210
+ listItemsReference.current[index] = node;
211
211
  }
212
212
  }));
213
213
  if ('children' in item) {
@@ -217,19 +217,19 @@ var MenuComponent = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
217
217
  }
218
218
  return /*#__PURE__*/_jsx(MenuItem, _objectSpread({}, props));
219
219
  }, [activeIndex]);
220
- var referenceRef = useMergeRefs([refs.setReference, forwardedRef]);
220
+ var referenceReference = useMergeRefs([refs.setReference, forwardedReference]);
221
221
  return /*#__PURE__*/_jsxs(FloatingNode, {
222
222
  id: nodeId,
223
- children: [!label ? null : /*#__PURE__*/_jsx(MenuItem, _objectSpread(_objectSpread({
223
+ children: [label ? /*#__PURE__*/_jsx(MenuItem, _objectSpread(_objectSpread({
224
224
  label: label,
225
225
  nested: isNested,
226
- ref: referenceRef,
226
+ ref: referenceReference,
227
227
  role: isNested ? 'menuitem' : 'menu'
228
228
  }, props), getReferenceProps({
229
229
  onClick: function onClick(event) {
230
230
  event.stopPropagation();
231
231
  }
232
- }))), /*#__PURE__*/_jsx(FloatingPortal, {
232
+ }))) : null, /*#__PURE__*/_jsx(FloatingPortal, {
233
233
  children: isOpen && /*#__PURE__*/_jsx(FloatingFocusManager, {
234
234
  context: context,
235
235
  initialFocus: isNested ? -1 : 0,
@@ -245,10 +245,10 @@ var MenuComponent = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
245
245
  })]
246
246
  });
247
247
  });
248
- var ContextMenu = /*#__PURE__*/forwardRef(function (props, ref) {
248
+ var ContextMenu = /*#__PURE__*/forwardRef(function (props, reference) {
249
249
  return /*#__PURE__*/_jsx(FloatingTree, {
250
250
  children: /*#__PURE__*/_jsx(MenuComponent, _objectSpread(_objectSpread({}, props), {}, {
251
- ref: ref
251
+ ref: reference
252
252
  }))
253
253
  });
254
254
  });
@@ -1,4 +1,4 @@
1
1
  export declare const useStyles: (props?: string | undefined) => import("antd-style").ReturnStyles<{
2
- container: string;
3
2
  button: string;
3
+ container: string;
4
4
  }>;
@@ -6,7 +6,7 @@ export var useStyles = createStyles(function (_ref, prefixCls) {
6
6
  cx = _ref.cx,
7
7
  token = _ref.token;
8
8
  return {
9
- container: cx(prefixCls, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n user-select: none;\n scrollbar-width: none;\n\n overflow-y: auto;\n overscroll-behavior: contain;\n\n box-sizing: border-box;\n width: 200px;\n padding: 5px;\n\n font-size: ", ";\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n outline: 0;\n box-shadow: ", ";\n\n &::-webkit-scrollbar {\n display: none;\n }\n "])), token.fontSize, token.colorBgContainer, token.colorBorder, token.boxShadowSecondary)),
10
- button: cx("".concat(prefixCls, "-button"), css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n all: unset;\n\n cursor: default;\n user-select: none;\n\n padding: 12px 10px;\n\n font-size: ", "px;\n line-height: 1;\n color: ", ";\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n\n -webkit-tap-highlight-color: transparent;\n\n &:hover {\n background: ", ";\n border-color: transparent;\n }\n\n &:focus-visible {\n border-color: ", ";\n box-shadow: 0 0 0 2px ", ";\n }\n "])), token.fontSize, token.colorText, token.colorBgContainer, token.colorBorder, token.borderRadius, token.colorPrimaryBg, token.colorPrimary, token.colorPrimaryBg))
9
+ button: cx("".concat(prefixCls, "-button"), css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n all: unset;\n\n cursor: default;\n user-select: none;\n\n padding: 12px 10px;\n\n font-size: ", "px;\n line-height: 1;\n color: ", ";\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n\n -webkit-tap-highlight-color: transparent;\n\n &:hover {\n background: ", ";\n border-color: transparent;\n }\n\n &:focus-visible {\n border-color: ", ";\n box-shadow: 0 0 0 2px ", ";\n }\n "])), token.fontSize, token.colorText, token.colorBgContainer, token.colorBorder, token.borderRadius, token.colorPrimaryBg, token.colorPrimary, token.colorPrimaryBg)),
10
+ container: cx(prefixCls, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n user-select: none;\n scrollbar-width: none;\n\n overflow-y: auto;\n overscroll-behavior: contain;\n\n box-sizing: border-box;\n width: 200px;\n padding: 5px;\n\n font-size: ", ";\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n outline: 0;\n box-shadow: ", ";\n\n &::-webkit-scrollbar {\n display: none;\n }\n "])), token.fontSize, token.colorBgContainer, token.colorBorder, token.boxShadowSecondary))
11
11
  };
12
12
  });
@@ -35,9 +35,9 @@ var ChatContainer = function ChatContainer(_ref) {
35
35
  type: 'secondary',
36
36
  children: description
37
37
  })]
38
- }) : null, /*#__PURE__*/_jsx(ChatList, {
38
+ }) : undefined, /*#__PURE__*/_jsx(ChatList, {
39
39
  includeSystem: includeSystem
40
- }), showInput ? /*#__PURE__*/_jsx(InputArea, {}) : null]
40
+ }), showInput ? /*#__PURE__*/_jsx(InputArea, {}) : undefined]
41
41
  });
42
42
  };
43
43
  export default /*#__PURE__*/memo(ChatContainer);
@@ -30,51 +30,51 @@ var Content = /*#__PURE__*/memo(function (_ref) {
30
30
  defaultValue: content,
31
31
  renderButtons: function renderButtons(text) {
32
32
  return [{
33
- type: 'primary',
34
33
  children: isUser ? '更新并重新生成' : '更新',
35
34
  onClick: function onClick() {
36
35
  dispatchMessage({
37
- type: 'updateMessage',
36
+ index: index,
38
37
  message: text,
39
- index: index
38
+ type: 'updateMessage'
40
39
  });
41
- handleMessageEditing(null);
40
+ handleMessageEditing();
42
41
 
43
42
  // 如果是用户的消息,那么重新生成下一条消息
44
43
  if (isUser) {
45
44
  resendMessage(index + 1);
46
45
  }
47
- }
46
+ },
47
+ type: 'primary'
48
48
  }, isUser ? {
49
49
  children: '仅更新',
50
50
  onClick: function onClick() {
51
51
  dispatchMessage({
52
- type: 'updateMessage',
52
+ index: index,
53
53
  message: text,
54
- index: index
54
+ type: 'updateMessage'
55
55
  });
56
- handleMessageEditing(null);
56
+ handleMessageEditing();
57
57
  }
58
- } : null, {
59
- type: 'text',
58
+ } : undefined, {
60
59
  children: '取消',
61
60
  onClick: function onClick() {
62
- return handleMessageEditing(null);
63
- }
61
+ return handleMessageEditing();
62
+ },
63
+ type: 'text'
64
64
  }].filter(Boolean);
65
65
  }
66
66
  });
67
67
  }
68
68
  return /*#__PURE__*/_jsxs(_Fragment, {
69
- children: [!loading ? /*#__PURE__*/_jsx(Markdown, {
70
- children: content
71
- }) : error ? null : /*#__PURE__*/_jsx("div", {
69
+ children: [loading ? error ? undefined : /*#__PURE__*/_jsx("div", {
72
70
  children: /*#__PURE__*/_jsx(LoadingOutlined, {
73
71
  spin: true,
74
72
  style: {
75
73
  fontSize: 20
76
74
  }
77
75
  })
76
+ }) : /*#__PURE__*/_jsx(Markdown, {
77
+ children: content
78
78
  }), error && /*#__PURE__*/_jsx(Alert, {
79
79
  action: /*#__PURE__*/_jsx(Button, {
80
80
  onClick: function onClick() {
@@ -48,7 +48,7 @@ var Toolbar = /*#__PURE__*/memo(function (_ref2) {
48
48
  placement: 'top',
49
49
  size: 'small',
50
50
  title: '复制'
51
- }), readonly ? null : /*#__PURE__*/_jsxs(_Fragment, {
51
+ }), readonly ? undefined : /*#__PURE__*/_jsxs(_Fragment, {
52
52
  children: [/*#__PURE__*/_jsx(IconAction, {
53
53
  icon: RotateCwIcon,
54
54
  onClick: function onClick() {
@@ -71,8 +71,8 @@ var Toolbar = /*#__PURE__*/memo(function (_ref2) {
71
71
  },
72
72
  onConfirm: function onConfirm() {
73
73
  dispatchMessage({
74
- type: 'deleteMessage',
75
- index: index
74
+ index: index,
75
+ type: 'deleteMessage'
76
76
  });
77
77
  },
78
78
  title: '确定要删除这条消息吗?',
@@ -22,14 +22,14 @@ var useStyles = createStyles(function (_ref) {
22
22
  token = _ref.token;
23
23
  var toolbarClassName = 'chat-float-toolbar';
24
24
  return {
25
- container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n padding: 12px;\n border-radius: 4px;\n\n ", " {\n padding-inline: 0;\n }\n\n &:hover {\n background: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n "])), responsive.mobile, token.colorFillQuaternary, toolbarClassName),
26
- user: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: linear-gradient(to right, ", ", ", ");\n "])), token.green3, token.gold3),
27
- system: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n filter: invert(1);\n "]))),
28
- assistant: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral([""]))),
29
- md: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n overflow: scroll;\n max-width: 100%;\n .", " {\n max-width: 100%;\n }\n "])), responsive.mobile),
30
- floatAction: cx(toolbarClassName, css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: ", ";\n top: 4px;\n right: 4px;\n\n opacity: 0;\n "])), token.zIndexPopupBase - 100)),
31
- choice: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n cursor: pointer;\n\n width: 20px;\n height: 20px;\n\n font-size: 12px;\n color: ", ";\n\n background: ", ";\n border-radius: 50%;\n "])), token.colorTextTertiary, token.colorFillContent),
32
- choiceActive: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n color: ", ";\n background: ", ";\n "])), token.colorTextLightSolid, token.colorPrimary)
25
+ assistant: css(_templateObject || (_templateObject = _taggedTemplateLiteral([""]))),
26
+ choice: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: pointer;\n\n width: 20px;\n height: 20px;\n\n font-size: 12px;\n color: ", ";\n\n background: ", ";\n border-radius: 50%;\n "])), token.colorTextTertiary, token.colorFillContent),
27
+ choiceActive: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n background: ", ";\n "])), token.colorTextLightSolid, token.colorPrimary),
28
+ container: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n padding: 12px;\n border-radius: 4px;\n\n ", " {\n padding-inline: 0;\n }\n\n &:hover {\n background: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n "])), responsive.mobile, token.colorFillQuaternary, toolbarClassName),
29
+ floatAction: cx(toolbarClassName, css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: ", ";\n top: 4px;\n right: 4px;\n\n opacity: 0;\n "])), token.zIndexPopupBase - 100)),
30
+ md: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n overflow: scroll;\n max-width: 100%;\n .", " {\n max-width: 100%;\n }\n "])), responsive.mobile),
31
+ system: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n filter: invert(1);\n "]))),
32
+ user: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n background: linear-gradient(to right, ", ", ", ");\n "])), token.green3, token.gold3)
33
33
  };
34
34
  });
35
35
  var MessageItem = /*#__PURE__*/memo(function (_ref2) {
@@ -55,7 +55,7 @@ var MessageItem = /*#__PURE__*/memo(function (_ref2) {
55
55
  _useStore2 = _slicedToArray(_useStore, 1),
56
56
  editingMessageId = _useStore2[0];
57
57
  var isEditing = editingMessageId === index;
58
- var fullChoices = !choices ? [content] : [content].concat(_toConsumableArray(choices));
58
+ var fullChoices = choices ? [content].concat(_toConsumableArray(choices)) : [content];
59
59
  var displayContent = fullChoices[activeChoice];
60
60
  var isSystem = role === 'system';
61
61
  var isUser = role === 'user';
@@ -65,7 +65,7 @@ var MessageItem = /*#__PURE__*/memo(function (_ref2) {
65
65
  gap: 12,
66
66
  horizontal: true,
67
67
  id: "message-item-".concat(index),
68
- children: [isEditing || mobile ? null : /*#__PURE__*/_jsx(Toolbar, {
68
+ children: [isEditing || mobile ? undefined : /*#__PURE__*/_jsx(Toolbar, {
69
69
  className: styles.floatAction,
70
70
  content: content,
71
71
  index: index,
@@ -85,7 +85,7 @@ var MessageItem = /*#__PURE__*/memo(function (_ref2) {
85
85
  shape: 'circle'
86
86
  // className={cx(styles[role])}
87
87
  })
88
- }), !choices ? null : fullChoices.map(function (choice, index) {
88
+ }), choices ? fullChoices.map(function (choice, index) {
89
89
  return /*#__PURE__*/_jsx(Center, {
90
90
  className: cx(styles.choice, activeChoice === index && styles.choiceActive),
91
91
  onClick: function onClick() {
@@ -99,7 +99,7 @@ var MessageItem = /*#__PURE__*/memo(function (_ref2) {
99
99
  tabIndex: 10,
100
100
  children: index + 1
101
101
  }, index);
102
- })]
102
+ }) : undefined]
103
103
  }), /*#__PURE__*/_jsx(Flexbox, {
104
104
  className: styles.md,
105
105
  flex: 1,
@@ -114,8 +114,8 @@ var MessageItem = /*#__PURE__*/memo(function (_ref2) {
114
114
  }), isSystem && /*#__PURE__*/_jsx(Divider, {
115
115
  children: /*#__PURE__*/_jsx(Typography.Text, {
116
116
  style: {
117
- fontWeight: 'normal',
118
- fontSize: 14
117
+ fontSize: 14,
118
+ fontWeight: 'normal'
119
119
  },
120
120
  type: 'secondary',
121
121
  children: "\u5F00\u59CB\u5BF9\u8BDD"
@@ -16,8 +16,8 @@ var useStyles = createStyles(function (_ref) {
16
16
  var css = _ref.css,
17
17
  token = _ref.token;
18
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)
19
+ btn: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: 12px;\n color: ", ";\n background: transparent;\n border: 2px solid ", " !important;\n "])), token.colorTextSecondary, token.colorBorderSecondary),
20
+ loading: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 12px;\n background: ", ";\n border-radius: 8px;\n "])), token.colorFillQuaternary)
21
21
  };
22
22
  });
23
23
  var ChatList = /*#__PURE__*/memo(function (_ref2) {
@@ -34,13 +34,13 @@ var ChatList = /*#__PURE__*/memo(function (_ref2) {
34
34
  _useStore2 = _slicedToArray(_useStore, 2),
35
35
  messages = _useStore2[0],
36
36
  loading = _useStore2[1];
37
- return !messages || messages.length === 0 ? null : /*#__PURE__*/_jsxs(Flexbox, {
37
+ return !messages || messages.length === 0 ? undefined : /*#__PURE__*/_jsxs(Flexbox, {
38
38
  gap: 8,
39
39
  style: style,
40
40
  children: [messages
41
41
  // 根据情况确认是否包含系统
42
42
  .filter(function (s) {
43
- return !includeSystem ? s.role !== 'system' : Boolean(s);
43
+ return includeSystem ? Boolean(s) : s.role !== 'system';
44
44
  }).map(function (item, index) {
45
45
  return /*#__PURE__*/_jsx(MessageItem, _objectSpread({
46
46
  index: index,
@@ -56,7 +56,7 @@ var ChatList = /*#__PURE__*/memo(function (_ref2) {
56
56
  horizontal: true,
57
57
  children: [/*#__PURE__*/_jsx("div", {}), "\u6B63\u5728\u751F\u6210...", /*#__PURE__*/_jsx("div", {})]
58
58
  })
59
- }) : null]
59
+ }) : undefined]
60
60
  });
61
61
  });
62
62
  export default ChatList;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- export declare const ActionBar: () => import("react/jsx-runtime").JSX.Element | null;
3
- declare const _default: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element | null>;
2
+ export declare const ActionBar: () => import("react/jsx-runtime").JSX.Element | undefined;
3
+ declare const _default: import("react").NamedExoticComponent<object>;
4
4
  export default _default;
@@ -59,13 +59,13 @@ export var ActionBar = function ActionBar() {
59
59
  title: '清空当前会话'
60
60
  })
61
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(' | '),
62
+ title: [agentToken > 0 ? "\u89D2\u8272\u5B9A\u4E49: ".concat(agentToken) : undefined, messagesToken > 0 ? "\u4F1A\u8BDD: ".concat(messagesToken) : undefined].filter(Boolean).join(' | '),
63
63
  children: /*#__PURE__*/_jsxs(Flexbox, {
64
64
  gap: 4,
65
65
  children: [" Tokens: ", totalToken]
66
66
  })
67
67
  })]
68
68
  })
69
- }) : null;
69
+ }) : undefined;
70
70
  };
71
71
  export default /*#__PURE__*/memo(ActionBar);
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- export declare const InputArea: ({}: {}) => import("react/jsx-runtime").JSX.Element;
3
- declare const _default: import("react").MemoExoticComponent<({}: {}) => import("react/jsx-runtime").JSX.Element>;
2
+ export declare const InputArea: () => import("react/jsx-runtime").JSX.Element;
3
+ declare const _default: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
4
4
  export default _default;
@@ -1,5 +1,4 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
3
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
4
3
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
5
4
  import { SendOutlined } from '@ant-design/icons';
@@ -17,15 +16,14 @@ var useStyles = createStyles(function (_ref) {
17
16
  responsive = _ref.responsive,
18
17
  token = _ref.token;
19
18
  return {
20
- container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: sticky;\n z-index: ", ";\n bottom: 0;\n\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.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\n &:hover {\n color: ", ";\n }\n "])), token.colorTextTertiary, token.colorTextSecondary),
24
- extra: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorTextTertiary)
19
+ boxShadow: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n border-radius: 8px;\n box-shadow: ", ";\n "])), token.boxShadowSecondary),
20
+ btn: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 10;\n right: 8px;\n bottom: 8px;\n\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n "])), token.colorTextTertiary, token.colorTextSecondary),
21
+ container: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: sticky;\n z-index: ", ";\n bottom: 0;\n\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.colorBgLayout, responsive.mobile),
22
+ extra: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorTextTertiary),
23
+ input: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n width: 100%;\n border-radius: 8px;\n "])))
25
24
  };
26
25
  });
27
- export var InputArea = function InputArea(_ref2) {
28
- _objectDestructuringEmpty(_ref2);
26
+ export var InputArea = function InputArea() {
29
27
  var _useStore = useStore(function (s) {
30
28
  return [s.message, s.sendMessage, s.loading, chatSelectors.disableInput(s)];
31
29
  }, shallow),
@@ -45,11 +43,11 @@ export var InputArea = function InputArea(_ref2) {
45
43
  theme: {
46
44
  token: {
47
45
  borderRadius: 4,
48
- fontSize: 16,
49
46
  colorBgContainer: theme.colorBgElevated,
50
- controlHeightLG: 48,
51
47
  colorBorder: 'transparent',
52
- colorPrimaryHover: 'transparent'
48
+ colorPrimaryHover: 'transparent',
49
+ controlHeightLG: 48,
50
+ fontSize: 16
53
51
  }
54
52
  },
55
53
  children: /*#__PURE__*/_jsxs(Flexbox, {
@@ -86,7 +84,7 @@ export var InputArea = function InputArea(_ref2) {
86
84
  placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9...",
87
85
  size: 'large',
88
86
  value: message
89
- }), mobile ? null : /*#__PURE__*/_jsx(Button, {
87
+ }), mobile ? undefined : /*#__PURE__*/_jsx(Button, {
90
88
  className: styles.btn,
91
89
  disabled: disabled,
92
90
  icon: /*#__PURE__*/_jsx(SendOutlined, {}),
@@ -20,6 +20,6 @@ var StoreUpdater = function StoreUpdater(_ref) {
20
20
  useStoreUpdater('description', description);
21
21
  useStoreUpdater('createAt', createAt);
22
22
  useStoreUpdater('updateAt', updateAt);
23
- return null;
23
+ return false;
24
24
  };
25
25
  export default StoreUpdater;
@@ -14,11 +14,11 @@ var Conversation = /*#__PURE__*/memo(function (_ref) {
14
14
  devtools = _ref.devtools,
15
15
  includeSystem = _ref.includeSystem,
16
16
  res = _objectWithoutProperties(_ref, _excluded);
17
- var ref = useRef(function () {
17
+ var reference = useRef(function () {
18
18
  return createChatStore(devtools);
19
19
  });
20
20
  return /*#__PURE__*/_jsxs(Provider, {
21
- createStore: ref.current,
21
+ createStore: reference.current,
22
22
  children: [/*#__PURE__*/_jsx(ChatContainer, {
23
23
  includeSystem: includeSystem,
24
24
  readonly: readonly
@@ -1,4 +1,6 @@
1
- import { ActionIconSize, TooltipProps } from "../index";
1
+ /// <reference types="react" />
2
+ import { type ActionIconSize } from "../ActionIcon";
3
+ import { type TooltipProps } from "../Tooltip";
2
4
  import { DivProps } from "../types";
3
5
  export interface CopyButtonProps extends DivProps {
4
6
  /**
@@ -22,5 +24,5 @@ export interface CopyButtonProps extends DivProps {
22
24
  */
23
25
  size?: ActionIconSize;
24
26
  }
25
- declare const CopyButton: ({ content, className, placement, size, ...props }: CopyButtonProps) => import("react/jsx-runtime").JSX.Element;
27
+ declare const CopyButton: import("react").NamedExoticComponent<CopyButtonProps>;
26
28
  export default CopyButton;
@@ -5,10 +5,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
5
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
6
  import copy from 'copy-to-clipboard';
7
7
  import { Copy } from 'lucide-react';
8
+ import { memo } from 'react';
9
+ import ActionIcon from "../ActionIcon";
8
10
  import { useCopied } from "../hooks/useCopied";
9
- import { ActionIcon } from "./..";
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
- var CopyButton = function CopyButton(_ref) {
12
+ var CopyButton = /*#__PURE__*/memo(function (_ref) {
12
13
  var content = _ref.content,
13
14
  className = _ref.className,
14
15
  _ref$placement = _ref.placement,
@@ -31,5 +32,5 @@ var CopyButton = function CopyButton(_ref) {
31
32
  size: size,
32
33
  title: copied ? '✅ Success' : 'Copy'
33
34
  }));
34
- };
35
+ });
35
36
  export default CopyButton;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import type { NumberSize, Size } from 're-resizable';
2
+ import { type CSSProperties } from 'react';
3
3
  import type { Props as RndProps } from 'react-rnd';
4
4
  import { DivProps } from "../types";
5
5
  export declare type placementType = 'right' | 'left' | 'top' | 'bottom';
@@ -39,7 +39,7 @@ export interface DraggablePanelProps extends DivProps {
39
39
  * @description The style of the panel handler
40
40
  * @type CSSProperties
41
41
  */
42
- hanlderStyle?: React.CSSProperties;
42
+ hanlderStyle?: CSSProperties;
43
43
  maxHeight?: number;
44
44
  maxWidth?: number;
45
45
  /**