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 ( + + + + + AI Assistant + + + + + + + + + + } + placement="right" + width={500} + mask={false} + onClose={() => { + this.setState({ + isAiAssistantOpen: false, + }); + }} + visible={this.state.isAiAssistantOpen} + > + + + ); + } + isDoorPages() { return this.isEntryPages() || window.location.pathname.startsWith("/callback"); } @@ -696,6 +744,9 @@ class App extends Component { { this.renderFooter() } + { + this.renderAiAssistant() + } ); } diff --git a/web/src/common/OpenTour.js b/web/src/common/OpenTour.js index ff42d7c0..99c0dce5 100644 --- a/web/src/common/OpenTour.js +++ b/web/src/common/OpenTour.js @@ -34,7 +34,7 @@ class OpenTour extends React.Component { render() { return ( this.canTour() ? - + TourConfig.setIsTourVisible(true)} > diff --git a/web/src/index.css b/web/src/index.css index 979af4eb..df446752 100644 --- a/web/src/index.css +++ b/web/src/index.css @@ -45,3 +45,12 @@ code { .ant-list-sm .ant-list-item { padding: 2px !important; } + +.ant-drawer-body { + padding: 0 !important; + overflow: hidden !important; +} + +.custom-link:hover { + color: rgb(64 64 64) !important; +}