Commit 3294be5e by archer

perf: auto refresh split data

parent ec868472
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
const nextConfig = { const nextConfig = {
output: 'standalone', output: 'standalone',
reactStrictMode: true, reactStrictMode: false,
compress: true, compress: true,
webpack(config) { webpack(config) {
......
...@@ -41,10 +41,6 @@ export const usePagination = <T = any,>({ ...@@ -41,10 +41,6 @@ export const usePagination = <T = any,>({
} }
}); });
useEffect(() => {
mutate(1);
}, []);
const Pagination = useCallback(() => { const Pagination = useCallback(() => {
return ( return (
<Flex alignItems={'center'} justifyContent={'end'}> <Flex alignItems={'center'} justifyContent={'end'}>
...@@ -93,6 +89,10 @@ export const usePagination = <T = any,>({ ...@@ -93,6 +89,10 @@ export const usePagination = <T = any,>({
); );
}, [maxPage, mutate, pageNum]); }, [maxPage, mutate, pageNum]);
useEffect(() => {
mutate(1);
}, [mutate]);
return { return {
pageNum, pageNum,
pageSize, pageSize,
......
...@@ -144,7 +144,8 @@ ${ ...@@ -144,7 +144,8 @@ ${
messages: filterPrompts, messages: filterPrompts,
frequency_penalty: 0.5, // 越大,重复内容越少 frequency_penalty: 0.5, // 越大,重复内容越少
presence_penalty: -0.5, // 越大,越容易出现新内容 presence_penalty: -0.5, // 越大,越容易出现新内容
stream: true stream: true,
stop: ['.!?。']
}, },
{ {
timeout: 40000, timeout: 40000,
......
...@@ -166,7 +166,8 @@ ${ ...@@ -166,7 +166,8 @@ ${
messages: filterPrompts, messages: filterPrompts,
frequency_penalty: 0.5, // 越大,重复内容越少 frequency_penalty: 0.5, // 越大,重复内容越少
presence_penalty: -0.5, // 越大,越容易出现新内容 presence_penalty: -0.5, // 越大,越容易出现新内容
stream: isStream stream: isStream,
stop: ['.!?。']
}, },
{ {
timeout: 180000, timeout: 180000,
......
...@@ -93,10 +93,16 @@ const ModelDataCard = ({ modelId }: { modelId: string }) => { ...@@ -93,10 +93,16 @@ const ModelDataCard = ({ modelId }: { modelId: string }) => {
(num = 1) => { (num = 1) => {
getData(num); getData(num);
refetch(); refetch();
return null;
}, },
[getData, refetch] [getData, refetch]
); );
useQuery(['refetchData'], () => refetchData(pageNum), {
refetchInterval: 5000,
enabled: splitDataLen > 0
});
// 获取所有的数据,并导出 json // 获取所有的数据,并导出 json
const { mutate: onclickExport, isLoading: isLoadingExport = false } = useMutation({ const { mutate: onclickExport, isLoading: isLoadingExport = false } = useMutation({
mutationFn: () => getExportDataList(modelId), mutationFn: () => getExportDataList(modelId),
...@@ -170,7 +176,7 @@ const ModelDataCard = ({ modelId }: { modelId: string }) => { ...@@ -170,7 +176,7 @@ const ModelDataCard = ({ modelId }: { modelId: string }) => {
</Menu> </Menu>
</Flex> </Flex>
<Flex mt={4}> <Flex mt={4}>
{splitDataLen > 0 && <Box fontSize={'xs'}>{splitDataLen}条数据正在拆分...</Box>} {splitDataLen > 0 && <Box fontSize={'xs'}>{splitDataLen}条数据正在拆分,请耐心等待...</Box>}
<Box flex={1} /> <Box flex={1} />
<Input <Input
maxW={'240px'} maxW={'240px'}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment