diff --git a/datacenter/app/datastores/documents/chunklist/page.tsx b/datacenter/app/datastores/documents/chunklist/page.tsx index ca17030e9..f25a42edd 100644 --- a/datacenter/app/datastores/documents/chunklist/page.tsx +++ b/datacenter/app/datastores/documents/chunklist/page.tsx @@ -2,12 +2,15 @@ import { useSearchParams } from 'next/navigation' import React, { useState, useEffect } from 'react' -import { Table } from '@/lib/mui' -import { Popover } from 'antd' +import { Table, Stack } from '@/lib/mui' +import { Popover, Pagination } from 'antd' +const page_size = 20; const ChunkList = () => { const spaceName = useSearchParams().get('spacename') const documentId = useSearchParams().get('documentid') + const [total, setTotal] = useState(0); + const [current, setCurrent] = useState(0); const [chunkList, setChunkList] = useState([]) useEffect(() => { async function fetchChunks() { @@ -19,13 +22,17 @@ const ChunkList = () => { 'Content-Type': 'application/json' }, body: JSON.stringify({ - document_id: documentId + document_id: documentId, + page: 1, + page_size }) } ) const data = await res.json() if (data.success) { - setChunkList(data.data) + setChunkList(data.data.data) + setTotal(data.data.total); + setCurrent(data.data.page); } } fetchChunks() @@ -69,6 +76,30 @@ const ChunkList = () => { ))} + + { + const res = await fetch( + `http://localhost:8000/knowledge/${spaceName}/chunk/list`, + { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + document_id: documentId, + page, + page_size + }) + } + ) + const data = await res.json() + if (data.success) { + setChunkList(data.data.data) + setTotal(data.data.total); + setCurrent(data.data.page); + } + }} hideOnSinglePage /> + ) } diff --git a/datacenter/app/globals.css b/datacenter/app/globals.css index 04a5d0afa..ae7bc662f 100644 --- a/datacenter/app/globals.css +++ b/datacenter/app/globals.css @@ -10,4 +10,21 @@ body { font-size: var(--joy-fontSize-md, 1rem); line-height: var(--joy-lineHeight-md, 1.5); background-color: var(--joy-palette-background-body); +} + +.ant-pagination .ant-pagination-prev * { + color: rgb(145, 35, 167) !important; +} + +.ant-pagination .ant-pagination-next * { + color: rgb(145, 35, 167) !important; +} + +.ant-pagination .ant-pagination-item { + border-color: rgb(145, 35, 167) !important; + background-color: rgb(145, 35, 167) !important; +} + +.ant-pagination .ant-pagination-item.ant-pagination-item-active a { + color: white !important; } \ No newline at end of file