diff --git a/document/app/[lang]/docs/layout.tsx b/document/app/[lang]/docs/layout.tsx
index f35384f638..3be1097868 100644
--- a/document/app/[lang]/docs/layout.tsx
+++ b/document/app/[lang]/docs/layout.tsx
@@ -1,18 +1,17 @@
import { type ReactNode } from 'react';
import { source } from '@/lib/source';
-import { DocsLayout } from 'fumadocs-ui/layouts/notebook';
+import { DocsLayout } from 'fumadocs-ui/layouts/docs';
import { baseOptions } from '@/app/layout.config';
import { t, getLocalizedPath, i18n } from '@/lib/i18n';
-import LogoLight from '@/components/docs/logo';
-import LogoDark from '@/components/docs/logoDark';
import '@/app/global.css';
import { CustomSidebarComponents } from '@/components/sideBar';
import { SidebarKeepOpen } from '@/components/sidebarKeepOpen';
+import { SidebarScrollFix } from '@/components/sidebarScrollFix';
import FeishuLogoLight from '@/components/docs/feishuLogoLIght';
import FeishuLogoDark from '@/components/docs/feishuLogoDark';
import GithubLogoLight from '@/components/docs/githubLogoLight';
import GithubLogoDark from '@/components/docs/githubLogoDark';
-import { BookOpen, Code, Lightbulb, CircleHelp, Scale, History, Server } from 'lucide-react';
+import { BookOpen, Code, Lightbulb, CircleHelp, Server } from 'lucide-react';
export default async function Layout({
params,
@@ -57,51 +56,6 @@ export default async function Layout({
return (
-
-
-
-
-
-
-
- ),
- mode: 'top'
- }}
- links={[
- {
- type: 'icon',
- icon: (
-
- ),
- url: 'https://oss.laf.run/otnvvf-imgs/fastgpt-feishu1.png',
- text: '飞书群'
- },
- {
- type: 'icon',
- icon: (
-
- ),
- url: 'https://github.com/labring/FastGPT',
- text: 'github'
- }
- ]}
tree={source.pageTree[lang] || source.pageTree[i18n.defaultLanguage]}
searchToggle={{
enabled: true
@@ -111,9 +65,23 @@ export default async function Layout({
collapsible: false,
components: CustomSidebarComponents
}}
- tabMode="sidebar"
+ links={[
+ {
+ type: 'icon',
+ icon: ,
+ url: 'https://oss.laf.run/otnvvf-imgs/fastgpt-feishu1.png',
+ text: '飞书群'
+ },
+ {
+ type: 'icon',
+ icon: ,
+ url: 'https://github.com/labring/FastGPT',
+ text: 'github'
+ }
+ ]}
>
+
{children}
);
diff --git a/document/app/global.css b/document/app/global.css
index 98a2f54968..2acb5dc382 100644
--- a/document/app/global.css
+++ b/document/app/global.css
@@ -1,553 +1,8 @@
@import 'tailwindcss';
@import 'fumadocs-ui/css/preset.css';
+@import 'fumadocs-ui/css/black.css';
-@font-face {
- font-family: 'Alef';
- src: url('/fonts/Alef-Regular.ttf') format('truetype');
-}
-
-/* 在文件开头添加这些基础变量 */
-:root {
- /* 基础颜色 */
- --primary-50-hsl: 210, 40%, 98%;
- --primary-hsl: 217, 91%, 60%;
- --emerald-50-hsl: 152, 81%, 96%;
- --emerald-500-hsl: 152, 76%, 40%;
- --cardinal-50-hsl: 0, 86%, 97%;
- --cardinal-500-hsl: 0, 74%, 42%;
- --yellow-50-hsl: 55, 92%, 95%;
- --yellow-500-hsl: 45, 93%, 47%;
- --blue-500-hsl: 217, 91%, 60%;
- --fd-layout-width: 1400px;
-
- /* 文本颜色 */
- --text-default: #374151;
- --text-default-inv: #ffffff;
- --text-muted: #6b7280;
- --content-link-color: #2563eb;
-
- /* 其他变量 */
- --font-size-sm: 0.875rem;
- --gray-200: #e5e7eb;
- --gray-700: #374151;
- --gray-800: #1f2937;
- --gray-900: #111827;
-
- /* 组件颜色 */
- --primary-200: #bfdbfe;
- --blue-200: #bfdbfe;
- --blue-800: #1e40af;
- --emerald-200: #a7f3d0;
- --emerald-800: #065f46;
- --cardinal-200: #fecaca;
- --cardinal-800: #991b1b;
- --yellow-200: #fde68a;
- --yellow-800: #92400e;
-
- /* Tabs 样式 */
- --nav-tabs-border-width: none;
- --nav-tabs-link-active-bg: none;
- --nav-tabs-link-active-color: var(--text-default);
- --nav-tabs-border-color: var(--gray-400);
-}
-
-[data-dark-mode] {
- /* Tabs 样式 */
- --nav-tabs-border-color: var(--gray-800);
-
- --text-muted: #9ca3af;
- --content-link-color: #60a5fa;
-}
-
-/* 全局代码块样式 */
-pre,
-code {
- border-radius: 16px;
- background: #f5f6f7;
- font-family: Alef;
- font-size: 1rem;
- font-weight: 400;
- line-height: 16px;
- letter-spacing: 0.48px;
-}
-
-div[role='tabpanel'] figure:has(+ p) pre,
-div[role='tabpanel'] figure:has(+ p) pre code {
- background-color: #ececec;
-}
-
-.dark div[role='tabpanel'] figure:has(+ p) pre,
-.dark div[role='tabpanel'] figure:has(+ p) pre code {
- background-color: #3d3d3d;
-}
-
-.dark pre,
-.dark code {
- background: #1e1e1e;
-}
-
-pre {
- padding: 24px 30px 24px 24px;
-}
-
-pre code {
- gap: 20px;
-}
-
-code span {
- padding-left: 0 !important;
-}
-
-/* 去除代码块内层边框 */
-.bg-fd-secondary.border {
- border: none;
-}
-
-/* 去除代码块外层边框 */
-.shiki {
- border: none;
- padding: 0;
-}
-
-/* 行内代码样式 */
-/* 行内代码样式 */
-:not(pre) > code {
- display: inline-block;
- height: 25px;
- padding: 0 10px;
- margin: 0 0.2em;
- color: #272727;
- background: #f5f6f7;
- font-family: 'PingFang SC';
- font-size: 14px;
- font-style: normal;
- font-weight: 500;
- line-height: 180%;
- letter-spacing: 0.056px;
- border: none;
- border-radius: 8px;
-}
-
-.dark :not(pre) > code {
- color: #e6e6e6 !important;
- background: #282828 !important;
-}
-
-div[role='tablist'] ~ div:has(figure, p, ul) {
- border-radius: 0 !important;
- border: solid 1.5px #e5e5e5;
- border-radius: 0.75rem !important;
-}
-
-.dark div[role='tablist'] ~ div:has(figure, p, ul) {
- border: solid 1.5px #535353;
-}
-
-.dark div[role='tablist'] {
- background-color: #1e1e1e;
-}
-
-/* 代码块下方的滚动条样式 */
-div.bg-fd-secondary:has(pre) {
- padding: 0;
-}
-
-.dark div.bg-fd-secondary:has(pre) {
- background-color: #1e1e1e;
-}
-
-div.bg-fd-secondary:has(pre)::-webkit-scrollbar-track {
- background: #e8e8e8;
-}
-
-div.bg-fd-secondary:has(pre)::-webkit-scrollbar-thumb {
- background: #b0b0b0;
-}
-
-div.bg-fd-secondary:has(pre)::-webkit-scrollbar-thumb:hover {
- background: #909090;
-}
-
-.dark div.bg-fd-secondary:has(pre)::-webkit-scrollbar-track {
- background: #1a1a1a;
-}
-
-.dark div.bg-fd-secondary:has(pre)::-webkit-scrollbar-thumb {
- background: #404040;
-}
-
-.dark div.bg-fd-secondary:has(pre)::-webkit-scrollbar-thumb:hover {
- background: #606060;
-}
-
-/* 代码块中的滚动条样式优化 */
-
-/* 图片居中显示 */
-.fumadocs-content img,
-.mdx-content img,
-.prose img,
-img {
- display: block !important;
- margin-left: auto !important;
- margin-right: auto !important;
- max-width: 100% !important;
- height: auto !important;
- border-radius: 8px !important;
- box-shadow:
- 0 4px 6px -1px rgba(0, 0, 0, 0.1),
- 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
-}
-
-/* MDX 表格样式 */
-.fumadocs-content table,
-.mdx-content table,
-.prose table {
- width: 100% !important;
- border-collapse: separate !important;
- margin: 1rem 0 !important;
-}
-
-.fumadocs-content table td,
-.fumadocs-content table th,
-.mdx-content table td,
-.mdx-content table th,
-.prose table td,
-.prose table th {
- padding: 0.75rem 1rem !important;
- text-align: left !important;
-}
-
-/* Tabs 样式 */
-.nav-tabs {
- display: flex;
- gap: 0.5rem;
- border-bottom: 1px solid var(--nav-tabs-border-color);
- margin-bottom: 0.8rem;
-}
-
-.nav-tabs .nav-link {
- color: var(--text-muted) !important;
- margin-bottom: -1px;
- padding: 0.75rem 1.5rem;
- border: none;
- background: none;
- cursor: pointer;
- font-size: 1rem;
- transition: all 0.2s ease;
-}
-
-.nav-tabs .nav-link:hover {
- text-decoration: none !important;
-}
-
-.nav-tabs .nav-link.active {
- border-bottom: 2px solid var(--content-link-color);
- color: var(--content-link-color) !important;
-}
-
-.tab-content {
- margin-bottom: 0.8rem;
- padding: 1rem 0;
-}
-
-div[data-state='open'].fixed.inset-0.z-50 {
- background-color: rgba(255, 255, 255, 0.4) !important;
-}
-
-#nd-subnav > div:nth-of-type(1) button:nth-of-type(1) {
- box-shadow:
- 0px 1px 2px 0px rgba(19, 51, 107, 0.05),
- 0px 0px 1px 0px rgba(19, 51, 107, 0.08) !important;
- background-color: none !important;
- &:hover {
- cursor: pointer;
- }
-}
-
-/* 复制按钮容器和按钮样式 */
-div[class*='bg-fd-card']:has(button[aria-label='Copy Text']),
-div[class*='bg-fd-card']:has(button[aria-label='Copied Text']) {
- right: 26px;
- top: 24px;
- display: flex;
- align-items: center;
- justify-content: center;
- background-color: #818181;
- color: #818181;
- border: none;
- border-radius: 4px;
- background: rgba(0, 0, 0, 0.01);
- -webkit-backdrop-filter: blur(5px);
- backdrop-filter: blur(5px);
- &:hover {
- cursor: pointer;
- }
-}
-
-/* 按钮内部样式 */
-button[aria-label='Copy Text'],
-button[aria-label='Copied Text'] {
- color: #818181;
- background-color: transparent;
- border: none;
- padding: 0;
- &:hover {
- cursor: pointer;
- }
-}
-
-button[aria-label='Copy Text'] svg {
- display: none;
-}
-
-button[aria-label='Copy Text']::before {
- content: '';
- background-image: url('../public/icons/copy.svg');
- width: 26px;
- height: 26px;
- transition: filter 0.2s ease;
-}
-
-/* 鼠标悬停时使复制图标颜色变深 */
-button[aria-label='Copy Text']:hover::before {
- filter: brightness(0.7); /* 降低亮度使颜色变深 */
-}
-
-button[aria-label='Copied Text'] {
- width: 26px;
- height: 26px;
- /* transition: filter 0.2s ease; */
-}
-
-button[aria-label='Copied Text'] svg {
- width: 20px;
- height: 20px;
- transition: filter 0.2s ease;
-}
-
-#nd-subnav > div:nth-of-type(1) button {
- &:hover {
- cursor: pointer;
- }
-}
-#nd-subnav > div:nth-of-type(1) {
- border-bottom: 0.1px solid #e8ebf0 !important;
-}
-#nd-subnav > div:nth-of-type(2) {
- border-bottom: 0.1px solid #e8ebf0 !important;
- height: 100%;
-}
-.dark #nd-subnav > div:nth-of-type(1) {
- border-bottom: 0.1px solid #363b4a58 !important;
-}
-.dark #nd-subnav > div:nth-of-type(2) {
- border-bottom: 0.1px solid #363b4a58 !important;
-}
-
-div[data-rmiz-modal-content] {
- background-color: none !important;
-}
-
-div[data-rmiz-modal-overlay='visible'] {
- background-color: #ffffff00 !important;
- backdrop-filter: blur(4px);
-}
-.dark div[data-rmiz-modal-overlay='visible'] {
- background-color: #060c1a00 !important;
- backdrop-filter: blur(4px);
-}
-.dark div[data-rmiz-modal-content] {
- background-color: #060c1a00 !important;
-}
-
-#nd-tocnav {
- border-bottom-color: #e8ebf0 !important;
-}
-.dark #nd-tocnav {
- border-bottom-color: #1d2532 !important;
- cursor: pointer !important;
-}
-
-#nd-subnav > div:nth-of-type(2) a {
- text-decoration: none;
- color: #485264;
- transition: color 0.2s ease;
- background-color: transparent !important;
- font-weight: 400;
- /* 先清除默认下划线 */
- &:hover {
- text-decoration: underline;
- text-decoration-color: #dfe2ea;
- text-decoration-thickness: 3px; /* 下划线粗细 */
- text-underline-offset: 17px; /* 下划线与文字距离 */
- }
- &.text-fd-primary {
- text-decoration: underline;
- text-decoration-color: #3370ff;
- text-decoration-thickness: 3px; /* 下划线粗细 */
- text-underline-offset: 17px; /* 下划线与文字距离 */
- background-color: transparent !important;
- font-weight: 600;
- color: #111824;
- }
-}
-.dark #nd-subnav > div:nth-of-type(2) a {
- color: #ffffff;
-}
-
-@theme {
- --color-fd-muted: hsl(0, 0%, 96.1%);
- --color-fd-popover: hsl(0, 0%, 100%);
- --color-fd-popover-foreground: hsl(0, 0%, 15.1%);
- --color-fd-card-foreground: hsl(0, 0%, 3.9%);
- --color-fd-border: hsl(0, 0%, 89.8%);
- --color-fd-primary-foreground: hsl(0, 0%, 98%);
- --color-fd-secondary-foreground: hsl(0, 0%, 9%);
- --color-fd-accent: hsl(0, 0%, 94.1%);
- --color-fd-ring: hsl(0, 0%, 63.9%);
-
- --color-fd-background: hsl(0, 0%, 100%);
- --color-fd-card: hsl(0, 0%, 100%);
- --color-fd-foreground: hsl(240, 6%, 25%);
- --color-fd-muted-foreground: hsl(240, 6%, 50%);
- --color-fd-secondary: hsl(240, 6%, 97%);
- --color-fd-accent-foreground: hsl(240, 6%, 25%);
- --color-fd-primary: hsl(226, 55%, 45%);
-}
-
-.dark {
- --color-fd-background: #000000;
- --color-fd-foreground: hsl(220, 60%, 94.5%);
- --color-fd-muted: hsl(220, 50%, 10%);
- --color-fd-muted-foreground: #b0b0b0;
- --color-fd-popover: hsl(220, 50%, 10%);
- --color-fd-popover-foreground: hsl(220, 60%, 94.5%);
- --color-fd-card: hsla(220, 56%, 15%, 0.4);
- --color-fd-card-foreground: hsl(220, 60%, 94.5%);
- --color-fd-border: hsla(220, 50%, 50%, 0.2);
- --color-fd-primary: #c2d3ff; /* 文本高亮色 */
- --color-fd-primary-foreground: hsl(0, 0%, 9%);
- --color-fd-secondary: hsl(220, 50%, 20%);
- --color-fd-secondary-foreground: hsl(220, 80%, 90%);
- --color-fd-accent: hsl(220, 40%, 20%);
- --color-fd-accent-foreground: hsl(220, 80%, 90%);
- --color-fd-ring: hsl(205, 100%, 85%);
-}
-
-#nd-sidebar {
- border-color: transparent;
-}
-
-#nd-page > article,
-#nd-toc {
- padding-top: 2rem;
-}
-
-button[data-search-full] {
- background-color: var(--color-fd-background);
-}
-
-.dark\:text-blue-400:where(.dark, .dark *) {
- color: #c2d3ff;
- background-color: #434548;
-}
-
-.dark div[role='tabpanel'].bg-fd-background {
- background-color: #1e1e1e;
-}
-
-div[role='tabpanel'].bg-fd-background {
- background-color: #f7f7f8;
-}
-
-div[role='tabpanel'].bg-fd-background > div > ul {
- margin: 0;
- display: flex;
- flex-direction: column;
- gap: 10px;
-}
-
-.dark div[role='tabpanel'].bg-fd-background > div > ul {
- margin: 0;
- background-color: #1e1e1e;
-}
-
-div[role='tabpanel'].bg-fd-background > div > ul > li {
- margin: 0;
-}
-
-button[role='tab'] {
- padding-top: 16px;
- padding-bottom: 16px;
-}
-
-/* 移动端侧边栏左侧 padding 缩小 */
-@media (max-width: 767px) {
- #nd-sidebar-mobile [data-radix-scroll-area-viewport] {
- padding-left: 8px;
- padding-right: 8px;
- padding-top: 0;
- }
-
- /* SidebarHeader 底部 padding */
- #nd-sidebar-mobile > div:first-child {
- padding-top: 8px;
- padding-bottom: 22px;
- }
-
- /* 去掉 viewport 内部的顶部渐变遮罩 */
- #nd-sidebar-mobile [data-radix-scroll-area-viewport] > div {
- mask-image: linear-gradient(
- transparent,
- #fff 0px,
- #fff calc(100% - 12px),
- transparent
- ) !important;
- -webkit-mask-image: linear-gradient(
- transparent,
- #fff 0px,
- #fff calc(100% - 12px),
- transparent
- ) !important;
- }
-}
-
-/* RootToggle 图标容器:缩小到与图标匹配,修复对齐和间距 */
-#nd-sidebar .size-9,
-#nd-sidebar .size-5,
-#nd-sidebar-mobile .size-9,
-#nd-sidebar-mobile .size-5,
-[data-radix-popper-content-wrapper] .size-9,
-[data-radix-popper-content-wrapper] .size-5 {
- width: 20px !important;
- height: 20px !important;
- flex-shrink: 0;
- display: flex !important;
- align-items: center;
- justify-content: center;
-}
-
-/* RootToggle sidebar tab selector: remove bottom margin */
-#nd-sidebar .mb-2,
-#nd-sidebar-mobile .mb-2 {
- margin-bottom: 0 !important;
-}
-
-/* RootToggle 下拉菜单:增加两侧 padding + 选中项浅蓝背景 */
-[data-radix-popper-content-wrapper] > div {
- padding: 6px 8px !important;
-}
-
-[data-radix-popper-content-wrapper] a {
- padding-left: 12px !important;
- padding-right: 12px !important;
- border-radius: 8px;
- display: flex !important;
- align-items: center !important;
- gap: 8px;
-}
-
-/* 移动端目录下拉框(TOC Popover Trigger):文本溢出省略号 */
+/* 移动端目录下拉框:文本溢出省略号 */
@media (max-width: 767px) {
button[class*='tocnav'] {
max-width: 100vw;
@@ -564,12 +19,69 @@ button[role='tab'] {
overflow-wrap: break-word;
word-break: break-word;
}
-
- /* RootToggle 图标容器:缩小尺寸,对齐文字 */
- #nd-sidebar-mobile [data-radix-popper-anchor] .size-9,
- #nd-sidebar-mobile button .size-9 {
- width: 20px !important;
- height: 20px !important;
- flex-shrink: 0;
- }
+}
+
+/* RootToggle 图标容器:缩小到与图标匹配,修复对齐和间距 */
+#nd-sidebar .size-9,
+#nd-sidebar .size-5,
+#nd-sidebar-mobile .size-9,
+#nd-sidebar-mobile .size-5,
+[data-radix-popper-content-wrapper] .size-9,
+[data-radix-popper-content-wrapper] .size-5 {
+ flex-shrink: 0;
+ display: flex !important;
+ align-items: center;
+ justify-content: center;
+}
+
+#nd-sidebar > div > div,
+#nd-sidebar-mobile > div > div {
+ padding-top: 6px !important;
+}
+
+#nd-sidebar > div > button,
+#nd-sidebar-mobile > div > button {
+ height: 38px;
+ padding: 6px 8px !important;
+}
+#nd-sidebar-mobile > div > button {
+ gap: 0;
+}
+
+/* 移除导航栏图标的上边距 - 使用通用选择器匹配所有 radix 弹窗 */
+[data-radix-popper-content-wrapper] > div > a {
+ padding: 8px 6px;
+ height: 38px;
+}
+
+[data-radix-popper-content-wrapper] > div > a > div {
+ margin-top: 0 !important;
+}
+
+/* Image zoom modal overlay */
+html [data-rmiz-modal-overlay='visible'] {
+ --color-fd-background: rgba(255, 255, 255, 0.7);
+ background-color: rgba(255, 255, 255, 0.7) !important;
+}
+html.dark [data-rmiz-modal-overlay='visible'] {
+ --color-fd-background: rgba(0, 0, 0, 0.75);
+ background-color: rgba(0, 0, 0, 0.75) !important;
+}
+
+/* Content */
+
+/* img */
+#nd-page article img {
+ object-fit: contain;
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+ max-width: 80%;
+ max-height: 500px;
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
+ border-radius: 6px;
+}
+[data-rmiz-modal-img] {
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
+ border-radius: 6px;
}
diff --git a/document/app/layout.config.tsx b/document/app/layout.config.tsx
index 1f7e8d0f14..f885fabfb3 100644
--- a/document/app/layout.config.tsx
+++ b/document/app/layout.config.tsx
@@ -1,5 +1,6 @@
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
import { i18n } from '@/lib/i18n';
+import Image from 'next/image';
/**
* Shared layout configurations
@@ -16,10 +17,9 @@ export const baseOptions = (locale: string): BaseLayoutProps => {
},
nav: {
title: (
-
-
-

-
+
+
+ FastGPT
)
},
diff --git a/document/components/docs/feishuLogoDark.tsx b/document/components/docs/feishuLogoDark.tsx
index 9556e48dd7..798458a068 100644
--- a/document/components/docs/feishuLogoDark.tsx
+++ b/document/components/docs/feishuLogoDark.tsx
@@ -2,8 +2,8 @@
import React from 'react';
-const feishuLogoDark: React.FC
> = (props) => (
-