Merge remote-tracking branch 'origin/new-page-framework' into llm_framework

This commit is contained in:
aries_ckt 2023-06-29 19:24:11 +08:00
commit e1fbf5a151
15 changed files with 623 additions and 353 deletions

View File

@ -1,36 +1,42 @@
"use client" "use client"
import { useRequest } from 'ahooks'; import { useRequest } from 'ahooks';
import { sendGetRequest } from '@/utils/request'; import { sendGetRequest, sendPostRequest } from '@/utils/request';
import useAgentChat from '@/hooks/useAgentChat'; import useAgentChat from '@/hooks/useAgentChat';
import ChatBoxComp from '@/components/chatBox'; import ChatBoxComp from '@/components/chatBox';
import { useDialogueContext } from '@/app/context/dialogue';
const AgentPage = (props) => { const AgentPage = (props) => {
const { refreshDialogList } = useDialogueContext();
const { data: historyList } = useRequest(async () => await sendGetRequest('/v1/chat/dialogue/messages/history', { const { data: historyList } = useRequest(async () => await sendGetRequest('/v1/chat/dialogue/messages/history', {
con_uid: props.params?.agentId con_uid: props.params?.agentId
}), { }), {
ready: !!props.params?.agentId ready: !!props.params?.agentId
}); });
const { data: paramsList } = useRequest(async () => await sendPostRequest(`/v1/chat/mode/params/list?chat_mode=${props.searchParams?.scene}`), {
ready: !!props.searchParams?.scene
});
const { history, handleChatSubmit } = useAgentChat({ const { history, handleChatSubmit } = useAgentChat({
queryAgentURL: `http://30.183.154.8:5000/v1/chat/completions`, queryAgentURL: `http://30.183.154.8:5000/v1/chat/completions`,
queryBody: { queryBody: {
conv_uid: props.params?.agentId, conv_uid: props.params?.agentId,
chat_mode: 'chat_normal' chat_mode: props.searchParams?.scene || 'chat_normal',
}, },
initHistory: historyList?.data initHistory: historyList?.data
}); });
return ( return (
<div className='mx-auto flex h-full max-w-3xl flex-col gap-6 px-5 pt-6 sm:gap-8 xl:max-w-4xl'> <div className='mx-auto flex h-full max-w-3xl flex-col gap-6 px-5 py-6 sm:gap-8 xl:max-w-5xl '>
<ChatBoxComp <ChatBoxComp
initialMessage={historyList?.data ? (historyList?.data?.length <= 0 ? props.searchParams?.initMessage : undefined) : undefined} initialMessage={historyList?.data ? (historyList?.data?.length <= 0 ? props.searchParams?.initMessage : undefined) : undefined}
clearIntialMessage={() => { clearIntialMessage={async () => {
const searchParams = new URLSearchParams(window.location.search); await refreshDialogList();
searchParams.delete('initMessage');
window.history.replaceState(null, null, `?${searchParams.toString()}`);
}} }}
messages={history || []} messages={history || []}
onSubmit={handleChatSubmit} onSubmit={handleChatSubmit}
paramsList={paramsList?.data}
/> />
</div> </div>
) )

View File

@ -16,7 +16,7 @@ const Item = styled(Sheet)(({ theme }) => ({
const Agents = () => { const Agents = () => {
const { handleChatSubmit, history } = useAgentChat({ const { handleChatSubmit, history } = useAgentChat({
queryAgentURL: `/api/agents/query`, queryAgentURL: `http://30.183.154.8:5000/v1/chat/completions`,
}); });
const data = [ const data = [
@ -203,7 +203,7 @@ const Agents = () => {
</Stack> </Stack>
</Grid> </Grid>
<Grid xs={4}> <Grid xs={4}>
<ChatBoxComp messages={[]} onSubmit={handleChatSubmit}/> <ChatBoxComp messages={history} onSubmit={handleChatSubmit}/>
</Grid> </Grid>
</Grid> </Grid>
</div> </div>

View File

@ -0,0 +1,35 @@
import { useRequest } from 'ahooks';
import { sendGetRequest } from '@/utils/request';
import { createCtx } from '@/utils/ctx-helper';
import { AxiosResponse } from 'axios';
import React from 'react';
export const [useDialogueContext, DialogueProvider] = createCtx<{
dialogueList?: void | AxiosResponse<any, any> | undefined;
queryDialogueList: () => void;
refreshDialogList: () => void;
}>();
export default ({ children }: {
children: React.ReactElement
}) => {
const {
run: queryDialogueList,
data: dialogueList,
refresh: refreshDialogList,
} = useRequest(async () => await sendGetRequest('/v1/chat/dialogue/list'), {
manual: true,
});
return (
<DialogueProvider
value={{
dialogueList,
queryDialogueList,
refreshDialogList
}}
>
{children}
</DialogueProvider>
)
}

View File

@ -12,6 +12,32 @@ body {
background-color: var(--joy-palette-background-body); background-color: var(--joy-palette-background-body);
} }
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #ddd;
text-align: left;
padding: 8px;
}
th {
background-color: #f2f2f2;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
tr:hover {
background-color: #ddd;
}
body .ant-btn-primary {
background-color: #1677ff;
}
.ant-pagination .ant-pagination-prev * { .ant-pagination .ant-pagination-prev * {
color: rgb(145, 35, 167) !important; color: rgb(145, 35, 167) !important;
} }

View File

@ -5,6 +5,8 @@ import LeftSider from '@/components/leftSider';
import { CssVarsProvider, ThemeProvider } from '@mui/joy/styles'; import { CssVarsProvider, ThemeProvider } from '@mui/joy/styles';
import { joyTheme } from './defaultTheme'; import { joyTheme } from './defaultTheme';
import TopProgressBar from '@/components/topProgressBar'; import TopProgressBar from '@/components/topProgressBar';
import DialogueContext from './context/dialogue';
function RootLayout({ function RootLayout({
children, children,
}: { }: {
@ -17,6 +19,7 @@ function RootLayout({
<ThemeProvider theme={joyTheme}> <ThemeProvider theme={joyTheme}>
<CssVarsProvider theme={joyTheme} defaultMode="light"> <CssVarsProvider theme={joyTheme} defaultMode="light">
<TopProgressBar /> <TopProgressBar />
<DialogueContext>
<div className={`contents h-full`}> <div className={`contents h-full`}>
<div className="grid h-full w-screen grid-cols-1 grid-rows-[auto,1fr] overflow-hidden text-smd dark:text-gray-300 md:grid-cols-[280px,1fr] md:grid-rows-[1fr]"> <div className="grid h-full w-screen grid-cols-1 grid-rows-[auto,1fr] overflow-hidden text-smd dark:text-gray-300 md:grid-cols-[280px,1fr] md:grid-rows-[1fr]">
<LeftSider /> <LeftSider />
@ -25,6 +28,7 @@ function RootLayout({
</div> </div>
</div> </div>
</div> </div>
</DialogueContext>
</CssVarsProvider> </CssVarsProvider>
</ThemeProvider> </ThemeProvider>
</body> </body>

View File

@ -1,4 +1,5 @@
"use client"; "use client";
import { useRequest } from 'ahooks';
import { useState } from 'react'; import { useState } from 'react';
import { Button, Input, useColorScheme } from '@/lib/mui'; import { Button, Input, useColorScheme } from '@/lib/mui';
import IconButton from '@mui/joy/IconButton'; import IconButton from '@mui/joy/IconButton';
@ -8,7 +9,6 @@ import { useForm } from 'react-hook-form';
import { z } from 'zod'; import { z } from 'zod';
import { sendPostRequest } from '@/utils/request'; import { sendPostRequest } from '@/utils/request';
import { useRouter } from 'next/navigation'; import { useRouter } from 'next/navigation';
import { useQueryDialog } from '@/hooks/useQueryDialogue';
export default function Home() { export default function Home() {
const Schema = z.object({ query: z.string().min(1) }); const Schema = z.object({ query: z.string().min(1) });
@ -19,7 +19,8 @@ export default function Home() {
resolver: zodResolver(Schema), resolver: zodResolver(Schema),
defaultValues: {}, defaultValues: {},
}); });
const { refreshDialogList } = useQueryDialog(); const { data: scenesList } = useRequest(async () => await sendPostRequest('v1/chat/dialogue/scenes'));
const submit = async ({ query }: z.infer<typeof Schema>) => { const submit = async ({ query }: z.infer<typeof Schema>) => {
try { try {
setIsLoading(true); setIsLoading(true);
@ -50,11 +51,24 @@ export default function Home() {
<div className='lg:my-auto grid gap-8 lg:grid-cols-3'> <div className='lg:my-auto grid gap-8 lg:grid-cols-3'>
<div className='lg:col-span-3 lg:mt-12'> <div className='lg:col-span-3 lg:mt-12'>
<p className='mb-3'>Scenes</p> <p className='mb-3'>Scenes</p>
<div className='grid gap-2 lg:grid-cols-4 lg:gap-5'> <div className='grid gap-2 lg:grid-cols-3 lg:gap-4'>
<Button size="md" variant="soft">LLM native dialogue</Button> {scenesList?.data?.map(scene => (
<Button size="md" variant="soft">Default documents</Button> <Button
<Button size="md" variant="soft">New documents</Button> key={scene['chat_scene']}
<Button size="md" variant="soft">Chat with url</Button> size="md"
variant="soft"
onClick={async () => {
const res = await sendPostRequest('/v1/chat/dialogue/new', {
chat_mode: scene['chat_scene']
});
if (res?.success && res?.data?.conv_uid) {
router.push(`/agents/${res?.data?.conv_uid}?scene=${scene['chat_scene']}`);
}
}}
>
{scene['scene_name']
}</Button>
))}
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,24 +1,21 @@
import { zodResolver } from '@hookform/resolvers/zod'; import { zodResolver } from '@hookform/resolvers/zod';
import SendRoundedIcon from '@mui/icons-material/SendRounded'; import SendRoundedIcon from '@mui/icons-material/SendRounded';
import Button from '@mui/joy/Button'; import { Card, CircularProgress, IconButton, Input, Stack, Select, Option, Tooltip } from '@/lib/mui';
import Card from '@mui/joy/Card';
import CircularProgress from '@mui/joy/CircularProgress';
import IconButton from '@mui/joy/IconButton';
import Input from '@mui/joy/Input';
import Stack from '@mui/joy/Stack';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import { z } from 'zod'; import { z } from 'zod';
import { Message } from '@/types'; import { Message } from '@/types';
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
import Markdown from 'markdown-to-jsx';
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
import { okaidia } from 'react-syntax-highlighter/dist/esm/styles/prism';
type Props = { type Props = {
messages: Message[]; messages: Message[];
onSubmit: (message: string) => Promise<any>; onSubmit: (message: string, otherQueryBody?: any) => Promise<any>;
messageTemplates?: string[];
initialMessage?: string; initialMessage?: string;
readOnly?: boolean; readOnly?: boolean;
paramsList?: { [key: string]: string };
clearIntialMessage?: () => void; clearIntialMessage?: () => void;
}; };
@ -27,15 +24,15 @@ const Schema = z.object({ query: z.string().min(1) });
const ChatBoxComp = ({ const ChatBoxComp = ({
messages, messages,
onSubmit, onSubmit,
messageTemplates,
initialMessage, initialMessage,
readOnly, readOnly,
paramsList,
clearIntialMessage clearIntialMessage
}: Props) => { }: Props) => {
const scrollableRef = React.useRef<HTMLDivElement>(null); const scrollableRef = React.useRef<HTMLDivElement>(null);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [firstMsg, setFirstMsg] = useState<Message>(); const [firstMsg, setFirstMsg] = useState<Message>();
const [hideTemplateMessages, setHideTemplateMessages] = useState(false); const [currentParam, setCurrentParam] = useState<string | undefined | null>();
const methods = useForm<z.infer<typeof Schema>>({ const methods = useForm<z.infer<typeof Schema>>({
resolver: zodResolver(Schema), resolver: zodResolver(Schema),
@ -45,9 +42,10 @@ const ChatBoxComp = ({
const submit = async ({ query }: z.infer<typeof Schema>) => { const submit = async ({ query }: z.infer<typeof Schema>) => {
try { try {
setIsLoading(true); setIsLoading(true);
setHideTemplateMessages(true);
methods.reset(); methods.reset();
await onSubmit(query); await onSubmit(query, {
select_param: paramsList?.[currentParam]
});
} catch (err) { } catch (err) {
} finally { } finally {
setIsLoading(false); setIsLoading(false);
@ -55,9 +53,27 @@ const ChatBoxComp = ({
}; };
const handleInitMessage = async () => { const handleInitMessage = async () => {
try {
const searchParams = new URLSearchParams(window.location.search);
searchParams.delete('initMessage');
window.history.replaceState(null, null, `?${searchParams.toString()}`);
await submit({ query: (initialMessage as string) }); await submit({ query: (initialMessage as string) });
} catch (err) {
console.log(err);
} finally {
clearIntialMessage?.(); clearIntialMessage?.();
} }
}
const options = {
overrides: {
code: ({ children }) => (
<SyntaxHighlighter language="javascript" style={okaidia}>
{children}
</SyntaxHighlighter>
),
},
};
React.useEffect(() => { React.useEffect(() => {
if (!scrollableRef.current) { if (!scrollableRef.current) {
@ -73,6 +89,12 @@ const ChatBoxComp = ({
} }
}, [initialMessage]); }, [initialMessage]);
React.useEffect(() => {
if (paramsList && Object.keys(paramsList || {})?.length > 0) {
setCurrentParam(Object.keys(paramsList || {})?.[0]);
}
}, [paramsList]);
return ( return (
<Stack <Stack
direction={'column'} direction={'column'}
@ -121,11 +143,11 @@ const ChatBoxComp = ({
</Card> </Card>
)} )}
{messages.filter(item => ['ai', 'human'].includes(item.role)).map((each, index) => ( {messages.filter(item => ['view', 'human'].includes(item.role)).map((each, index) => (
<Stack <Stack
key={index} key={index}
sx={{ sx={{
mr: each.role === 'ai' ? 'auto' : 'none', mr: each.role === 'view' ? 'auto' : 'none',
ml: each.role === 'human' ? 'auto' : 'none', ml: each.role === 'human' ? 'auto' : 'none',
}} }}
> >
@ -133,9 +155,9 @@ const ChatBoxComp = ({
size="sm" size="sm"
variant={'outlined'} variant={'outlined'}
className={ className={
each.role === 'ai' ? 'message-agent' : 'message-human' each.role === 'view' ? 'message-agent' : 'message-human'
} }
color={each.role === 'ai' ? 'primary' : 'neutral'} color={each.role === 'view' ? 'primary' : 'neutral'}
sx={(theme) => ({ sx={(theme) => ({
px: 2, px: 2,
'ol, ul': { 'ol, ul': {
@ -157,9 +179,9 @@ const ChatBoxComp = ({
}, },
})} })}
> >
<ReactMarkdown remarkPlugins={[remarkGfm]} linkTarget={'_blank'}> <Markdown options={options}>
{each.context} {each.context?.replaceAll('\\n', '\n')}
</ReactMarkdown> </Markdown>
</Card> </Card>
</Stack> </Stack>
))} ))}
@ -186,37 +208,41 @@ const ChatBoxComp = ({
justifyContent: 'center', justifyContent: 'center',
marginLeft: 'auto', marginLeft: 'auto',
marginRight: 'auto', marginRight: 'auto',
flexDirection: 'column',
gap: '12px'
}} }}
onSubmit={(e) => { onSubmit={(e) => {
e.stopPropagation(); e.stopPropagation();
methods.handleSubmit(submit)(e); methods.handleSubmit(submit)(e);
}} }}
> >
{!hideTemplateMessages && (messageTemplates?.length || 0) > 0 && ( {(Object.keys(paramsList || {}).length > 0) && (
<Stack <div className='flex items-center gap-3'>
direction="row" <Select
gap={1} value={currentParam}
sx={{ onChange={(e, newValue) => {
position: 'absolute', setCurrentParam(newValue);
zIndex: 1,
transform: 'translateY(-100%)',
flexWrap: 'wrap',
mt: -1,
left: '0',
}} }}
className='max-w-xs'
> >
{messageTemplates?.map((each, idx) => ( {Object.keys(paramsList || {}).map(paramItem => (
<Button <Option
key={idx} key={paramItem}
size="sm" value={paramItem}
variant="soft"
onClick={() => submit({ query: each })}
> >
{each} {paramsList?.[paramItem]}
</Button> </Option>
))} ))}
</Stack> </Select>
<Tooltip
className="cursor-pointer"
title={currentParam}
placement="top"
variant="outlined"
>
<InfoOutlinedIcon />
</Tooltip>
</div>
)} )}
<Input <Input

View File

@ -1,20 +1,23 @@
"use client"; "use client";
import React, { useEffect, useMemo, useState } from 'react'; import React, { useEffect, useMemo } from 'react';
import { usePathname, useSearchParams } from 'next/navigation'; import { usePathname, useRouter } from 'next/navigation';
import Link from 'next/link'; import Link from 'next/link';
import Image from 'next/image'; import { Popconfirm } from 'antd';
import { Box, List, ListItem, ListItemButton, ListItemDecorator, ListItemContent, Typography, Button, useColorScheme } from '@/lib/mui'; import { Box, List, ListItem, ListItemButton, ListItemDecorator, ListItemContent, Typography, Button, useColorScheme, IconButton } from '@/lib/mui';
import Article from '@mui/icons-material/Article'; import Article from '@mui/icons-material/Article';
import DarkModeIcon from '@mui/icons-material/DarkMode'; import DarkModeIcon from '@mui/icons-material/DarkMode';
import WbSunnyIcon from '@mui/icons-material/WbSunny'; import WbSunnyIcon from '@mui/icons-material/WbSunny';
import MenuIcon from '@mui/icons-material/Menu'; import MenuIcon from '@mui/icons-material/Menu';
import AddIcon from '@mui/icons-material/Add'; import AddIcon from '@mui/icons-material/Add';
import { useQueryDialog } from '@/hooks/useQueryDialogue'; import { useDialogueContext } from '@/app/context/dialogue';
import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
import { sendPostRequest } from '@/utils/request';
const LeftSider = () => { const LeftSider = () => {
const pathname = usePathname(); const pathname = usePathname();
const router = useRouter();
const { dialogueList, queryDialogueList, refreshDialogList } = useDialogueContext();
const { mode, setMode } = useColorScheme(); const { mode, setMode } = useColorScheme();
const { dialogueList } = useQueryDialog();
const menus = useMemo(() => { const menus = useMemo(() => {
return [{ return [{
@ -33,6 +36,12 @@ const LeftSider = () => {
} }
}; };
useEffect(() => {
(async () => {
await queryDialogueList();
})();
}, []);
return ( return (
<> <>
<nav className='flex h-12 items-center justify-between border-b bg-gray-50 px-4 dark:border-gray-800 dark:bg-gray-800/70 md:hidden'> <nav className='flex h-12 items-center justify-between border-b bg-gray-50 px-4 dark:border-gray-800 dark:bg-gray-800/70 md:hidden'>
@ -80,7 +89,7 @@ const LeftSider = () => {
}} }}
> >
<Link href={`/`}> <Link href={`/`}>
<Button variant="outlined" color="primary" className='w-full'>+ </Button> <Button variant="outlined" color="primary" className='w-full'>+ New Chat</Button>
</Link> </Link>
</Box> </Box>
<Box <Box
@ -112,13 +121,30 @@ const LeftSider = () => {
variant={isSelect ? 'soft' : 'plain'} variant={isSelect ? 'soft' : 'plain'}
> >
<ListItemContent> <ListItemContent>
<Link href={`/agents/${each.conv_uid}`}> <Link href={`/agents/${each.conv_uid}?scene=${each?.chat_mode}`}>
<Typography fontSize={14} noWrap={true}> <Typography fontSize={14} noWrap={true}>
{each?.user_name || each?.user_input || 'undefined'} {each?.user_name || each?.user_input || 'undefined'}
</Typography> </Typography>
</Link> </Link>
</ListItemContent> </ListItemContent>
</ListItemButton> </ListItemButton>
<Popconfirm
title="删除对话"
description="确认要删除该对话吗"
onConfirm={async() => {
await sendPostRequest(`v1/chat/dialogue/delete?con_uid=${each.conv_uid}`);
await refreshDialogList();
if (pathname === `/agents/${each.conv_uid}`) {
router.push('/');
}
}}
okText="Yes"
cancelText="No"
>
<IconButton color="neutral" variant="plain">
<DeleteOutlineOutlinedIcon />
</IconButton>
</Popconfirm>
</ListItem> </ListItem>
) )
})} })}

View File

@ -5,12 +5,13 @@ import {
import useStateReducer from './useStateReducer'; import useStateReducer from './useStateReducer';
import { Message } from '@/types'; import { Message } from '@/types';
import { useEffect } from 'react'; import { useEffect } from 'react';
import { useDialogueContext } from '@/app/context/dialogue';
type Props = { type Props = {
queryAgentURL: string; queryAgentURL: string;
channel?: "dashboard" | "website" | "slack" | "crisp"; channel?: "dashboard" | "website" | "slack" | "crisp";
queryBody?: any; queryBody?: any;
initHistory: Message[]; initHistory?: Message[];
}; };
const useAgentChat = ({ const useAgentChat = ({
@ -20,14 +21,16 @@ import { useEffect } from 'react';
initHistory initHistory
}: Props) => { }: Props) => {
const [state, setState] = useStateReducer({ const [state, setState] = useStateReducer({
history: (initHistory || []) as { role: 'human' | 'ai'; context: string; id?: string }[], history: (initHistory || []) as { role: 'human' | 'view'; context: string; id?: string }[],
}); });
const { refreshDialogList } = useDialogueContext();
useEffect(() => { useEffect(() => {
if (initHistory) setState({ history: initHistory }); if (initHistory) setState({ history: initHistory });
}, [initHistory]); }, [initHistory]);
const handleChatSubmit = async (context: string) => { const handleChatSubmit = async (context: string, otherQueryBody?: any) => {
if (!context) { if (!context) {
return; return;
} }
@ -52,6 +55,7 @@ import { useEffect } from 'react';
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
body: JSON.stringify({ body: JSON.stringify({
...otherQueryBody,
...queryBody, ...queryBody,
user_input: context, user_input: context,
channel, channel,
@ -59,6 +63,12 @@ import { useEffect } from 'react';
signal: ctrl.signal, signal: ctrl.signal,
async onopen(response) { async onopen(response) {
if (history.length <= 1) {
refreshDialogList();
const searchParams = new URLSearchParams(window.location.search);
searchParams.delete('initMessage');
window.history.replaceState(null, null, `?${searchParams.toString()}`);
}
if ( if (
response.ok && response.ok &&
response.headers.get('content-type') === EventStreamContentType response.headers.get('content-type') === EventStreamContentType
@ -81,14 +91,14 @@ import { useEffect } from 'react';
onclose() { onclose() {
// if the server closes the connection unexpectedly, retry: // if the server closes the connection unexpectedly, retry:
console.log('onclose'); console.log('onclose');
//throw new RetriableError();
}, },
onerror(err) { onerror(err) {
throw new Error(err); throw new Error(err);
}, },
onmessage: (event) => { onmessage: (event) => {
console.log(event, 'e');
event.data = event.data.replaceAll('\\n', '\n'); event.data = event.data.replaceAll('\\n', '\n');
console.log(event, 'event');
if (event.data === '[DONE]') { if (event.data === '[DONE]') {
ctrl.abort(); ctrl.abort();
} else if (event.data?.startsWith('[ERROR]')) { } else if (event.data?.startsWith('[ERROR]')) {
@ -97,7 +107,7 @@ import { useEffect } from 'react';
history: [ history: [
...history, ...history,
{ {
role: 'ai', role: 'view',
context: event.data.replace('[ERROR]', ''), context: event.data.replace('[ERROR]', ''),
} as any, } as any,
], ],
@ -108,7 +118,7 @@ import { useEffect } from 'react';
if (h?.[nextIndex]) { if (h?.[nextIndex]) {
h[nextIndex].context = `${event.data}`; h[nextIndex].context = `${event.data}`;
} else { } else {
h.push({ role: 'ai', context: event.data }); h.push({ role: 'view', context: event.data });
} }
setState({ setState({
history: h as any, history: h as any,
@ -119,10 +129,12 @@ import { useEffect } from 'react';
}, },
}); });
} catch (err) { } catch (err) {
console.log('---e', err);
setState({ setState({
history: [ history: [
...history, ...history,
{ role: 'ai', context: answer || '请求出错' as string }, { role: 'view', context: answer || '请求出错' as string },
] as any, ] as any,
}); });
// if (err instanceof ApiError) { // if (err instanceof ApiError) {

View File

@ -1,20 +0,0 @@
import { useRequest } from 'ahooks';
import { sendGetRequest } from '@/utils/request';
export function useQueryDialog() {
const {
run: queryDialogueList,
data: dialogueList,
loading: loadingDialogList,
refresh: refreshDialogList,
} = useRequest(async () => await sendGetRequest('/v1/chat/dialogue/list'), {
manual: false,
});
return {
queryDialogueList,
dialogueList,
loadingDialogList,
refreshDialogList
};
}

View File

@ -33,6 +33,7 @@
"eslint": "8.43.0", "eslint": "8.43.0",
"eslint-config-next": "13.4.7", "eslint-config-next": "13.4.7",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"markdown-to-jsx": "^7.2.1",
"moment": "^2.29.4", "moment": "^2.29.4",
"next": "13.4.7", "next": "13.4.7",
"next-auth": "^4.20.1", "next-auth": "^4.20.1",
@ -41,7 +42,7 @@
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-hook-form": "^7.43.8", "react-hook-form": "^7.43.8",
"react-markdown": "^8.0.7", "react-syntax-highlighter": "^15.5.0",
"remark-gfm": "^3.0.1", "remark-gfm": "^3.0.1",
"styled-components": "^5.3.11", "styled-components": "^5.3.11",
"swr": "^2.1.1", "swr": "^2.1.1",
@ -51,7 +52,8 @@
}, },
"devDependencies": { "devDependencies": {
"@types/lodash": "^4.14.195", "@types/lodash": "^4.14.195",
"@types/nprogress": "^0.2.0" "@types/nprogress": "^0.2.0",
"@types/react-syntax-highlighter": "^15.5.7"
} }
}, },
"node_modules/@alloc/quick-lru": { "node_modules/@alloc/quick-lru": {
@ -2323,6 +2325,15 @@
"@types/react": "*" "@types/react": "*"
} }
}, },
"node_modules/@types/react-syntax-highlighter": {
"version": "15.5.7",
"resolved": "https://registry.npmmirror.com/@types/react-syntax-highlighter/-/react-syntax-highlighter-15.5.7.tgz",
"integrity": "sha512-bo5fEO5toQeyCp0zVHBeggclqf5SQ/Z5blfFmjwO5dkMVGPgmiwZsJh9nu/Bo5L7IHTuGWrja6LxJVE2uB5ZrQ==",
"dev": true,
"dependencies": {
"@types/react": "*"
}
},
"node_modules/@types/react-transition-group": { "node_modules/@types/react-transition-group": {
"version": "4.4.6", "version": "4.4.6",
"resolved": "https://registry.npmmirror.com/@types/react-transition-group/-/react-transition-group-4.4.6.tgz", "resolved": "https://registry.npmmirror.com/@types/react-transition-group/-/react-transition-group-4.4.6.tgz",
@ -3101,6 +3112,16 @@
"resolved": "https://registry.npmmirror.com/character-entities/-/character-entities-2.0.2.tgz", "resolved": "https://registry.npmmirror.com/character-entities/-/character-entities-2.0.2.tgz",
"integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==" "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ=="
}, },
"node_modules/character-entities-legacy": {
"version": "1.1.4",
"resolved": "https://registry.npmmirror.com/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz",
"integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA=="
},
"node_modules/character-reference-invalid": {
"version": "1.1.4",
"resolved": "https://registry.npmmirror.com/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz",
"integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg=="
},
"node_modules/chokidar": { "node_modules/chokidar": {
"version": "3.5.3", "version": "3.5.3",
"resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.5.3.tgz", "resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.5.3.tgz",
@ -3187,11 +3208,6 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/comma-separated-tokens": {
"version": "2.0.3",
"resolved": "https://registry.npmmirror.com/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",
"integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg=="
},
"node_modules/commander": { "node_modules/commander": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmmirror.com/commander/-/commander-4.1.1.tgz", "resolved": "https://registry.npmmirror.com/commander/-/commander-4.1.1.tgz",
@ -4151,6 +4167,14 @@
"reusify": "^1.0.4" "reusify": "^1.0.4"
} }
}, },
"node_modules/fault": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/fault/-/fault-1.0.4.tgz",
"integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==",
"dependencies": {
"format": "^0.2.0"
}
},
"node_modules/fecha": { "node_modules/fecha": {
"version": "4.2.3", "version": "4.2.3",
"resolved": "https://registry.npmmirror.com/fecha/-/fecha-4.2.3.tgz", "resolved": "https://registry.npmmirror.com/fecha/-/fecha-4.2.3.tgz",
@ -4258,6 +4282,14 @@
"node": ">= 6" "node": ">= 6"
} }
}, },
"node_modules/format": {
"version": "0.2.2",
"resolved": "https://registry.npmmirror.com/format/-/format-0.2.2.tgz",
"integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==",
"engines": {
"node": ">=0.4.x"
}
},
"node_modules/fraction.js": { "node_modules/fraction.js": {
"version": "4.2.0", "version": "4.2.0",
"resolved": "https://registry.npmmirror.com/fraction.js/-/fraction.js-4.2.0.tgz", "resolved": "https://registry.npmmirror.com/fraction.js/-/fraction.js-4.2.0.tgz",
@ -4527,10 +4559,48 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/hast-util-whitespace": { "node_modules/hast-util-parse-selector": {
"version": "2.0.1", "version": "2.2.5",
"resolved": "https://registry.npmmirror.com/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz", "resolved": "https://registry.npmmirror.com/hast-util-parse-selector/-/hast-util-parse-selector-2.2.5.tgz",
"integrity": "sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==" "integrity": "sha512-7j6mrk/qqkSehsM92wQjdIgWM2/BW61u/53G6xmC8i1OmEdKLHbk419QKQUjz6LglWsfqoiHmyMRkP1BGjecNQ=="
},
"node_modules/hastscript": {
"version": "6.0.0",
"resolved": "https://registry.npmmirror.com/hastscript/-/hastscript-6.0.0.tgz",
"integrity": "sha512-nDM6bvd7lIqDUiYEiu5Sl/+6ReP0BMk/2f4U/Rooccxkj0P5nm+acM5PrGJ/t5I8qPGiqZSE6hVAwZEdZIvP4w==",
"dependencies": {
"@types/hast": "^2.0.0",
"comma-separated-tokens": "^1.0.0",
"hast-util-parse-selector": "^2.0.0",
"property-information": "^5.0.0",
"space-separated-tokens": "^1.0.0"
}
},
"node_modules/hastscript/node_modules/comma-separated-tokens": {
"version": "1.0.8",
"resolved": "https://registry.npmmirror.com/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz",
"integrity": "sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw=="
},
"node_modules/hastscript/node_modules/property-information": {
"version": "5.6.0",
"resolved": "https://registry.npmmirror.com/property-information/-/property-information-5.6.0.tgz",
"integrity": "sha512-YUHSPk+A30YPv+0Qf8i9Mbfe/C0hdPXk1s1jPVToV8pk8BQtpw10ct89Eo7OWkutrwqvT0eicAxlOg3dOAu8JA==",
"dependencies": {
"xtend": "^4.0.0"
}
},
"node_modules/hastscript/node_modules/space-separated-tokens": {
"version": "1.1.5",
"resolved": "https://registry.npmmirror.com/space-separated-tokens/-/space-separated-tokens-1.1.5.tgz",
"integrity": "sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA=="
},
"node_modules/highlight.js": {
"version": "10.7.3",
"resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-10.7.3.tgz",
"integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==",
"engines": {
"node": "*"
}
}, },
"node_modules/hoist-non-react-statics": { "node_modules/hoist-non-react-statics": {
"version": "3.3.2", "version": "3.3.2",
@ -4590,11 +4660,6 @@
"resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz", "resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
}, },
"node_modules/inline-style-parser": {
"version": "0.1.1",
"resolved": "https://registry.npmmirror.com/inline-style-parser/-/inline-style-parser-0.1.1.tgz",
"integrity": "sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q=="
},
"node_modules/internal-slot": { "node_modules/internal-slot": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmmirror.com/internal-slot/-/internal-slot-1.0.5.tgz", "resolved": "https://registry.npmmirror.com/internal-slot/-/internal-slot-1.0.5.tgz",
@ -4613,6 +4678,20 @@
"resolved": "https://registry.npmmirror.com/intersection-observer/-/intersection-observer-0.12.2.tgz", "resolved": "https://registry.npmmirror.com/intersection-observer/-/intersection-observer-0.12.2.tgz",
"integrity": "sha512-7m1vEcPCxXYI8HqnL8CKI6siDyD+eIWSwgB3DZA+ZTogxk9I4CDnj4wilt9x/+/QbHI4YG5YZNmC6458/e9Ktg==" "integrity": "sha512-7m1vEcPCxXYI8HqnL8CKI6siDyD+eIWSwgB3DZA+ZTogxk9I4CDnj4wilt9x/+/QbHI4YG5YZNmC6458/e9Ktg=="
}, },
"node_modules/is-alphabetical": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/is-alphabetical/-/is-alphabetical-1.0.4.tgz",
"integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg=="
},
"node_modules/is-alphanumerical": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz",
"integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==",
"dependencies": {
"is-alphabetical": "^1.0.0",
"is-decimal": "^1.0.0"
}
},
"node_modules/is-arguments": { "node_modules/is-arguments": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmmirror.com/is-arguments/-/is-arguments-1.1.1.tgz", "resolved": "https://registry.npmmirror.com/is-arguments/-/is-arguments-1.1.1.tgz",
@ -4703,6 +4782,11 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/is-decimal": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/is-decimal/-/is-decimal-1.0.4.tgz",
"integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw=="
},
"node_modules/is-docker": { "node_modules/is-docker": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmmirror.com/is-docker/-/is-docker-3.0.0.tgz", "resolved": "https://registry.npmmirror.com/is-docker/-/is-docker-3.0.0.tgz",
@ -4733,6 +4817,11 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/is-hexadecimal": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz",
"integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw=="
},
"node_modules/is-inside-container": { "node_modules/is-inside-container": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmmirror.com/is-inside-container/-/is-inside-container-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/is-inside-container/-/is-inside-container-1.0.0.tgz",
@ -5112,6 +5201,15 @@
"loose-envify": "cli.js" "loose-envify": "cli.js"
} }
}, },
"node_modules/lowlight": {
"version": "1.20.0",
"resolved": "https://registry.npmmirror.com/lowlight/-/lowlight-1.20.0.tgz",
"integrity": "sha512-8Ktj+prEb1RoCPkEOrPMYUN/nCggB7qAWe3a7OpMjWQkh3l2RD5wKRQ+o8Q8YuI9RG/xs95waaI/E6ym/7NsTw==",
"dependencies": {
"fault": "^1.0.0",
"highlight.js": "~10.7.0"
}
},
"node_modules/lru-cache": { "node_modules/lru-cache": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-6.0.0.tgz", "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-6.0.0.tgz",
@ -5128,14 +5226,15 @@
"resolved": "https://registry.npmmirror.com/markdown-table/-/markdown-table-3.0.3.tgz", "resolved": "https://registry.npmmirror.com/markdown-table/-/markdown-table-3.0.3.tgz",
"integrity": "sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==" "integrity": "sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw=="
}, },
"node_modules/mdast-util-definitions": { "node_modules/markdown-to-jsx": {
"version": "5.1.2", "version": "7.2.1",
"resolved": "https://registry.npmmirror.com/mdast-util-definitions/-/mdast-util-definitions-5.1.2.tgz", "resolved": "https://registry.npmmirror.com/markdown-to-jsx/-/markdown-to-jsx-7.2.1.tgz",
"integrity": "sha512-8SVPMuHqlPME/z3gqVwWY4zVXn8lqKv/pAhC57FuJ40ImXyBpmO5ukh98zB2v7Blql2FiHjHv9LVztSIqjY+MA==", "integrity": "sha512-9HrdzBAo0+sFz9ZYAGT5fB8ilzTW+q6lPocRxrIesMO+aB40V9MgFfbfMXxlGjf22OpRy+IXlvVaQenicdpgbg==",
"dependencies": { "engines": {
"@types/mdast": "^3.0.0", "node": ">= 10"
"@types/unist": "^2.0.0", },
"unist-util-visit": "^4.0.0" "peerDependencies": {
"react": ">= 0.14.0"
} }
}, },
"node_modules/mdast-util-find-and-replace": { "node_modules/mdast-util-find-and-replace": {
@ -5249,21 +5348,6 @@
"unist-util-is": "^5.0.0" "unist-util-is": "^5.0.0"
} }
}, },
"node_modules/mdast-util-to-hast": {
"version": "12.3.0",
"resolved": "https://registry.npmmirror.com/mdast-util-to-hast/-/mdast-util-to-hast-12.3.0.tgz",
"integrity": "sha512-pits93r8PhnIoU4Vy9bjW39M2jJ6/tdHyja9rrot9uujkN7UTU9SDnE6WNJz/IGyQk3XHX6yNNtrBH6cQzm8Hw==",
"dependencies": {
"@types/hast": "^2.0.0",
"@types/mdast": "^3.0.0",
"mdast-util-definitions": "^5.0.0",
"micromark-util-sanitize-uri": "^1.1.0",
"trim-lines": "^3.0.0",
"unist-util-generated": "^2.0.0",
"unist-util-position": "^4.0.0",
"unist-util-visit": "^4.0.0"
}
},
"node_modules/mdast-util-to-markdown": { "node_modules/mdast-util-to-markdown": {
"version": "1.5.0", "version": "1.5.0",
"resolved": "https://registry.npmmirror.com/mdast-util-to-markdown/-/mdast-util-to-markdown-1.5.0.tgz", "resolved": "https://registry.npmmirror.com/mdast-util-to-markdown/-/mdast-util-to-markdown-1.5.0.tgz",
@ -6061,6 +6145,24 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/parse-entities": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/parse-entities/-/parse-entities-2.0.0.tgz",
"integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==",
"dependencies": {
"character-entities": "^1.0.0",
"character-entities-legacy": "^1.0.0",
"character-reference-invalid": "^1.0.0",
"is-alphanumerical": "^1.0.0",
"is-decimal": "^1.0.0",
"is-hexadecimal": "^1.0.0"
}
},
"node_modules/parse-entities/node_modules/character-entities": {
"version": "1.2.4",
"resolved": "https://registry.npmmirror.com/character-entities/-/character-entities-1.2.4.tgz",
"integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw=="
},
"node_modules/parse-json": { "node_modules/parse-json": {
"version": "5.2.0", "version": "5.2.0",
"resolved": "https://registry.npmmirror.com/parse-json/-/parse-json-5.2.0.tgz", "resolved": "https://registry.npmmirror.com/parse-json/-/parse-json-5.2.0.tgz",
@ -6278,6 +6380,14 @@
"resolved": "https://registry.npmmirror.com/pretty-format/-/pretty-format-3.8.0.tgz", "resolved": "https://registry.npmmirror.com/pretty-format/-/pretty-format-3.8.0.tgz",
"integrity": "sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew==" "integrity": "sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew=="
}, },
"node_modules/prismjs": {
"version": "1.29.0",
"resolved": "https://registry.npmmirror.com/prismjs/-/prismjs-1.29.0.tgz",
"integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==",
"engines": {
"node": ">=6"
}
},
"node_modules/prop-types": { "node_modules/prop-types": {
"version": "15.8.1", "version": "15.8.1",
"resolved": "https://registry.npmmirror.com/prop-types/-/prop-types-15.8.1.tgz", "resolved": "https://registry.npmmirror.com/prop-types/-/prop-types-15.8.1.tgz",
@ -6288,11 +6398,6 @@
"react-is": "^16.13.1" "react-is": "^16.13.1"
} }
}, },
"node_modules/property-information": {
"version": "6.2.0",
"resolved": "https://registry.npmmirror.com/property-information/-/property-information-6.2.0.tgz",
"integrity": "sha512-kma4U7AFCTwpqq5twzC1YVIDXSqg6qQK6JN0smOw8fgRy1OkMi0CYSzFmsy6dnqSenamAtj0CyXMUJ1Mf6oROg=="
},
"node_modules/proxy-from-env": { "node_modules/proxy-from-env": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
@ -6962,37 +7067,21 @@
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
"integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
}, },
"node_modules/react-markdown": { "node_modules/react-syntax-highlighter": {
"version": "8.0.7", "version": "15.5.0",
"resolved": "https://registry.npmmirror.com/react-markdown/-/react-markdown-8.0.7.tgz", "resolved": "https://registry.npmmirror.com/react-syntax-highlighter/-/react-syntax-highlighter-15.5.0.tgz",
"integrity": "sha512-bvWbzG4MtOU62XqBx3Xx+zB2raaFFsq4mYiAzfjXJMEz2sixgeAfraA3tvzULF02ZdOMUOKTBFFaZJDDrq+BJQ==", "integrity": "sha512-+zq2myprEnQmH5yw6Gqc8lD55QHnpKaU8TOcFeC/Lg/MQSs8UknEA0JC4nTZGFAXC2J2Hyj/ijJ7NlabyPi2gg==",
"dependencies": { "dependencies": {
"@types/hast": "^2.0.0", "@babel/runtime": "^7.3.1",
"@types/prop-types": "^15.0.0", "highlight.js": "^10.4.1",
"@types/unist": "^2.0.0", "lowlight": "^1.17.0",
"comma-separated-tokens": "^2.0.0", "prismjs": "^1.27.0",
"hast-util-whitespace": "^2.0.0", "refractor": "^3.6.0"
"prop-types": "^15.0.0",
"property-information": "^6.0.0",
"react-is": "^18.0.0",
"remark-parse": "^10.0.0",
"remark-rehype": "^10.0.0",
"space-separated-tokens": "^2.0.0",
"style-to-object": "^0.4.0",
"unified": "^10.0.0",
"unist-util-visit": "^4.0.0",
"vfile": "^5.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@types/react": ">=16", "react": ">= 0.14.0"
"react": ">=16"
} }
}, },
"node_modules/react-markdown/node_modules/react-is": {
"version": "18.2.0",
"resolved": "https://registry.npmmirror.com/react-is/-/react-is-18.2.0.tgz",
"integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
},
"node_modules/react-transition-group": { "node_modules/react-transition-group": {
"version": "4.4.5", "version": "4.4.5",
"resolved": "https://registry.npmmirror.com/react-transition-group/-/react-transition-group-4.4.5.tgz", "resolved": "https://registry.npmmirror.com/react-transition-group/-/react-transition-group-4.4.5.tgz",
@ -7035,6 +7124,24 @@
"node": ">=8.10.0" "node": ">=8.10.0"
} }
}, },
"node_modules/refractor": {
"version": "3.6.0",
"resolved": "https://registry.npmmirror.com/refractor/-/refractor-3.6.0.tgz",
"integrity": "sha512-MY9W41IOWxxk31o+YvFCNyNzdkc9M20NoZK5vq6jkv4I/uh2zkWcfudj0Q1fovjUQJrNewS9NMzeTtqPf+n5EA==",
"dependencies": {
"hastscript": "^6.0.0",
"parse-entities": "^2.0.0",
"prismjs": "~1.27.0"
}
},
"node_modules/refractor/node_modules/prismjs": {
"version": "1.27.0",
"resolved": "https://registry.npmmirror.com/prismjs/-/prismjs-1.27.0.tgz",
"integrity": "sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA==",
"engines": {
"node": ">=6"
}
},
"node_modules/regenerator-runtime": { "node_modules/regenerator-runtime": {
"version": "0.13.11", "version": "0.13.11",
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
@ -7064,27 +7171,6 @@
"unified": "^10.0.0" "unified": "^10.0.0"
} }
}, },
"node_modules/remark-parse": {
"version": "10.0.2",
"resolved": "https://registry.npmmirror.com/remark-parse/-/remark-parse-10.0.2.tgz",
"integrity": "sha512-3ydxgHa/ZQzG8LvC7jTXccARYDcRld3VfcgIIFs7bI6vbRSxJJmzgLEIIoYKyrfhaY+ujuWaf/PJiMZXoiCXgw==",
"dependencies": {
"@types/mdast": "^3.0.0",
"mdast-util-from-markdown": "^1.0.0",
"unified": "^10.0.0"
}
},
"node_modules/remark-rehype": {
"version": "10.1.0",
"resolved": "https://registry.npmmirror.com/remark-rehype/-/remark-rehype-10.1.0.tgz",
"integrity": "sha512-EFmR5zppdBp0WQeDVZ/b66CWJipB2q2VLNFMabzDSGR66Z2fQii83G5gTBbgGEnEEA0QRussvrFHxk1HWGJskw==",
"dependencies": {
"@types/hast": "^2.0.0",
"@types/mdast": "^3.0.0",
"mdast-util-to-hast": "^12.1.0",
"unified": "^10.0.0"
}
},
"node_modules/repeat-string": { "node_modules/repeat-string": {
"version": "1.6.1", "version": "1.6.1",
"resolved": "https://registry.npmmirror.com/repeat-string/-/repeat-string-1.6.1.tgz", "resolved": "https://registry.npmmirror.com/repeat-string/-/repeat-string-1.6.1.tgz",
@ -7477,11 +7563,6 @@
"node": ">=0.8.0" "node": ">=0.8.0"
} }
}, },
"node_modules/space-separated-tokens": {
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz",
"integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q=="
},
"node_modules/streamsearch": { "node_modules/streamsearch": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmmirror.com/streamsearch/-/streamsearch-1.1.0.tgz", "resolved": "https://registry.npmmirror.com/streamsearch/-/streamsearch-1.1.0.tgz",
@ -7578,14 +7659,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/style-to-object": {
"version": "0.4.1",
"resolved": "https://registry.npmmirror.com/style-to-object/-/style-to-object-0.4.1.tgz",
"integrity": "sha512-HFpbb5gr2ypci7Qw+IOhnP2zOU7e77b+rzM+wTzXzfi1PrtBCX0E7Pk4wL4iTLnhzZ+JgEGAhX81ebTg/aYjQw==",
"dependencies": {
"inline-style-parser": "0.1.1"
}
},
"node_modules/styled-components": { "node_modules/styled-components": {
"version": "5.3.11", "version": "5.3.11",
"resolved": "https://registry.npmjs.org/styled-components/-/styled-components-5.3.11.tgz", "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-5.3.11.tgz",
@ -7908,11 +7981,6 @@
"resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz", "resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz",
"integrity": "sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==" "integrity": "sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ=="
}, },
"node_modules/trim-lines": {
"version": "3.0.1",
"resolved": "https://registry.npmmirror.com/trim-lines/-/trim-lines-3.0.1.tgz",
"integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg=="
},
"node_modules/trough": { "node_modules/trough": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmmirror.com/trough/-/trough-2.1.0.tgz", "resolved": "https://registry.npmmirror.com/trough/-/trough-2.1.0.tgz",
@ -8056,11 +8124,6 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/unist-util-generated": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/unist-util-generated/-/unist-util-generated-2.0.1.tgz",
"integrity": "sha512-qF72kLmPxAw0oN2fwpWIqbXAVyEqUzDHMsbtPvOudIlUzXYFIeQIuxXQCRCFh22B7cixvU0MG7m3MW8FTq/S+A=="
},
"node_modules/unist-util-is": { "node_modules/unist-util-is": {
"version": "5.2.1", "version": "5.2.1",
"resolved": "https://registry.npmmirror.com/unist-util-is/-/unist-util-is-5.2.1.tgz", "resolved": "https://registry.npmmirror.com/unist-util-is/-/unist-util-is-5.2.1.tgz",
@ -8069,14 +8132,6 @@
"@types/unist": "^2.0.0" "@types/unist": "^2.0.0"
} }
}, },
"node_modules/unist-util-position": {
"version": "4.0.4",
"resolved": "https://registry.npmmirror.com/unist-util-position/-/unist-util-position-4.0.4.tgz",
"integrity": "sha512-kUBE91efOWfIVBo8xzh/uZQ7p9ffYRtUbMRZBNFYwf0RK8koUMx6dGUfwylLOKmaT2cs4wSW96QoYUSXAyEtpg==",
"dependencies": {
"@types/unist": "^2.0.0"
}
},
"node_modules/unist-util-stringify-position": { "node_modules/unist-util-stringify-position": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmmirror.com/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", "resolved": "https://registry.npmmirror.com/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz",
@ -8308,6 +8363,14 @@
"resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
}, },
"node_modules/xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmmirror.com/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
"engines": {
"node": ">=0.4"
}
},
"node_modules/yallist": { "node_modules/yallist": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmmirror.com/yallist/-/yallist-4.0.0.tgz", "resolved": "https://registry.npmmirror.com/yallist/-/yallist-4.0.0.tgz",
@ -10024,6 +10087,15 @@
"@types/react": "*" "@types/react": "*"
} }
}, },
"@types/react-syntax-highlighter": {
"version": "15.5.7",
"resolved": "https://registry.npmmirror.com/@types/react-syntax-highlighter/-/react-syntax-highlighter-15.5.7.tgz",
"integrity": "sha512-bo5fEO5toQeyCp0zVHBeggclqf5SQ/Z5blfFmjwO5dkMVGPgmiwZsJh9nu/Bo5L7IHTuGWrja6LxJVE2uB5ZrQ==",
"dev": true,
"requires": {
"@types/react": "*"
}
},
"@types/react-transition-group": { "@types/react-transition-group": {
"version": "4.4.6", "version": "4.4.6",
"resolved": "https://registry.npmmirror.com/@types/react-transition-group/-/react-transition-group-4.4.6.tgz", "resolved": "https://registry.npmmirror.com/@types/react-transition-group/-/react-transition-group-4.4.6.tgz",
@ -10639,6 +10711,16 @@
"resolved": "https://registry.npmmirror.com/character-entities/-/character-entities-2.0.2.tgz", "resolved": "https://registry.npmmirror.com/character-entities/-/character-entities-2.0.2.tgz",
"integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==" "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ=="
}, },
"character-entities-legacy": {
"version": "1.1.4",
"resolved": "https://registry.npmmirror.com/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz",
"integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA=="
},
"character-reference-invalid": {
"version": "1.1.4",
"resolved": "https://registry.npmmirror.com/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz",
"integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg=="
},
"chokidar": { "chokidar": {
"version": "3.5.3", "version": "3.5.3",
"resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.5.3.tgz", "resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.5.3.tgz",
@ -10710,11 +10792,6 @@
"delayed-stream": "~1.0.0" "delayed-stream": "~1.0.0"
} }
}, },
"comma-separated-tokens": {
"version": "2.0.3",
"resolved": "https://registry.npmmirror.com/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",
"integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg=="
},
"commander": { "commander": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmmirror.com/commander/-/commander-4.1.1.tgz", "resolved": "https://registry.npmmirror.com/commander/-/commander-4.1.1.tgz",
@ -11493,6 +11570,14 @@
"reusify": "^1.0.4" "reusify": "^1.0.4"
} }
}, },
"fault": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/fault/-/fault-1.0.4.tgz",
"integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==",
"requires": {
"format": "^0.2.0"
}
},
"fecha": { "fecha": {
"version": "4.2.3", "version": "4.2.3",
"resolved": "https://registry.npmmirror.com/fecha/-/fecha-4.2.3.tgz", "resolved": "https://registry.npmmirror.com/fecha/-/fecha-4.2.3.tgz",
@ -11577,6 +11662,11 @@
"mime-types": "^2.1.12" "mime-types": "^2.1.12"
} }
}, },
"format": {
"version": "0.2.2",
"resolved": "https://registry.npmmirror.com/format/-/format-0.2.2.tgz",
"integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww=="
},
"fraction.js": { "fraction.js": {
"version": "4.2.0", "version": "4.2.0",
"resolved": "https://registry.npmmirror.com/fraction.js/-/fraction.js-4.2.0.tgz", "resolved": "https://registry.npmmirror.com/fraction.js/-/fraction.js-4.2.0.tgz",
@ -11790,10 +11880,47 @@
"has-symbols": "^1.0.2" "has-symbols": "^1.0.2"
} }
}, },
"hast-util-whitespace": { "hast-util-parse-selector": {
"version": "2.0.1", "version": "2.2.5",
"resolved": "https://registry.npmmirror.com/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz", "resolved": "https://registry.npmmirror.com/hast-util-parse-selector/-/hast-util-parse-selector-2.2.5.tgz",
"integrity": "sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==" "integrity": "sha512-7j6mrk/qqkSehsM92wQjdIgWM2/BW61u/53G6xmC8i1OmEdKLHbk419QKQUjz6LglWsfqoiHmyMRkP1BGjecNQ=="
},
"hastscript": {
"version": "6.0.0",
"resolved": "https://registry.npmmirror.com/hastscript/-/hastscript-6.0.0.tgz",
"integrity": "sha512-nDM6bvd7lIqDUiYEiu5Sl/+6ReP0BMk/2f4U/Rooccxkj0P5nm+acM5PrGJ/t5I8qPGiqZSE6hVAwZEdZIvP4w==",
"requires": {
"@types/hast": "^2.0.0",
"comma-separated-tokens": "^1.0.0",
"hast-util-parse-selector": "^2.0.0",
"property-information": "^5.0.0",
"space-separated-tokens": "^1.0.0"
},
"dependencies": {
"comma-separated-tokens": {
"version": "1.0.8",
"resolved": "https://registry.npmmirror.com/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz",
"integrity": "sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw=="
},
"property-information": {
"version": "5.6.0",
"resolved": "https://registry.npmmirror.com/property-information/-/property-information-5.6.0.tgz",
"integrity": "sha512-YUHSPk+A30YPv+0Qf8i9Mbfe/C0hdPXk1s1jPVToV8pk8BQtpw10ct89Eo7OWkutrwqvT0eicAxlOg3dOAu8JA==",
"requires": {
"xtend": "^4.0.0"
}
},
"space-separated-tokens": {
"version": "1.1.5",
"resolved": "https://registry.npmmirror.com/space-separated-tokens/-/space-separated-tokens-1.1.5.tgz",
"integrity": "sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA=="
}
}
},
"highlight.js": {
"version": "10.7.3",
"resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-10.7.3.tgz",
"integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A=="
}, },
"hoist-non-react-statics": { "hoist-non-react-statics": {
"version": "3.3.2", "version": "3.3.2",
@ -11841,11 +11968,6 @@
"resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz", "resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
}, },
"inline-style-parser": {
"version": "0.1.1",
"resolved": "https://registry.npmmirror.com/inline-style-parser/-/inline-style-parser-0.1.1.tgz",
"integrity": "sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q=="
},
"internal-slot": { "internal-slot": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmmirror.com/internal-slot/-/internal-slot-1.0.5.tgz", "resolved": "https://registry.npmmirror.com/internal-slot/-/internal-slot-1.0.5.tgz",
@ -11861,6 +11983,20 @@
"resolved": "https://registry.npmmirror.com/intersection-observer/-/intersection-observer-0.12.2.tgz", "resolved": "https://registry.npmmirror.com/intersection-observer/-/intersection-observer-0.12.2.tgz",
"integrity": "sha512-7m1vEcPCxXYI8HqnL8CKI6siDyD+eIWSwgB3DZA+ZTogxk9I4CDnj4wilt9x/+/QbHI4YG5YZNmC6458/e9Ktg==" "integrity": "sha512-7m1vEcPCxXYI8HqnL8CKI6siDyD+eIWSwgB3DZA+ZTogxk9I4CDnj4wilt9x/+/QbHI4YG5YZNmC6458/e9Ktg=="
}, },
"is-alphabetical": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/is-alphabetical/-/is-alphabetical-1.0.4.tgz",
"integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg=="
},
"is-alphanumerical": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz",
"integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==",
"requires": {
"is-alphabetical": "^1.0.0",
"is-decimal": "^1.0.0"
}
},
"is-arguments": { "is-arguments": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmmirror.com/is-arguments/-/is-arguments-1.1.1.tgz", "resolved": "https://registry.npmmirror.com/is-arguments/-/is-arguments-1.1.1.tgz",
@ -11936,6 +12072,11 @@
"has-tostringtag": "^1.0.0" "has-tostringtag": "^1.0.0"
} }
}, },
"is-decimal": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/is-decimal/-/is-decimal-1.0.4.tgz",
"integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw=="
},
"is-docker": { "is-docker": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmmirror.com/is-docker/-/is-docker-3.0.0.tgz", "resolved": "https://registry.npmmirror.com/is-docker/-/is-docker-3.0.0.tgz",
@ -11954,6 +12095,11 @@
"is-extglob": "^2.1.1" "is-extglob": "^2.1.1"
} }
}, },
"is-hexadecimal": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz",
"integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw=="
},
"is-inside-container": { "is-inside-container": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmmirror.com/is-inside-container/-/is-inside-container-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/is-inside-container/-/is-inside-container-1.0.0.tgz",
@ -12245,6 +12391,15 @@
"js-tokens": "^3.0.0 || ^4.0.0" "js-tokens": "^3.0.0 || ^4.0.0"
} }
}, },
"lowlight": {
"version": "1.20.0",
"resolved": "https://registry.npmmirror.com/lowlight/-/lowlight-1.20.0.tgz",
"integrity": "sha512-8Ktj+prEb1RoCPkEOrPMYUN/nCggB7qAWe3a7OpMjWQkh3l2RD5wKRQ+o8Q8YuI9RG/xs95waaI/E6ym/7NsTw==",
"requires": {
"fault": "^1.0.0",
"highlight.js": "~10.7.0"
}
},
"lru-cache": { "lru-cache": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-6.0.0.tgz", "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-6.0.0.tgz",
@ -12258,15 +12413,11 @@
"resolved": "https://registry.npmmirror.com/markdown-table/-/markdown-table-3.0.3.tgz", "resolved": "https://registry.npmmirror.com/markdown-table/-/markdown-table-3.0.3.tgz",
"integrity": "sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==" "integrity": "sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw=="
}, },
"mdast-util-definitions": { "markdown-to-jsx": {
"version": "5.1.2", "version": "7.2.1",
"resolved": "https://registry.npmmirror.com/mdast-util-definitions/-/mdast-util-definitions-5.1.2.tgz", "resolved": "https://registry.npmmirror.com/markdown-to-jsx/-/markdown-to-jsx-7.2.1.tgz",
"integrity": "sha512-8SVPMuHqlPME/z3gqVwWY4zVXn8lqKv/pAhC57FuJ40ImXyBpmO5ukh98zB2v7Blql2FiHjHv9LVztSIqjY+MA==", "integrity": "sha512-9HrdzBAo0+sFz9ZYAGT5fB8ilzTW+q6lPocRxrIesMO+aB40V9MgFfbfMXxlGjf22OpRy+IXlvVaQenicdpgbg==",
"requires": { "requires": {}
"@types/mdast": "^3.0.0",
"@types/unist": "^2.0.0",
"unist-util-visit": "^4.0.0"
}
}, },
"mdast-util-find-and-replace": { "mdast-util-find-and-replace": {
"version": "2.2.2", "version": "2.2.2",
@ -12378,21 +12529,6 @@
"unist-util-is": "^5.0.0" "unist-util-is": "^5.0.0"
} }
}, },
"mdast-util-to-hast": {
"version": "12.3.0",
"resolved": "https://registry.npmmirror.com/mdast-util-to-hast/-/mdast-util-to-hast-12.3.0.tgz",
"integrity": "sha512-pits93r8PhnIoU4Vy9bjW39M2jJ6/tdHyja9rrot9uujkN7UTU9SDnE6WNJz/IGyQk3XHX6yNNtrBH6cQzm8Hw==",
"requires": {
"@types/hast": "^2.0.0",
"@types/mdast": "^3.0.0",
"mdast-util-definitions": "^5.0.0",
"micromark-util-sanitize-uri": "^1.1.0",
"trim-lines": "^3.0.0",
"unist-util-generated": "^2.0.0",
"unist-util-position": "^4.0.0",
"unist-util-visit": "^4.0.0"
}
},
"mdast-util-to-markdown": { "mdast-util-to-markdown": {
"version": "1.5.0", "version": "1.5.0",
"resolved": "https://registry.npmmirror.com/mdast-util-to-markdown/-/mdast-util-to-markdown-1.5.0.tgz", "resolved": "https://registry.npmmirror.com/mdast-util-to-markdown/-/mdast-util-to-markdown-1.5.0.tgz",
@ -13066,6 +13202,26 @@
"callsites": "^3.0.0" "callsites": "^3.0.0"
} }
}, },
"parse-entities": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/parse-entities/-/parse-entities-2.0.0.tgz",
"integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==",
"requires": {
"character-entities": "^1.0.0",
"character-entities-legacy": "^1.0.0",
"character-reference-invalid": "^1.0.0",
"is-alphanumerical": "^1.0.0",
"is-decimal": "^1.0.0",
"is-hexadecimal": "^1.0.0"
},
"dependencies": {
"character-entities": {
"version": "1.2.4",
"resolved": "https://registry.npmmirror.com/character-entities/-/character-entities-1.2.4.tgz",
"integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw=="
}
}
},
"parse-json": { "parse-json": {
"version": "5.2.0", "version": "5.2.0",
"resolved": "https://registry.npmmirror.com/parse-json/-/parse-json-5.2.0.tgz", "resolved": "https://registry.npmmirror.com/parse-json/-/parse-json-5.2.0.tgz",
@ -13214,6 +13370,11 @@
"resolved": "https://registry.npmmirror.com/pretty-format/-/pretty-format-3.8.0.tgz", "resolved": "https://registry.npmmirror.com/pretty-format/-/pretty-format-3.8.0.tgz",
"integrity": "sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew==" "integrity": "sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew=="
}, },
"prismjs": {
"version": "1.29.0",
"resolved": "https://registry.npmmirror.com/prismjs/-/prismjs-1.29.0.tgz",
"integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q=="
},
"prop-types": { "prop-types": {
"version": "15.8.1", "version": "15.8.1",
"resolved": "https://registry.npmmirror.com/prop-types/-/prop-types-15.8.1.tgz", "resolved": "https://registry.npmmirror.com/prop-types/-/prop-types-15.8.1.tgz",
@ -13224,11 +13385,6 @@
"react-is": "^16.13.1" "react-is": "^16.13.1"
} }
}, },
"property-information": {
"version": "6.2.0",
"resolved": "https://registry.npmmirror.com/property-information/-/property-information-6.2.0.tgz",
"integrity": "sha512-kma4U7AFCTwpqq5twzC1YVIDXSqg6qQK6JN0smOw8fgRy1OkMi0CYSzFmsy6dnqSenamAtj0CyXMUJ1Mf6oROg=="
},
"proxy-from-env": { "proxy-from-env": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
@ -13684,33 +13840,16 @@
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
"integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
}, },
"react-markdown": { "react-syntax-highlighter": {
"version": "8.0.7", "version": "15.5.0",
"resolved": "https://registry.npmmirror.com/react-markdown/-/react-markdown-8.0.7.tgz", "resolved": "https://registry.npmmirror.com/react-syntax-highlighter/-/react-syntax-highlighter-15.5.0.tgz",
"integrity": "sha512-bvWbzG4MtOU62XqBx3Xx+zB2raaFFsq4mYiAzfjXJMEz2sixgeAfraA3tvzULF02ZdOMUOKTBFFaZJDDrq+BJQ==", "integrity": "sha512-+zq2myprEnQmH5yw6Gqc8lD55QHnpKaU8TOcFeC/Lg/MQSs8UknEA0JC4nTZGFAXC2J2Hyj/ijJ7NlabyPi2gg==",
"requires": { "requires": {
"@types/hast": "^2.0.0", "@babel/runtime": "^7.3.1",
"@types/prop-types": "^15.0.0", "highlight.js": "^10.4.1",
"@types/unist": "^2.0.0", "lowlight": "^1.17.0",
"comma-separated-tokens": "^2.0.0", "prismjs": "^1.27.0",
"hast-util-whitespace": "^2.0.0", "refractor": "^3.6.0"
"prop-types": "^15.0.0",
"property-information": "^6.0.0",
"react-is": "^18.0.0",
"remark-parse": "^10.0.0",
"remark-rehype": "^10.0.0",
"space-separated-tokens": "^2.0.0",
"style-to-object": "^0.4.0",
"unified": "^10.0.0",
"unist-util-visit": "^4.0.0",
"vfile": "^5.0.0"
},
"dependencies": {
"react-is": {
"version": "18.2.0",
"resolved": "https://registry.npmmirror.com/react-is/-/react-is-18.2.0.tgz",
"integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
}
} }
}, },
"react-transition-group": { "react-transition-group": {
@ -13748,6 +13887,23 @@
"picomatch": "^2.2.1" "picomatch": "^2.2.1"
} }
}, },
"refractor": {
"version": "3.6.0",
"resolved": "https://registry.npmmirror.com/refractor/-/refractor-3.6.0.tgz",
"integrity": "sha512-MY9W41IOWxxk31o+YvFCNyNzdkc9M20NoZK5vq6jkv4I/uh2zkWcfudj0Q1fovjUQJrNewS9NMzeTtqPf+n5EA==",
"requires": {
"hastscript": "^6.0.0",
"parse-entities": "^2.0.0",
"prismjs": "~1.27.0"
},
"dependencies": {
"prismjs": {
"version": "1.27.0",
"resolved": "https://registry.npmmirror.com/prismjs/-/prismjs-1.27.0.tgz",
"integrity": "sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA=="
}
}
},
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.13.11", "version": "0.13.11",
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
@ -13774,27 +13930,6 @@
"unified": "^10.0.0" "unified": "^10.0.0"
} }
}, },
"remark-parse": {
"version": "10.0.2",
"resolved": "https://registry.npmmirror.com/remark-parse/-/remark-parse-10.0.2.tgz",
"integrity": "sha512-3ydxgHa/ZQzG8LvC7jTXccARYDcRld3VfcgIIFs7bI6vbRSxJJmzgLEIIoYKyrfhaY+ujuWaf/PJiMZXoiCXgw==",
"requires": {
"@types/mdast": "^3.0.0",
"mdast-util-from-markdown": "^1.0.0",
"unified": "^10.0.0"
}
},
"remark-rehype": {
"version": "10.1.0",
"resolved": "https://registry.npmmirror.com/remark-rehype/-/remark-rehype-10.1.0.tgz",
"integrity": "sha512-EFmR5zppdBp0WQeDVZ/b66CWJipB2q2VLNFMabzDSGR66Z2fQii83G5gTBbgGEnEEA0QRussvrFHxk1HWGJskw==",
"requires": {
"@types/hast": "^2.0.0",
"@types/mdast": "^3.0.0",
"mdast-util-to-hast": "^12.1.0",
"unified": "^10.0.0"
}
},
"repeat-string": { "repeat-string": {
"version": "1.6.1", "version": "1.6.1",
"resolved": "https://registry.npmmirror.com/repeat-string/-/repeat-string-1.6.1.tgz", "resolved": "https://registry.npmmirror.com/repeat-string/-/repeat-string-1.6.1.tgz",
@ -14099,11 +14234,6 @@
} }
} }
}, },
"space-separated-tokens": {
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz",
"integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q=="
},
"streamsearch": { "streamsearch": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmmirror.com/streamsearch/-/streamsearch-1.1.0.tgz", "resolved": "https://registry.npmmirror.com/streamsearch/-/streamsearch-1.1.0.tgz",
@ -14182,14 +14312,6 @@
"resolved": "https://registry.npmmirror.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "resolved": "https://registry.npmmirror.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
"integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="
}, },
"style-to-object": {
"version": "0.4.1",
"resolved": "https://registry.npmmirror.com/style-to-object/-/style-to-object-0.4.1.tgz",
"integrity": "sha512-HFpbb5gr2ypci7Qw+IOhnP2zOU7e77b+rzM+wTzXzfi1PrtBCX0E7Pk4wL4iTLnhzZ+JgEGAhX81ebTg/aYjQw==",
"requires": {
"inline-style-parser": "0.1.1"
}
},
"styled-components": { "styled-components": {
"version": "5.3.11", "version": "5.3.11",
"resolved": "https://registry.npmjs.org/styled-components/-/styled-components-5.3.11.tgz", "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-5.3.11.tgz",
@ -14430,11 +14552,6 @@
"resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz", "resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz",
"integrity": "sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==" "integrity": "sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ=="
}, },
"trim-lines": {
"version": "3.0.1",
"resolved": "https://registry.npmmirror.com/trim-lines/-/trim-lines-3.0.1.tgz",
"integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg=="
},
"trough": { "trough": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmmirror.com/trough/-/trough-2.1.0.tgz", "resolved": "https://registry.npmmirror.com/trough/-/trough-2.1.0.tgz",
@ -14552,11 +14669,6 @@
} }
} }
}, },
"unist-util-generated": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/unist-util-generated/-/unist-util-generated-2.0.1.tgz",
"integrity": "sha512-qF72kLmPxAw0oN2fwpWIqbXAVyEqUzDHMsbtPvOudIlUzXYFIeQIuxXQCRCFh22B7cixvU0MG7m3MW8FTq/S+A=="
},
"unist-util-is": { "unist-util-is": {
"version": "5.2.1", "version": "5.2.1",
"resolved": "https://registry.npmmirror.com/unist-util-is/-/unist-util-is-5.2.1.tgz", "resolved": "https://registry.npmmirror.com/unist-util-is/-/unist-util-is-5.2.1.tgz",
@ -14565,14 +14677,6 @@
"@types/unist": "^2.0.0" "@types/unist": "^2.0.0"
} }
}, },
"unist-util-position": {
"version": "4.0.4",
"resolved": "https://registry.npmmirror.com/unist-util-position/-/unist-util-position-4.0.4.tgz",
"integrity": "sha512-kUBE91efOWfIVBo8xzh/uZQ7p9ffYRtUbMRZBNFYwf0RK8koUMx6dGUfwylLOKmaT2cs4wSW96QoYUSXAyEtpg==",
"requires": {
"@types/unist": "^2.0.0"
}
},
"unist-util-stringify-position": { "unist-util-stringify-position": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmmirror.com/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", "resolved": "https://registry.npmmirror.com/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz",
@ -14758,6 +14862,11 @@
"resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
}, },
"xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmmirror.com/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
},
"yallist": { "yallist": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmmirror.com/yallist/-/yallist-4.0.0.tgz", "resolved": "https://registry.npmmirror.com/yallist/-/yallist-4.0.0.tgz",

View File

@ -34,6 +34,7 @@
"eslint": "8.43.0", "eslint": "8.43.0",
"eslint-config-next": "13.4.7", "eslint-config-next": "13.4.7",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"markdown-to-jsx": "^7.2.1",
"moment": "^2.29.4", "moment": "^2.29.4",
"next": "13.4.7", "next": "13.4.7",
"next-auth": "^4.20.1", "next-auth": "^4.20.1",
@ -42,7 +43,7 @@
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-hook-form": "^7.43.8", "react-hook-form": "^7.43.8",
"react-markdown": "^8.0.7", "react-syntax-highlighter": "^15.5.0",
"remark-gfm": "^3.0.1", "remark-gfm": "^3.0.1",
"styled-components": "^5.3.11", "styled-components": "^5.3.11",
"swr": "^2.1.1", "swr": "^2.1.1",
@ -52,6 +53,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/lodash": "^4.14.195", "@types/lodash": "^4.14.195",
"@types/nprogress": "^0.2.0" "@types/nprogress": "^0.2.0",
"@types/react-syntax-highlighter": "^15.5.7"
} }
} }

