This commit is contained in:
archer
2023-08-04 18:26:54 +08:00
parent 9a31407a01
commit a19c8b9106
4 changed files with 10 additions and 9 deletions

View File

@@ -9,8 +9,7 @@ import {
NumberInputStepper,
NumberIncrementStepper,
NumberDecrementStepper,
Image,
Textarea
Image
} from '@chakra-ui/react';
import { useToast } from '@/hooks/useToast';
import { useConfirm } from '@/hooks/useConfirm';

View File

@@ -52,7 +52,7 @@ const CsvImport = ({ kbId }: { kbId: string }) => {
promise = promise.then(async () => {
const { header, data } = await readCsvContent(file);
if (header[0] !== 'question' || header[1] !== 'answer') {
throw new Error('csv 文件格式有误');
throw new Error('csv 文件格式有误,请确保 question 和 answer 两列');
}
setFiles((state) => [
@@ -73,7 +73,7 @@ const CsvImport = ({ kbId }: { kbId: string }) => {
} catch (error: any) {
console.log(error);
toast({
title: typeof error === 'string' ? error : '解析文件失败',
title: getErrText(error, '解析文件失败'),
status: 'error'
});
}
@@ -136,7 +136,9 @@ const CsvImport = ({ kbId }: { kbId: string }) => {
fileExtension={fileExtension}
onSelectFile={onSelectFile}
isLoading={selecting}
tipText={'If the imported file is garbled, please convert CSV to utf-8 encoding format'}
tipText={
'file.If the imported file is garbled, please convert CSV to UTF-8 encoding format'
}
py={emptyFiles ? '100px' : 5}
isCsv
/>