fix:add not-found path map (#5309)

This commit is contained in:
dreamer6680
2025-07-24 17:35:14 +08:00
committed by GitHub
parent c390eb186c
commit 51268f1187
3 changed files with 43 additions and 4 deletions

View File

@@ -1,6 +1,45 @@
'use client';
import { redirect } from 'next/navigation';
import { usePathname } from 'next/navigation';
import { useEffect } from 'react';
const exactMap: Record<string, string> = {
'/docs/intro': '/docs/introduction/index',
'/docs/guide/dashboard/workflow/coreferenceresolution':
'/docs/introduction/guide/dashboard/workflow/coreferenceResolution',
'/docs/guide/admin/sso_dingtalk':
'/docs/introduction/guide/admin/sso#/docs/introduction/guide/admin/sso#钉钉',
'/docs/guide/knowledge_base/rag': '/docs/introduction/guide/knowledge_base/RAG',
'/docs/commercial/intro/': '/docs/introduction'
};
const prefixMap: Record<string, string> = {
'/docs/development': '/docs/introduction/development',
'/docs/FAQ': '/docs/introduction/FAQ',
'/docs/guide': '/docs/introduction/guide',
'/docs/shopping_cart': '/docs/introduction/shopping_cart',
'/docs/agreement': '/docs/protocol'
};
export default function NotFound() {
redirect(`/docs/introduction`);
return <></>;
const pathname = usePathname();
useEffect(() => {
if (exactMap[pathname]) {
redirect(exactMap[pathname]);
return;
}
for (const [oldPrefix, newPrefix] of Object.entries(prefixMap)) {
if (pathname.startsWith(oldPrefix)) {
const rest = pathname.slice(oldPrefix.length);
redirect(newPrefix + rest);
return;
}
}
redirect('/docs/introduction');
}, [pathname]);
return;
}

View File

@@ -50,7 +50,7 @@ description: FastGPT V4.8.16 更新说明
2. 新增 - 商业版支持 API 知识库和链接集合定时同步。
3. 新增 - 猜你想问支持选择模型和自定义提示词。
4. 新增 - 钉钉和企微机器人 webhook 插件。
5. 新增 - 商业版支持钉钉 SSO 登录配置。[点击查看教程](/docs/introduction/guide/admin/sso_dingtalk/)
5. 新增 - 商业版支持钉钉 SSO 登录配置。[点击查看教程](/docs/introduction/guide/admin/sso#钉钉)
6. 新增 - 商业版支持飞书和语雀知识库导入。[点击查看教程](/docs/introduction/guide/knowledge_base/lark_dataset/)
7. 新增 - sandbox 新增 createHmac 加密全局方法。
8. 新增 - 工作流右键支持全部折叠。

View File

@@ -5,4 +5,4 @@ description: FastGPT 版本更新
import { Redirect } from '@/components/docs/Redirect';
<Redirect to="/docs/introduction/development/upgrading/4111" />
<Redirect to="/docs/introduction/development/upgrading/intro" />