sidebar.tsx 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. import React, { useEffect, useRef, useMemo, useState, Fragment } from "react";
  2. import styles from "./home.module.scss";
  3. import DragIcon from "../icons/drag.svg";
  4. import faviconSrc from "../icons/favicon.png";
  5. import deepSeekSrc from "../icons/deepSeek.png";
  6. import { AppstoreOutlined, EditOutlined, MenuOutlined } from '@ant-design/icons';
  7. import { useAppConfig, useChatStore, useGlobalStore } from "../store";
  8. import {
  9. DEFAULT_SIDEBAR_WIDTH,
  10. MAX_SIDEBAR_WIDTH,
  11. MIN_SIDEBAR_WIDTH,
  12. NARROW_SIDEBAR_WIDTH,
  13. } from "../constant";
  14. import { useLocation, useNavigate } from "react-router-dom";
  15. import { isIOS, useMobileScreen } from "../utils";
  16. import api from "@/app/api/api";
  17. import { Button, Drawer, Dropdown, Empty, Form, Input, Menu, message, Modal, Rate, Tag } from "antd";
  18. import { downloadFile } from "../utils/index";
  19. import dayjs from "dayjs";
  20. const FormItem = Form.Item;
  21. export function useHotKey() {
  22. const chatStore = useChatStore();
  23. useEffect(() => {
  24. const onKeyDown = (e: KeyboardEvent) => {
  25. if (e.altKey || e.ctrlKey) {
  26. if (e.key === "ArrowUp") {
  27. chatStore.nextSession(-1);
  28. } else if (e.key === "ArrowDown") {
  29. chatStore.nextSession(1);
  30. }
  31. }
  32. };
  33. window.addEventListener("keydown", onKeyDown);
  34. return () => window.removeEventListener("keydown", onKeyDown);
  35. });
  36. }
  37. export function useDragSideBar() {
  38. const limit = (x: number) => Math.min(MAX_SIDEBAR_WIDTH, x);
  39. const config = useAppConfig();
  40. const startX = useRef(0);
  41. const startDragWidth = useRef(config.sidebarWidth ?? DEFAULT_SIDEBAR_WIDTH);
  42. const lastUpdateTime = useRef(Date.now());
  43. const toggleSideBar = () => {
  44. config.update((config) => {
  45. if (config.sidebarWidth < MIN_SIDEBAR_WIDTH) {
  46. config.sidebarWidth = DEFAULT_SIDEBAR_WIDTH;
  47. } else {
  48. config.sidebarWidth = NARROW_SIDEBAR_WIDTH;
  49. }
  50. });
  51. };
  52. const onDragStart = (e: MouseEvent) => {
  53. // Remembers the initial width each time the mouse is pressed
  54. startX.current = e.clientX;
  55. startDragWidth.current = config.sidebarWidth;
  56. const dragStartTime = Date.now();
  57. const handleDragMove = (e: MouseEvent) => {
  58. if (Date.now() < lastUpdateTime.current + 20) {
  59. return;
  60. }
  61. lastUpdateTime.current = Date.now();
  62. const d = e.clientX - startX.current;
  63. const nextWidth = limit(startDragWidth.current + d);
  64. config.update((config) => {
  65. if (nextWidth < MIN_SIDEBAR_WIDTH) {
  66. config.sidebarWidth = NARROW_SIDEBAR_WIDTH;
  67. } else {
  68. config.sidebarWidth = nextWidth;
  69. }
  70. });
  71. };
  72. const handleDragEnd = () => {
  73. // In useRef the data is non-responsive, so `config.sidebarWidth` can't get the dynamic sidebarWidth
  74. window.removeEventListener("pointermove", handleDragMove);
  75. window.removeEventListener("pointerup", handleDragEnd);
  76. // if user click the drag icon, should toggle the sidebar
  77. const shouldFireClick = Date.now() - dragStartTime < 300;
  78. if (shouldFireClick) {
  79. toggleSideBar();
  80. }
  81. };
  82. window.addEventListener("pointermove", handleDragMove);
  83. window.addEventListener("pointerup", handleDragEnd);
  84. };
  85. const isMobileScreen = useMobileScreen();
  86. const shouldNarrow =
  87. !isMobileScreen && config.sidebarWidth < MIN_SIDEBAR_WIDTH;
  88. useEffect(() => {
  89. const barWidth = shouldNarrow
  90. ? NARROW_SIDEBAR_WIDTH
  91. : limit(config.sidebarWidth ?? DEFAULT_SIDEBAR_WIDTH);
  92. const sideBarWidth = isMobileScreen ? "100vw" : `${barWidth}px`;
  93. document.documentElement.style.setProperty("--sidebar-width", sideBarWidth);
  94. }, [config.sidebarWidth, isMobileScreen, shouldNarrow]);
  95. return {
  96. onDragStart,
  97. shouldNarrow,
  98. };
  99. }
  100. export function SideBarContainer(props: {
  101. children: React.ReactNode;
  102. onDragStart: (e: MouseEvent) => void;
  103. shouldNarrow: boolean;
  104. className?: string;
  105. }) {
  106. const isMobileScreen = useMobileScreen();
  107. const isIOSMobile = useMemo(
  108. () => isIOS() && isMobileScreen,
  109. [isMobileScreen],
  110. );
  111. const { children, className, onDragStart, shouldNarrow } = props;
  112. return (
  113. <div
  114. className={`${styles.sidebar} ${className} ${shouldNarrow && styles["narrow-sidebar"]
  115. }`}
  116. style={{
  117. transition: isMobileScreen && isIOSMobile ? "none" : undefined,
  118. background: '#FFFFFF',
  119. overflowY: "auto",
  120. }}
  121. >
  122. {children}
  123. <div
  124. className={styles["sidebar-drag"]}
  125. onPointerDown={(e) => onDragStart(e as any)}
  126. >
  127. <DragIcon />
  128. </div>
  129. </div>
  130. );
  131. }
  132. export function SideBarHeader(props: {
  133. title?: string | React.ReactNode;
  134. subTitle?: string | React.ReactNode;
  135. logo?: React.ReactNode;
  136. children?: React.ReactNode;
  137. }) {
  138. const { title, subTitle, logo, children } = props;
  139. return (
  140. <Fragment>
  141. <div className={styles["sidebar-header"]} data-tauri-drag-region>
  142. <div className={styles["sidebar-title-container"]}>
  143. <div className={styles["sidebar-title"]} data-tauri-drag-region>
  144. {title}
  145. </div>
  146. <div className={styles["sidebar-sub-title"]}>{subTitle}</div>
  147. </div>
  148. <div className={styles["sidebar-logo"] + " no-dark"}>{logo}</div>
  149. </div>
  150. {children}
  151. </Fragment>
  152. );
  153. }
  154. export function SideBarBody(props: {
  155. children: React.ReactNode;
  156. onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
  157. }) {
  158. const { onClick, children } = props;
  159. return (
  160. <div className={styles["sidebar-body"]} onClick={onClick}>
  161. {children}
  162. </div>
  163. );
  164. }
  165. export function SideBarTail(props: {
  166. primaryAction?: React.ReactNode;
  167. secondaryAction?: React.ReactNode;
  168. }) {
  169. const { primaryAction, secondaryAction } = props;
  170. return (
  171. <div className={styles["sidebar-tail"]}>
  172. <div className={styles["sidebar-actions"]}>{primaryAction}</div>
  173. <div className={styles["sidebar-actions"]}>{secondaryAction}</div>
  174. </div>
  175. );
  176. }
  177. interface AppDrawerProps {
  178. isMobileScreen: boolean,
  179. selectedAppId: string,
  180. type: 'all' | 'collect',
  181. open: boolean,
  182. onClose: () => void,
  183. }
  184. const AppDrawer: React.FC<AppDrawerProps> = (props) => {
  185. const {
  186. isMobileScreen,
  187. selectedAppId,
  188. type,
  189. open,
  190. onClose,
  191. } = props;
  192. const navigate = useNavigate();
  193. const [listLoading, setListLoading] = useState(false);
  194. type List = {
  195. name: string,
  196. chatMode: string,
  197. appId: string,
  198. desc: string,
  199. createTime: string,
  200. typeName: string,
  201. isCollect: boolean,
  202. }[];
  203. const [list, setList] = useState<List>([]);
  204. const fetchAppList = async () => {
  205. setListLoading(true);
  206. try {
  207. const res = await api.get(`/deepseek/api/project/app`);
  208. if (type === 'all') {
  209. setList(res.data);
  210. } else {
  211. setList(res.data.filter((item: any) => item.isCollect));
  212. }
  213. } catch (error) {
  214. console.error(error);
  215. } finally {
  216. setListLoading(false);
  217. }
  218. };
  219. // 收藏应用
  220. const collectApp = async (appId: string) => {
  221. try {
  222. await api.post('/deepseek/api/app/collect', {
  223. appId: appId
  224. });
  225. message.success('收藏成功');
  226. await fetchAppList();
  227. } catch (error: any) {
  228. message.error(error.msg);
  229. }
  230. };
  231. // 取消收藏应用
  232. const cancelCollectApp = async (appId: string) => {
  233. try {
  234. await api.delete(`/deepseek/api/app/collect/${appId}`);
  235. message.success('操作成功');
  236. await fetchAppList();
  237. } catch (error: any) {
  238. message.error(error.msg);
  239. }
  240. };
  241. const init = async () => {
  242. await fetchAppList();
  243. }
  244. useEffect(() => {
  245. init();
  246. }, [])
  247. return (
  248. <Drawer
  249. width={isMobileScreen ? '100%' : 400}
  250. title={type === 'all' ? '我的应用' : '我的收藏'}
  251. open={open}
  252. loading={listLoading}
  253. onClose={onClose}
  254. >
  255. {
  256. list.length > 0 ?
  257. list.map((item, index) => {
  258. return <div
  259. style={{
  260. padding: 20,
  261. border: '1px solid #f0f0f0',
  262. borderRadius: 4,
  263. marginBottom: 20,
  264. cursor: 'pointer',
  265. }}
  266. key={index}
  267. >
  268. <div style={{ display: 'flex', marginBottom: 10 }}>
  269. <AppstoreOutlined style={{ fontSize: 40, color: '#3875f6', marginRight: 20 }} />
  270. <div>
  271. <div style={{ fontSize: 16, fontWeight: 'bold', marginBottom: 5 }}>
  272. {item.name}
  273. </div>
  274. <div style={{ color: '#d4d7de' }}>
  275. ID:{item.appId}
  276. </div>
  277. </div>
  278. </div>
  279. <div style={{ color: '#8f949e', marginBottom: 10 }}>
  280. {item.desc}
  281. </div>
  282. <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 10 }}>
  283. <div style={{ color: '#747a86' }}>
  284. {dayjs(item.createTime).format('YYYY-MM-DD')} 发布
  285. </div>
  286. <div>
  287. <Tag style={{ margin: 0 }} color="blue">
  288. {item.typeName}
  289. </Tag>
  290. </div>
  291. </div>
  292. <div
  293. style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
  294. <div onClick={async () => {
  295. if (item.isCollect) {
  296. await cancelCollectApp(item.appId);
  297. } else {
  298. await collectApp(item.appId);
  299. }
  300. }}>
  301. {
  302. item.isCollect ?
  303. <Rate count={1} value={1} />
  304. :
  305. <Rate count={1} />
  306. }
  307. </div>
  308. <Button type='primary' size="small" onClick={() => {
  309. const search = `?showMenu=false&chatMode=${item.chatMode}&appId=${item.appId}`;
  310. navigate({
  311. pathname: '/knowledgeChat',
  312. search: search,
  313. })
  314. location.reload();
  315. }}>
  316. 使用
  317. </Button>
  318. </div>
  319. </div>
  320. })
  321. :
  322. <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
  323. }
  324. </Drawer>
  325. )
  326. }
  327. export const SideBar = (props: { className?: string }) => {
  328. // useHotKey();
  329. const { onDragStart, shouldNarrow } = useDragSideBar();
  330. const [showPluginSelector, setShowPluginSelector] = useState(false);
  331. const navigate = useNavigate();
  332. const location = useLocation();
  333. const chatStore = useChatStore();
  334. const globalStore = useGlobalStore();
  335. const [menuList, setMenuList] = useState([])
  336. const [modalOpen, setModalOpen] = useState(false)
  337. const [form] = Form.useForm();
  338. const getType = (): 'bigModel' | 'deepSeek' => {
  339. if (['/knowledgeChat', '/newChat'].includes(location.pathname)) {
  340. return 'bigModel';
  341. } else if (['/deepseekChat', '/newDeepseekChat'].includes(location.pathname)) {
  342. return 'deepSeek';
  343. } else {
  344. return 'bigModel';
  345. }
  346. }
  347. // 获取聊天列表
  348. const fetchChatList = async (chatMode?: 'ONLINE' | 'LOCAL') => {
  349. try {
  350. let url = '';
  351. if (getType() === 'bigModel') {
  352. const appId = globalStore.selectedAppId;
  353. if (appId) {
  354. if (chatMode === 'LOCAL') {
  355. url = `/deepseek/api/dialog/list/${appId}`;
  356. } else {
  357. url = `/bigmodel/api/dialog/list/${appId}`;
  358. }
  359. }
  360. } else {
  361. const appId = '1881269958412521255';
  362. url = `/bigmodel/api/dialog/list/${appId}`;
  363. }
  364. const res = await api.get(url);
  365. const list = res.data.map((item: any) => {
  366. return {
  367. ...item,
  368. children: item.children.map((child: any) => {
  369. const items = [
  370. {
  371. key: '1',
  372. label: (
  373. <a onClick={() => {
  374. setModalOpen(true);
  375. form.setFieldsValue({
  376. dialogId: child.key,
  377. dialogName: child.label
  378. });
  379. }}>
  380. 重命名
  381. </a>
  382. ),
  383. },
  384. {
  385. key: '2',
  386. label: (
  387. <a onClick={async () => {
  388. try {
  389. let blob = null;
  390. if (getType() === 'bigModel') {
  391. if (chatMode === 'LOCAL') {
  392. blob = await api.post(`/deepseek/api/dialog/export/${child.key}`, {}, { responseType: 'blob' });
  393. } else {
  394. blob = await api.post(`/bigmodel/api/dialog/export/${child.key}`, {}, { responseType: 'blob' });
  395. }
  396. } else {
  397. blob = await api.post(`/bigmodel/api/dialog/export/${child.key}`, {}, { responseType: 'blob' });
  398. }
  399. const fileName = `${child.label}.xlsx`;
  400. downloadFile(blob, fileName);
  401. } catch (error) {
  402. console.error(error);
  403. }
  404. }}>
  405. 导出
  406. </a>
  407. ),
  408. },
  409. {
  410. key: '3',
  411. label: (
  412. <a onClick={async () => {
  413. try {
  414. if (getType() === 'bigModel') {
  415. if (chatMode === 'LOCAL') {
  416. await api.delete(`/deepseek/api/dialog/del/${child.key}`);
  417. await fetchChatList(chatMode);
  418. } else {
  419. await api.delete(`/bigmodel/api/dialog/del/${child.key}`);
  420. await fetchChatList();
  421. }
  422. } else {
  423. await api.delete(`/bigmodel/api/dialog/del/${child.key}`);
  424. await fetchChatList();
  425. }
  426. chatStore.clearSessions();
  427. useChatStore.setState({
  428. message: {
  429. content: '',
  430. role: 'assistant',
  431. }
  432. });
  433. } catch (error) {
  434. console.error(error);
  435. }
  436. }}>
  437. 删除
  438. </a>
  439. ),
  440. },
  441. ];
  442. return {
  443. ...child,
  444. label: <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
  445. <div style={{ flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', marginRight: 10 }}>
  446. {child.label}
  447. </div>
  448. <div style={{ width: 20 }}>
  449. <Dropdown menu={{ items }} trigger={['click']} placement="bottomRight">
  450. <EditOutlined onClick={(e) => e.stopPropagation()} />
  451. </Dropdown>
  452. </div>
  453. </div>
  454. }
  455. })
  456. }
  457. })
  458. setMenuList(list);
  459. } catch (error) {
  460. console.error(error)
  461. }
  462. }
  463. useEffect(() => {
  464. if (getType() === 'bigModel') {
  465. if (globalStore.selectedAppId) {
  466. fetchChatList(chatStore.chatMode);
  467. }
  468. }
  469. }, [globalStore.selectedAppId]);
  470. useEffect(() => {
  471. chatStore.clearSessions();
  472. useChatStore.setState({
  473. message: {
  474. content: '',
  475. role: 'assistant',
  476. }
  477. });
  478. }, []);
  479. useEffect(() => {
  480. fetchChatList(chatStore.chatMode);
  481. }, [chatStore.chatMode]);
  482. const isMobileScreen = useMobileScreen();
  483. const [drawerOpen, setDrawerOpen] = useState(false);
  484. const [drawerType, setDrawerType] = useState<'all' | 'collect'>('all');
  485. return (
  486. <>
  487. {
  488. globalStore.showMenu &&
  489. <SideBarContainer
  490. onDragStart={onDragStart}
  491. shouldNarrow={shouldNarrow}
  492. {...props}
  493. >
  494. {
  495. getType() === 'deepSeek' &&
  496. <div>
  497. <img style={{ width: '100%' }} src={deepSeekSrc.src} />
  498. </div>
  499. }
  500. <SideBarHeader
  501. title={getType() === 'bigModel' ?
  502. <div style={{ display: 'flex', alignItems: 'center' }}>
  503. {isMobileScreen && <div>
  504. <Button
  505. type='text'
  506. icon={<MenuOutlined />}
  507. onClick={() => {
  508. globalStore.setShowMenu(!globalStore.showMenu);
  509. }}
  510. />
  511. </div>}
  512. 问答历史
  513. </div>
  514. :
  515. ''
  516. }
  517. logo={getType() === 'bigModel' ? <img style={{ height: 40 }} src={faviconSrc.src} /> : ''}
  518. >
  519. <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
  520. <Button
  521. style={{ width: '48%' }}
  522. onClick={() => {
  523. navigate({ pathname: '/' });
  524. }}
  525. >
  526. 回到首页
  527. </Button>
  528. <Button
  529. style={{ width: '48%' }}
  530. onClick={async () => {
  531. chatStore.clearSessions();
  532. chatStore.updateCurrentSession((value) => {
  533. value.appId = globalStore.selectedAppId;
  534. });
  535. if (getType() === 'bigModel') {
  536. navigate({ pathname: '/newChat' });
  537. } else {
  538. navigate({ pathname: '/newDeepseekChat' });
  539. }
  540. if (getType() === 'bigModel') {
  541. if (chatStore.chatMode === 'LOCAL') {
  542. await fetchChatList(chatStore.chatMode);
  543. } else {
  544. await fetchChatList();
  545. }
  546. } else {
  547. await fetchChatList();
  548. }
  549. }}
  550. >
  551. 新建对话
  552. </Button>
  553. </div>
  554. <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
  555. <Button
  556. style={{ width: '48%' }}
  557. type="primary"
  558. onClick={() => {
  559. setDrawerType('all');
  560. setDrawerOpen(true);
  561. }}
  562. >
  563. 我的应用
  564. </Button>
  565. <Button
  566. style={{ width: '48%' }}
  567. type="primary"
  568. onClick={() => {
  569. setDrawerType('collect');
  570. setDrawerOpen(true);
  571. }}
  572. >
  573. 我的收藏
  574. </Button>
  575. </div>
  576. </SideBarHeader>
  577. <Menu
  578. style={{ border: 'none' }}
  579. onClick={async ({ key }) => {
  580. let url = ``;
  581. if (getType() === 'bigModel') {
  582. if (chatStore.chatMode === 'LOCAL') {
  583. url = `/deepseek/api/dialog/detail/${key}`;
  584. } else {
  585. url = `/bigmodel/api/dialog/detail/${key}`;
  586. }
  587. } else {
  588. url = `/bigmodel/api/dialog/detail/${key}`;
  589. }
  590. const res = await api.get(url);
  591. const list = res.data.map(((item: any) => {
  592. return {
  593. id: item.did,
  594. role: item.type,
  595. date: item.create_time,
  596. content: item.content,
  597. document: item.document ? item.document : undefined,
  598. sliceInfo: item.sliceInfo ? item.sliceInfo : undefined,
  599. networkInfo: item.networkInfo ? item.networkInfo : undefined,
  600. }
  601. }))
  602. const session = {
  603. appId: res.data.length ? res.data[0].appId : '',
  604. dialogName: res.data.length ? res.data[0].dialog_name : '',
  605. id: res.data.length ? res.data[0].id : '',
  606. messages: list,
  607. }
  608. globalStore.setCurrentSession(session);
  609. chatStore.clearSessions();
  610. chatStore.updateCurrentSession((value) => {
  611. value.appId = session.appId;
  612. value.topic = session.dialogName;
  613. value.id = session.id;
  614. value.messages = list;
  615. });
  616. if (getType() === 'bigModel') {
  617. navigate({ pathname: '/newChat' });
  618. } else {
  619. navigate({ pathname: '/newDeepseekChat' });
  620. }
  621. }}
  622. mode="inline"
  623. items={menuList}
  624. />
  625. <Modal
  626. title="重命名"
  627. open={modalOpen}
  628. width={300}
  629. maskClosable={false}
  630. onOk={() => {
  631. form.validateFields().then(async (values) => {
  632. setModalOpen(false);
  633. try {
  634. if (getType() === 'bigModel') {
  635. if (chatStore.chatMode === 'LOCAL') {
  636. await api.put(`/deepseek/api/dialog/update`, {
  637. id: values.dialogId,
  638. dialogName: values.dialogName
  639. });
  640. await fetchChatList(chatStore.chatMode);
  641. } else {
  642. await api.put(`/bigmodel/api/dialog/update`, {
  643. id: values.dialogId,
  644. dialogName: values.dialogName
  645. });
  646. await fetchChatList();
  647. }
  648. } else {
  649. await api.put(`/bigmodel/api/dialog/update`, {
  650. id: values.dialogId,
  651. dialogName: values.dialogName
  652. });
  653. await fetchChatList();
  654. }
  655. chatStore.updateCurrentSession((value) => {
  656. value.topic = values.dialogName;
  657. });
  658. } catch (error) {
  659. console.error(error);
  660. }
  661. }).catch((error) => {
  662. console.error(error);
  663. });
  664. }}
  665. onCancel={() => {
  666. setModalOpen(false);
  667. }}
  668. >
  669. <Form form={form} layout='inline'>
  670. <FormItem name='dialogId' noStyle />
  671. <FormItem
  672. label='名称'
  673. name='dialogName'
  674. rules={[{ required: true, message: '名称不能为空', whitespace: true }]}
  675. >
  676. <Input
  677. style={{ width: 300 }}
  678. placeholder='请输入'
  679. maxLength={20}
  680. />
  681. </FormItem>
  682. </Form>
  683. </Modal>
  684. </SideBarContainer>
  685. }
  686. {
  687. drawerOpen &&
  688. <AppDrawer
  689. isMobileScreen={isMobileScreen}
  690. selectedAppId={globalStore.selectedAppId}
  691. type={drawerType}
  692. open={drawerOpen}
  693. onClose={() => {
  694. setDrawerOpen(false);
  695. }}
  696. />
  697. }
  698. </>
  699. );
  700. }