feat: 图片地址

This commit is contained in:
archer
2023-03-06 17:20:14 +08:00
parent 9f8d696bbe
commit dd5217d8a5
18 changed files with 113 additions and 109 deletions

4
.gitignore vendored
View File

@@ -34,6 +34,6 @@ yarn-error.log*
# typescript # typescript
*.tsbuildinfo *.tsbuildinfo
next-env.d.ts next-env.d.ts
public/trainData/ /public/trainData/
.vscode/ /.vscode/
platform.json platform.json

View File

@@ -1,5 +0,0 @@
{
"editor.formatOnType": true,
"editor.formatOnSave": true ,
"prettier.tabWidth": 2
}

View File

@@ -70,4 +70,4 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the
### 其他问题 ### 其他问题
还有其他问题,可以加我 wx拉个交流群大家一起聊聊。 还有其他问题,可以加我 wx拉个交流群大家一起聊聊。
![](https://docgpt-1301319986.cos.ap-shanghai.myqcloud.com/icon/erweima.jpg) ![](/icon/erweima.jpg)

View File

@@ -23,8 +23,6 @@
"axios": "^1.3.3", "axios": "^1.3.3",
"crypto": "^1.0.1", "crypto": "^1.0.1",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"eslint": "8.34.0",
"eslint-config-next": "13.1.6",
"formidable": "^2.1.1", "formidable": "^2.1.1",
"framer-motion": "^9.0.6", "framer-motion": "^9.0.6",
"hyperdown": "^2.4.29", "hyperdown": "^2.4.29",
@@ -60,7 +58,9 @@
"@types/uuid": "^9.0.1", "@types/uuid": "^9.0.1",
"husky": "^8.0.3", "husky": "^8.0.3",
"lint-staged": "^13.1.2", "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": { "lint-staged": {
"./src/**/*.{ts,tsx,scss}": "npm run format" "./src/**/*.{ts,tsx,scss}": "npm run format"

19
public/icon/chatting.svg Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: none; display: block; shape-rendering: auto;" width="204px" height="204px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
<circle cx="84" cy="50" r="10" fill="#e15b64">
<animate attributeName="r" repeatCount="indefinite" dur="0.5681818181818182s" calcMode="spline" keyTimes="0;1" values="15;0" keySplines="0 0.5 0.5 1" begin="0s"></animate>
<animate attributeName="fill" repeatCount="indefinite" dur="2.272727272727273s" calcMode="discrete" keyTimes="0;0.25;0.5;0.75;1" values="#e15b64;#abbd81;#f8b26a;#f47e60;#e15b64" begin="0s"></animate>
</circle><circle cx="16" cy="50" r="10" fill="#e15b64">
<animate attributeName="r" repeatCount="indefinite" dur="2.272727272727273s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;15;15;15" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>
<animate attributeName="cx" repeatCount="indefinite" dur="2.272727272727273s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>
</circle><circle cx="50" cy="50" r="10" fill="#f47e60">
<animate attributeName="r" repeatCount="indefinite" dur="2.272727272727273s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;15;15;15" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5681818181818182s"></animate>
<animate attributeName="cx" repeatCount="indefinite" dur="2.272727272727273s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5681818181818182s"></animate>
</circle><circle cx="84" cy="50" r="10" fill="#f8b26a">
<animate attributeName="r" repeatCount="indefinite" dur="2.272727272727273s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;15;15;15" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.1363636363636365s"></animate>
<animate attributeName="cx" repeatCount="indefinite" dur="2.272727272727273s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.1363636363636365s"></animate>
</circle><circle cx="16" cy="50" r="10" fill="#abbd81">
<animate attributeName="r" repeatCount="indefinite" dur="2.272727272727273s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;15;15;15" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.7045454545454546s"></animate>
<animate attributeName="cx" repeatCount="indefinite" dur="2.272727272727273s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.7045454545454546s"></animate>
</circle>
<!-- [ldio] generated by https://loading.io/ --></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
public/icon/human.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

3
public/icon/login-bg.svg Normal file
View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1440" height="900" viewBox="0 0 1440 900" fill="none"><defs><path id="path_0"
transform="translate(0 0) rotate(0 720 450)"
d="M0,900L1440,900L1440,0L0,0L0,900Z" /><linearGradient id="linear_0" x1="45.776671171188354%" y1="3.4534157006028896%" x2="45.77667520943754%" y2="95.15074645348403%" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#4D3AF9" stop-opacity="1" /><stop offset="0.4571722174852774" stop-color="#3B4DFE" stop-opacity="1" /><stop offset="1" stop-color="#1A68FF" stop-opacity="1" /></linearGradient><linearGradient id="linear_1" x1="50%" y1="2.535076530612245%" x2="51%" y2="100%" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#4581FF" stop-opacity="1" /><stop offset="1" stop-color="#1C57FE" stop-opacity="1" /></linearGradient><linearGradient id="linear_2" x1="50%" y1="2.535076530612245%" x2="51%" y2="100%" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#4581FF" stop-opacity="1" /><stop offset="1" stop-color="#1C57FE" stop-opacity="1" /></linearGradient><linearGradient id="linear_3" x1="50%" y1="0%" x2="51%" y2="100%" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#29BFA8" stop-opacity="1" /><stop offset="1" stop-color="#34D1B6" stop-opacity="1" /></linearGradient><linearGradient id="linear_4" x1="50%" y1="2.535076530612245%" x2="51%" y2="100%" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#4581FF" stop-opacity="1" /><stop offset="1" stop-color="#1C57FE" stop-opacity="1" /></linearGradient></defs><g opacity="1" transform="translate(0 0) rotate(0 720 450)"><mask id="mask-0" fill="white"><use xlink:href="#path_0"></use></mask><g mask="url(#mask-0)"><path id="Mask" fill-rule="evenodd" fill="url(#linear_0)" transform="translate(0 0) rotate(0 720 450)" opacity="1" d="M0,900L1440,900L1440,0L0,0L0,900Z " /></g><g mask="url(#mask-0)"><path id="Oval" fill-rule="evenodd" fill="url(#linear_1)" transform="translate(51.66666666666667 412.5) rotate(0 37.5 37.5)" opacity="1" d="M75,37.5C75,16.79 58.21,0 37.5,0C16.79,0 0,16.79 0,37.5C0,58.21 16.79,75 37.5,75C58.21,75 75,58.21 75,37.5Z " /></g><g mask="url(#mask-0)"><path id="Oval Copy 2" fill-rule="evenodd" fill="url(#linear_2)" transform="translate(1049.166666666667 -3.333333333333333) rotate(0 30.833333333333336 30.833333333333336)" opacity="0.69" d="M61.67,30.83C61.67,13.81 47.86,0 30.83,0C13.81,0 0,13.81 0,30.83C0,47.86 13.81,61.67 30.83,61.67C47.86,61.67 61.67,47.86 61.67,30.83Z " /></g><g mask="url(#mask-0)"><g opacity="0.55" transform="translate(-64.16666666666667 547.4999999999999) rotate(0 50 226.5)"><path id="Rectangle 2" fill-rule="evenodd" style="fill:#5088FF" transform="translate(14.63769413070223 15.28431509376342) rotate(-45 35.20283757354478 34.876453649023716)" opacity="1" d="M8.17,61.88L70.41,69.75L47.22,22.97L0,0L8.17,61.88Z " /><path id="Rectangle 3" fill-rule="evenodd" fill="url(#linear_3)" transform="translate(0 50.20419426048581) rotate(0 26.487523940001577 201.14790286975716)" opacity="1" d="M0,402.3L51.51,402.3L52.98,23.25L0,0L0,402.3Z " /><path id="Rectangle 3 Copy" fill-rule="evenodd" fill="url(#linear_4)" transform="translate(48.48484848484848 50.20419426048581) rotate(0 25.75757575757576 201.14790286975716)" opacity="1" d="M0,402.3L51.52,402.3L51.52,0L0,21.68L0,402.3Z " /></g></g></g></svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 201 KiB

BIN
public/icon/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -34,12 +34,7 @@ const Navbar = ({
> >
{/* logo */} {/* logo */}
<Box pb={4}> <Box pb={4}>
<Image <Image src={'/icon/logo.png'} width={'35'} height={'35'} alt=""></Image>
src={'https://docgpt-1301319986.cos.ap-shanghai.myqcloud.com/icon/logo.png'}
width={'35'}
height={'35'}
alt=""
></Image>
</Box> </Box>
{/* 导航列表 */} {/* 导航列表 */}
<Box flex={1}> <Box flex={1}>

View File

@@ -48,13 +48,7 @@ const NavbarPhone = ({
<DrawerContent maxWidth={'50vw'}> <DrawerContent maxWidth={'50vw'}>
<DrawerBody p={4}> <DrawerBody p={4}>
<Box py={4}> <Box py={4}>
<Image <Image src={'/icon/logo.png'} margin={'auto'} w={'35'} h={'35'} alt=""></Image>
src={'https://docgpt-1301319986.cos.ap-shanghai.myqcloud.com/icon/logo.png'}
margin={'auto'}
w={'35'}
h={'35'}
alt=""
></Image>
</Box> </Box>
{navbarList.map((item) => ( {navbarList.map((item) => (
<Flex <Flex

View File

@@ -38,6 +38,5 @@ export const introPage = `
* 分享链接应为http://docgpt.ahapocket.cn/chat?chatId=6402c9f64cb5d6283f764 * 分享链接应为http://docgpt.ahapocket.cn/chat?chatId=6402c9f64cb5d6283f764
### 其他问题 ### 其他问题
还有其他问题,可以加我 wx拉个交流群大家一起聊聊。 还有其他问题,可以加我 wx: YNyiqi,拉个交流群大家一起聊聊。
![](https://docgpt-1301319986.cos.ap-shanghai.myqcloud.com/icon/erweima.jpg)
`; `;

View File

@@ -1,4 +1,4 @@
import { useState, useRef } from 'react'; import { useCallback, useRef } from 'react';
import { import {
AlertDialog, AlertDialog,
AlertDialogBody, AlertDialogBody,
@@ -17,45 +17,51 @@ export const useConfirm = ({ title = '提示', content }: { title?: string; cont
const cancelCb = useRef<any>(); const cancelCb = useRef<any>();
return { return {
openConfirm: (confirm?: any, cancel?: any) => { openConfirm: useCallback(
onOpen(); (confirm?: any, cancel?: any) => {
confirmCb.current = confirm; onOpen();
cancelCb.current = cancel; confirmCb.current = confirm;
}, cancelCb.current = cancel;
ConfirmChild: () => ( },
<AlertDialog isOpen={isOpen} leastDestructiveRef={cancelRef} onClose={onClose}> [onOpen]
<AlertDialogOverlay> ),
<AlertDialogContent> ConfirmChild: useCallback(
<AlertDialogHeader fontSize="lg" fontWeight="bold"> () => (
{title} <AlertDialog isOpen={isOpen} leastDestructiveRef={cancelRef} onClose={onClose}>
</AlertDialogHeader> <AlertDialogOverlay>
<AlertDialogContent>
<AlertDialogHeader fontSize="lg" fontWeight="bold">
{title}
</AlertDialogHeader>
<AlertDialogBody>{content}</AlertDialogBody> <AlertDialogBody>{content}</AlertDialogBody>
<AlertDialogFooter> <AlertDialogFooter>
<Button <Button
colorScheme={'gray'} colorScheme={'gray'}
onClick={() => { onClick={() => {
onClose(); onClose();
typeof cancelCb.current === 'function' && cancelCb.current(); typeof cancelCb.current === 'function' && cancelCb.current();
}} }}
> >
</Button> </Button>
<Button <Button
colorScheme="blue" colorScheme="blue"
ml={3} ml={4}
onClick={() => { onClick={() => {
onClose(); onClose();
typeof confirmCb.current === 'function' && confirmCb.current(); typeof confirmCb.current === 'function' && confirmCb.current();
}} }}
> >
</Button> </Button>
</AlertDialogFooter> </AlertDialogFooter>
</AlertDialogContent> </AlertDialogContent>
</AlertDialogOverlay> </AlertDialogOverlay>
</AlertDialog> </AlertDialog>
),
[content, isOpen, onClose, title]
) )
}; };
}; };

View File

@@ -1,36 +1,33 @@
import { useState, memo } from 'react'; import { useState, useCallback } from 'react';
import { Spinner, Flex } from '@chakra-ui/react'; import { Spinner, Flex } from '@chakra-ui/react';
export const useLoading = (props?: { defaultLoading: boolean }) => { export const useLoading = (props?: { defaultLoading: boolean }) => {
const [isLoading, setIsLoading] = useState(props?.defaultLoading || false); const [isLoading, setIsLoading] = useState(props?.defaultLoading || false);
const Loading = ({ const Loading = useCallback(
loading, ({ loading, fixed = true }: { loading?: boolean; fixed?: boolean }): JSX.Element | null => {
fixed = true return isLoading || loading ? (
}: { <Flex
loading?: boolean; position={fixed ? 'fixed' : 'absolute'}
fixed?: boolean; zIndex={100}
}): JSX.Element | null => { backgroundColor={'rgba(255,255,255,0.5)'}
return isLoading || loading ? ( top={0}
<Flex left={0}
position={fixed ? 'fixed' : 'absolute'} right={0}
zIndex={100} bottom={0}
backgroundColor={'rgba(255,255,255,0.5)'} alignItems={'center'}
top={0} justifyContent={'center'}
left={0} >
right={0} <Spinner thickness="4px" speed="0.65s" emptyColor="gray.200" color="blue.500" size="xl" />
bottom={0} </Flex>
alignItems={'center'} ) : null;
justifyContent={'center'} },
> [isLoading]
<Spinner thickness="4px" speed="0.65s" emptyColor="gray.200" color="blue.500" size="xl" /> );
</Flex>
) : null;
};
return { return {
isLoading, isLoading,
setIsLoading, setIsLoading,
Loading: memo(Loading) Loading
}; };
}; };

View File

@@ -15,18 +15,18 @@ Router.events.on('routeChangeStart', () => NProgress.start());
Router.events.on('routeChangeComplete', () => NProgress.done()); Router.events.on('routeChangeComplete', () => NProgress.done());
Router.events.on('routeChangeError', () => NProgress.done()); Router.events.on('routeChangeError', () => NProgress.done());
export default function App({ Component, pageProps }: AppProps) { // Create a client
// Create a client const queryClient = new QueryClient({
const queryClient = new QueryClient({ defaultOptions: {
defaultOptions: { queries: {
queries: { refetchOnWindowFocus: false,
refetchOnWindowFocus: false, retry: false,
retry: false, cacheTime: 0
cacheTime: 0
}
} }
}); }
});
export default function App({ Component, pageProps }: AppProps) {
return ( return (
<> <>
<Head> <Head>

View File

@@ -300,12 +300,8 @@ const Chat = () => {
<Flex maxW={'800px'} m={'auto'} alignItems={'flex-start'}> <Flex maxW={'800px'} m={'auto'} alignItems={'flex-start'}>
<Box mr={media(4, 1)}> <Box mr={media(4, 1)}>
<Image <Image
src={ src={item.obj === 'Human' ? '/icon/human.png' : '/icon/logo.png'}
item.obj === 'Human' alt="/icon/logo.png"
? 'https://docgpt-1301319986.cos.ap-shanghai.myqcloud.com/icon/human.png'
: 'https://docgpt-1301319986.cos.ap-shanghai.myqcloud.com/icon/logo.png'
}
alt="https://docgpt-1301319986.cos.ap-shanghai.myqcloud.com/icon/logo.png"
width={30} width={30}
height={30} height={30}
/> />
@@ -394,7 +390,7 @@ const Chat = () => {
{isChatting ? ( {isChatting ? (
<Image <Image
style={{ transform: 'translateY(4px)' }} style={{ transform: 'translateY(4px)' }}
src={'https://docgpt-1301319986.cos.ap-shanghai.myqcloud.com/icon/chatting.svg'} src={'/icon/chatting.svg'}
width={30} width={30}
height={30} height={30}
alt={''} alt={''}

View File

@@ -1,6 +1,5 @@
.loginPage { .loginPage {
background: url('https://docgpt-1301319986.cos.ap-shanghai.myqcloud.com/icon/login-bg.svg') background: url('/icon/login-bg.svg') no-repeat;
no-repeat;
background-size: cover; background-size: cover;
user-select: none; user-select: none;
} }

View File

@@ -53,7 +53,7 @@ const Login = () => {
> >
{isPc && ( {isPc && (
<Image <Image
src={'https://docgpt-1301319986.cos.ap-shanghai.myqcloud.com/icon/loginLeft.svg'} src={'/icon/loginLeft.svg'}
order={pageType === PageTypeEnum.login ? 0 : 2} order={pageType === PageTypeEnum.login ? 0 : 2}
flex={'1 0 0'} flex={'1 0 0'}
w="0" w="0"