feat: pg vector 0.8.0;perf: app pdf enhance parse (#3962)

* perf: app pdf enhance parse

* feat: pg vector 0.8.0

* update schema default

* model sort and default image

* perf: i18n

* perf: ui tip
This commit is contained in:
Archer
2025-03-04 13:43:50 +08:00
committed by archer
parent adf5377ebe
commit 54eb5c0547
33 changed files with 181 additions and 66 deletions

View File

@@ -51,13 +51,13 @@ export const navbarWidth = '64px';
const Layout = ({ children }: { children: JSX.Element }) => {
const router = useRouter();
const { toast } = useToast();
const { t } = useTranslation();
const { Loading } = useLoading();
const { loading, feConfigs, notSufficientModalType, llmModelList, embeddingModelList } =
useSystemStore();
const { isPc } = useSystem();
const { userInfo, teamPlanStatus, isUpdateNotification, setIsUpdateNotification } =
useUserStore();
const { userInfo, isUpdateNotification, setIsUpdateNotification } = useUserStore();
const { setUserDefaultLng } = useI18nLng();
const isChatPage = useMemo(
@@ -87,7 +87,6 @@ const Layout = ({ children }: { children: JSX.Element }) => {
});
// Check model invalid
const { toast } = useToast();
useDebounceEffect(
() => {
if (userInfo?.username === 'root') {

View File

@@ -110,7 +110,7 @@ const OneRowSelector = ({ list, onchange, disableTip, ...props }: Props) => {
</Box>
);
};
const MultipleRowSelector = ({ list, onchange, disableTip, ...props }: Props) => {
const MultipleRowSelector = ({ list, onchange, disableTip, placeholder, ...props }: Props) => {
const { t } = useTranslation();
const { llmModelList, embeddingModelList, ttsModelList, sttModelList, reRankModelList } =
useSystemStore();
@@ -124,7 +124,7 @@ const MultipleRowSelector = ({ list, onchange, disableTip, ...props }: Props) =>
];
return list.map((item) => getModelFromList(allModels, item.value)!).filter(Boolean);
}, [llmModelList, embeddingModelList, ttsModelList, sttModelList, reRankModelList]);
}, [llmModelList, embeddingModelList, ttsModelList, sttModelList, reRankModelList, list]);
const [value, setValue] = useState<string[]>([]);
@@ -174,7 +174,7 @@ const MultipleRowSelector = ({ list, onchange, disableTip, ...props }: Props) =>
}
return renderList.filter((item) => item.children.length > 0);
}, [avatarSize, list, modelList]);
}, [avatarSize, list, modelList, t]);
const onSelect = useCallback(
(e: string[]) => {
@@ -184,7 +184,9 @@ const MultipleRowSelector = ({ list, onchange, disableTip, ...props }: Props) =>
);
const SelectedModel = useMemo(() => {
if (!props.value) return <>{t('common:not_model_config')}</>;
const modelData = getModelFromList(modelList, props.value);
if (!modelData) return <>{t('common:not_model_config')}</>;
setValue([modelData.provider, props.value]);
@@ -201,7 +203,7 @@ const MultipleRowSelector = ({ list, onchange, disableTip, ...props }: Props) =>
<Box>{modelData?.name}</Box>
</HStack>
);
}, [modelList, props.value, avatarSize]);
}, [modelList, props.value, t, avatarSize]);
return (
<Box
@@ -217,6 +219,7 @@ const MultipleRowSelector = ({ list, onchange, disableTip, ...props }: Props) =>
list={selectorList}
onSelect={onSelect}
value={value}
placeholder={placeholder}
rowMinWidth="160px"
ButtonProps={{
isDisabled: !!disableTip,

View File

@@ -9,7 +9,8 @@ import {
HStack,
Switch,
ModalFooter,
BoxProps
BoxProps,
Checkbox
} from '@chakra-ui/react';
import React, { useMemo } from 'react';
import { useTranslation } from 'next-i18next';
@@ -22,6 +23,8 @@ import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
import { useMount } from 'ahooks';
import { useSystemStore } from '@/web/common/system/useSystemStore';
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
import MyTag from '@fastgpt/web/components/common/Tag/index';
import MyDivider from '@fastgpt/web/components/common/MyDivider';
const FileSelect = ({
forbidVision = false,
@@ -95,6 +98,42 @@ const FileSelect = ({
}}
/>
</HStack>
{value.canSelectFile && feConfigs.showCustomPdfParse && (
<>
<HStack justifyContent={'end'} spacing={1} mt={2}>
<Checkbox
isChecked={value.customPdfParse}
onChange={(e) => {
onChange({
...value,
customPdfParse: e.target.checked
});
}}
>
<FormLabel>{t('app:pdf_enhance_parse')}</FormLabel>
</Checkbox>
<QuestionTip label={t('app:pdf_enhance_parse_tips')} />
{feConfigs?.show_pay && (
<MyTag
type={'borderSolid'}
borderColor={'myGray.200'}
bg={'myGray.100'}
color={'primary.600'}
py={1.5}
borderRadius={'md'}
px={3}
whiteSpace={'wrap'}
ml={1}
>
{t('app:pdf_enhance_parse_price', {
price: feConfigs.customPdfParsePrice || 0
})}
</MyTag>
)}
</HStack>
<MyDivider my={2} />
</>
)}
<HStack mt={6}>
<FormLabel flex={'1 0 0'}>{t('app:image_upload')}</FormLabel>
{forbidVision ? (