@lobehub/ui 1.16.1 → 1.16.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/ActionIcon/index.d.ts +15 -15
- package/es/ActionIcon/index.js +7 -5
- package/es/Avatar/index.d.ts +9 -9
- package/es/Avatar/index.js +3 -3
- package/es/Chat/store/initialState.d.ts +12 -12
- package/es/Chat/store/messageReducer.d.ts +12 -12
- package/es/Chat/store/store.d.ts +12 -12
- package/es/Chat/store/store.js +11 -9
- package/es/Chat/types.d.ts +14 -14
- package/es/Chat/utils/fetch.d.ts +1 -1
- package/es/Chat/utils/fetch.js +3 -3
- package/es/ColorScales/ScaleRow.d.ts +1 -1
- package/es/ColorScales/ScaleRow.js +3 -3
- package/es/ColorScales/index.d.ts +1 -1
- package/es/ColorScales/index.js +8 -8
- package/es/ContextMenu/MenuItem/icons.js +23 -23
- package/es/ContextMenu/MenuItem/index.d.ts +4 -4
- package/es/ContextMenu/MenuItem/index.js +6 -5
- package/es/ContextMenu/index.d.ts +4 -4
- package/es/ContextMenu/index.js +11 -17
- package/es/ContextMenu/types/menuItem.d.ts +3 -3
- package/es/Conversation/App.d.ts +5 -5
- package/es/Conversation/App.js +5 -5
- package/es/Conversation/ChatList/MessageItem/Content.js +13 -13
- package/es/Conversation/ChatList/MessageItem/Toolbar.d.ts +3 -3
- package/es/Conversation/ChatList/MessageItem/Toolbar.js +16 -21
- package/es/Conversation/ChatList/MessageItem/index.js +15 -15
- package/es/Conversation/ChatList/index.d.ts +4 -4
- package/es/Conversation/ChatList/index.js +8 -6
- package/es/Conversation/InputArea/ActionBar.js +7 -7
- package/es/Conversation/InputArea/index.js +17 -17
- package/es/Conversation/StoreUpdater.d.ts +1 -1
- package/es/Conversation/index.js +4 -2
- package/es/CopyButton/index.d.ts +10 -10
- package/es/CopyButton/index.js +10 -8
- package/es/DraggablePanel/index.d.ts +45 -44
- package/es/DraggablePanel/index.js +10 -9
- package/es/EditableMessage/index.d.ts +23 -23
- package/es/EditableMessage/index.js +15 -15
- package/es/EditableMessageList/index.d.ts +5 -5
- package/es/EditableMessageList/index.js +16 -16
- package/es/EditableText/index.js +9 -9
- package/es/Highlighter/SyntaxHighlighter/Prism.d.ts +1 -1
- package/es/Highlighter/SyntaxHighlighter/Prism.js +4 -2
- package/es/Highlighter/SyntaxHighlighter/index.js +5 -5
- package/es/Highlighter/index.d.ts +5 -5
- package/es/Highlighter/index.js +5 -5
- package/es/Icon/index.d.ts +6 -6
- package/es/Icon/index.js +3 -1
- package/es/Input/index.js +7 -5
- package/es/List/ListItem/index.d.ts +21 -21
- package/es/List/ListItem/index.js +13 -11
- package/es/List/ListItem/time.js +1 -1
- package/es/Logo/Divider.js +4 -2
- package/es/Logo/Logo3D.js +3 -1
- package/es/Logo/LogoFlat.js +46 -44
- package/es/Logo/LogoHighContrast.js +7 -5
- package/es/Logo/LogoText.js +6 -4
- package/es/Logo/index.d.ts +5 -5
- package/es/Logo/index.js +3 -1
- package/es/Markdown/Code.js +1 -1
- package/es/Markdown/CodeBlock.js +4 -4
- package/es/MessageInput/index.d.ts +10 -10
- package/es/MessageInput/index.js +12 -10
- package/es/MessageModal/index.d.ts +11 -11
- package/es/MessageModal/index.js +15 -15
- package/es/SearchBar/index.d.ts +5 -5
- package/es/SearchBar/index.js +19 -17
- package/es/SideNav/index.d.ts +5 -5
- package/es/SideNav/index.js +9 -7
- package/es/Snippet/index.d.ts +5 -5
- package/es/Snippet/index.js +5 -3
- package/es/StroyBook/index.d.ts +2 -2
- package/es/StroyBook/index.js +7 -5
- package/es/StroyBook/style.d.ts +1 -1
- package/es/Swatches/index.d.ts +4 -4
- package/es/Swatches/index.js +7 -7
- package/es/TabsNav/index.d.ts +6 -6
- package/es/TabsNav/index.js +3 -1
- package/es/ThemeProvider/index.d.ts +6 -6
- package/es/ThemeProvider/index.js +3 -3
- package/es/ThemeSwitch/index.d.ts +5 -5
- package/es/ThemeSwitch/index.js +11 -9
- package/es/Tooltip/index.js +5 -3
- package/es/components/ControlInput.d.ts +1 -1
- package/es/components/ControlInput.js +20 -18
- package/es/hooks/useHighlight.d.ts +8 -8
- package/es/hooks/useHighlight.js +4 -4
- package/es/styles/algorithms/generateColorPalette.d.ts +4 -4
- package/es/styles/algorithms/generateCustomStylish.d.ts +1 -1
- package/es/styles/algorithms/generateCustomToken.d.ts +1 -1
- package/es/styles/algorithms/generateCustomToken.js +3 -2
- package/es/styles/algorithms/generateTheme.js +3 -1
- package/es/styles/colors.d.ts +13 -13
- package/es/styles/theme/dark.js +3 -1
- package/es/styles/theme/light.js +3 -1
- package/es/types/customStylish.d.ts +4 -4
- package/es/types/customToken.d.ts +5 -5
- package/es/types/global.d.ts +2 -0
- package/package.json +71 -68
package/es/ActionIcon/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { LucideIcon } from 'lucide-react';
|
|
2
3
|
import { TooltipProps } from "../index";
|
|
3
4
|
import { DivProps } from "../types";
|
|
4
|
-
import { LucideIcon } from 'lucide-react';
|
|
5
5
|
export declare type ActionIconSize = 'large' | 'normal' | 'small' | 'site' | {
|
|
6
6
|
blockSize?: number;
|
|
7
|
+
borderRadius?: number;
|
|
7
8
|
fontSize?: number;
|
|
8
9
|
strokeWidth?: number;
|
|
9
|
-
borderRadius?: number;
|
|
10
10
|
};
|
|
11
11
|
export interface ActionIconProps extends DivProps {
|
|
12
12
|
/**
|
|
@@ -15,24 +15,20 @@ export interface ActionIconProps extends DivProps {
|
|
|
15
15
|
*/
|
|
16
16
|
active?: boolean;
|
|
17
17
|
/**
|
|
18
|
-
* @description
|
|
19
|
-
* @default
|
|
20
|
-
*/
|
|
21
|
-
size?: ActionIconSize;
|
|
22
|
-
/**
|
|
23
|
-
* @description The icon element to be rendered
|
|
24
|
-
* @type LucideIcon
|
|
18
|
+
* @description Change arrow's visible state and change whether the arrow is pointed at the center of target.
|
|
19
|
+
* @default false
|
|
25
20
|
*/
|
|
26
|
-
|
|
21
|
+
arrow?: boolean;
|
|
27
22
|
/**
|
|
28
23
|
* @description Glass blur style
|
|
29
24
|
* @default 'false'
|
|
30
25
|
*/
|
|
31
26
|
glass?: boolean;
|
|
32
27
|
/**
|
|
33
|
-
* @description The
|
|
28
|
+
* @description The icon element to be rendered
|
|
29
|
+
* @type LucideIcon
|
|
34
30
|
*/
|
|
35
|
-
|
|
31
|
+
icon: LucideIcon;
|
|
36
32
|
/**
|
|
37
33
|
* @description The position of the tooltip relative to the target
|
|
38
34
|
* @enum ["top","left","right","bottom","topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]
|
|
@@ -40,10 +36,14 @@ export interface ActionIconProps extends DivProps {
|
|
|
40
36
|
*/
|
|
41
37
|
placement?: TooltipProps['placement'];
|
|
42
38
|
/**
|
|
43
|
-
* @description
|
|
44
|
-
* @default
|
|
39
|
+
* @description Size of the icon
|
|
40
|
+
* @default 'normal'
|
|
45
41
|
*/
|
|
46
|
-
|
|
42
|
+
size?: ActionIconSize;
|
|
43
|
+
/**
|
|
44
|
+
* @description The text shown in the tooltip
|
|
45
|
+
*/
|
|
46
|
+
title?: string;
|
|
47
47
|
}
|
|
48
48
|
declare const ActionIcon: import("react").NamedExoticComponent<ActionIconProps>;
|
|
49
49
|
export default ActionIcon;
|
package/es/ActionIcon/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["className", "active", "icon", "size", "style", "glass", "title", "placement", "arrow"];
|
|
4
|
-
|
|
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; }
|
|
5
6
|
import { memo } from 'react';
|
|
7
|
+
import { Icon, Tooltip } from "./..";
|
|
6
8
|
import { useStyles } from "./style";
|
|
7
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
10
|
var ActionIcon = /*#__PURE__*/memo(function (_ref) {
|
|
@@ -57,15 +59,15 @@ var ActionIcon = /*#__PURE__*/memo(function (_ref) {
|
|
|
57
59
|
}, style)
|
|
58
60
|
}, props), {}, {
|
|
59
61
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
icon: icon,
|
|
63
|
+
size: size === 'site' ? 'normal' : size
|
|
62
64
|
})
|
|
63
65
|
}));
|
|
64
66
|
if (!title) return actionIconBlock;
|
|
65
67
|
return /*#__PURE__*/_jsx(Tooltip, {
|
|
66
68
|
arrow: arrow,
|
|
67
|
-
title: title,
|
|
68
69
|
placement: placement,
|
|
70
|
+
title: title,
|
|
69
71
|
children: actionIconBlock
|
|
70
72
|
});
|
|
71
73
|
});
|
package/es/Avatar/index.d.ts
CHANGED
|
@@ -5,23 +5,23 @@ export interface AvatarProps {
|
|
|
5
5
|
*/
|
|
6
6
|
avatar?: string;
|
|
7
7
|
/**
|
|
8
|
-
* @description The
|
|
9
|
-
*/
|
|
10
|
-
title?: string;
|
|
11
|
-
/**
|
|
12
|
-
* @description The size of the avatar in pixels
|
|
13
|
-
* @default 40
|
|
8
|
+
* @description The background color of the avatar
|
|
14
9
|
*/
|
|
15
|
-
|
|
10
|
+
background?: string;
|
|
16
11
|
/**
|
|
17
12
|
* @description The shape of the avatar
|
|
18
13
|
* @default 'circle'
|
|
19
14
|
*/
|
|
20
15
|
shape?: 'circle' | 'square';
|
|
21
16
|
/**
|
|
22
|
-
* @description The
|
|
17
|
+
* @description The size of the avatar in pixels
|
|
18
|
+
* @default 40
|
|
23
19
|
*/
|
|
24
|
-
|
|
20
|
+
size?: number;
|
|
21
|
+
/**
|
|
22
|
+
* @description The title text to display if avatar is not provided
|
|
23
|
+
*/
|
|
24
|
+
title?: string;
|
|
25
25
|
}
|
|
26
26
|
declare const Avatar: FC<AvatarProps>;
|
|
27
27
|
export default Avatar;
|
package/es/Avatar/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var Avatar = function Avatar(_ref) {
|
|
|
18
18
|
return avatar.startsWith(i);
|
|
19
19
|
});
|
|
20
20
|
return /*#__PURE__*/_jsx(Center, {
|
|
21
|
+
className: styles.container,
|
|
21
22
|
style: {
|
|
22
23
|
width: size,
|
|
23
24
|
height: size,
|
|
@@ -25,16 +26,15 @@ var Avatar = function Avatar(_ref) {
|
|
|
25
26
|
backgroundColor: backgroundColor,
|
|
26
27
|
borderWidth: isImage ? 1 : 0
|
|
27
28
|
},
|
|
28
|
-
className: styles.container,
|
|
29
29
|
children: !avatar ? /*#__PURE__*/_jsx(A, {
|
|
30
30
|
shape: shape,
|
|
31
31
|
size: size,
|
|
32
32
|
children: title === null || title === void 0 ? void 0 : title.slice(0, 2)
|
|
33
33
|
}) : isImage ? /*#__PURE__*/_jsx(A, {
|
|
34
|
+
className: styles.border,
|
|
34
35
|
shape: shape,
|
|
35
36
|
size: size,
|
|
36
|
-
src: avatar
|
|
37
|
-
className: styles.border
|
|
37
|
+
src: avatar
|
|
38
38
|
}) : /*#__PURE__*/_jsx(Center, {
|
|
39
39
|
className: styles.border,
|
|
40
40
|
style: {
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { ChatMessage, InternalChatContext, OpenAIRequestParams } from '../types';
|
|
2
2
|
export interface ChatState extends InternalChatContext {
|
|
3
|
-
/**
|
|
4
|
-
* @title 消息
|
|
5
|
-
* @type {string}
|
|
6
|
-
*/
|
|
7
|
-
message: string;
|
|
8
|
-
/**
|
|
9
|
-
* @title 加载状态
|
|
10
|
-
* @type {boolean}
|
|
11
|
-
*/
|
|
12
|
-
loading: boolean;
|
|
13
3
|
/**
|
|
14
4
|
* @title 改变系统角色状态
|
|
15
5
|
* @type {boolean}
|
|
@@ -19,10 +9,20 @@ export interface ChatState extends InternalChatContext {
|
|
|
19
9
|
* 编辑中的消息 id
|
|
20
10
|
*/
|
|
21
11
|
editingMessageId?: number | null;
|
|
12
|
+
/**
|
|
13
|
+
* @title 加载状态
|
|
14
|
+
* @type {boolean}
|
|
15
|
+
*/
|
|
16
|
+
loading: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* @title 消息
|
|
19
|
+
* @type {string}
|
|
20
|
+
*/
|
|
21
|
+
message: string;
|
|
22
|
+
onAgentChange?: (agent: any, type: 'update' | 'remove') => void;
|
|
22
23
|
onMessagesChange?: (messages: ChatMessage[]) => void;
|
|
23
|
-
onResponseStart?: (messages: ChatMessage[]) => Promise<void>;
|
|
24
24
|
onResponseFinished?: (session: any) => void;
|
|
25
|
-
|
|
25
|
+
onResponseStart?: (messages: ChatMessage[]) => Promise<void>;
|
|
26
26
|
request?: (params: OpenAIRequestParams) => Promise<Response>;
|
|
27
27
|
}
|
|
28
28
|
export declare const initialState: ChatState;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { ChatMessage, ChatMessageError, MessageRoleType } from '../types';
|
|
2
2
|
export declare type MessageDispatch = {
|
|
3
|
-
type: 'addMessage';
|
|
4
3
|
message: ChatMessage;
|
|
4
|
+
type: 'addMessage';
|
|
5
5
|
} | {
|
|
6
|
-
type: 'insertMessage';
|
|
7
|
-
message: ChatMessage;
|
|
8
6
|
index: number;
|
|
7
|
+
message: ChatMessage;
|
|
8
|
+
type: 'insertMessage';
|
|
9
9
|
} | {
|
|
10
|
-
type: 'deleteMessage';
|
|
11
10
|
index: number;
|
|
11
|
+
type: 'deleteMessage';
|
|
12
12
|
} | {
|
|
13
13
|
type: 'resetMessages';
|
|
14
14
|
} | {
|
|
15
|
-
type: 'updateMessage';
|
|
16
15
|
index: number;
|
|
17
16
|
message: string;
|
|
17
|
+
type: 'updateMessage';
|
|
18
18
|
} | {
|
|
19
|
-
type: 'updateMessageRole';
|
|
20
19
|
index: number;
|
|
21
20
|
role: MessageRoleType;
|
|
21
|
+
type: 'updateMessageRole';
|
|
22
22
|
} | {
|
|
23
|
-
type: 'addUserMessage';
|
|
24
23
|
message: string;
|
|
24
|
+
type: 'addUserMessage';
|
|
25
25
|
} | {
|
|
26
|
-
type: 'updateLatestBotMessage';
|
|
27
26
|
responseStream: string[];
|
|
27
|
+
type: 'updateLatestBotMessage';
|
|
28
28
|
} | {
|
|
29
|
-
type: 'updateMessageChoice';
|
|
30
|
-
message: string;
|
|
31
29
|
index: number;
|
|
30
|
+
message: string;
|
|
31
|
+
type: 'updateMessageChoice';
|
|
32
32
|
} | {
|
|
33
|
-
type: 'setErrorMessage';
|
|
34
|
-
index: number;
|
|
35
33
|
error: ChatMessageError | undefined;
|
|
34
|
+
index: number;
|
|
35
|
+
type: 'setErrorMessage';
|
|
36
36
|
};
|
|
37
37
|
export declare const messagesReducer: (state: ChatMessage[], payload: MessageDispatch) => ChatMessage[];
|
package/es/Chat/store/store.d.ts
CHANGED
|
@@ -4,30 +4,30 @@ import { FetchSSEOptions } from '../utils/fetch';
|
|
|
4
4
|
import { ChatState } from './initialState';
|
|
5
5
|
import { MessageDispatch } from './messageReducer';
|
|
6
6
|
interface ChatAction {
|
|
7
|
-
/**
|
|
8
|
-
* @title 发送消息
|
|
9
|
-
* @returns Promise<void>
|
|
10
|
-
*/
|
|
11
|
-
sendMessage: () => Promise<void>;
|
|
12
|
-
/**
|
|
13
|
-
* @title 重发消息
|
|
14
|
-
* @param index - 消息索引
|
|
15
|
-
* @returns Promise<void>
|
|
16
|
-
*/
|
|
17
|
-
resendMessage: (index: number) => Promise<void>;
|
|
18
|
-
generateMessage: (message: string, messages: ChatMessage[], options: FetchSSEOptions) => Promise<void>;
|
|
19
7
|
/**
|
|
20
8
|
* @title 派发消息
|
|
21
9
|
* @param payload - 消息分发
|
|
22
10
|
* @returns void
|
|
23
11
|
*/
|
|
24
12
|
dispatchMessage: (payload: MessageDispatch) => void;
|
|
13
|
+
generateMessage: (message: string, messages: ChatMessage[], options: FetchSSEOptions) => Promise<void>;
|
|
25
14
|
/**
|
|
26
15
|
* @title 处理消息编辑
|
|
27
16
|
* @param index - 消息索引或空
|
|
28
17
|
* @returns void
|
|
29
18
|
*/
|
|
30
19
|
handleMessageEditing: (index?: number | null) => void;
|
|
20
|
+
/**
|
|
21
|
+
* @title 重发消息
|
|
22
|
+
* @param index - 消息索引
|
|
23
|
+
* @returns Promise<void>
|
|
24
|
+
*/
|
|
25
|
+
resendMessage: (index: number) => Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* @title 发送消息
|
|
28
|
+
* @returns Promise<void>
|
|
29
|
+
*/
|
|
30
|
+
sendMessage: () => Promise<void>;
|
|
31
31
|
}
|
|
32
32
|
export declare type ChatStore = ChatAction & ChatState;
|
|
33
33
|
export declare const createStore: StateCreator<ChatStore, [['zustand/devtools', never]]>;
|
package/es/Chat/store/store.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
import
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
5
|
var _excluded = ["type"];
|
|
7
|
-
import
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
8
9
|
import { LOADING_FLAT } from "../const";
|
|
10
|
+
import { fetchSSE } from "../utils/fetch";
|
|
9
11
|
import { initialState } from "./initialState";
|
|
10
12
|
import { messagesReducer } from "./messageReducer";
|
|
11
13
|
export var createStore = function createStore(set, get) {
|
|
@@ -29,9 +31,9 @@ export var createStore = function createStore(set, get) {
|
|
|
29
31
|
});
|
|
30
32
|
},
|
|
31
33
|
generateMessage: function () {
|
|
32
|
-
var _generateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime
|
|
34
|
+
var _generateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(message, messages, options) {
|
|
33
35
|
var _get2, onResponseStart, request, onResponseFinished, fetcher;
|
|
34
|
-
return _regeneratorRuntime
|
|
36
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35
37
|
while (1) switch (_context.prev = _context.next) {
|
|
36
38
|
case 0:
|
|
37
39
|
_get2 = get(), onResponseStart = _get2.onResponseStart, request = _get2.request, onResponseFinished = _get2.onResponseFinished;
|
|
@@ -73,9 +75,9 @@ export var createStore = function createStore(set, get) {
|
|
|
73
75
|
return generateMessage;
|
|
74
76
|
}(),
|
|
75
77
|
sendMessage: function () {
|
|
76
|
-
var _sendMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime
|
|
78
|
+
var _sendMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
77
79
|
var _get3, message, dispatchMessage, generateMessage, messages, currentResponse;
|
|
78
|
-
return _regeneratorRuntime
|
|
80
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
79
81
|
while (1) switch (_context2.prev = _context2.next) {
|
|
80
82
|
case 0:
|
|
81
83
|
_get3 = get(), message = _get3.message, dispatchMessage = _get3.dispatchMessage, generateMessage = _get3.generateMessage, messages = _get3.messages;
|
|
@@ -138,10 +140,10 @@ export var createStore = function createStore(set, get) {
|
|
|
138
140
|
return sendMessage;
|
|
139
141
|
}(),
|
|
140
142
|
resendMessage: function () {
|
|
141
|
-
var _resendMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime
|
|
143
|
+
var _resendMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(index) {
|
|
142
144
|
var _contextMessages$at;
|
|
143
145
|
var _get4, dispatchMessage, sendMessage, generateMessage, messages, lastMessage, contextMessages, userMessage, targetMsg, botPrevMsg, currentResponse;
|
|
144
|
-
return _regeneratorRuntime
|
|
146
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
145
147
|
while (1) switch (_context3.prev = _context3.next) {
|
|
146
148
|
case 0:
|
|
147
149
|
_get4 = get(), dispatchMessage = _get4.dispatchMessage, sendMessage = _get4.sendMessage, generateMessage = _get4.generateMessage, messages = _get4.messages;
|
package/es/Chat/types.d.ts
CHANGED
|
@@ -25,44 +25,44 @@ export interface ChatMessageError {
|
|
|
25
25
|
*/
|
|
26
26
|
export interface ChatMessage {
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @description 消息发送者的角色
|
|
30
|
-
* @enum {MessageRoleType} ChatGPTAgent
|
|
28
|
+
* 其余生成项
|
|
31
29
|
*/
|
|
32
|
-
|
|
30
|
+
choices?: string[];
|
|
33
31
|
/**
|
|
34
32
|
* @title 内容
|
|
35
33
|
* @description 消息内容
|
|
36
34
|
*/
|
|
37
35
|
content: string;
|
|
38
|
-
/**
|
|
39
|
-
* 其余生成项
|
|
40
|
-
*/
|
|
41
|
-
choices?: string[];
|
|
42
36
|
/**
|
|
43
37
|
* 如果存在错误消息
|
|
44
38
|
*/
|
|
45
39
|
error?: ChatMessageError;
|
|
46
|
-
}
|
|
47
|
-
export interface ChatContext {
|
|
48
|
-
id: string;
|
|
49
40
|
/**
|
|
50
|
-
* @title
|
|
41
|
+
* @title 角色
|
|
42
|
+
* @description 消息发送者的角色
|
|
43
|
+
* @enum {MessageRoleType} ChatGPTAgent
|
|
51
44
|
*/
|
|
52
|
-
|
|
45
|
+
role: MessageRoleType;
|
|
46
|
+
}
|
|
47
|
+
export interface ChatContext {
|
|
48
|
+
createAt: number;
|
|
53
49
|
/**
|
|
54
50
|
* @title 会话描述
|
|
55
51
|
* @description 用户设置的会话描述
|
|
56
52
|
* @type {string}
|
|
57
53
|
*/
|
|
58
54
|
description?: string;
|
|
55
|
+
id: string;
|
|
59
56
|
/**
|
|
60
57
|
* @title 消息列表
|
|
61
58
|
* @description 聊天室中的所有消息
|
|
62
59
|
* @type {ChatMessage[]}
|
|
63
60
|
*/
|
|
64
61
|
messages: ChatMessage[];
|
|
65
|
-
|
|
62
|
+
/**
|
|
63
|
+
* @title 会话标题
|
|
64
|
+
*/
|
|
65
|
+
title?: string;
|
|
66
66
|
updateAt: number;
|
|
67
67
|
}
|
|
68
68
|
export declare type ChatContextMap = Record<string, Omit<ChatContext, 'systemRole'>>;
|
package/es/Chat/utils/fetch.d.ts
CHANGED
package/es/Chat/utils/fetch.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
var codeMessage = {
|
|
4
4
|
200: '成功获取数据,服务已响应',
|
|
5
5
|
201: '操作成功,数据已保存',
|
|
@@ -23,7 +23,7 @@ var codeMessage = {
|
|
|
23
23
|
* @param options
|
|
24
24
|
*/
|
|
25
25
|
export var fetchSSE = /*#__PURE__*/function () {
|
|
26
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime
|
|
26
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(fetchFn) {
|
|
27
27
|
var options,
|
|
28
28
|
response,
|
|
29
29
|
_options$onErrorHandl,
|
|
@@ -39,7 +39,7 @@ export var fetchSSE = /*#__PURE__*/function () {
|
|
|
39
39
|
doneReading,
|
|
40
40
|
chunkValue,
|
|
41
41
|
_args = arguments;
|
|
42
|
-
return _regeneratorRuntime
|
|
42
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
43
43
|
while (1) switch (_context.prev = _context.next) {
|
|
44
44
|
case 0:
|
|
45
45
|
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface IScaleRow {
|
|
3
3
|
name: string;
|
|
4
|
-
title: 'light' | 'lightA' | 'dark' | 'darkA';
|
|
5
4
|
scale: string[];
|
|
5
|
+
title: 'light' | 'lightA' | 'dark' | 'darkA';
|
|
6
6
|
}
|
|
7
7
|
declare const ScaleRow: import("react").NamedExoticComponent<IScaleRow>;
|
|
8
8
|
export default ScaleRow;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { message, Space } from 'antd';
|
|
2
2
|
import copy from 'copy-to-clipboard';
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
import { alphaBg, useStyles } from "./style";
|
|
@@ -42,13 +42,13 @@ var ScaleRow = /*#__PURE__*/memo(function (_ref) {
|
|
|
42
42
|
if (index === 0 || index === 12) return null;
|
|
43
43
|
return /*#__PURE__*/_jsx("div", {
|
|
44
44
|
className: styles.scaleBox,
|
|
45
|
-
title: color,
|
|
46
|
-
style: style,
|
|
47
45
|
onClick: function onClick() {
|
|
48
46
|
var content = "token.".concat(name).concat(index).concat(isAlpha ? 'A' : '', " /* ").concat(color, " */");
|
|
49
47
|
copy(content);
|
|
50
48
|
message.success(content);
|
|
51
49
|
},
|
|
50
|
+
style: style,
|
|
51
|
+
title: color,
|
|
52
52
|
children: /*#__PURE__*/_jsx("div", {
|
|
53
53
|
className: styles.scaleItem,
|
|
54
54
|
style: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ColorScaleItem } from "../styles/colors";
|
|
3
3
|
export interface ColorScalesProps {
|
|
4
|
+
midHighLight: number;
|
|
4
5
|
name: string;
|
|
5
6
|
scale: ColorScaleItem;
|
|
6
|
-
midHighLight: number;
|
|
7
7
|
}
|
|
8
8
|
declare const ColorScales: import("react").NamedExoticComponent<ColorScalesProps>;
|
|
9
9
|
export default ColorScales;
|
package/es/ColorScales/index.js
CHANGED
|
@@ -43,20 +43,20 @@ var ColorScales = /*#__PURE__*/memo(function (_ref) {
|
|
|
43
43
|
})]
|
|
44
44
|
}, "scale-title"), /*#__PURE__*/_jsx(ScaleRow, {
|
|
45
45
|
name: name,
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
scale: scale.light,
|
|
47
|
+
title: "light"
|
|
48
48
|
}, "light"), /*#__PURE__*/_jsx(ScaleRow, {
|
|
49
49
|
name: name,
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
scale: scale.lightA,
|
|
51
|
+
title: "lightA"
|
|
52
52
|
}, "lightA"), /*#__PURE__*/_jsx(ScaleRow, {
|
|
53
53
|
name: name,
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
scale: scale.dark,
|
|
55
|
+
title: "dark"
|
|
56
56
|
}, "dark"), /*#__PURE__*/_jsx(ScaleRow, {
|
|
57
57
|
name: name,
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
scale: scale.darkA,
|
|
59
|
+
title: "darkA"
|
|
60
60
|
}, "darkA")]
|
|
61
61
|
})
|
|
62
62
|
})
|
|
@@ -4,15 +4,15 @@ var strokeWidth = 2.2;
|
|
|
4
4
|
var iconSize = '13px';
|
|
5
5
|
export var CommandIcon = function CommandIcon() {
|
|
6
6
|
return /*#__PURE__*/_jsx("svg", {
|
|
7
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
-
width: iconSize,
|
|
9
|
-
height: iconSize,
|
|
10
|
-
viewBox: "0 0 24 24",
|
|
11
7
|
fill: "none",
|
|
8
|
+
height: iconSize,
|
|
12
9
|
stroke: "currentColor",
|
|
13
|
-
strokeWidth: strokeWidth,
|
|
14
10
|
strokeLinecap: "round",
|
|
15
11
|
strokeLinejoin: "round",
|
|
12
|
+
strokeWidth: strokeWidth,
|
|
13
|
+
viewBox: "0 0 24 24",
|
|
14
|
+
width: iconSize,
|
|
15
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16
16
|
children: /*#__PURE__*/_jsx("path", {
|
|
17
17
|
d: "M18 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3V6a3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3h12a3 3 0 0 0 3-3 3 3 0 0 0-3-3z"
|
|
18
18
|
})
|
|
@@ -20,16 +20,16 @@ export var CommandIcon = function CommandIcon() {
|
|
|
20
20
|
};
|
|
21
21
|
export var ControlIcon = function ControlIcon() {
|
|
22
22
|
return /*#__PURE__*/_jsx("svg", {
|
|
23
|
-
|
|
24
|
-
width: iconSize,
|
|
25
|
-
height: iconSize,
|
|
26
|
-
viewBox: "0 0 24 24",
|
|
23
|
+
className: "lucide lucide-chevron-up",
|
|
27
24
|
fill: "none",
|
|
25
|
+
height: iconSize,
|
|
28
26
|
stroke: "currentColor",
|
|
29
|
-
strokeWidth: strokeWidth,
|
|
30
27
|
strokeLinecap: "round",
|
|
31
28
|
strokeLinejoin: "round",
|
|
32
|
-
|
|
29
|
+
strokeWidth: strokeWidth,
|
|
30
|
+
viewBox: "0 0 24 24",
|
|
31
|
+
width: iconSize,
|
|
32
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
33
33
|
children: /*#__PURE__*/_jsx("polyline", {
|
|
34
34
|
points: "18 15 12 9 6 15"
|
|
35
35
|
})
|
|
@@ -37,16 +37,16 @@ export var ControlIcon = function ControlIcon() {
|
|
|
37
37
|
};
|
|
38
38
|
export var ShiftIcon = function ShiftIcon() {
|
|
39
39
|
return /*#__PURE__*/_jsx("svg", {
|
|
40
|
-
|
|
41
|
-
width: iconSize,
|
|
42
|
-
height: iconSize,
|
|
43
|
-
viewBox: "0 0 24 24",
|
|
40
|
+
className: "lucide lucide-chevron-up",
|
|
44
41
|
fill: "none",
|
|
42
|
+
height: iconSize,
|
|
45
43
|
stroke: "currentColor",
|
|
46
|
-
strokeWidth: strokeWidth,
|
|
47
44
|
strokeLinecap: "round",
|
|
48
45
|
strokeLinejoin: "round",
|
|
49
|
-
|
|
46
|
+
strokeWidth: strokeWidth,
|
|
47
|
+
viewBox: "0 0 24 24",
|
|
48
|
+
width: iconSize,
|
|
49
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
50
50
|
children: /*#__PURE__*/_jsx("path", {
|
|
51
51
|
d: "M9 18v-6H5l7-7 7 7h-4v6H9z"
|
|
52
52
|
})
|
|
@@ -54,16 +54,16 @@ export var ShiftIcon = function ShiftIcon() {
|
|
|
54
54
|
};
|
|
55
55
|
export var AltIcon = function AltIcon() {
|
|
56
56
|
return /*#__PURE__*/_jsxs("svg", {
|
|
57
|
-
|
|
58
|
-
width: iconSize,
|
|
59
|
-
height: iconSize,
|
|
60
|
-
viewBox: "0 0 24 24",
|
|
57
|
+
className: "lucide lucide-chevron-up",
|
|
61
58
|
fill: "none",
|
|
59
|
+
height: iconSize,
|
|
62
60
|
stroke: "currentColor",
|
|
63
|
-
strokeWidth: strokeWidth,
|
|
64
61
|
strokeLinecap: "round",
|
|
65
62
|
strokeLinejoin: "round",
|
|
66
|
-
|
|
63
|
+
strokeWidth: strokeWidth,
|
|
64
|
+
viewBox: "0 0 24 24",
|
|
65
|
+
width: iconSize,
|
|
66
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
67
67
|
children: [/*#__PURE__*/_jsx("path", {
|
|
68
68
|
d: "M3 3h6l6 18h6"
|
|
69
69
|
}), /*#__PURE__*/_jsx("path", {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
interface MenuItemProps {
|
|
3
|
-
label: ReactNode;
|
|
4
|
-
disabled?: boolean;
|
|
5
3
|
active?: boolean;
|
|
6
|
-
|
|
7
|
-
nested?: boolean;
|
|
4
|
+
disabled?: boolean;
|
|
8
5
|
icon?: ReactNode;
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
nested?: boolean;
|
|
8
|
+
selected?: boolean;
|
|
9
9
|
shortcut?: string[];
|
|
10
10
|
}
|
|
11
11
|
declare const MenuItem: import("react").ForwardRefExoticComponent<MenuItemProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
3
|
var _excluded = ["label", "icon", "disabled", "nested", "shortcut", "active", "selected"];
|
|
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; }
|
|
5
6
|
import { ChevronRightIcon } from 'lucide-react';
|
|
6
7
|
import { forwardRef } from 'react';
|
|
7
8
|
import { Flexbox } from 'react-layout-kit';
|
|
@@ -41,13 +42,13 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
41
42
|
return /*#__PURE__*/_jsxs("button", _objectSpread(_objectSpread({
|
|
42
43
|
type: 'button'
|
|
43
44
|
}, props), {}, {
|
|
45
|
+
className: cx(styles.item, (_cx = {}, _defineProperty(_cx, styles.selected, selected), _defineProperty(_cx, styles.active, active), _cx)),
|
|
46
|
+
disabled: disabled,
|
|
44
47
|
ref: ref,
|
|
45
48
|
role: "menuitem",
|
|
46
|
-
disabled: disabled,
|
|
47
|
-
className: cx(styles.item, (_cx = {}, _defineProperty(_cx, styles.selected, selected), _defineProperty(_cx, styles.active, active), _cx)),
|
|
48
49
|
children: [/*#__PURE__*/_jsxs(Flexbox, {
|
|
49
|
-
horizontal: true,
|
|
50
50
|
gap: 8,
|
|
51
|
+
horizontal: true,
|
|
51
52
|
children: [icon && /*#__PURE__*/_jsx("span", {
|
|
52
53
|
children: icon
|
|
53
54
|
}), label]
|
|
@@ -57,8 +58,8 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
57
58
|
className: styles.arrow
|
|
58
59
|
})
|
|
59
60
|
}) : shortcut ? /*#__PURE__*/_jsx(Flexbox, {
|
|
60
|
-
horizontal: true,
|
|
61
61
|
align: 'center',
|
|
62
|
+
horizontal: true,
|
|
62
63
|
children: shortcut.map(function (c) {
|
|
63
64
|
var code = CODE_MAP[c.toLowerCase()];
|
|
64
65
|
return /*#__PURE__*/_jsx("kbd", {
|