diff --git a/client/public/imgs/files/file.svg b/client/public/imgs/files/file.svg index f1b07130b..1f106af9e 100644 --- a/client/public/imgs/files/file.svg +++ b/client/public/imgs/files/file.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/client/src/pages/kb/detail/components/Import/Chunk.tsx b/client/src/pages/kb/detail/components/Import/Chunk.tsx index cce870213..aa1cf37e5 100644 --- a/client/src/pages/kb/detail/components/Import/Chunk.tsx +++ b/client/src/pages/kb/detail/components/Import/Chunk.tsx @@ -106,12 +106,15 @@ const ChunkImport = ({ kbId }: { kbId: string }) => { text: file.text, maxLen: chunkLen }); + return { ...file, tokens: splitRes.tokens, - chunks: file.chunks.map((chunk, i) => ({ - ...chunk, - q: splitRes.chunks[i] + chunks: splitRes.chunks.map((chunk) => ({ + a: '', + source: file.filename, + file_id: file.id, + q: chunk })) }; }) diff --git a/client/src/pages/kb/detail/components/Import/FileSelect.tsx b/client/src/pages/kb/detail/components/Import/FileSelect.tsx index 4d91b8c1c..b1d31a11a 100644 --- a/client/src/pages/kb/detail/components/Import/FileSelect.tsx +++ b/client/src/pages/kb/detail/components/Import/FileSelect.tsx @@ -129,7 +129,7 @@ const FileSelect = ({ maxLen: chunkLen }); const fileItem: FileItemType = { - id: nanoid(), + id: filesId[0], filename: file.name, icon, text, diff --git a/client/src/pages/kb/detail/components/Import/QA.tsx b/client/src/pages/kb/detail/components/Import/QA.tsx index e69c003d1..503ec60b5 100644 --- a/client/src/pages/kb/detail/components/Import/QA.tsx +++ b/client/src/pages/kb/detail/components/Import/QA.tsx @@ -97,9 +97,11 @@ const QAImport = ({ kbId }: { kbId: string }) => { return { ...file, tokens: splitRes.tokens, - chunks: file.chunks.map((chunk, i) => ({ - ...chunk, - q: splitRes.chunks[i] + chunks: splitRes.chunks.map((chunk) => ({ + a: '', + source: file.filename, + file_id: file.id, + q: chunk })) }; })