diff --git a/.gitignore b/.gitignore index bb50d5836..0f2b0d56e 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,6 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts -public/trainData/ -.vscode/ +/public/trainData/ +/.vscode/ platform.json \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index d916a93e2..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "editor.formatOnType": true, - "editor.formatOnSave": true , - "prettier.tabWidth": 2 -} \ No newline at end of file diff --git a/README.md b/README.md index ef44f01e4..545156d90 100644 --- a/README.md +++ b/README.md @@ -70,4 +70,4 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the ### 其他问题 还有其他问题,可以加我 wx,拉个交流群大家一起聊聊。 -![](https://docgpt-1301319986.cos.ap-shanghai.myqcloud.com/icon/erweima.jpg) \ No newline at end of file +![](/icon/erweima.jpg) \ No newline at end of file diff --git a/package.json b/package.json index bd1b94ea0..4aec7d4f9 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,6 @@ "axios": "^1.3.3", "crypto": "^1.0.1", "dayjs": "^1.11.7", - "eslint": "8.34.0", - "eslint-config-next": "13.1.6", "formidable": "^2.1.1", "framer-motion": "^9.0.6", "hyperdown": "^2.4.29", @@ -60,7 +58,9 @@ "@types/uuid": "^9.0.1", "husky": "^8.0.3", "lint-staged": "^13.1.2", - "prettier": "^2.8.4" + "prettier": "^2.8.4", + "eslint": "8.34.0", + "eslint-config-next": "13.1.6" }, "lint-staged": { "./src/**/*.{ts,tsx,scss}": "npm run format" diff --git a/public/icon/chatting.svg b/public/icon/chatting.svg new file mode 100644 index 000000000..32edead6e --- /dev/null +++ b/public/icon/chatting.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/icon/human.png b/public/icon/human.png new file mode 100644 index 000000000..639c38755 Binary files /dev/null and b/public/icon/human.png differ diff --git a/public/icon/login-bg.svg b/public/icon/login-bg.svg new file mode 100644 index 000000000..125f07c4a --- /dev/null +++ b/public/icon/login-bg.svg @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/public/icon/loginLeft.svg b/public/icon/loginLeft.svg new file mode 100644 index 000000000..e943b9c8d --- /dev/null +++ b/public/icon/loginLeft.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/icon/logo.png b/public/icon/logo.png new file mode 100644 index 000000000..93670150a Binary files /dev/null and b/public/icon/logo.png differ diff --git a/src/components/Layout/navbar.tsx b/src/components/Layout/navbar.tsx index 9b30d33da..97bc13b28 100644 --- a/src/components/Layout/navbar.tsx +++ b/src/components/Layout/navbar.tsx @@ -34,12 +34,7 @@ const Navbar = ({ > {/* logo */} - + {/* 导航列表 */} diff --git a/src/components/Layout/navbarPhone.tsx b/src/components/Layout/navbarPhone.tsx index 62e0975c4..251a0a791 100644 --- a/src/components/Layout/navbarPhone.tsx +++ b/src/components/Layout/navbarPhone.tsx @@ -48,13 +48,7 @@ const NavbarPhone = ({ - + {navbarList.map((item) => ( (); return { - openConfirm: (confirm?: any, cancel?: any) => { - onOpen(); - confirmCb.current = confirm; - cancelCb.current = cancel; - }, - ConfirmChild: () => ( - - - - - {title} - + openConfirm: useCallback( + (confirm?: any, cancel?: any) => { + onOpen(); + confirmCb.current = confirm; + cancelCb.current = cancel; + }, + [onOpen] + ), + ConfirmChild: useCallback( + () => ( + + + + + {title} + - {content} + {content} - - - - - - - + + + + + + + + ), + [content, isOpen, onClose, title] ) }; }; diff --git a/src/hooks/useLoading.tsx b/src/hooks/useLoading.tsx index d50ede065..7083fe8ae 100644 --- a/src/hooks/useLoading.tsx +++ b/src/hooks/useLoading.tsx @@ -1,36 +1,33 @@ -import { useState, memo } from 'react'; +import { useState, useCallback } from 'react'; import { Spinner, Flex } from '@chakra-ui/react'; export const useLoading = (props?: { defaultLoading: boolean }) => { const [isLoading, setIsLoading] = useState(props?.defaultLoading || false); - const Loading = ({ - loading, - fixed = true - }: { - loading?: boolean; - fixed?: boolean; - }): JSX.Element | null => { - return isLoading || loading ? ( - - - - ) : null; - }; + const Loading = useCallback( + ({ loading, fixed = true }: { loading?: boolean; fixed?: boolean }): JSX.Element | null => { + return isLoading || loading ? ( + + + + ) : null; + }, + [isLoading] + ); return { isLoading, setIsLoading, - Loading: memo(Loading) + Loading }; }; diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 9596b4ab3..f43b83a24 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -15,18 +15,18 @@ Router.events.on('routeChangeStart', () => NProgress.start()); Router.events.on('routeChangeComplete', () => NProgress.done()); Router.events.on('routeChangeError', () => NProgress.done()); -export default function App({ Component, pageProps }: AppProps) { - // Create a client - const queryClient = new QueryClient({ - defaultOptions: { - queries: { - refetchOnWindowFocus: false, - retry: false, - cacheTime: 0 - } +// Create a client +const queryClient = new QueryClient({ + defaultOptions: { + queries: { + refetchOnWindowFocus: false, + retry: false, + cacheTime: 0 } - }); + } +}); +export default function App({ Component, pageProps }: AppProps) { return ( <> diff --git a/src/pages/chat/index.tsx b/src/pages/chat/index.tsx index c22bdc20a..d79164384 100644 --- a/src/pages/chat/index.tsx +++ b/src/pages/chat/index.tsx @@ -300,12 +300,8 @@ const Chat = () => { https://docgpt-1301319986.cos.ap-shanghai.myqcloud.com/icon/logo.png @@ -394,7 +390,7 @@ const Chat = () => { {isChatting ? ( {''} { > {isPc && (