View File

@ -1,8 +1,16 @@
import { NextApiRequest, NextPage } from 'next/types'; import { NextApiRequest, NextPage } from 'next/types';
import { Session } from 'next-auth'; import { Session } from 'next-auth';
export type Message = { role: 'human' | 'ai'; context: string; createdAt?: Date }; export type Message = { role: 'human' | 'view'; context: string; createdAt?: Date };
export type AppNextApiRequest = NextApiRequest & { export type AppNextApiRequest = NextApiRequest & {
session: Session; session: Session;
}; };
export interface DialogueItem {
chat_mode: string;
conv_uid: string;
select_param?: string;
user_input?: string;
user_name?: string;
}

View File

@ -0,0 +1,15 @@
import React from 'react';
export function createCtx<A>(): readonly [
() => A,
React.Provider<A | undefined>,
] {
const ctx = React.createContext<A | undefined>(undefined);
function useCtx() {
const c = React.useContext(ctx);
if (c === undefined)
throw new Error('useCtx must be inside a Provider with a value');
return c;
}
return [useCtx, ctx.Provider] as const; // 'as const' makes TypeScript infer a tuple
}

View File

@ -1,3 +1,4 @@
import { message } from 'antd';
import axios from 'axios'; import axios from 'axios';
import { isPlainObject } from 'lodash'; import { isPlainObject } from 'lodash';
@ -40,7 +41,10 @@ export const sendGetRequest = (url: string, qs?: { [key: string]: any }) => {
} }
return axios.get(url, { return axios.get(url, {
headers: DEFAULT_HEADERS headers: DEFAULT_HEADERS
}).then(res => res).catch(err => Promise.reject(err)); }).then(res => res).catch(err => {
message.error(err);
Promise.reject(err);
});
} }
export const sendPostRequest = (url: string, body?: any) => { export const sendPostRequest = (url: string, body?: any) => {
@ -48,5 +52,8 @@ export const sendPostRequest = (url: string, body?: any) => {
return axios.post(url, { return axios.post(url, {
body: reqBody, body: reqBody,
headers: DEFAULT_HEADERS headers: DEFAULT_HEADERS
}).then(res => res).catch(err => Promise.reject(err)); }).then(res => res).catch(err => {
message.error(err);
Promise.reject(err);
});
} }