@antv/dumi-theme-antv 0.8.0-beta.8 → 0.8.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AI/HomeDialog/PromptTextarea/index.js +12 -5
- package/dist/components/AI/HomeDialog/RecommendCase/Card.js +3 -5
- package/dist/components/AI/HomeDialog/RecommendCase/index.js +39 -12
- package/dist/components/AI/HomeDialog/RecommendCase/index.module.less +1 -0
- package/dist/components/AI/HomeDialog/index.js +6 -1
- package/dist/components/Login/LoginForm.js +1 -7
- package/dist/model/AIChat.js +7 -1
- package/dist/model/auth.js +10 -6
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.js +2 -3
- package/dist/pages/AIPlayground/components/MsgBox/index.js +15 -9
- package/dist/slots/Header/Search/SearchResult.js +11 -8
- package/package.json +1 -1
- package/dist/utils/uid.js +0 -17
|
@@ -12,7 +12,7 @@ import { DatasourceCard } from "./DatasourceCard";
|
|
|
12
12
|
import { useEventListener } from 'ahooks';
|
|
13
13
|
import classnames from 'classnames';
|
|
14
14
|
import _ from 'lodash';
|
|
15
|
-
import React, { useState } from 'react';
|
|
15
|
+
import React, { useRef, useState } from 'react';
|
|
16
16
|
import styles from "./index.module.less";
|
|
17
17
|
import { SendButton } from "./SendButton";
|
|
18
18
|
import { ChooseLib } from "./ChooseLib";
|
|
@@ -41,6 +41,7 @@ export var PromptTextarea = /*#__PURE__*/React.memo(function PromptTextareaInner
|
|
|
41
41
|
var authSnap = useSnapshot(authStore);
|
|
42
42
|
var _useIntl = useIntl(),
|
|
43
43
|
formatMessage = _useIntl.formatMessage;
|
|
44
|
+
var textareaRef = useRef(null);
|
|
44
45
|
|
|
45
46
|
// 将fileMeta状态移到组件内部管理
|
|
46
47
|
var _useState = useState(null),
|
|
@@ -92,14 +93,17 @@ export var PromptTextarea = /*#__PURE__*/React.memo(function PromptTextareaInner
|
|
|
92
93
|
}
|
|
93
94
|
var datasourceNode = renderDatasourceCard();
|
|
94
95
|
var promptTextValid = Boolean(value);
|
|
96
|
+
var pureSend = function pureSend() {
|
|
97
|
+
if (promptTextValid) {
|
|
98
|
+
onConfirm === null || onConfirm === void 0 || onConfirm();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
95
101
|
var send = function send() {
|
|
96
102
|
if (!authSnap.isAuthenticated) {
|
|
97
|
-
showLoginModal();
|
|
103
|
+
showLoginModal(pureSend);
|
|
98
104
|
return;
|
|
99
105
|
}
|
|
100
|
-
|
|
101
|
-
onConfirm === null || onConfirm === void 0 || onConfirm();
|
|
102
|
-
}
|
|
106
|
+
pureSend();
|
|
103
107
|
};
|
|
104
108
|
useEventListener('keydown', function (event) {
|
|
105
109
|
if (event.key === 'Enter') {
|
|
@@ -109,6 +113,8 @@ export var PromptTextarea = /*#__PURE__*/React.memo(function PromptTextareaInner
|
|
|
109
113
|
send(); // 触发自定义事件
|
|
110
114
|
}
|
|
111
115
|
}
|
|
116
|
+
}, {
|
|
117
|
+
target: textareaRef
|
|
112
118
|
});
|
|
113
119
|
return /*#__PURE__*/React.createElement("div", {
|
|
114
120
|
className: classnames(styles.container, _defineProperty(_defineProperty(_defineProperty({}, styles.active, focus), styles.compact, isCompact), styles.withDatasource, Boolean(datasourceNode))),
|
|
@@ -124,6 +130,7 @@ export var PromptTextarea = /*#__PURE__*/React.memo(function PromptTextareaInner
|
|
|
124
130
|
},
|
|
125
131
|
id: "prompt-textarea",
|
|
126
132
|
className: classnames(styles.promptTextarea),
|
|
133
|
+
ref: textareaRef,
|
|
127
134
|
placeholder:
|
|
128
135
|
// (!isCompact && !themeConfig.isAntVSite && ic(themeConfig.metas.description)) ||
|
|
129
136
|
!isCompact && !themeConfig.isAntVSite ? typedPlaceholder : formatMessage({
|
|
@@ -7,19 +7,17 @@ import { FormattedMessage } from 'dumi';
|
|
|
7
7
|
export var Card = function Card(_ref) {
|
|
8
8
|
var _AIModeMeta$tag;
|
|
9
9
|
var item = _ref.item,
|
|
10
|
-
index = _ref.index
|
|
10
|
+
index = _ref.index,
|
|
11
|
+
onClick = _ref.onClick;
|
|
11
12
|
var query = item.query,
|
|
12
13
|
description = item.description,
|
|
13
14
|
_item$imageUrls = item.imageUrls,
|
|
14
15
|
imageUrls = _item$imageUrls === void 0 ? [] : _item$imageUrls,
|
|
15
|
-
link = item.link,
|
|
16
16
|
tag = item.tag;
|
|
17
17
|
var style = COLORS[index];
|
|
18
18
|
var handleClick = function handleClick(e) {
|
|
19
19
|
e.stopPropagation();
|
|
20
|
-
|
|
21
|
-
urlObj.hash = "";
|
|
22
|
-
window.open(urlObj.toString(), '_blank');
|
|
20
|
+
onClick === null || onClick === void 0 || onClick();
|
|
23
21
|
};
|
|
24
22
|
var popoverContent = /*#__PURE__*/React.createElement("div", {
|
|
25
23
|
className: styles.popoverContent
|
|
@@ -15,12 +15,15 @@ import styles from "./index.module.less";
|
|
|
15
15
|
import { ReloadOutlined } from "@ant-design/icons";
|
|
16
16
|
import RecommendJson from "./recommend.json";
|
|
17
17
|
import classnames from "classnames";
|
|
18
|
-
import { FormattedMessage } from 'dumi';
|
|
18
|
+
import { FormattedMessage, useSiteData } from 'dumi';
|
|
19
|
+
import { sampleSize } from "lodash-es";
|
|
19
20
|
export var RecommendCase = function RecommendCase(props) {
|
|
20
21
|
var _useState = useState(false),
|
|
21
22
|
_useState2 = _slicedToArray(_useState, 2),
|
|
22
23
|
loading = _useState2[0],
|
|
23
24
|
setLoading = _useState2[1];
|
|
25
|
+
var _useSiteData = useSiteData(),
|
|
26
|
+
themeConfig = _useSiteData.themeConfig;
|
|
24
27
|
var _useState3 = useState([]),
|
|
25
28
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
26
29
|
list = _useState4[0],
|
|
@@ -30,20 +33,40 @@ export var RecommendCase = function RecommendCase(props) {
|
|
|
30
33
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
31
34
|
while (1) switch (_context.prev = _context.next) {
|
|
32
35
|
case 0:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} finally {
|
|
40
|
-
setLoading(false);
|
|
36
|
+
_context.prev = 0;
|
|
37
|
+
setLoading(true);
|
|
38
|
+
data = [];
|
|
39
|
+
if (!(themeConfig !== null && themeConfig !== void 0 && themeConfig.recommend)) {
|
|
40
|
+
_context.next = 9;
|
|
41
|
+
break;
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
+
_context.next = 6;
|
|
44
|
+
return fetch(themeConfig.recommend).then(function (res) {
|
|
45
|
+
return res.json();
|
|
46
|
+
});
|
|
47
|
+
case 6:
|
|
48
|
+
data = _context.sent;
|
|
49
|
+
_context.next = 10;
|
|
50
|
+
break;
|
|
51
|
+
case 9:
|
|
52
|
+
data = RecommendJson;
|
|
53
|
+
case 10:
|
|
54
|
+
setList(sampleSize(data, 4));
|
|
55
|
+
_context.next = 16;
|
|
56
|
+
break;
|
|
57
|
+
case 13:
|
|
58
|
+
_context.prev = 13;
|
|
59
|
+
_context.t0 = _context["catch"](0);
|
|
60
|
+
console.log(_context.t0);
|
|
61
|
+
case 16:
|
|
62
|
+
_context.prev = 16;
|
|
63
|
+
setLoading(false);
|
|
64
|
+
return _context.finish(16);
|
|
65
|
+
case 19:
|
|
43
66
|
case "end":
|
|
44
67
|
return _context.stop();
|
|
45
68
|
}
|
|
46
|
-
}, _callee);
|
|
69
|
+
}, _callee, null, [[0, 13, 16, 19]]);
|
|
47
70
|
})), [list]);
|
|
48
71
|
useEffect(function () {
|
|
49
72
|
fetchList();
|
|
@@ -75,7 +98,11 @@ export var RecommendCase = function RecommendCase(props) {
|
|
|
75
98
|
return /*#__PURE__*/React.createElement(Card, {
|
|
76
99
|
key: item.caseId,
|
|
77
100
|
item: item,
|
|
78
|
-
index: index
|
|
101
|
+
index: index,
|
|
102
|
+
onClick: function onClick() {
|
|
103
|
+
var _props$onClick;
|
|
104
|
+
(_props$onClick = props.onClick) === null || _props$onClick === void 0 || _props$onClick.call(props, item);
|
|
105
|
+
}
|
|
79
106
|
});
|
|
80
107
|
}))));
|
|
81
108
|
};
|
|
@@ -69,6 +69,11 @@ export function HomeDialog(props) {
|
|
|
69
69
|
style: props.promptTextareaStyle,
|
|
70
70
|
onDataSummaryChange: setFileSummary
|
|
71
71
|
}), /*#__PURE__*/React.createElement(RecommendCase, {
|
|
72
|
-
className: props.recommendCaseClassName
|
|
72
|
+
className: props.recommendCaseClassName,
|
|
73
|
+
onClick: function onClick(val) {
|
|
74
|
+
if (val !== null && val !== void 0 && val.query) {
|
|
75
|
+
setPromptText(val.query);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
73
78
|
}));
|
|
74
79
|
}
|
|
@@ -15,7 +15,6 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
16
|
import React, { useState } from 'react';
|
|
17
17
|
import { Button, Checkbox, Form, Input, Modal } from 'antd';
|
|
18
|
-
import { parse } from 'query-string';
|
|
19
18
|
import { chinaMobilePhoneRE, getFingerprint, SignupRegion } from "./utils";
|
|
20
19
|
import CheckCode from "./CheckCode";
|
|
21
20
|
import classNames from 'classnames';
|
|
@@ -55,7 +54,7 @@ export default function LoginForm() {
|
|
|
55
54
|
}
|
|
56
55
|
function _handleLoginOrRegister() {
|
|
57
56
|
_handleLoginOrRegister = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
|
|
58
|
-
var platform, params, fingerprintRes
|
|
57
|
+
var platform, params, fingerprintRes;
|
|
59
58
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
60
59
|
while (1) switch (_context.prev = _context.next) {
|
|
61
60
|
case 0:
|
|
@@ -76,11 +75,6 @@ export default function LoginForm() {
|
|
|
76
75
|
_context.next = 9;
|
|
77
76
|
return loginOrRegister(params);
|
|
78
77
|
case 9:
|
|
79
|
-
res = _context.sent;
|
|
80
|
-
gotoFromServer = res.goto;
|
|
81
|
-
_parse = parse(window.location.search), gotoFromUrl = _parse.goto;
|
|
82
|
-
window.location.href = gotoFromUrl || gotoFromServer || '/';
|
|
83
|
-
case 13:
|
|
84
78
|
case "end":
|
|
85
79
|
return _context.stop();
|
|
86
80
|
}
|
package/dist/model/AIChat.js
CHANGED
|
@@ -196,10 +196,16 @@ subscribeKey(AIChatStore, 'activeSessionId', function () {
|
|
|
196
196
|
AIChatStore.codeBlock = null;
|
|
197
197
|
});
|
|
198
198
|
export var createPureNewSession = function createPureNewSession(title) {
|
|
199
|
+
var newConversationName = 'New Conversation';
|
|
200
|
+
if (AIChatStore.sessions.some(function (s) {
|
|
201
|
+
return s.title === newConversationName && s.messages.length === 0;
|
|
202
|
+
})) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
199
205
|
var newSessionId = crypto.randomUUID();
|
|
200
206
|
AIChatStore.sessions.unshift({
|
|
201
207
|
id: newSessionId,
|
|
202
|
-
title: title !== null && title !== void 0 ? title :
|
|
208
|
+
title: title !== null && title !== void 0 ? title : newConversationName,
|
|
203
209
|
createdAt: Date.now(),
|
|
204
210
|
messages: []
|
|
205
211
|
});
|
package/dist/model/auth.js
CHANGED
|
@@ -27,18 +27,21 @@ function hasSkipLoginParam() {
|
|
|
27
27
|
// 1. 定义 State (只包含数据)
|
|
28
28
|
export var authStore = proxy({
|
|
29
29
|
isModalOpen: false,
|
|
30
|
-
isAuthenticated: false
|
|
30
|
+
isAuthenticated: false,
|
|
31
|
+
loginCallback: function loginCallback() {}
|
|
31
32
|
});
|
|
32
33
|
|
|
33
34
|
// 2. 定义 Actions (作为独立函数)
|
|
34
|
-
export var showLoginModal = function showLoginModal() {
|
|
35
|
+
export var showLoginModal = function showLoginModal(callback) {
|
|
35
36
|
authStore.isModalOpen = true;
|
|
37
|
+
authStore.loginCallback = callback;
|
|
36
38
|
};
|
|
37
39
|
export var hideLoginModal = function hideLoginModal() {
|
|
38
40
|
authStore.isModalOpen = false;
|
|
39
41
|
};
|
|
40
42
|
export var loginOrRegister = /*#__PURE__*/function () {
|
|
41
43
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
44
|
+
var _authStore$loginCallb;
|
|
42
45
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
43
46
|
while (1) switch (_context.prev = _context.next) {
|
|
44
47
|
case 0:
|
|
@@ -48,17 +51,18 @@ export var loginOrRegister = /*#__PURE__*/function () {
|
|
|
48
51
|
case 3:
|
|
49
52
|
authStore.isAuthenticated = true;
|
|
50
53
|
hideLoginModal();
|
|
54
|
+
(_authStore$loginCallb = authStore.loginCallback) === null || _authStore$loginCallb === void 0 || _authStore$loginCallb.call(authStore);
|
|
51
55
|
return _context.abrupt("return", true);
|
|
52
|
-
case
|
|
53
|
-
_context.prev =
|
|
56
|
+
case 9:
|
|
57
|
+
_context.prev = 9;
|
|
54
58
|
_context.t0 = _context["catch"](0);
|
|
55
59
|
console.error('Login failed in store:', _context.t0);
|
|
56
60
|
return _context.abrupt("return", false);
|
|
57
|
-
case
|
|
61
|
+
case 13:
|
|
58
62
|
case "end":
|
|
59
63
|
return _context.stop();
|
|
60
64
|
}
|
|
61
|
-
}, _callee, null, [[0,
|
|
65
|
+
}, _callee, null, [[0, 9]]);
|
|
62
66
|
}));
|
|
63
67
|
return function loginOrRegister(_x) {
|
|
64
68
|
return _ref.apply(this, arguments);
|
|
@@ -10,8 +10,7 @@ import { Dropdown, Input, Modal } from 'antd';
|
|
|
10
10
|
import { Menu } from 'antd';
|
|
11
11
|
import styles from "./index.module.less";
|
|
12
12
|
import { useSnapshot } from 'valtio';
|
|
13
|
-
import { AIChatStore, handleDeleteSession, handlePinSession, handleRenameSession } from "../../../../model/AIChat";
|
|
14
|
-
import { history } from 'dumi';
|
|
13
|
+
import { AIChatStore, createPureNewSession, handleDeleteSession, handlePinSession, handleRenameSession } from "../../../../model/AIChat";
|
|
15
14
|
import { useSetState } from "ahooks";
|
|
16
15
|
import { useIntl } from 'dumi';
|
|
17
16
|
export var ConversationsMenu = function ConversationsMenu() {
|
|
@@ -54,7 +53,7 @@ export var ConversationsMenu = function ConversationsMenu() {
|
|
|
54
53
|
id: 'ai.conversations.new'
|
|
55
54
|
}),
|
|
56
55
|
onClick: function onClick() {
|
|
57
|
-
return
|
|
56
|
+
return createPureNewSession();
|
|
58
57
|
}
|
|
59
58
|
}, {
|
|
60
59
|
key: 'history',
|
|
@@ -9,7 +9,7 @@ import { Bubble } from '@ant-design/x';
|
|
|
9
9
|
import { Button, Flex, Space, Tooltip } from 'antd';
|
|
10
10
|
import { useChat } from '@ai-sdk/react';
|
|
11
11
|
import { TextStreamChatTransport } from 'ai';
|
|
12
|
-
import {
|
|
12
|
+
import { useIntl, useSiteData } from 'dumi';
|
|
13
13
|
import { findLast } from 'lodash-es';
|
|
14
14
|
import React, { useEffect, useState, useMemo, useRef } from 'react';
|
|
15
15
|
import { useCopyToClipboard } from 'react-use';
|
|
@@ -63,7 +63,7 @@ var getTextContent = function getTextContent(message) {
|
|
|
63
63
|
}).join('');
|
|
64
64
|
};
|
|
65
65
|
function MsgBox(props) {
|
|
66
|
-
var _derivedSnap$activeSe, _derivedSnap$activeSe2, _derivedSnap$activeSe4, _derivedSnap$
|
|
66
|
+
var _derivedSnap$activeSe, _derivedSnap$activeSe2, _derivedSnap$activeSe4, _derivedSnap$activeSe7, _derivedSnap$activeSe8, _messages;
|
|
67
67
|
var _props$messages = props.messages,
|
|
68
68
|
initialMessages = _props$messages === void 0 ? [] : _props$messages,
|
|
69
69
|
_props$simple = props.simple,
|
|
@@ -177,9 +177,12 @@ function MsgBox(props) {
|
|
|
177
177
|
|
|
178
178
|
// 处理用户提交
|
|
179
179
|
var handleSubmit = function handleSubmit() {
|
|
180
|
-
var _derivedState$activeS3;
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
var _derivedSnap$activeSe5, _derivedState$activeS3;
|
|
181
|
+
var trimmedPrompt = promptText.trim();
|
|
182
|
+
if (!trimmedPrompt || status === 'streaming' || status === 'submitted') return;
|
|
183
|
+
if (!((_derivedSnap$activeSe5 = derivedSnap.activeSession.messages) !== null && _derivedSnap$activeSe5 !== void 0 && _derivedSnap$activeSe5.length)) {
|
|
184
|
+
derivedState.activeSession.title = trimmedPrompt;
|
|
185
|
+
}
|
|
183
186
|
// 使用 sendMessage 函数发送新消息
|
|
184
187
|
// 第二个参数传递每次请求特定的额外数据
|
|
185
188
|
sendMessage({
|
|
@@ -209,17 +212,19 @@ function MsgBox(props) {
|
|
|
209
212
|
return;
|
|
210
213
|
}
|
|
211
214
|
setTimeout(function () {
|
|
212
|
-
var _derivedSnap$
|
|
213
|
-
var sessionMessages = (_derivedSnap$
|
|
215
|
+
var _derivedSnap$activeSe6;
|
|
216
|
+
var sessionMessages = (_derivedSnap$activeSe6 = derivedSnap.activeSession) === null || _derivedSnap$activeSe6 === void 0 ? void 0 : _derivedSnap$activeSe6.messages;
|
|
214
217
|
if ((sessionMessages === null || sessionMessages === void 0 ? void 0 : sessionMessages.length) > 0) {
|
|
215
218
|
var converted = convertToUIMessages(sessionMessages);
|
|
216
219
|
// 避免无限循环,仅当消息数量或内容不同时更新
|
|
217
220
|
if (messages.length !== converted.length || JSON.stringify(messages) !== JSON.stringify(converted)) {
|
|
218
221
|
setMessages(converted);
|
|
219
222
|
}
|
|
223
|
+
} else {
|
|
224
|
+
setMessages([]);
|
|
220
225
|
}
|
|
221
226
|
});
|
|
222
|
-
}, [(_derivedSnap$
|
|
227
|
+
}, [(_derivedSnap$activeSe7 = derivedSnap.activeSession) === null || _derivedSnap$activeSe7 === void 0 ? void 0 : _derivedSnap$activeSe7.id, (_derivedSnap$activeSe8 = derivedSnap.activeSession) === null || _derivedSnap$activeSe8 === void 0 || (_derivedSnap$activeSe8 = _derivedSnap$activeSe8.messages) === null || _derivedSnap$activeSe8 === void 0 ? void 0 : _derivedSnap$activeSe8.length]);
|
|
223
228
|
|
|
224
229
|
// 处理从外部(如demo页)发起的对话
|
|
225
230
|
useEffect(function () {
|
|
@@ -243,6 +248,7 @@ function MsgBox(props) {
|
|
|
243
248
|
}, []);
|
|
244
249
|
useEffect(function () {
|
|
245
250
|
chatScrollIntoView();
|
|
251
|
+
stop();
|
|
246
252
|
}, [snap.activeSessionId]);
|
|
247
253
|
|
|
248
254
|
// 将 messages 数组作为依赖项。当它变化时,Hook 会运行。
|
|
@@ -304,7 +310,7 @@ function MsgBox(props) {
|
|
|
304
310
|
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement("button", {
|
|
305
311
|
type: "button",
|
|
306
312
|
onClick: function onClick() {
|
|
307
|
-
return
|
|
313
|
+
return createPureNewSession();
|
|
308
314
|
},
|
|
309
315
|
className: styles.newButton
|
|
310
316
|
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(PlusSquareOutlined, null), formatMessage({
|
|
@@ -24,6 +24,15 @@ export var SearchResult = function SearchResult(_ref) {
|
|
|
24
24
|
themeConfig = _useSiteData.themeConfig;
|
|
25
25
|
var intl = useIntl();
|
|
26
26
|
var authSnap = useSnapshot(authStore);
|
|
27
|
+
function pureSearch() {
|
|
28
|
+
createNewSession({
|
|
29
|
+
promptText: keywords,
|
|
30
|
+
mode: 'solve',
|
|
31
|
+
lib: !themeConfig.isAntVSite ? themeConfig.title : undefined,
|
|
32
|
+
jump: true,
|
|
33
|
+
lang: intl.locale === 'zh' ? 'zh' : 'en'
|
|
34
|
+
});
|
|
35
|
+
}
|
|
27
36
|
return /*#__PURE__*/React.createElement("div", {
|
|
28
37
|
className: styles.searchResult
|
|
29
38
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -39,16 +48,10 @@ export var SearchResult = function SearchResult(_ref) {
|
|
|
39
48
|
className: styles.result,
|
|
40
49
|
onClick: function onClick() {
|
|
41
50
|
if (!authSnap.isAuthenticated) {
|
|
42
|
-
showLoginModal();
|
|
51
|
+
showLoginModal(pureSearch);
|
|
43
52
|
return;
|
|
44
53
|
}
|
|
45
|
-
|
|
46
|
-
promptText: keywords,
|
|
47
|
-
mode: "solve",
|
|
48
|
-
lib: !themeConfig.isAntVSite ? themeConfig.title : undefined,
|
|
49
|
-
jump: true,
|
|
50
|
-
lang: intl.locale === 'zh' ? 'zh' : 'en'
|
|
51
|
-
});
|
|
54
|
+
pureSearch();
|
|
52
55
|
}
|
|
53
56
|
}, /*#__PURE__*/React.createElement("div", {
|
|
54
57
|
className: classnames(styles.title, styles.highlighted)
|
package/package.json
CHANGED
package/dist/utils/uid.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var ALL_CHARS = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 生成一个指定长度的、完全随机的字母数字ID。
|
|
5
|
-
* @param l ID 长度,默认为 6
|
|
6
|
-
*/
|
|
7
|
-
export function simpleUid(l) {
|
|
8
|
-
var n = l !== null && l !== void 0 ? l : 6;
|
|
9
|
-
if (n <= 0) {
|
|
10
|
-
throw new RangeError('ID 长度必须大于 0');
|
|
11
|
-
}
|
|
12
|
-
return Array.from({
|
|
13
|
-
length: n
|
|
14
|
-
}, function () {
|
|
15
|
-
return ALL_CHARS[Math.floor(Math.random() * ALL_CHARS.length)];
|
|
16
|
-
}).join('');
|
|
17
|
-
}
|