diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index 5f955c054..82dc56c84 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -51,20 +51,6 @@ jobs: ${{ matrix.domain_config.suffix }}-${{ needs.generate-timestamp.outputs.datetime }} flavor: latest=false - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Cache Docker layers - uses: actions/cache@v4 - with: - path: /tmp/.buildx-cache-${{ matrix.domain_config.suffix }} - key: ${{ runner.os }}-docs-buildx-${{ matrix.domain_config.suffix }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-docs-buildx-${{ matrix.domain_config.suffix }}- - - name: Login to Aliyun uses: docker/login-action@v3 with: @@ -72,7 +58,8 @@ jobs: username: ${{ secrets.ALI_HUB_USERNAME }} password: ${{ secrets.ALI_HUB_PASSWORD }} - - name: Build and push Docker images + - name: Build and push Docker images (CN) + if: matrix.domain_config.suffix == 'cn' uses: docker/build-push-action@v5 with: context: ./document @@ -80,14 +67,27 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - # 使用本地缓存替代 GHA 缓存 - cache-from: type=local,src=/tmp/.buildx-cache-${{ matrix.domain_config.suffix }} - cache-to: type=local,dest=/tmp/.buildx-cache-${{ matrix.domain_config.suffix }} + platforms: linux/amd64 + build-args: | + NEXT_PUBLIC_SEARCH_APPKEY=c4708d48f2de6ac5d2f0f443979ef92a + NEXT_PUBLIC_SEARCH_APPID=HZAF4C2T88 + FASTGPT_HOME_DOMAIN=${{ matrix.domain_config.domain }} + SEARCH_APPWRITEKEY=${{ secrets.SEARCH_APPWRITEKEY }} + + - name: Build and push Docker images (IO) + if: matrix.domain_config.suffix == 'io' + uses: docker/build-push-action@v5 + with: + context: ./document + file: ./document/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64 build-args: | NEXT_PUBLIC_SEARCH_APPKEY=c4708d48f2de6ac5d2f0f443979ef92a NEXT_PUBLIC_SEARCH_APPID=HZAF4C2T88 FASTGPT_HOME_DOMAIN=${{ matrix.domain_config.domain }} - ${{ matrix.domain_config.suffix == 'cn' && 'SEARCH_APPWRITEKEY=${{ secrets.SEARCH_APPWRITEKEY }}' || '' }} update-images: needs: [generate-timestamp, build-images] diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 9358487bc..ad84a86a1 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -35,20 +35,6 @@ jobs: ${{ steps.datetime.outputs.datetime }} flavor: latest=false - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Cache Docker layers - uses: actions/cache@v4 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-docs-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-docs-buildx- - - name: Login to Aliyun uses: docker/login-action@v3 with: @@ -64,9 +50,6 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - # 使用本地缓存替代 GHA 缓存 - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache build-args: | NEXT_PUBLIC_SEARCH_APPKEY=c4708d48f2de6ac5d2f0f443979ef92a NEXT_PUBLIC_SEARCH_APPID=HZAF4C2T88 diff --git a/document/Dockerfile b/document/Dockerfile index 9506cf59f..820db0bff 100644 --- a/document/Dockerfile +++ b/document/Dockerfile @@ -30,7 +30,8 @@ ENV SEARCH_APPWRITEKEY=$SEARCH_APPWRITEKEY ENV FASTGPT_HOME_DOMAIN=$FASTGPT_HOME_DOMAIN COPY . . -RUN npm install && npm run build +RUN npm install +RUN npm run build # Update search index if SEARCH_APPWRITEKEY is provided RUN if [ -n "$SEARCH_APPWRITEKEY" ]; then \ echo "SEARCH_APPWRITEKEY found, updating search index..." && \ @@ -39,15 +40,6 @@ RUN if [ -n "$SEARCH_APPWRITEKEY" ]; then \ echo "SEARCH_APPWRITEKEY not provided, skipping search index update"; \ fi - -# Run update-index-action if SEARCH_APPWRITEKEY is provided -RUN if [ -n "$SEARCH_APPWRITEKEY" ]; then \ - echo "SEARCH_APPWRITEKEY is provided, running update-index-action..."; \ - npm run update-index-action; \ -else \ - echo "SEARCH_APPWRITEKEY is not provided, skipping update-index-action"; \ -fi - FROM base AS runner RUN apk add --no-cache curl ENV NODE_ENV=production diff --git a/document/components/CustomSearchDialog.tsx b/document/components/CustomSearchDialog.tsx index cb41f594c..0eb42aacc 100644 --- a/document/components/CustomSearchDialog.tsx +++ b/document/components/CustomSearchDialog.tsx @@ -15,6 +15,10 @@ import { } from 'fumadocs-ui/components/dialog/search'; import { useI18n } from 'fumadocs-ui/contexts/i18n'; +console.log({ + NEXT_PUBLIC_SEARCH_APPID: process.env.NEXT_PUBLIC_SEARCH_APPID, + NEXT_PUBLIC_SEARCH_APPKEY: process.env.NEXT_PUBLIC_SEARCH_APPKEY +}) if (!process.env.NEXT_PUBLIC_SEARCH_APPID || !process.env.NEXT_PUBLIC_SEARCH_APPKEY) { throw new Error('NEXT_PUBLIC_SEARCH_APPID and NEXT_PUBLIC_SEARCH_APPKEY are not set'); } diff --git a/document/content/docs/use-cases/external-integration/feishu.mdx b/document/content/docs/use-cases/external-integration/feishu.mdx index dc5525b7e..2e3ceb777 100644 --- a/document/content/docs/use-cases/external-integration/feishu.mdx +++ b/document/content/docs/use-cases/external-integration/feishu.mdx @@ -3,7 +3,7 @@ title: 接入飞书机器人教程 description: FastGPT 接入飞书机器人教程 --- -从 4.8.10 版本起,FastGPT 商业版支持直接接入飞书机器人,无需额外的 API。 +从 4.8.10 版本起,FastGPT 商业版支持直接接入飞书机器人,无需额外的 API。 ## 1. 申请飞书应用 diff --git a/document/content/docs/use-cases/index.mdx b/document/content/docs/use-cases/index.mdx index c7754fe3b..cea5a623c 100644 --- a/document/content/docs/use-cases/index.mdx +++ b/document/content/docs/use-cases/index.mdx @@ -3,7 +3,6 @@ title: 使用案例 description: FastGPT 使用案例 --- - import { Redirect } from '@/components/docs/Redirect'; \ No newline at end of file diff --git a/document/source.config.ts b/document/source.config.ts index 4bae9856f..886d4bac0 100644 --- a/document/source.config.ts +++ b/document/source.config.ts @@ -1,10 +1,13 @@ import { defineConfig, defineDocs, frontmatterSchema, metaSchema } from 'fumadocs-mdx/config'; +import { z } from 'zod'; // You can customise Zod schemas for frontmatter and `meta.json` here // see https://fumadocs.vercel.app/docs/mdx/collections#define-docs export const docs = defineDocs({ docs: { - schema: frontmatterSchema + schema: frontmatterSchema.extend({ + title: z.string().optional().default('Untitled') + }) }, meta: { schema: metaSchema @@ -16,4 +19,4 @@ export default defineConfig({ mdxOptions: { // MDX options } -}); +}); \ No newline at end of file diff --git a/document/update-index.mjs b/document/update-index.mjs index bf021dd44..4146bfa08 100644 --- a/document/update-index.mjs +++ b/document/update-index.mjs @@ -9,7 +9,13 @@ async function main() { /** @type {import('fumadocs-core/search/algolia').DocumentRecord[]} **/ const records = JSON.parse(content.toString()); - if (!process.env.NEXT_PUBLIC_SEARCH_APPID || !process.env.SEARCH_APPWRITEKEY) { + console.log({ + NEXT_PUBLIC_SEARCH_APPID: process.env.NEXT_PUBLIC_SEARCH_APPID, + SEARCH_APPWRITEKEY: process.env.SEARCH_APPWRITEKEY, + SEARCH_APPWRITEKEY: process.env.SEARCH_APPWRITEKEY + }) + + if (!process.env.NEXT_PUBLIC_SEARCH_APPID || !process.env.SEARCH_APPWRITEKEY || !process.env.SEARCH_APPWRITEKEY) { console.log('NEXT_PUBLIC_SEARCH_APPID or SEARCH_APPWRITEKEY is not set'); return; }