diff --git a/.husky/pre-commit b/.husky/pre-commit
old mode 100644
new mode 100755
index 3e0b1db68..12cc5e1ce
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -1,6 +1,6 @@
-#!/usr/bin/env sh
-. "$(dirname -- "$0")/_/husky.sh"
-
-if command -v npx >/dev/null 2>&1; then
- npx lint-staged
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+
+if command -v npx >/dev/null 2>&1; then
+ npx lint-staged
fi
\ No newline at end of file
diff --git a/src/components/Icon/icons/menu.svg b/src/components/Icon/icons/menu.svg
new file mode 100644
index 000000000..335d82561
--- /dev/null
+++ b/src/components/Icon/icons/menu.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/components/Icon/index.tsx b/src/components/Icon/index.tsx
index b5467792f..c0abd88b8 100644
--- a/src/components/Icon/index.tsx
+++ b/src/components/Icon/index.tsx
@@ -4,18 +4,18 @@ import { Icon } from '@chakra-ui/react';
import dynamic from 'next/dynamic';
const map = {
- model: dynamic(() => import('./icons/model.svg')),
- share: dynamic(() => import('./icons/share.svg')),
- home: dynamic(() => import('./icons/home.svg'))
+ model: require('./icons/model.svg').default,
+ share: require('./icons/share.svg').default,
+ home: require('./icons/home.svg').default,
+ menu: require('./icons/menu.svg').default
};
-const MyIcon = ({
- name,
- w = 'auto',
- h = 'auto',
- ...props
-}: { name: keyof typeof map } & IconProps) => {
- return map[name] ? : null;
+export type IconName = keyof typeof map;
+
+const MyIcon = ({ name, w = 'auto', h = 'auto', ...props }: { name: IconName } & IconProps) => {
+ return map[name] ? (
+
+ ) : null;
};
export default MyIcon;
diff --git a/src/components/Layout/index.tsx b/src/components/Layout/index.tsx
index 281f4ef67..1dd6eb9cd 100644
--- a/src/components/Layout/index.tsx
+++ b/src/components/Layout/index.tsx
@@ -1,6 +1,5 @@
-import React from 'react';
-import { Box } from '@chakra-ui/react';
-import Link from 'next/link';
+import React, { useEffect } from 'react';
+import { Box, useColorMode } from '@chakra-ui/react';
import Navbar from './navbar';
import NavbarPhone from './navbarPhone';
import { useRouter } from 'next/router';
@@ -44,9 +43,16 @@ const navbarList = [
const Layout = ({ children }: { children: JSX.Element }) => {
const { isPc } = useScreen();
const router = useRouter();
+ const { colorMode, setColorMode } = useColorMode();
const { Loading } = useLoading({ defaultLoading: true });
const { loading } = useGlobalStore();
+ useEffect(() => {
+ if (colorMode === 'dark' && router.pathname !== '/chat') {
+ setColorMode('light');
+ }
+ }, [colorMode, router.pathname, setColorMode]);
+
return (
<>
{!unShowLayoutRoute[router.pathname] ? (
diff --git a/src/components/Markdown/index.module.scss b/src/components/Markdown/index.module.scss
index 9e6273761..30466dbb3 100644
--- a/src/components/Markdown/index.module.scss
+++ b/src/components/Markdown/index.module.scss
@@ -4,7 +4,7 @@
width: 4px;
height: 14px;
transform: translate(4px, 2px) scaleY(1.3);
- background-color: rgba(0, 0, 0, 0.7);
+ background-color: var(--chakra-colors-chakra-body-text);
animation: blink 0.6s infinite;
}
.animation {
@@ -14,7 +14,7 @@
width: 4px;
height: 14px;
transform: translate(4px, 2px) scaleY(1.3);
- background-color: rgba(0, 0, 0, 0.7);
+ background-color: var(--chakra-colors-chakra-body-text);
animation: blink 0.6s infinite;
}
}
@@ -65,7 +65,6 @@
.markdown h4 .mini-icon-link,
.markdown h5 .mini-icon-link,
.markdown h6 .mini-icon-link {
- color: #000000;
display: none;
}
.markdown h1:hover a.anchor,
@@ -103,11 +102,9 @@
font-size: inherit;
}
.markdown h1 {
- color: #000000;
font-size: 28px;
}
.markdown h2 {
- color: #000000;
font-size: 24px;
}
.markdown h3 {
@@ -120,8 +117,7 @@
font-size: 14px;
}
.markdown h6 {
- color: #777777;
- font-size: 14px;
+ font-size: 12px;
}
.markdown p,
.markdown blockquote,
@@ -132,14 +128,6 @@
.markdown pre {
margin: 10px 0;
}
-.markdown hr {
- background: url('https://a248.e.akamai.net/assets.github.com/assets/primer/markdown/dirty-shade-350cca8f57223ebd53603021b2e670f4f319f1b7.png')
- repeat-x scroll 0 0 transparent;
- border: 0 none;
- color: #cccccc;
- height: 4px;
- padding: 0;
-}
.markdown > h2:first-child,
.markdown > h1:first-child,
.markdown > h1:first-child + h2,
@@ -321,7 +309,6 @@
}
.markdown code,
.markdown tt {
- background-color: #f0f0f0;
border: 1px solid #eaeaea;
border-radius: 3px 3px 3px 3px;
margin: 0 2px;
@@ -336,7 +323,6 @@
}
.markdown .highlight pre,
.markdown pre {
- background-color: #f0f0f0;
border: 1px solid #cccccc;
border-radius: 3px 3px 3px 3px;
font-size: max(0.9em, 14px);
@@ -369,11 +355,11 @@
border-radius: 0;
background-color: #222 !important;
overflow-x: auto;
+ color: #fff;
}
pre code {
background-color: #222 !important;
- color: #fff;
width: 100%;
}
@@ -385,6 +371,7 @@
table {
border-collapse: separate;
border-spacing: 0px;
+ color: var(--chakra-colors-gray-700);
thead tr:first-child th {
border-bottom-width: 1px;
diff --git a/src/components/Markdown/index.tsx b/src/components/Markdown/index.tsx
index 6ffaa1f39..dc206a628 100644
--- a/src/components/Markdown/index.tsx
+++ b/src/components/Markdown/index.tsx
@@ -1,7 +1,7 @@
import React, { memo, useMemo } from 'react';
import ReactMarkdown from 'react-markdown';
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
-import { Box, Flex } from '@chakra-ui/react';
+import { Box, Flex, useColorModeValue } from '@chakra-ui/react';
import { useCopyData } from '@/utils/tools';
import Icon from '@/components/Iconfont';
import remarkGfm from 'remark-gfm';
@@ -34,7 +34,7 @@ const Markdown = ({ source, isChatting = false }: { source: string; isChatting?:
{
removeChatHistoryByWindowId(item.chatId);
+ if (item.chatId === chatId) {
+ resetChat();
+ }
e.stopPropagation();
}}
/>
@@ -132,7 +136,7 @@ const SlideBar = ({
w={'100%'}
h={'100%'}
py={3}
- backgroundColor={'rgba(32,33,35,1)'}
+ backgroundColor={useColorModeValue('blackAlpha.800', 'blackAlpha.500')}
color={'white'}
>
{/* 新对话 */}
@@ -152,7 +156,7 @@ const SlideBar = ({
{/* 我的模型 & 历史记录 折叠框*/}
-
+
{isSuccess && (
@@ -210,7 +214,7 @@ const SlideBar = ({
-
+
router.push('/')}>
<>
@@ -243,7 +247,7 @@ const SlideBar = ({
{/* 分享提示modal */}
-
+
分享对话
@@ -252,7 +256,7 @@ const SlideBar = ({
{getToken() && (