@antv/dumi-theme-antv 0.8.0-beta.1 → 0.8.0-beta.11
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/builtins/Playground/index.module.less +0 -1
- package/dist/components/AI/HomeDialog/AntVBanner/index.module.less +2 -2
- package/dist/components/AI/HomeDialog/ModeSelector/index.js +4 -1
- package/dist/components/AI/HomeDialog/ModeSelector/index.module.less +39 -22
- package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.js +4 -2
- package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.module.less +0 -1
- package/dist/components/AI/HomeDialog/PromptTextarea/DatasourceCard/index.module.less +3 -3
- package/dist/components/AI/HomeDialog/PromptTextarea/Uploader/DataUploader.js +225 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/index.js +74 -43
- package/dist/components/AI/HomeDialog/PromptTextarea/index.module.less +9 -8
- package/dist/components/AI/HomeDialog/RecommendCase/Card.js +13 -8
- package/dist/components/AI/HomeDialog/RecommendCase/card.module.less +1 -1
- package/dist/components/AI/HomeDialog/RecommendCase/index.js +46 -14
- package/dist/components/AI/HomeDialog/RecommendCase/index.module.less +3 -2
- package/dist/components/AI/HomeDialog/index.js +19 -17
- package/dist/components/AI/constant.js +2 -2
- package/dist/components/Login/Captcha/index.js +185 -0
- package/dist/components/Login/Captcha/index.less +91 -0
- package/dist/components/Login/CheckCode/index.js +244 -0
- package/dist/components/Login/CheckCode/index.less +137 -0
- package/dist/components/Login/CountDownButton/index.js +109 -0
- package/dist/components/Login/CountDownButton/index.less +8 -0
- package/dist/components/Login/LoginForm.js +239 -0
- package/dist/components/Login/LoginForm.less +409 -0
- package/dist/components/Login/index.js +24 -0
- package/dist/components/Login/openAuthWindow.js +54 -0
- package/dist/components/Login/types.js +5 -0
- package/dist/components/Login/utils.js +47 -0
- package/dist/layouts/DocLayout.js +2 -1
- package/dist/layouts/GlobalLayout/index.js +10 -4
- package/dist/locales/en.json +125 -1
- package/dist/locales/zh.json +125 -1
- package/dist/model/AIChat.js +72 -8
- package/dist/model/auth.js +133 -0
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.js +36 -12
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.module.less +2 -0
- package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.js +25 -11
- package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.module.less +1 -2
- package/dist/pages/AIPlayground/components/MarkdownComponent/index.js +5 -2
- package/dist/pages/AIPlayground/components/MsgBox/index.js +202 -146
- package/dist/pages/AIPlayground/components/MsgBox/index.module.less +3 -2
- package/dist/pages/AIPlayground/components/MsgBox/useAutoScroll.js +46 -0
- package/dist/pages/AIPlayground/components/SessionLayout/index.js +2 -2
- package/dist/pages/AIPlayground/components/SessionLayout/index.module.less +4 -2
- package/dist/pages/AIPlayground/components/TaskBox/generateCode.js +7 -1
- package/dist/pages/AIPlayground/components/TaskBox/index.js +78 -55
- package/dist/pages/AIPlayground/components/TaskBox/index.module.less +1 -0
- package/dist/pages/Examples/components/Accouncement/index.module.less +1 -1
- package/dist/pages/Examples/index.module.less +11 -11
- package/dist/pages/Index/components/Cases/index.module.less +8 -8
- package/dist/pages/Index/components/Companies/index.module.less +4 -3
- package/dist/pages/Index/components/Features/FeatureCard.module.less +4 -5
- package/dist/pages/Index/components/Features/index.module.less +5 -5
- package/dist/pages/Index/components/_.less +9 -9
- package/dist/plugin/index.js +2 -2
- package/dist/slots/Banner/Notification.module.less +8 -8
- package/dist/slots/Banner/index.module.less +10 -9
- package/dist/slots/CodeEditor/Toolbar.js +15 -9
- package/dist/slots/CodeEditor/index.js +35 -12
- package/dist/slots/CodeEditor/index.module.less +3 -1
- package/dist/slots/CodePreview/index.module.less +0 -3
- package/dist/slots/CodeRunner/index.js +5 -2
- package/dist/slots/ContentTable/index.module.less +2 -1
- package/dist/slots/Detail/News.module.less +9 -9
- package/dist/slots/Detail/index.module.less +11 -14
- package/dist/slots/ExampleSider/index.module.less +3 -4
- package/dist/slots/Footer/index.module.less +2 -2
- package/dist/slots/Header/Products/Product.module.less +2 -2
- package/dist/slots/Header/Search/SearchResult.js +23 -8
- package/dist/slots/Header/Search/SearchResult.module.less +1 -0
- package/dist/slots/Header/index.js +72 -12
- package/dist/slots/Header/index.module.less +13 -5
- package/dist/slots/LiveExample/index.module.less +1 -1
- package/dist/slots/Loading/index.module.less +30 -28
- package/dist/slots/ManualContent/index.module.less +14 -17
- package/dist/slots/_.less +9 -9
- package/dist/static/user.svg +3 -0
- package/dist/utils/env.js +37 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/request.js +42 -0
- package/package.json +7 -3
|
@@ -13,9 +13,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
13
13
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
15
|
import MonacoEditor, { loader } from '@monaco-editor/react';
|
|
16
|
-
import { Drawer, Switch } from 'antd';
|
|
16
|
+
import { Button, Drawer, Switch, Tooltip } from 'antd';
|
|
17
17
|
import { autoType as d3AutoType, dsvFormat } from 'd3-dsv';
|
|
18
|
-
import { useLocale, useSiteData } from 'dumi';
|
|
18
|
+
import { useIntl, useLocale, useLocation, useSiteData } from 'dumi';
|
|
19
19
|
import { debounce, noop } from 'lodash-es';
|
|
20
20
|
import { format } from 'prettier';
|
|
21
21
|
import parserBabel from 'prettier/parser-babel';
|
|
@@ -26,6 +26,7 @@ import styles from "./index.module.less";
|
|
|
26
26
|
import { EDITOR_TABS, Toolbar } from "./Toolbar";
|
|
27
27
|
import { compile, execute, replaceInsertCss } from "./utils";
|
|
28
28
|
import MsgBox from "../../pages/AIPlayground/components/MsgBox";
|
|
29
|
+
import { ClearOutlined } from '@ant-design/icons';
|
|
29
30
|
loader.config({
|
|
30
31
|
'vs/nls': {
|
|
31
32
|
availableLanguages: {
|
|
@@ -57,10 +58,14 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
57
58
|
_ref$onError = _ref.onError,
|
|
58
59
|
onError = _ref$onError === void 0 ? noop : _ref$onError,
|
|
59
60
|
_ref$onFullscreen = _ref.onFullscreen,
|
|
60
|
-
onFullscreen = _ref$onFullscreen === void 0 ? noop : _ref$onFullscreen
|
|
61
|
+
onFullscreen = _ref$onFullscreen === void 0 ? noop : _ref$onFullscreen,
|
|
62
|
+
_ref$showAI = _ref.showAI,
|
|
63
|
+
showAI = _ref$showAI === void 0 ? true : _ref$showAI;
|
|
64
|
+
var umiLocation = useLocation();
|
|
61
65
|
var locale = useLocale();
|
|
62
66
|
var _useSiteData = useSiteData(),
|
|
63
67
|
themeConfig = _useSiteData.themeConfig;
|
|
68
|
+
var intl = useIntl();
|
|
64
69
|
var _themeConfig$es = themeConfig.es5,
|
|
65
70
|
es5 = _themeConfig$es === void 0 ? true : _themeConfig$es,
|
|
66
71
|
_themeConfig$showSpec = themeConfig.showSpecTab,
|
|
@@ -103,8 +108,12 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
103
108
|
setCurrentEditorTab = _useState12[1];
|
|
104
109
|
var _useState13 = useState(false),
|
|
105
110
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
showAIDrawer = _useState14[0],
|
|
112
|
+
setShowAIDrawer = _useState14[1];
|
|
113
|
+
var _useState15 = useState("_"),
|
|
114
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
115
|
+
msgBoxKey = _useState16[0],
|
|
116
|
+
setMsgBoxKey = _useState16[1];
|
|
108
117
|
var containerId = "playgroundScriptContainer_".concat(exampleId);
|
|
109
118
|
|
|
110
119
|
// 出发 auto resize
|
|
@@ -280,7 +289,7 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
280
289
|
// 用于更新当前 example 的 spec 和 data
|
|
281
290
|
useEffect(function () {
|
|
282
291
|
setCurrentEditorTab(EDITOR_TABS.JAVASCRIPT);
|
|
283
|
-
|
|
292
|
+
setShowAIDrawer(false);
|
|
284
293
|
}, [exampleId]);
|
|
285
294
|
|
|
286
295
|
// hook 用户的数据
|
|
@@ -384,7 +393,7 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
384
393
|
}
|
|
385
394
|
};
|
|
386
395
|
var onClickAI = function onClickAI() {
|
|
387
|
-
|
|
396
|
+
setShowAIDrawer(true);
|
|
388
397
|
};
|
|
389
398
|
var onReload = function onReload() {
|
|
390
399
|
setCode(source);
|
|
@@ -406,6 +415,7 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
406
415
|
onEditorTabChange: onTabChange,
|
|
407
416
|
onToggleFullscreen: onFullscreen,
|
|
408
417
|
onClickAI: onClickAI,
|
|
418
|
+
showAI: showAI,
|
|
409
419
|
onReload: onReload,
|
|
410
420
|
slots: {
|
|
411
421
|
Spec: /*#__PURE__*/React.createElement("span", {
|
|
@@ -459,21 +469,34 @@ var CodeEditor = function CodeEditor(_ref) {
|
|
|
459
469
|
monacoRef.current = editor;
|
|
460
470
|
}
|
|
461
471
|
}), /*#__PURE__*/React.createElement(Drawer, {
|
|
462
|
-
placement: "right",
|
|
463
472
|
closable: true,
|
|
464
|
-
open:
|
|
473
|
+
open: showAIDrawer,
|
|
465
474
|
getContainer: false,
|
|
466
475
|
onClose: function onClose() {
|
|
467
|
-
return
|
|
476
|
+
return setShowAIDrawer(false);
|
|
468
477
|
},
|
|
469
478
|
rootClassName: styles.drawer,
|
|
470
|
-
width: '
|
|
479
|
+
width: '80%',
|
|
480
|
+
key: "".concat(umiLocation.hash, "_").concat(umiLocation.key),
|
|
481
|
+
extra: /*#__PURE__*/React.createElement(Tooltip, {
|
|
482
|
+
title: intl.formatMessage({
|
|
483
|
+
id: 'ai.toolbar.clear.conversation'
|
|
484
|
+
})
|
|
485
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
486
|
+
type: "link",
|
|
487
|
+
onClick: function onClick() {
|
|
488
|
+
return setMsgBoxKey(crypto.randomUUID());
|
|
489
|
+
}
|
|
490
|
+
}, /*#__PURE__*/React.createElement(ClearOutlined, null)))
|
|
471
491
|
}, /*#__PURE__*/React.createElement(MsgBox, {
|
|
492
|
+
key: "".concat(umiLocation.hash, "_").concat(umiLocation.key, "_").concat(msgBoxKey),
|
|
472
493
|
simple: true,
|
|
473
494
|
messages: [{
|
|
474
495
|
id: crypto.randomUUID(),
|
|
475
496
|
role: 'assistant',
|
|
476
|
-
content:
|
|
497
|
+
content: intl.formatMessage({
|
|
498
|
+
id: 'ai.assistant.editor.intro'
|
|
499
|
+
}),
|
|
477
500
|
createdAt: Date.now()
|
|
478
501
|
}],
|
|
479
502
|
context: valueOf(tab),
|
|
@@ -12,18 +12,20 @@
|
|
|
12
12
|
|
|
13
13
|
.drawer{
|
|
14
14
|
margin-top: 36px;
|
|
15
|
+
|
|
15
16
|
:global {
|
|
16
17
|
.ant-drawer-content {
|
|
17
18
|
background: #f8f9fc;
|
|
19
|
+
|
|
18
20
|
div.ant-drawer-header {
|
|
19
21
|
padding-bottom: unset;
|
|
20
22
|
border-bottom: unset;
|
|
21
|
-
flex-direction: row-reverse;
|
|
22
23
|
|
|
23
24
|
.ant-drawer-header-title {
|
|
24
25
|
flex: unset;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
28
|
+
|
|
27
29
|
.ant-drawer-body{
|
|
28
30
|
display: flex;
|
|
29
31
|
flex-direction: column;
|
|
@@ -32,7 +32,9 @@ var CodeRunner = function CodeRunner(_ref) {
|
|
|
32
32
|
replaceId = _ref.replaceId,
|
|
33
33
|
isPlayground = _ref.isPlayground,
|
|
34
34
|
_ref$notFound = _ref.notFound,
|
|
35
|
-
notFound = _ref$notFound === void 0 ? /*#__PURE__*/React.createElement(NotFound, null) : _ref$notFound
|
|
35
|
+
notFound = _ref$notFound === void 0 ? /*#__PURE__*/React.createElement(NotFound, null) : _ref$notFound,
|
|
36
|
+
_ref$showAI = _ref.showAI,
|
|
37
|
+
showAI = _ref$showAI === void 0 ? true : _ref$showAI;
|
|
36
38
|
var demoInfo = getDemoInfo(exampleTopics, topic, example, demo);
|
|
37
39
|
|
|
38
40
|
// 找不到,啥也别干了,404 页面
|
|
@@ -80,7 +82,8 @@ var CodeRunner = function CodeRunner(_ref) {
|
|
|
80
82
|
onDestroy: noop,
|
|
81
83
|
onReady: noop,
|
|
82
84
|
playground: playground,
|
|
83
|
-
title: ic(title)
|
|
85
|
+
title: ic(title),
|
|
86
|
+
showAI: showAI
|
|
84
87
|
}))));
|
|
85
88
|
};
|
|
86
89
|
export default CodeRunner;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
.news {
|
|
2
2
|
width: 50%;
|
|
3
3
|
margin-right: 2%;
|
|
4
|
-
background-color: #
|
|
4
|
+
background-color: #fff;
|
|
5
5
|
border: 1px solid #e5e8ef;
|
|
6
|
-
box-shadow: 0 8px 28px 0 rgba(0, 0, 0,
|
|
6
|
+
box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 5%);
|
|
7
7
|
border-radius: 16px;
|
|
8
8
|
height: 100%;
|
|
9
9
|
font-size: 14px;
|
|
@@ -91,13 +91,13 @@
|
|
|
91
91
|
@keyframes showAndHide0 {
|
|
92
92
|
0% {
|
|
93
93
|
opacity: 1;
|
|
94
|
-
top:
|
|
94
|
+
top: 0;
|
|
95
95
|
z-index: 1;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
33.3% {
|
|
99
99
|
opacity: 0;
|
|
100
|
-
top:
|
|
100
|
+
top: 0;
|
|
101
101
|
z-index: 0;
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
|
|
110
110
|
100% {
|
|
111
111
|
opacity: 1;
|
|
112
|
-
top:
|
|
112
|
+
top: 0;
|
|
113
113
|
z-index: 1;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -123,13 +123,13 @@
|
|
|
123
123
|
|
|
124
124
|
33.3% {
|
|
125
125
|
opacity: 1;
|
|
126
|
-
top:
|
|
126
|
+
top: 0;
|
|
127
127
|
z-index: 1;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
66.6% {
|
|
131
131
|
opacity: 0;
|
|
132
|
-
top:
|
|
132
|
+
top: 0;
|
|
133
133
|
z-index: 0;
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -155,13 +155,13 @@
|
|
|
155
155
|
|
|
156
156
|
66.6% {
|
|
157
157
|
opacity: 1;
|
|
158
|
-
top:
|
|
158
|
+
top: 0;
|
|
159
159
|
z-index: 1;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
100% {
|
|
163
163
|
opacity: 0;
|
|
164
|
-
top:
|
|
164
|
+
top: 0;
|
|
165
165
|
z-index: 0;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
.wrapper {
|
|
4
4
|
min-height: 1000px;
|
|
5
5
|
max-height: 1150px;
|
|
6
|
-
background: linear-gradient(225deg, #
|
|
6
|
+
background: linear-gradient(225deg, #fff, #f0f5ff);
|
|
7
7
|
height: calc(94vh);
|
|
8
8
|
position: relative;
|
|
9
9
|
overflow: hidden;
|
|
10
10
|
|
|
11
11
|
.content {
|
|
12
12
|
.container1440();
|
|
13
|
+
|
|
13
14
|
height: 100%;
|
|
14
15
|
position: relative;
|
|
15
16
|
}
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
|
|
29
30
|
.title {
|
|
30
31
|
font-size: 3.4em; //2.875em;
|
|
31
|
-
color: rgba(0, 0, 0,
|
|
32
|
+
color: rgba(0, 0, 0, 100%);
|
|
32
33
|
position: relative;
|
|
33
34
|
font-family: AlibabaPuHuiTiRHeavy;
|
|
34
35
|
|
|
@@ -39,8 +40,7 @@
|
|
|
39
40
|
|
|
40
41
|
.description {
|
|
41
42
|
margin-top: 0.83%; //12px;
|
|
42
|
-
margin-bottom:
|
|
43
|
-
color: rgba(106, 123, 140, 1);
|
|
43
|
+
margin-bottom: 0;
|
|
44
44
|
font-weight: 200;
|
|
45
45
|
position: relative;
|
|
46
46
|
width: 40%;
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
overflow: hidden;
|
|
53
53
|
text-overflow: ellipsis;
|
|
54
54
|
-webkit-line-clamp: 4;
|
|
55
|
-
display:
|
|
55
|
+
display: box;
|
|
56
56
|
-webkit-box-orient: vertical;
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
display: flex;
|
|
65
65
|
align-items: center;
|
|
66
66
|
justify-content: center;
|
|
67
|
-
cursor: pointer;
|
|
68
67
|
border-radius: 12px;
|
|
69
68
|
z-index: 10;
|
|
70
69
|
position: relative;
|
|
@@ -73,13 +72,12 @@
|
|
|
73
72
|
height: 54px;
|
|
74
73
|
min-width: 166px;
|
|
75
74
|
padding: 0 10px;
|
|
76
|
-
box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 0.1);
|
|
77
75
|
background-color: #691eff;
|
|
78
76
|
font-size: 18px;
|
|
79
77
|
cursor: pointer;
|
|
80
78
|
box-shadow: 0 8px 28px 0 #f2f2f2;
|
|
81
79
|
margin-right: 20px;
|
|
82
|
-
color: #
|
|
80
|
+
color: #fff;
|
|
83
81
|
overflow: hidden;
|
|
84
82
|
|
|
85
83
|
.icon {
|
|
@@ -94,8 +92,7 @@
|
|
|
94
92
|
}
|
|
95
93
|
|
|
96
94
|
&.primary {
|
|
97
|
-
color: #fff;
|
|
98
|
-
background-color: #ffffff;
|
|
95
|
+
background-color: #fff;
|
|
99
96
|
color: #000;
|
|
100
97
|
border: 1px solid #e8e8e8;
|
|
101
98
|
|
|
@@ -123,8 +120,8 @@
|
|
|
123
120
|
display: flex;
|
|
124
121
|
height: 54px;
|
|
125
122
|
cursor: pointer;
|
|
126
|
-
box-shadow: 0 8px 28px 0 rgba(0, 0, 0,
|
|
127
|
-
background-color: #
|
|
123
|
+
box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 5%);
|
|
124
|
+
background-color: #fff;
|
|
128
125
|
border: 1px solid #e8e8e8;
|
|
129
126
|
justify-content: center;
|
|
130
127
|
align-items: center;
|
|
@@ -146,6 +143,7 @@
|
|
|
146
143
|
|
|
147
144
|
.gh-btn {
|
|
148
145
|
padding: 16px;
|
|
146
|
+
|
|
149
147
|
.gh-ico {
|
|
150
148
|
display: block;
|
|
151
149
|
width: 20px;
|
|
@@ -172,7 +170,7 @@
|
|
|
172
170
|
margin-left: -8px;
|
|
173
171
|
color: #1d2129;
|
|
174
172
|
letter-spacing: 0;
|
|
175
|
-
font-family: AlibabaSans102-Medium;
|
|
173
|
+
font-family: "AlibabaSans102-Medium";
|
|
176
174
|
}
|
|
177
175
|
}
|
|
178
176
|
}
|
|
@@ -195,7 +193,6 @@
|
|
|
195
193
|
display: flex;
|
|
196
194
|
position: absolute;
|
|
197
195
|
right: 0;
|
|
198
|
-
margin-top: -300px;
|
|
199
196
|
width: 32%;
|
|
200
197
|
max-width: 598px;
|
|
201
198
|
height: 324px;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
z-index: 1;
|
|
12
12
|
top: 0;
|
|
13
13
|
height: 100%;
|
|
14
|
-
box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0);
|
|
14
|
+
box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0%);
|
|
15
15
|
width: 1px;
|
|
16
16
|
transition: all 0.3s;
|
|
17
17
|
}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
user-select: none;
|
|
46
46
|
background-color: #fff;
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
&::after {
|
|
49
49
|
transition: all 0.3s;
|
|
50
50
|
background-color: transparent;
|
|
51
51
|
border: 1px solid transparent;
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
&:hover {
|
|
61
61
|
border-color: var(--primary-color);
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
&::before {
|
|
64
64
|
transition: all 0.3s;
|
|
65
65
|
content: '';
|
|
66
66
|
position: absolute;
|
|
@@ -127,7 +127,6 @@
|
|
|
127
127
|
display: inline-block;
|
|
128
128
|
width: 100%;
|
|
129
129
|
vertical-align: bottom;
|
|
130
|
-
|
|
131
130
|
overflow: hidden;
|
|
132
131
|
text-overflow: ellipsis;
|
|
133
132
|
white-space: nowrap;
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
display: flex;
|
|
37
37
|
justify-content: center;
|
|
38
38
|
font-size: 14px;
|
|
39
|
-
border-bottom: 1px solid rgba(255, 255, 255,
|
|
39
|
+
border-bottom: 1px solid rgba(255, 255, 255, 25%);
|
|
40
40
|
margin-bottom: 16px;
|
|
41
41
|
box-sizing: border-box;
|
|
42
42
|
padding-bottom: 16px;
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
:global(.anticon),
|
|
73
73
|
a {
|
|
74
74
|
margin-right: 8px;
|
|
75
|
-
color: rgba(255, 255, 255,
|
|
75
|
+
color: rgba(255, 255, 255, 60%);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
&.light {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
ul {
|
|
58
58
|
list-style: none;
|
|
59
59
|
padding: 0;
|
|
60
|
-
margin: 0 0 20px
|
|
60
|
+
margin: 0 0 20px;
|
|
61
61
|
|
|
62
62
|
&:last-child {
|
|
63
63
|
margin-bottom: 32px;
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
margin-bottom: 4px;
|
|
88
88
|
font-size: 14px;
|
|
89
89
|
line-height: 22px;
|
|
90
|
-
color: rgba(0, 0, 0,
|
|
90
|
+
color: rgba(0, 0, 0, 85%);
|
|
91
91
|
transition: all 0.3s;
|
|
92
92
|
|
|
93
93
|
&:hover {
|
|
@@ -3,6 +3,8 @@ import React from 'react';
|
|
|
3
3
|
import styles from "./SearchResult.module.less";
|
|
4
4
|
import classnames from "classnames";
|
|
5
5
|
import { createNewSession } from "../../../model/AIChat";
|
|
6
|
+
import { authStore, showLoginModal } from "../../../model/auth";
|
|
7
|
+
import { useSnapshot } from "valtio";
|
|
6
8
|
var getHighlightInfo = function getHighlightInfo(textSegments) {
|
|
7
9
|
return /*#__PURE__*/React.createElement(React.Fragment, null, textSegments.map(function (segment) {
|
|
8
10
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -21,6 +23,16 @@ export var SearchResult = function SearchResult(_ref) {
|
|
|
21
23
|
var _useSiteData = useSiteData(),
|
|
22
24
|
themeConfig = _useSiteData.themeConfig;
|
|
23
25
|
var intl = useIntl();
|
|
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
|
+
}
|
|
24
36
|
return /*#__PURE__*/React.createElement("div", {
|
|
25
37
|
className: styles.searchResult
|
|
26
38
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -35,20 +47,23 @@ export var SearchResult = function SearchResult(_ref) {
|
|
|
35
47
|
}), /*#__PURE__*/React.createElement("a", {
|
|
36
48
|
className: styles.result,
|
|
37
49
|
onClick: function onClick() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
50
|
+
if (!authSnap.isAuthenticated) {
|
|
51
|
+
showLoginModal(pureSearch);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
pureSearch();
|
|
44
55
|
}
|
|
45
56
|
}, /*#__PURE__*/React.createElement("div", {
|
|
46
57
|
className: classnames(styles.title, styles.highlighted)
|
|
47
58
|
}, keywords), /*#__PURE__*/React.createElement("div", {
|
|
48
59
|
className: styles.description
|
|
49
|
-
},
|
|
60
|
+
}, intl.formatMessage({
|
|
61
|
+
id: 'ai.search.try'
|
|
62
|
+
}), "\xA0", /*#__PURE__*/React.createElement("span", {
|
|
50
63
|
className: styles.highlighted
|
|
51
|
-
}, "AI"), "\xA0
|
|
64
|
+
}, "AI"), "\xA0", intl.formatMessage({
|
|
65
|
+
id: 'ai.search.visualization'
|
|
66
|
+
})))), results !== null && results !== void 0 && results.length ? results.map(function (r, index) {
|
|
52
67
|
return /*#__PURE__*/React.createElement("div", {
|
|
53
68
|
className: styles.item,
|
|
54
69
|
key: index
|
|
@@ -13,10 +13,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
13
13
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
14
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
import { CaretDownFilled, DownOutlined, GithubOutlined, LinkOutlined, MenuOutlined, WechatOutlined } from '@ant-design/icons';
|
|
16
|
+
import { CaretDownFilled, DownOutlined, GithubOutlined, LinkOutlined, LogoutOutlined, MenuOutlined, MessageOutlined, UserDeleteOutlined, WechatOutlined } from '@ant-design/icons';
|
|
17
17
|
import { Alert, Button, Dropdown, Menu, Modal, Popover } from 'antd';
|
|
18
18
|
import cx from 'classnames';
|
|
19
|
-
import { FormattedMessage, Link, useLocale, useSiteData } from 'dumi';
|
|
19
|
+
import { FormattedMessage, Link, useLocale, useSiteData, useIntl, history } from 'dumi';
|
|
20
20
|
import { get, map, size } from 'lodash-es';
|
|
21
21
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
22
22
|
import { useMedia } from 'react-use';
|
|
@@ -26,11 +26,15 @@ import { Navs } from "./Navs";
|
|
|
26
26
|
import { Products } from "./Products";
|
|
27
27
|
import { Search } from "./Search";
|
|
28
28
|
import { findVersion } from "./utils";
|
|
29
|
+
import { ReactComponent as UserIcon } from "../../static/user.svg";
|
|
29
30
|
import { Assistant } from '@petercatai/assistant';
|
|
30
31
|
import '@petercatai/assistant/style';
|
|
31
32
|
import { useLocation } from 'react-router-dom';
|
|
32
33
|
import { determineUserType } from "../../utils/user";
|
|
33
34
|
import styles from "./index.module.less";
|
|
35
|
+
import { useSnapshot } from "valtio";
|
|
36
|
+
import { authStore, logout } from "../../model/auth";
|
|
37
|
+
import { clearAllChatData } from "../../model/AIChat";
|
|
34
38
|
function redirectChinaMirror(chinaMirrorOrigin) {
|
|
35
39
|
window.location.href = window.location.href.replace(window.location.origin, chinaMirrorOrigin);
|
|
36
40
|
}
|
|
@@ -76,11 +80,12 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
76
80
|
ecosystems = _ref.ecosystems,
|
|
77
81
|
announcement = _ref.announcement;
|
|
78
82
|
var isAntVHome = isAntVSite && isHomePage; // 是否为AntV官网首页
|
|
79
|
-
|
|
83
|
+
var authSnap = useSnapshot(authStore);
|
|
80
84
|
var _useState = useState(false),
|
|
81
85
|
_useState2 = _slicedToArray(_useState, 2),
|
|
82
86
|
bannerVisible = _useState2[0],
|
|
83
87
|
setBannerVisible = _useState2[1];
|
|
88
|
+
var intl = useIntl();
|
|
84
89
|
var showChinaMirror = !!internalSite;
|
|
85
90
|
var chinaMirrorUrl = get(internalSite, 'url');
|
|
86
91
|
var _useState3 = useState(false),
|
|
@@ -195,7 +200,9 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
195
200
|
href: href,
|
|
196
201
|
target: "_blank",
|
|
197
202
|
rel: "noreferrer"
|
|
198
|
-
},
|
|
203
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
204
|
+
id: "header.ai.code"
|
|
205
|
+
})));
|
|
199
206
|
}, [isInternalUser, showWeavefox]);
|
|
200
207
|
var menu = /*#__PURE__*/React.createElement("ul", {
|
|
201
208
|
className: cx(styles.menu, _defineProperty(_defineProperty({}, styles.popup, !isWide), styles.popupHidden, !popupMenuVisible))
|
|
@@ -235,7 +242,9 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
235
242
|
style: {
|
|
236
243
|
marginRight: '8px'
|
|
237
244
|
}
|
|
238
|
-
}, "\uD83C\uDDE8\uD83C\uDDF3"),
|
|
245
|
+
}, "\uD83C\uDDE8\uD83C\uDDF3"), /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
246
|
+
id: "header.china.mirror.title"
|
|
247
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
239
248
|
style: {
|
|
240
249
|
marginTop: 16,
|
|
241
250
|
textAlign: 'right'
|
|
@@ -248,14 +257,18 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
248
257
|
style: {
|
|
249
258
|
marginRight: 8
|
|
250
259
|
}
|
|
251
|
-
},
|
|
260
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
261
|
+
id: "header.china.mirror.temp.close"
|
|
262
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
252
263
|
type: "primary",
|
|
253
264
|
size: "small",
|
|
254
265
|
onClick: function onClick() {
|
|
255
266
|
localStorage.setItem('china-mirror-no-more-hint', Date.now().toString());
|
|
256
267
|
updateChinaMirrorHintVisible(false);
|
|
257
268
|
}
|
|
258
|
-
},
|
|
269
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
270
|
+
id: "header.china.mirror.no.more"
|
|
271
|
+
})))),
|
|
259
272
|
open: chinaMirrorHintVisible,
|
|
260
273
|
placement: "bottomRight",
|
|
261
274
|
align: {
|
|
@@ -273,8 +286,12 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
273
286
|
}
|
|
274
287
|
})))) : null, showChinaMirror && !isWide && /*#__PURE__*/React.createElement(Modal, {
|
|
275
288
|
open: chinaMirrorHintVisible,
|
|
276
|
-
cancelText:
|
|
277
|
-
|
|
289
|
+
cancelText: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
290
|
+
id: "header.china.mirror.no.more"
|
|
291
|
+
}),
|
|
292
|
+
okText: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
293
|
+
id: "header.china.mirror.temp.close"
|
|
294
|
+
}),
|
|
278
295
|
onCancel: function onCancel() {
|
|
279
296
|
updateChinaMirrorHintVisible(false);
|
|
280
297
|
},
|
|
@@ -292,7 +309,9 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
292
309
|
}, /*#__PURE__*/React.createElement("span", {
|
|
293
310
|
role: "img",
|
|
294
311
|
"aria-labelledby": "\u4E2D\u56FD"
|
|
295
|
-
}, "\uD83C\uDDE8\uD83C\uDDF3"),
|
|
312
|
+
}, "\uD83C\uDDE8\uD83C\uDDF3"), /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
313
|
+
id: "header.china.mirror.title"
|
|
314
|
+
}), /*#__PURE__*/React.createElement("a", {
|
|
296
315
|
href: chinaMirrorUrl,
|
|
297
316
|
onClick: function onClick(e) {
|
|
298
317
|
e.preventDefault();
|
|
@@ -370,7 +389,9 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
370
389
|
src: "https://gw.alipayobjects.com/zos/antfincdn/ZKlx96dsfs/qrcode_for_gh_f52d8b6aa591_258.jpg",
|
|
371
390
|
alt: "wx-qrcode"
|
|
372
391
|
}),
|
|
373
|
-
title:
|
|
392
|
+
title: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
393
|
+
id: "header.wx.qrcode.title"
|
|
394
|
+
}),
|
|
374
395
|
styles: {
|
|
375
396
|
body: {
|
|
376
397
|
padding: 2
|
|
@@ -387,7 +408,46 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
387
408
|
href: githubUrl,
|
|
388
409
|
target: "_blank",
|
|
389
410
|
rel: "noreferrer"
|
|
390
|
-
}, /*#__PURE__*/React.createElement(GithubOutlined, null)))
|
|
411
|
+
}, /*#__PURE__*/React.createElement(GithubOutlined, null))), authSnap.isAuthenticated && /*#__PURE__*/React.createElement("li", {
|
|
412
|
+
className: cx(styles.navIcon, styles.githubCorner)
|
|
413
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
414
|
+
menu: {
|
|
415
|
+
items: [{
|
|
416
|
+
key: 'history',
|
|
417
|
+
label: /*#__PURE__*/React.createElement("a", {
|
|
418
|
+
onClick: function onClick() {
|
|
419
|
+
return history.push("/".concat(lang || 'zh', "/ai-playground"));
|
|
420
|
+
}
|
|
421
|
+
}, intl.formatMessage({
|
|
422
|
+
id: 'header.user.history'
|
|
423
|
+
})),
|
|
424
|
+
icon: /*#__PURE__*/React.createElement(MessageOutlined, null)
|
|
425
|
+
}, {
|
|
426
|
+
key: 'logout',
|
|
427
|
+
label: /*#__PURE__*/React.createElement("a", {
|
|
428
|
+
onClick: function onClick() {
|
|
429
|
+
return logout();
|
|
430
|
+
}
|
|
431
|
+
}, intl.formatMessage({
|
|
432
|
+
id: 'header.user.logout'
|
|
433
|
+
})),
|
|
434
|
+
icon: /*#__PURE__*/React.createElement(LogoutOutlined, null)
|
|
435
|
+
}, {
|
|
436
|
+
key: 'deleteAccount',
|
|
437
|
+
label: /*#__PURE__*/React.createElement("a", {
|
|
438
|
+
onClick: function onClick() {
|
|
439
|
+
logout();
|
|
440
|
+
clearAllChatData();
|
|
441
|
+
}
|
|
442
|
+
}, intl.formatMessage({
|
|
443
|
+
id: 'header.user.deleteAccount'
|
|
444
|
+
})),
|
|
445
|
+
icon: /*#__PURE__*/React.createElement(UserDeleteOutlined, null)
|
|
446
|
+
}]
|
|
447
|
+
}
|
|
448
|
+
}, /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(UserIcon, {
|
|
449
|
+
className: styles.userIcon
|
|
450
|
+
})))));
|
|
391
451
|
return /*#__PURE__*/React.createElement("header", {
|
|
392
452
|
className: cx(styles.header, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.transparent, !!transparent && !productMenuVisible), styles.isHomePage, !!isHomePage && !isAntVHome), styles.lightTheme, !!isAntVHome && !productMenuVisible && isWide), styles.isAntVHome, !!isAntVHome), styles.fixed, popupMenuVisible))
|
|
393
453
|
}, bannerVisible && announcementTitle && /*#__PURE__*/React.createElement(Alert, {
|