From b38654a45a1b03eb10843a6baff469314210eaab Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Sat, 28 Oct 2023 23:58:51 +0800 Subject: [PATCH] Add renderAiAssistant() --- web/src/App.js | 63 ++++++++++++++++++++++++++++++++++---- web/src/common/OpenTour.js | 2 +- web/src/index.css | 9 ++++++ 3 files changed, 67 insertions(+), 7 deletions(-) diff --git a/web/src/App.js b/web/src/App.js index 963e2120..77560c8d 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -17,11 +17,10 @@ import "./App.less"; import {Helmet} from "react-helmet"; import Dashboard from "./basic/Dashboard"; import ShortcutsPage from "./basic/ShortcutsPage"; -import {MfaRuleRequired} from "./Setting"; import * as Setting from "./Setting"; import {StyleProvider, legacyLogicalPropertiesTransformer} from "@ant-design/cssinjs"; -import {AppstoreTwoTone, BarsOutlined, DollarTwoTone, DownOutlined, HomeTwoTone, InfoCircleFilled, LockTwoTone, LogoutOutlined, SafetyCertificateTwoTone, SettingOutlined, SettingTwoTone, WalletTwoTone} from "@ant-design/icons"; -import {Alert, Avatar, Button, Card, ConfigProvider, Drawer, Dropdown, FloatButton, Layout, Menu, Result} from "antd"; +import {AppstoreTwoTone, BarsOutlined, DeploymentUnitOutlined, DollarTwoTone, DownOutlined, GithubOutlined, HomeTwoTone, InfoCircleFilled, LockTwoTone, LogoutOutlined, SafetyCertificateTwoTone, SettingOutlined, SettingTwoTone, ShareAltOutlined, WalletTwoTone} from "@ant-design/icons"; +import {Alert, Avatar, Button, Card, ConfigProvider, Drawer, Dropdown, FloatButton, Layout, Menu, Result, Tooltip} from "antd"; import {Link, Redirect, Route, Switch, withRouter} from "react-router-dom"; import OrganizationListPage from "./OrganizationListPage"; import OrganizationEditPage from "./OrganizationEditPage"; @@ -110,6 +109,7 @@ class App extends Component { themeData: Conf.ThemeDefault, logo: this.getLogo(Setting.getAlgorithmNames(Conf.ThemeDefault)), requiredEnableMfa: false, + isAiAssistantOpen: false, }; Setting.initServerUrl(); @@ -137,8 +137,8 @@ class App extends Component { }); if (requiredEnableMfa === true) { - const mfaType = Setting.getMfaItemsByRules(this.state.account, this.state.account?.organization, [MfaRuleRequired]) - .find((item) => item.rule === MfaRuleRequired)?.name; + const mfaType = Setting.getMfaItemsByRules(this.state.account, this.state.account?.organization, [Setting.MfaRuleRequired]) + .find((item) => item.rule === Setting.MfaRuleRequired)?.name; if (mfaType !== undefined) { this.props.history.push(`/mfa/setup?mfaType=${mfaType}`, {from: "/login"}); } @@ -380,6 +380,15 @@ class App extends Component { }); }} /> + +
{ + this.setState({ + isAiAssistantOpen: true, + }); + }}> + +
+
{Setting.isAdminUser(this.state.account) && !Setting.isMobile() && } - {this.renderFooter()} + { + this.renderFooter() + } + { + this.renderAiAssistant() + } ); } @@ -651,6 +665,40 @@ class App extends Component { ); } + renderAiAssistant() { + return ( + + + + help + AI Assistant + + + + + + + + + + } + placement="right" + width={500} + mask={false} + onClose={() => { + this.setState({ + isAiAssistantOpen: false, + }); + }} + visible={this.state.isAiAssistantOpen} + > +