4.6.7 fix (#752)

This commit is contained in:
Archer
2024-01-19 20:16:08 +08:00
committed by GitHub
parent c031e6dcc9
commit 5e2adb22f0
37 changed files with 420 additions and 293 deletions

View File

@@ -27,7 +27,7 @@ const Upload = dynamic(() => import('../commonProgress/Upload'));
const PreviewRawText = dynamic(() => import('../components/PreviewRawText'));
type FileItemType = ImportSourceItemType & { file: File };
const fileType = '.txt, .docx, .pdf, .md, .html';
const fileType = '.txt, .docx, .csv, .pdf, .md, .html';
const maxSelectFileCount = 1000;
const FileLocal = ({ activeStep, goToNext }: ImportDataComponentProps) => {

View File

@@ -14,7 +14,8 @@ import { useImportStore } from '../Provider';
import { feConfigs } from '@/web/common/system/staticData';
import dynamic from 'next/dynamic';
import { fileDownload, readCsvContent } from '@/web/common/file/utils';
import { fileDownload } from '@/web/common/file/utils';
import { readCsvContent } from '@fastgpt/web/common/file/read/csv';
const PreviewData = dynamic(() => import('../commonProgress/PreviewData'));
const Upload = dynamic(() => import('../commonProgress/Upload'));
@@ -56,7 +57,7 @@ const SelectFile = React.memo(function SelectFile({ goToNext }: { goToNext: () =
{
for await (const selectFile of files) {
const { file, folderPath } = selectFile;
const { header, data } = await readCsvContent(file);
const { header, data } = await readCsvContent({ file });
const filterData: FileItemType['chunks'] = data
.filter((item) => item[0])

View File

@@ -193,7 +193,10 @@ const InputDataModal = ({
// not exactly same
await putDatasetDataById({
id: dataId,
...e
...e,
indexes: e.indexes.map((index) =>
index.defaultIndex ? getDefaultIndex({ q: e.q, a: e.a }) : index
)
});
return {

View File

@@ -35,7 +35,8 @@ import dynamic from 'next/dynamic';
import { useForm } from 'react-hook-form';
import MySelect from '@/components/Select';
import { useSelectFile } from '@/web/common/file/hooks/useSelectFile';
import { fileDownload, readCsvContent } from '@/web/common/file/utils';
import { fileDownload } from '@/web/common/file/utils';
import { readCsvContent } from '@fastgpt/web/common/file/read/csv';
import { delay } from '@fastgpt/global/common/system/utils';
import QuoteItem from '@/components/core/dataset/QuoteItem';
@@ -125,7 +126,7 @@ const Test = ({ datasetId }: { datasetId: string }) => {
const { mutate: onFileTest, isLoading: fileTestIsLoading } = useRequest({
mutationFn: async ({ searchParams }: FormType) => {
if (!selectFile) return Promise.reject('File is not selected');
const { data } = await readCsvContent(selectFile);
const { data } = await readCsvContent({ file: selectFile });
const testList = data.slice(0, 100);
const results: SearchTestResponse[] = [];