@antv/dumi-theme-antv 0.8.0-beta.13 → 0.8.0-beta.14
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/RecommendCase/index.js +48 -42
- package/dist/locales/en.json +4 -1
- package/dist/locales/zh.json +4 -1
- package/dist/model/AIChat.js +15 -3
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.js +7 -1
- package/dist/pages/AIPlayground/components/MsgBox/index.js +29 -5
- package/dist/pages/AIPlayground/components/SessionLayout/index.js +2 -1
- package/dist/pages/AIPlayground/components/SessionLayout/index.module.less +2 -1
- package/dist/pages/AIPlayground/components/TaskBox/generateCode.js +7 -1
- package/dist/pages/AIPlayground/components/TaskBox/index.js +3 -2
- package/dist/pages/AIPlayground/index.js +4 -1
- package/dist/pages/AIPlayground/index.module.less +5 -0
- package/dist/slots/Header/Search/SearchResult.js +2 -1
- package/dist/slots/Header/index.js +3 -21
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
9
9
|
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; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
import { Spin } from 'antd';
|
|
12
|
-
import React, {
|
|
12
|
+
import React, { useEffect, useState } from 'react';
|
|
13
13
|
import { Card } from "./Card";
|
|
14
14
|
import styles from "./index.module.less";
|
|
15
15
|
import { ReloadOutlined } from "@ant-design/icons";
|
|
@@ -27,54 +27,60 @@ export var RecommendCase = function RecommendCase(props) {
|
|
|
27
27
|
setLoading = _useState2[1];
|
|
28
28
|
var _useSiteData = useSiteData(),
|
|
29
29
|
themeConfig = _useSiteData.themeConfig;
|
|
30
|
-
var _useState3 = useState(
|
|
30
|
+
var _useState3 = useState([]),
|
|
31
31
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
32
|
list = _useState4[0],
|
|
33
33
|
setList = _useState4[1];
|
|
34
34
|
var _useLibrary = useLibrary(),
|
|
35
35
|
_useLibrary$data = _useLibrary.data,
|
|
36
36
|
library = _useLibrary$data === void 0 ? [] : _useLibrary$data;
|
|
37
|
-
var fetchList =
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
var fetchList = /*#__PURE__*/function () {
|
|
38
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
39
|
+
var _themeConfig$ai, data, url;
|
|
40
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
41
|
+
while (1) switch (_context.prev = _context.next) {
|
|
42
|
+
case 0:
|
|
43
|
+
_context.prev = 0;
|
|
44
|
+
setLoading(true);
|
|
45
|
+
data = [];
|
|
46
|
+
url = themeConfig.isAntVSite && library.length ? "".concat(getBaseSiteDataUrl(), "/").concat(sample(library).toLowerCase(), "/recommend.json") : (themeConfig === null || themeConfig === void 0 || (_themeConfig$ai = themeConfig.ai) === null || _themeConfig$ai === void 0 ? void 0 : _themeConfig$ai.recommend) || "".concat(getBaseSiteDataUrl(), "/").concat(themeConfig.title, "/recommend.json");
|
|
47
|
+
if (!url) {
|
|
48
|
+
_context.next = 10;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
_context.next = 7;
|
|
52
|
+
return fetch(url).then(function (res) {
|
|
53
|
+
return res.json();
|
|
54
|
+
});
|
|
55
|
+
case 7:
|
|
56
|
+
data = _context.sent;
|
|
57
|
+
_context.next = 11;
|
|
48
58
|
break;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return _context.stop();
|
|
75
|
-
}
|
|
76
|
-
}, _callee, null, [[0, 14, 17, 20]]);
|
|
77
|
-
})), [list]);
|
|
59
|
+
case 10:
|
|
60
|
+
data = RecommendJson;
|
|
61
|
+
case 11:
|
|
62
|
+
setList(sampleSize(data, 4));
|
|
63
|
+
_context.next = 18;
|
|
64
|
+
break;
|
|
65
|
+
case 14:
|
|
66
|
+
_context.prev = 14;
|
|
67
|
+
_context.t0 = _context["catch"](0);
|
|
68
|
+
setList(RecommendJson);
|
|
69
|
+
console.log(_context.t0);
|
|
70
|
+
case 18:
|
|
71
|
+
_context.prev = 18;
|
|
72
|
+
setLoading(false);
|
|
73
|
+
return _context.finish(18);
|
|
74
|
+
case 21:
|
|
75
|
+
case "end":
|
|
76
|
+
return _context.stop();
|
|
77
|
+
}
|
|
78
|
+
}, _callee, null, [[0, 14, 18, 21]]);
|
|
79
|
+
}));
|
|
80
|
+
return function fetchList() {
|
|
81
|
+
return _ref.apply(this, arguments);
|
|
82
|
+
};
|
|
83
|
+
}();
|
|
78
84
|
useEffect(function () {
|
|
79
85
|
fetchList();
|
|
80
86
|
}, []);
|
package/dist/locales/en.json
CHANGED
|
@@ -207,6 +207,7 @@
|
|
|
207
207
|
"ai.msgbox.start.new.chat": "Start New Chat",
|
|
208
208
|
"ai.msgbox.send.tip": "Please enter content before sending",
|
|
209
209
|
"ai.msgbox.error.response": "Sorry, I couldn't successfully process your request, please try again later",
|
|
210
|
+
"ai.msgbox.continue.from.here": "Continue from here",
|
|
210
211
|
"ai.recommend.title": "Featured Cases",
|
|
211
212
|
"ai.recommend.refresh": "Refresh",
|
|
212
213
|
"ai.recommend.card.caseName": "Case Name",
|
|
@@ -229,12 +230,14 @@
|
|
|
229
230
|
"ai.conversations.pin": "Pin",
|
|
230
231
|
"ai.conversations.delete": "Delete",
|
|
231
232
|
"ai.conversations.edit.title": "Edit Conversation Name",
|
|
233
|
+
"ai.conversations.ok": "OK",
|
|
234
|
+
"ai.conversations.cancel": "Cancel",
|
|
235
|
+
"ai.msgbox.delete": "Delete",
|
|
232
236
|
"ai.chooseLib.placeholder": "Choose Technology Stack",
|
|
233
237
|
"ai.search.try": "Try",
|
|
234
238
|
"ai.search.visualization": "Q&A",
|
|
235
239
|
"ai.assistant.editor.intro": "I am AntV AI Assistant. You can ask me questions at any time to:\n1. Interpret the code configuration of the current chart.\n2. Generate new code based on the current case through natural language dialogue to customize the chart.",
|
|
236
240
|
"ai.placeholder.whatis": "What is {title}?",
|
|
237
|
-
"header.ai.code": "AI Code Generation",
|
|
238
241
|
"header.user.history": "History",
|
|
239
242
|
"header.user.logout": "Logout",
|
|
240
243
|
"header.user.deleteAccount": "Delete Account",
|
package/dist/locales/zh.json
CHANGED
|
@@ -222,18 +222,21 @@
|
|
|
222
222
|
"ai.toolbar.clear.conversation": "清空对话",
|
|
223
223
|
"ai.conversations.expand": "展开",
|
|
224
224
|
"ai.conversations.collapse": "收起",
|
|
225
|
+
"ai.msgbox.continue.from.here": "从这里继续",
|
|
225
226
|
"ai.conversations.new": "开始新对话",
|
|
226
227
|
"ai.conversations.history": "历史对话",
|
|
227
228
|
"ai.conversations.rename": "重命名",
|
|
228
229
|
"ai.conversations.pin": "置顶",
|
|
229
230
|
"ai.conversations.delete": "删除",
|
|
230
231
|
"ai.conversations.edit.title": "编辑对话名称",
|
|
232
|
+
"ai.conversations.ok": "确定",
|
|
233
|
+
"ai.conversations.cancel": "取消",
|
|
234
|
+
"ai.msgbox.delete": "删除",
|
|
231
235
|
"ai.chooseLib.placeholder": "选择技术栈",
|
|
232
236
|
"ai.search.try": "试试",
|
|
233
237
|
"ai.search.visualization": "可视化答疑",
|
|
234
238
|
"ai.assistant.editor.intro": "我是AntV AI助手。您可以随时向我提问,让我为您:\n\n1、解读当前图表的代码配置。\n2、通过自然语言对话,基于当前案例生成新代码以定制图表。",
|
|
235
239
|
"ai.placeholder.whatis": "{title}是什么?",
|
|
236
|
-
"header.ai.code": "AI生码",
|
|
237
240
|
"header.user.history": "历史会话",
|
|
238
241
|
"header.user.logout": "退出登录",
|
|
239
242
|
"header.user.deleteAccount": "注销账号",
|
package/dist/model/AIChat.js
CHANGED
|
@@ -205,9 +205,11 @@ subscribeKey(AIChatStore, 'activeSessionId', function () {
|
|
|
205
205
|
});
|
|
206
206
|
export var createPureNewSession = function createPureNewSession(title) {
|
|
207
207
|
var newConversationName = 'New Conversation';
|
|
208
|
-
|
|
208
|
+
var existNewSession = AIChatStore.sessions.find(function (s) {
|
|
209
209
|
return s.title === newConversationName && s.messages.length === 0;
|
|
210
|
-
})
|
|
210
|
+
});
|
|
211
|
+
if (existNewSession) {
|
|
212
|
+
AIChatStore.activeSessionId = existNewSession.id;
|
|
211
213
|
return;
|
|
212
214
|
}
|
|
213
215
|
var newSessionId = crypto.randomUUID();
|
|
@@ -287,4 +289,14 @@ export var clearAllChatData = /*#__PURE__*/function () {
|
|
|
287
289
|
return function clearAllChatData() {
|
|
288
290
|
return _ref2.apply(this, arguments);
|
|
289
291
|
};
|
|
290
|
-
}();
|
|
292
|
+
}();
|
|
293
|
+
export function deleteMessage(msgId) {
|
|
294
|
+
derivedState.activeSession.messages = derivedState.activeSession.messages.filter(function (m) {
|
|
295
|
+
return m.id !== msgId;
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
export function branchMessage(index) {
|
|
299
|
+
var messages = derivedState.activeSession.messages.slice(0, index + 1);
|
|
300
|
+
createPureNewSession(messages[0].content);
|
|
301
|
+
AIChatStore.sessions[0].messages = messages;
|
|
302
|
+
}
|
|
@@ -156,7 +156,13 @@ export var ConversationsMenu = function ConversationsMenu() {
|
|
|
156
156
|
},
|
|
157
157
|
okButtonProps: {
|
|
158
158
|
disabled: !state.rename
|
|
159
|
-
}
|
|
159
|
+
},
|
|
160
|
+
okText: formatMessage({
|
|
161
|
+
id: 'ai.conversations.ok'
|
|
162
|
+
}),
|
|
163
|
+
cancelText: formatMessage({
|
|
164
|
+
id: 'ai.conversations.cancel'
|
|
165
|
+
})
|
|
160
166
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
161
167
|
showCount: true,
|
|
162
168
|
maxLength: 100,
|
|
@@ -4,7 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
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; }
|
|
5
5
|
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; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import { CheckOutlined, CopyOutlined, PlusSquareOutlined, SyncOutlined } from '@ant-design/icons';
|
|
7
|
+
import { BranchesOutlined, CheckOutlined, CopyOutlined, DeleteOutlined, PlusSquareOutlined, SyncOutlined } from '@ant-design/icons';
|
|
8
8
|
import { Bubble } from '@ant-design/x';
|
|
9
9
|
import { Button, Flex, Space, Tooltip } from 'antd';
|
|
10
10
|
import { useChat } from '@ai-sdk/react';
|
|
@@ -15,7 +15,7 @@ import React, { useEffect, useState, useMemo, useRef } from 'react';
|
|
|
15
15
|
import { useCopyToClipboard } from 'react-use';
|
|
16
16
|
import { useSnapshot } from 'valtio';
|
|
17
17
|
import { PromptTextarea } from "../../../../components/AI/HomeDialog/PromptTextarea";
|
|
18
|
-
import { AIChatStore, clearEmptySession, createPureNewSession, derivedState } from "../../../../model/AIChat";
|
|
18
|
+
import { AIChatStore, branchMessage, clearEmptySession, createPureNewSession, deleteMessage, derivedState } from "../../../../model/AIChat";
|
|
19
19
|
import { getCodeFromMarkdown, isPreviewable } from "../../../../utils/code";
|
|
20
20
|
import { MarkdownComponent } from "../MarkdownComponent";
|
|
21
21
|
import styles from "./index.module.less";
|
|
@@ -274,9 +274,9 @@ function MsgBox(props) {
|
|
|
274
274
|
showRunButton: !props.simple
|
|
275
275
|
}),
|
|
276
276
|
avatar: msg.role === 'assistant' ? avatar : null,
|
|
277
|
-
footer:
|
|
277
|
+
footer: status === 'ready' && /*#__PURE__*/React.createElement(Space, {
|
|
278
278
|
size: "small"
|
|
279
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
279
|
+
}, msg.role === 'assistant' && index === messages.length - 1 && /*#__PURE__*/React.createElement(Tooltip, {
|
|
280
280
|
title: formatMessage({
|
|
281
281
|
id: 'ai.msgbox.retry'
|
|
282
282
|
})
|
|
@@ -301,7 +301,31 @@ function MsgBox(props) {
|
|
|
301
301
|
return copyToClipboard(textContent);
|
|
302
302
|
},
|
|
303
303
|
icon: copyState.value === textContent ? /*#__PURE__*/React.createElement(CheckOutlined, null) : /*#__PURE__*/React.createElement(CopyOutlined, null)
|
|
304
|
-
}))
|
|
304
|
+
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
305
|
+
title: formatMessage({
|
|
306
|
+
id: 'ai.msgbox.continue.from.here'
|
|
307
|
+
})
|
|
308
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
309
|
+
color: "default",
|
|
310
|
+
variant: "text",
|
|
311
|
+
size: "small",
|
|
312
|
+
onClick: function onClick() {
|
|
313
|
+
return branchMessage(index);
|
|
314
|
+
},
|
|
315
|
+
icon: /*#__PURE__*/React.createElement(BranchesOutlined, null)
|
|
316
|
+
})), msg.role === 'assistant' && /*#__PURE__*/React.createElement(Tooltip, {
|
|
317
|
+
title: formatMessage({
|
|
318
|
+
id: 'ai.msgbox.delete'
|
|
319
|
+
})
|
|
320
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
321
|
+
color: "default",
|
|
322
|
+
variant: "text",
|
|
323
|
+
size: "small",
|
|
324
|
+
onClick: function onClick() {
|
|
325
|
+
return deleteMessage(msg.id);
|
|
326
|
+
},
|
|
327
|
+
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
|
|
328
|
+
}))),
|
|
305
329
|
placement: msg.role === 'user' ? 'end' : 'start'
|
|
306
330
|
});
|
|
307
331
|
}), (status === 'streaming' || status === 'submitted') && ((_messages = messages[messages.length - 1]) === null || _messages === void 0 ? void 0 : _messages.role) === 'user' && /*#__PURE__*/React.createElement(Bubble, {
|
|
@@ -38,7 +38,8 @@ function SessionLayout(props) {
|
|
|
38
38
|
primary: "second",
|
|
39
39
|
style: {
|
|
40
40
|
position: 'unset'
|
|
41
|
-
}
|
|
41
|
+
},
|
|
42
|
+
minSize: 100
|
|
42
43
|
}, /*#__PURE__*/React.createElement("div", {
|
|
43
44
|
className: classnames(styles.msgBox)
|
|
44
45
|
}, children[0]), /*#__PURE__*/React.createElement("div", {
|
|
@@ -79,11 +79,17 @@ export function wrap2VisionSnap() {
|
|
|
79
79
|
var codeBlock = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
80
80
|
var dependencies = generateDependencies(codeBlock);
|
|
81
81
|
var rootElementType = dependencies['@antv/f2'] ? 'canvas' : 'div';
|
|
82
|
+
var dependenciesJSON = {
|
|
83
|
+
"name": "AntV-adapted-project",
|
|
84
|
+
"version": "1.0.0",
|
|
85
|
+
"main": "/src/index.jsx",
|
|
86
|
+
"dependencies": dependencies
|
|
87
|
+
};
|
|
82
88
|
return {
|
|
83
89
|
modules: {
|
|
84
90
|
'/package.json': {
|
|
85
91
|
fpath: '/package.json',
|
|
86
|
-
code:
|
|
92
|
+
code: JSON.stringify(dependenciesJSON, null, 2)
|
|
87
93
|
},
|
|
88
94
|
'/src/index.jsx': {
|
|
89
95
|
fpath: '/src/index.jsx',
|
|
@@ -48,7 +48,8 @@ function TaskBox() {
|
|
|
48
48
|
if (loading) {
|
|
49
49
|
return /*#__PURE__*/React.createElement(Loading, null);
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
var wrappedVisionSnapCode = wrap2VisionSnap(snap.codeBlock);
|
|
52
|
+
if (themeConfig.isAntVSite || ((_themeConfig$ai = themeConfig.ai) === null || _themeConfig$ai === void 0 ? void 0 : _themeConfig$ai.codeRunner) === "VisionSnap" || !((_themeConfig$ai2 = themeConfig.ai) !== null && _themeConfig$ai2 !== void 0 && _themeConfig$ai2.codeRunner) || !wrappedVisionSnapCode.modules["/package.json"].code.includes("@antv/f2")) {
|
|
52
53
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
53
54
|
FallbackComponent: ErrorFallback
|
|
54
55
|
}, /*#__PURE__*/React.createElement(sdk.VisionPreview, {
|
|
@@ -61,7 +62,7 @@ function TaskBox() {
|
|
|
61
62
|
displayMode: "code-and-preview",
|
|
62
63
|
initialView: "preview",
|
|
63
64
|
theme: "light",
|
|
64
|
-
code:
|
|
65
|
+
code: wrappedVisionSnapCode,
|
|
65
66
|
requestProxy: requestProxy,
|
|
66
67
|
isStreaming: false,
|
|
67
68
|
proxyOptions: {
|
|
@@ -3,7 +3,10 @@ import { SessionLayout } from "./components/SessionLayout";
|
|
|
3
3
|
import MsgBox from "./components/MsgBox";
|
|
4
4
|
import TaskBox from "./components/TaskBox";
|
|
5
5
|
import Header from "dumi/theme/slots/Header";
|
|
6
|
+
import styles from "./index.module.less";
|
|
6
7
|
function AIPlayground() {
|
|
7
|
-
return /*#__PURE__*/React.createElement(
|
|
8
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
className: styles.aiPlayground
|
|
10
|
+
}, /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(SessionLayout, null, /*#__PURE__*/React.createElement(MsgBox, null), /*#__PURE__*/React.createElement(TaskBox, null)));
|
|
8
11
|
}
|
|
9
12
|
export default AIPlayground;
|
|
@@ -2,7 +2,7 @@ import { useIntl, useSiteData } from 'dumi';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styles from "./SearchResult.module.less";
|
|
4
4
|
import classnames from "classnames";
|
|
5
|
-
import { createNewSession } from "../../../model/AIChat";
|
|
5
|
+
import { AIChatStore, createNewSession } from "../../../model/AIChat";
|
|
6
6
|
import { authStore, showLoginModal } from "../../../model/auth";
|
|
7
7
|
import { useSnapshot } from "valtio";
|
|
8
8
|
var getHighlightInfo = function getHighlightInfo(textSegments) {
|
|
@@ -25,6 +25,7 @@ export var SearchResult = function SearchResult(_ref) {
|
|
|
25
25
|
var intl = useIntl();
|
|
26
26
|
var authSnap = useSnapshot(authStore);
|
|
27
27
|
function pureSearch() {
|
|
28
|
+
AIChatStore.mode = 'solve';
|
|
28
29
|
createNewSession({
|
|
29
30
|
promptText: keywords,
|
|
30
31
|
mode: 'solve',
|
|
@@ -18,7 +18,7 @@ import { Alert, Button, Dropdown, Menu, Modal, Popover } from 'antd';
|
|
|
18
18
|
import cx from 'classnames';
|
|
19
19
|
import { FormattedMessage, Link, useLocale, useSiteData, useIntl, history } from 'dumi';
|
|
20
20
|
import { get, map, size } from 'lodash-es';
|
|
21
|
-
import React, { useEffect,
|
|
21
|
+
import React, { useEffect, useState } from 'react';
|
|
22
22
|
import { useMedia } from 'react-use';
|
|
23
23
|
import { getPurePathname } from "../../utils/location";
|
|
24
24
|
import { ic, icWithLocale } from "../hooks";
|
|
@@ -57,9 +57,6 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
57
57
|
showAntVProductsCard = _ref$showAntVProducts === void 0 ? true : _ref$showAntVProducts,
|
|
58
58
|
_ref$showLanguageSwit = _ref.showLanguageSwitcher,
|
|
59
59
|
showLanguageSwitcher = _ref$showLanguageSwit === void 0 ? true : _ref$showLanguageSwit,
|
|
60
|
-
_ref$showWeavefox = _ref.showWeavefox,
|
|
61
|
-
showWeavefox = _ref$showWeavefox === void 0 ? {} : _ref$showWeavefox,
|
|
62
|
-
isInternalUser = _ref.isInternalUser,
|
|
63
60
|
logo = _ref.logo,
|
|
64
61
|
onLanguageChange = _ref.onLanguageChange,
|
|
65
62
|
_ref$showWxQrcode = _ref.showWxQrcode,
|
|
@@ -154,8 +151,7 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
154
151
|
}),
|
|
155
152
|
link: ''
|
|
156
153
|
}, logo),
|
|
157
|
-
img = _img$link$logo.img
|
|
158
|
-
link = _img$link$logo.link;
|
|
154
|
+
img = _img$link$logo.img;
|
|
159
155
|
var _useLocation = useLocation(),
|
|
160
156
|
pathname = _useLocation.pathname;
|
|
161
157
|
useEffect(function () {
|
|
@@ -190,27 +186,13 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
190
186
|
var handleSwitchLanguage = function handleSwitchLanguage() {
|
|
191
187
|
onLanguageChange === null || onLanguageChange === void 0 || onLanguageChange(lang);
|
|
192
188
|
};
|
|
193
|
-
var weavefox = useMemo(function () {
|
|
194
|
-
var configKey = isInternalUser ? 'internal' : 'public';
|
|
195
|
-
var configValue = showWeavefox[configKey];
|
|
196
|
-
if (!configValue) return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
197
|
-
var defaultLink = isInternalUser ? 'https://weavefox.antgroup-inc.cn/agent/@huiyu.zjt/AntV' : 'https://weavefox.alipay.com/agent/@ufox-b8tydq-0758/202505AP7vfl00422922';
|
|
198
|
-
var href = typeof configValue === 'string' ? configValue : defaultLink;
|
|
199
|
-
return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("a", {
|
|
200
|
-
href: href,
|
|
201
|
-
target: "_blank",
|
|
202
|
-
rel: "noreferrer"
|
|
203
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
204
|
-
id: "header.ai.code"
|
|
205
|
-
})));
|
|
206
|
-
}, [isInternalUser, showWeavefox]);
|
|
207
189
|
var menu = /*#__PURE__*/React.createElement("ul", {
|
|
208
190
|
className: cx(styles.menu, _defineProperty(_defineProperty({}, styles.popup, !isWide), styles.popupHidden, !popupMenuVisible))
|
|
209
191
|
}, /** 最左侧的菜单,一般是 教程、API、示例,或者其他自定义,有配置文件中的 `navs` 决定 */
|
|
210
192
|
size(navs) ? /*#__PURE__*/React.createElement(Navs, {
|
|
211
193
|
navs: navs,
|
|
212
194
|
path: pathname
|
|
213
|
-
}) : null,
|
|
195
|
+
}) : null, /** 生态产品 */
|
|
214
196
|
size(ecosystems) ? /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
215
197
|
className: styles.ecoSystems,
|
|
216
198
|
overlay: /*#__PURE__*/React.createElement(Menu, null, map(ecosystems, function (_ref2) {
|