Skip to content

fix: next config #4207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion projects/app/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ const nextConfig = {
transpilePackages: ['@fastgpt/global', '@fastgpt/web', 'ahooks'],
experimental: {
// 优化 Server Components 的构建和运行,避免不必要的客户端打包。
serverComponentsExternalPackages: ['mongoose', 'pg', '@zilliz/milvus2-sdk-node', 'tiktoken'],
serverComponentsExternalPackages: [
'mongoose',
'pg',
'@zilliz/milvus2-sdk-node',
"tiktoken",
],
outputFileTracingRoot: path.join(__dirname, '../../'),
instrumentationHook: true
}
Expand Down
1 change: 1 addition & 0 deletions projects/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"request-ip": "^3.3.0",
"sass": "^1.58.3",
"use-context-selector": "^1.4.4",
"@node-rs/jieba": "2.0.1",
"zustand": "^4.3.5"
},
"devDependencies": {
Expand Down
12 changes: 7 additions & 5 deletions projects/app/src/pageComponents/app/list/TypeTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,32 @@ import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
import { useI18n } from '@/web/context/I18n';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { Box, Flex } from '@chakra-ui/react';
import { i18nT } from '@fastgpt/web/i18n/utils';
import { useTranslation } from 'next-i18next';

const AppTypeTag = ({ type }: { type: AppTypeEnum }) => {
const { t } = useTranslation();

const map = useRef({
[AppTypeEnum.simple]: {
label: i18nT('app:type.Simple bot'),
label: t('app:type.Simple bot'),
icon: 'core/app/type/simple',
bg: '#DBF3FF',
color: '#0884DD'
},
[AppTypeEnum.workflow]: {
label: i18nT('app:type.Workflow bot'),
label: t('app:type.Workflow bot'),
icon: 'core/app/type/workflow',
bg: '#E4E1FC',
color: '#6F5DD7'
},
[AppTypeEnum.plugin]: {
label: i18nT('app:type.Plugin'),
label: t('app:type.Plugin'),
icon: 'core/app/type/plugin',
bg: '#D0F5EE',
color: '#007E7C'
},
[AppTypeEnum.httpPlugin]: {
label: i18nT('app:type.Http plugin'),
label: t('app:type.Http plugin'),
icon: 'core/app/type/httpPlugin',
bg: '#FFE4EE',
color: '#E82F72'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Markdown from '@/components/Markdown';
import { Box, Flex } from '@chakra-ui/react';
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
import { Dispatch, MutableRefObject, SetStateAction, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useTranslation } from 'next-i18next';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { useCopyData } from '@fastgpt/web/hooks/useCopyData';
import InputDataModal from '@/pageComponents/dataset/detail/InputDataModal';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type';
import { getSourceNameIcon } from '@fastgpt/global/core/dataset/utils';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { useRouter } from 'next/router';
import { useTranslation } from 'react-i18next';
import { useTranslation } from 'next-i18next';
import DownloadButton from './DownloadButton';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import { downloadFetch } from '@/web/common/system/utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MyMenu from '@fastgpt/web/components/common/MyMenu';
import { useTranslation } from 'react-i18next';
import { useTranslation } from 'next-i18next';
import MyIconButton from '@fastgpt/web/components/common/Icon/button';

const DownloadButton = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
import ScoreTag from './ScoreTag';
import Markdown from '@/components/Markdown';
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
import { useTranslation } from 'react-i18next';
import { useTranslation } from 'next-i18next';
import { useCopyData } from '@fastgpt/web/hooks/useCopyData';

const QuoteItem = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Box, Flex } from '@chakra-ui/react';
import { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type';
import MyIcon from '@fastgpt/web/components/common/Icon';
import MyBox from '@fastgpt/web/components/common/MyBox';
import { useTranslation } from 'react-i18next';
import { useTranslation } from 'next-i18next';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import QuoteItem from './QuoteItem';
import { useMemo } from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ScoreItemType, scoreTheme } from '@/components/core/dataset/QuoteItem';
import { Box, Flex, Progress } from '@chakra-ui/react';
import { SearchScoreTypeMap } from '@fastgpt/global/core/dataset/constants';
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
import { useTranslation } from 'react-i18next';
import { useTranslation } from 'next-i18next';

const ScoreTag = (score: { primaryScore?: ScoreItemType; secondaryScore: ScoreItemType[] }) => {
const { t } = useTranslation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ import MyNumberInput from '@fastgpt/web/components/common/Input/NumberInput';
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
import { shadowLight } from '@fastgpt/web/styles/theme';
import { DatasetPageContext } from '@/web/core/dataset/context/datasetPageContext';
import { useToast } from '@fastgpt/web/hooks/useToast';

function DataProcess() {
const { t } = useTranslation();
const { feConfigs } = useSystemStore();
const { toast } = useToast();

const { goToNext, processParamsForm, chunkSizeField, minChunkSize, maxChunkSize } =
useContextSelector(DatasetImportContext, (v) => v);
const datasetDetail = useContextSelector(DatasetPageContext, (v) => v.datasetDetail);
const { getValues, setValue, register, watch } = processParamsForm;
const { setValue, register, watch } = processParamsForm;

const trainingType = watch('trainingType');
const chunkSettingMode = watch('chunkSettingMode');
const qaPrompt = watch('qaPrompt');

const {
isOpen: isOpenCustomPrompt,
Expand All @@ -65,7 +65,7 @@ function DataProcess() {
value: key as DatasetCollectionDataProcessModeEnum,
tooltip: t(value.tooltip as any)
}));
}, []);
}, [t]);

const Title = useCallback(({ title }: { title: string }) => {
return (
Expand Down Expand Up @@ -284,7 +284,7 @@ function DataProcess() {
}
}}
>
{getValues('qaPrompt')}
{qaPrompt}

<Box
display={'none'}
Expand Down Expand Up @@ -333,44 +333,6 @@ function DataProcess() {
</AccordionPanel>
</AccordionItem>

{/* <AccordionItem mt={4} border={'none'}>
<Title title={t('dataset:import_model_config')} />
<AccordionPanel p={2} fontSize={'sm'}>
<Box>
<Box>{t('common:core.ai.model.Dataset Agent Model')}</Box>
<Box mt={1}>
<AIModelSelector
w={'100%'}
value={llmModel}
list={datasetModelList.map((item) => ({
label: item.name,
value: item.model
}))}
onChange={(e) => {
setValue('llmModel', e);
}}
/>
</Box>
</Box>
<Box pt={5}>
<Box>{t('dataset:vllm_model')}</Box>
<Box mt={1}>
<AIModelSelector
w={'100%'}
value={vlmModel}
list={vllmModelList.map((item) => ({
label: item.name,
value: item.model
}))}
onChange={(e) => {
setValue('vlmModel', e);
}}
/>
</Box>
</Box>
</AccordionPanel>
</AccordionItem> */}

<Flex mt={5} gap={3} justifyContent={'flex-end'}>
<Button
onClick={() => {
Expand All @@ -385,7 +347,7 @@ function DataProcess() {

{isOpenCustomPrompt && (
<PromptTextarea
defaultValue={getValues('qaPrompt')}
defaultValue={qaPrompt}
onChange={(e) => {
setValue('qaPrompt', e);
}}
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/_error.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect } from 'react';
import { useRouter } from 'next/router';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';
import { useSystemStore } from '@/web/common/system/useSystemStore';
import { Box } from '@chakra-ui/react';
import { TrackEventName } from '@/web/common/system/constants';
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/account/apikey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ApiKeyTable from '@/components/support/apikey/Table';
import { useTranslation } from 'next-i18next';
import { Box } from '@chakra-ui/react';
import AccountContainer, { TabEnum } from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';

const ApiKey = () => {
const { t } = useTranslation();
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/account/bill/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useTranslation } from 'next-i18next';
import ApplyInvoiceModal from '@/pageComponents/account/bill/ApplyInvoiceModal';
import { useRouter } from 'next/router';
import AccountContainer from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';

export enum InvoiceTabEnum {
bill = 'bill',
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/account/info/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
import { useSystem } from '@fastgpt/web/hooks/useSystem';
import { getWebReqUrl } from '@fastgpt/web/common/system/utils';
import AccountContainer from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';
import { useRouter } from 'next/router';
import TeamSelector from '@/pageComponents/account/TeamSelector';
import { getWorkorderURL } from '@/web/common/workorder/api';
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/account/inform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useLoading } from '@fastgpt/web/hooks/useLoading';
import { useTranslation } from 'next-i18next';
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
import AccountContainer from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';

const InformTable = () => {
const { t } = useTranslation();
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/account/model/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';
import React, { useMemo, useState } from 'react';
import AccountContainer from '@/pageComponents/account/AccountContainer';
import { Box, Flex } from '@chakra-ui/react';
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/account/promotion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { useLoading } from '@fastgpt/web/hooks/useLoading';
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
import AccountContainer from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';

const Promotion = () => {
const { t } = useTranslation();
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/account/setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { UserUpdateParams } from '@/types/user';
import TimezoneSelect from '@fastgpt/web/components/common/MySelect/TimezoneSelect';
import I18nLngSelector from '@/components/Select/I18nLngSelector';
import AccountContainer from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';

const Individuation = () => {
const { t } = useTranslation();
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/account/team/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';
import AccountContainer from '@/pageComponents/account/AccountContainer';
import { Box, Flex } from '@chakra-ui/react';
import Icon from '@fastgpt/web/components/common/Icon';
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/account/thirdParty/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import dynamic from 'next/dynamic';
import { useState, useMemo } from 'react';
import WorkflowVariableModal from '@/pageComponents/account/thirdParty/WorkflowVariableModal';
import { useToast } from '@fastgpt/web/hooks/useToast';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import { GET } from '@/web/common/api/request';
import type { checkUsageResponse } from '@/pages/api/support/user/team/thirtdParty/checkUsage';
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/account/usage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useTranslation } from 'next-i18next';
import { useUserStore } from '@/web/support/user/useUserStore';
import Avatar from '@fastgpt/web/components/common/Avatar';
import AccountContainer from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';
import { useScrollPagination } from '@fastgpt/web/hooks/useScrollPagination';
import { getTeamMembers } from '@/web/support/user/team/api';
import FillRowTabs from '@fastgpt/web/components/common/Tabs/FillRowTabs';
Expand Down
4 changes: 1 addition & 3 deletions projects/app/src/pages/api/admin/initv491.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const updateData = async () => {
console.log('更新分词完成');
break;
}
console.log('读取数据完成', Date.now() - time);

const dataTextOps: AnyBulkWriteOperation<DatasetDataTextSchemaType>[] = [];
const datasetDataIds: string[] = [];

Expand All @@ -46,7 +46,6 @@ const updateData = async () => {
console.log(`分词处理错误: ${item._id}`, error);
}
}
console.log('分词处理完成', Date.now() - time);

await mongoSessionRun(async (session) => {
if (dataTextOps.length > 0) {
Expand All @@ -62,7 +61,6 @@ const updateData = async () => {
);
}
});
console.log('保存完成', Date.now() - time);

success += dataTextOps.length;
console.log(`成功 ${success}`);
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/app/detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
import { Box } from '@chakra-ui/react';
import dynamic from 'next/dynamic';
import Loading from '@fastgpt/web/components/common/MyLoading';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';
import NextHead from '@/components/common/NextHead';
import { useContextSelector } from 'use-context-selector';
import AppContextProvider, { AppContext } from '@/pageComponents/app/detail/context';
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/app/list/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useMemo, useState } from 'react';
import { Box, Flex, Button, useDisclosure, Input, InputGroup } from '@chakra-ui/react';
import { AddIcon } from '@chakra-ui/icons';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';
import { useUserStore } from '@/web/support/user/useUserStore';
import { useTranslation } from 'next-i18next';
import dynamic from 'next/dynamic';
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ChatHistorySlider from '@/pageComponents/chat/ChatHistorySlider';
import SliderApps from '@/pageComponents/chat/SliderApps';
import ChatHeader from '@/pageComponents/chat/ChatHeader';
import { useUserStore } from '@/web/support/user/useUserStore';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';
import { getChatTitleFromChatMessage } from '@fastgpt/global/core/chat/utils';
import { GPTMessages2Chats } from '@fastgpt/global/core/chat/adapt';
import { getMyApps } from '@/web/core/app/api';
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/chat/share.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { StartChatFnProps } from '@/components/core/chat/ChatContainer/type
import PageContainer from '@/components/PageContainer';
import ChatHeader from '@/pageComponents/chat/ChatHeader';
import ChatHistorySlider from '@/pageComponents/chat/ChatHistorySlider';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';
import { useTranslation } from 'next-i18next';
import { getInitOutLinkChatInfo } from '@/web/core/chat/api';
import { getChatTitleFromChatMessage } from '@fastgpt/global/core/chat/utils';
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/chat/team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import PageContainer from '@/components/PageContainer';
import { getMyTokensApps } from '@/web/core/chat/api';
import ChatHistorySlider from '@/pageComponents/chat/ChatHistorySlider';
import ChatHeader from '@/pageComponents/chat/ChatHeader';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';
import { useTranslation } from 'next-i18next';
import ChatBox from '@/components/core/chat/ChatContainer/ChatBox';
import type { StartChatFnProps } from '@/components/core/chat/ChatContainer/type';
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/dataset/detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useToast } from '@fastgpt/web/hooks/useToast';
import { getErrText } from '@fastgpt/global/common/error/utils';
import dynamic from 'next/dynamic';
import PageContainer from '@/components/PageContainer';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';
import { useTranslation } from 'next-i18next';
import MetaDataCard from '@/pageComponents/dataset/detail/MetaDataCard';
import NavBar from '@/pageComponents/dataset/detail/NavBar';
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/dataset/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useCallback, useMemo, useState } from 'react';
import { Box, Flex, Button, InputGroup, InputLeftElement, Input } from '@chakra-ui/react';
import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next';
import { serviceSideProps } from '@/web/common/system/nextjs';
import { serviceSideProps } from '@/web/common/i18n/utils';
import ParentPaths from '@/components/common/folder/Path';
import List from '@/pageComponents/dataset/list/List';
import { DatasetsContext } from './context';
Expand Down
Loading
Loading