mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-15 15:41:05 +00:00
feat: Store pdfparse in local (#5534)
This commit is contained in:
@@ -45,7 +45,7 @@ const ChatTest = ({ appForm, setRenderEdit }: Props) => {
|
||||
setRenderEdit(!datasetCiteData);
|
||||
}, [datasetCiteData, setRenderEdit]);
|
||||
|
||||
const { ChatContainer, restartChat, loading } = useChatTest({
|
||||
const { ChatContainer, restartChat } = useChatTest({
|
||||
...workflowData,
|
||||
chatConfig: appForm.chatConfig,
|
||||
isReady: true
|
||||
|
@@ -71,7 +71,6 @@ const EditForm = ({
|
||||
const { appDetail } = useContextSelector(AppContext, (v) => v);
|
||||
const selectDatasets = useMemo(() => appForm?.dataset?.datasets, [appForm]);
|
||||
const [, startTst] = useTransition();
|
||||
const { llmModelList, defaultModels } = useSystemStore();
|
||||
|
||||
const {
|
||||
isOpen: isOpenDatasetSelect,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { useRouter } from 'next/router';
|
||||
import { type SetStateAction, useMemo, useState } from 'react';
|
||||
import { type SetStateAction, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { createContext, useContextSelector } from 'use-context-selector';
|
||||
import {
|
||||
@@ -20,6 +20,7 @@ import { DatasetPageContext } from '@/web/core/dataset/context/datasetPageContex
|
||||
import { DataChunkSplitModeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import { chunkAutoChunkSize, getAutoIndexSize } from '@fastgpt/global/core/dataset/training/utils';
|
||||
import { type CollectionChunkFormType } from '../Form/CollectionChunkForm';
|
||||
import { useLocalStorageState } from 'ahooks';
|
||||
|
||||
export type ImportFormType = {
|
||||
customPdfParse: boolean;
|
||||
@@ -38,7 +39,7 @@ type DatasetImportContextType = {
|
||||
};
|
||||
|
||||
export const defaultFormData: ImportFormType = {
|
||||
customPdfParse: false,
|
||||
customPdfParse: true,
|
||||
|
||||
trainingType: DatasetCollectionDataProcessModeEnum.chunk,
|
||||
|
||||
@@ -198,12 +199,23 @@ const DatasetImportContextProvider = ({ children }: { children: React.ReactNode
|
||||
|
||||
const vectorModel = datasetDetail.vectorModel;
|
||||
|
||||
const [localCustomPdfParse, setLocalCustomPdfParse] = useLocalStorageState(
|
||||
'dataset_customPdfParse',
|
||||
{
|
||||
defaultValue: true
|
||||
}
|
||||
);
|
||||
const processParamsForm = useForm<ImportFormType>({
|
||||
defaultValues: (() => ({
|
||||
...defaultFormData,
|
||||
customPdfParse: localCustomPdfParse,
|
||||
indexSize: getAutoIndexSize(vectorModel)
|
||||
}))()
|
||||
});
|
||||
const customPdfParse = processParamsForm.watch('customPdfParse');
|
||||
useEffect(() => {
|
||||
setLocalCustomPdfParse(customPdfParse);
|
||||
}, [customPdfParse, setLocalCustomPdfParse]);
|
||||
|
||||
const [sources, setSources] = useState<ImportSourceItemType[]>([]);
|
||||
|
||||
|
@@ -46,7 +46,7 @@ const ReTraining = () => {
|
||||
]);
|
||||
|
||||
processParamsForm.reset({
|
||||
customPdfParse: collection.customPdfParse || false,
|
||||
customPdfParse: collection.customPdfParse ?? defaultFormData.customPdfParse,
|
||||
trainingType: collection.trainingType,
|
||||
|
||||
chunkTriggerType: collection.chunkTriggerType || defaultFormData.chunkTriggerType,
|
||||
|
Reference in New Issue
Block a user