From f8fc53811cb623a34fcf21417cbef2cce9b95d9b Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Wed, 23 Aug 2023 18:21:11 +0800 Subject: [PATCH] docs --- .github/workflows/deploy-docs.yml | 70 +++++++++++++++++++++++++++++++ docSite/README.md | 6 +++ docSite/assets/jsconfig.json | 4 +- docSite/content/docs/intro.md | 24 +++++------ docSite/go.mod | 2 +- docSite/vercel.json | 52 +++++++++++++++++++++++ 6 files changed, 143 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/deploy-docs.yml create mode 100644 docSite/vercel.json diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 000000000..aff185674 --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,70 @@ +# Workflow to build and deploy site to Vercel using Hugo + +# Name of Workflow +name: deploy-production + +# Controls when the action will run. Triggers the workflow on push +# events but only for the vercel branch +on: + push: + branches: [docs] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains jobs "deploy-production" + deploy-production: + # The environment this job references + environment: + name: Production + url: ${{ steps.vercel-action.outputs.preview-url }} + + # The type of runner that the job will run on + runs-on: ubuntu-22.04 + + # Job outputs + outputs: + docs: ${{ steps.filter.outputs.docs }} + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Step 1 - Checks-out your repository under $GITHUB_WORKSPACE + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive # Fetch submodules + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + + # Step 2 Detect changes to Docs Content + - name: Detect changes in doc content + uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + docs: + - 'docSite/content/docs/**' + base: main + + # Step 3 - Install Hugo (specific version) + - name: Install Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: '0.117.0' + extended: true + + # Step 4 - Builds the site using Hugo + - name: Build + run: hugo -v --minify -s docSite + env: + HUGO_BASEURL: ${{ vars.BASE_URL }} + + # Step 5 - Push our generated site to Vercel + - name: Deploy to Vercel + uses: amondnet/vercel-action@v25 + id: vercel-action + with: + vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required + vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} #Required + vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} #Required + github-comment: false + vercel-args: '--prod --local-config ../vercel.json' # Optional + working-directory: docSite/public diff --git a/docSite/README.md b/docSite/README.md index 77fba8ae0..21668d49f 100644 --- a/docSite/README.md +++ b/docSite/README.md @@ -1,3 +1,9 @@ # 文档 ## 本地运行 + +1. 安装 go 语言环境。 +2. 安装 hugo。 [二进制下载](https://github.com/gohugoio/hugo/releases/tag/v0.117.0) +3. cd docSite +4. hugo serve +5. 访问 http://localhost:1313 diff --git a/docSite/assets/jsconfig.json b/docSite/assets/jsconfig.json index 12196fbee..8f397dcb4 100644 --- a/docSite/assets/jsconfig.json +++ b/docSite/assets/jsconfig.json @@ -3,8 +3,8 @@ "baseUrl": ".", "paths": { "*": [ - "../../../../../Library/Caches/hugo_cache/modules/filecache/modules/pkg/mod/github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2@v2.21100.20000/package/dist/cjs/popper.js/*", - "../../../../../Library/Caches/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.0+incompatible/js/*" + "../../../../../.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2@v2.21100.20000/package/dist/cjs/popper.js/*", + "../../../../../.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.0+incompatible/js/*" ] } } diff --git a/docSite/content/docs/intro.md b/docSite/content/docs/intro.md index 46f869fa3..e487c957f 100644 --- a/docSite/content/docs/intro.md +++ b/docSite/content/docs/intro.md @@ -1,7 +1,7 @@ --- -title: "快速了解 FastGPT" -description: "FastGPT 的能力与优势" -icon: "rocket_launch" +title: '快速了解 FastGPT' +description: 'FastGPT 的能力与优势' +icon: 'rocket_launch' draft: false toc: true weight: -100 @@ -13,8 +13,8 @@ FastGPT 是一个基于 LLM 大语言模型的知识库问答系统,提供开 FastGPT 在线体验:[https://fastgpt.run](https://fastgpt.run) {{% /alert %}} -| | | -| -------------------------- | -------------------------- | +| | | +| --------------------- | --------------------- | | ![](/imgs/intro1.png) | ![](/imgs/intro2.png) | | ![](/imgs/intro3.png) | ![](/imgs/intro4.png) | @@ -53,29 +53,29 @@ FastGPT 对外的 API 接口对齐了 OpenAI 官方接口,可以直接接入 ## FastGPT 特点 1. **项目完全开源** - + FastGPT 遵循 Apache License 2.0 开源协议,你可以 [Fork](https://github.com/labring/FastGPT/fork) 之后进行二次开发和发布。FastGPT 社区版将保留核心功能,商业版仅在社区版基础上使用 API 的形式进行扩展,不影响学习使用。 2. **独特的 QA 结构** - + 针对客服问答场景设计的 QA 结构,提高在大量数据场景中的问答准确性。 3. **可视化工作流** - + 通过 Flow 模块展示了从问题输入到模型输出的完整流程,便于调试和设计复杂流程。 4. **无限扩展** - + 基于 API 进行扩展,无需修改 FastGPT 源码,也可快速接入现有的程序中。 5. **便于调试** - + 提供搜索测试、引用修改、完整对话预览等多种调试途径。 6. **支持多种模型** - + 支持 GPT、Claude、文心一言等多种 LLM 模型,未来也将支持自定义的向量模型。 ## 知识库核心流程图 -![](/imgs/KBProcess.jpg) \ No newline at end of file +![](/imgs/KBProcess.jpg) diff --git a/docSite/go.mod b/docSite/go.mod index 535ed443a..c6a0b4710 100644 --- a/docSite/go.mod +++ b/docSite/go.mod @@ -1,6 +1,6 @@ module fastgpt-docs -go 1.21.0 +go 1.23 require ( github.com/colinwilson/lotusdocs v0.0.0-20230821033552-c5bcbdd9df80 // indirect diff --git a/docSite/vercel.json b/docSite/vercel.json new file mode 100644 index 000000000..92b3c64fb --- /dev/null +++ b/docSite/vercel.json @@ -0,0 +1,52 @@ +{ + "redirects": [ + { + "source": "/", + "destination": "/docs" + }, + { + "source": "/imgs/:path*", + "destination": "https://cdn.jsdelivr.us/gh/yangchuansheng/FastGPT@main/docSite/assets/imgs/:path*" + } + ], + "headers": [ + { + "source": "/(.*)", + "headers": [ + { + "key": "X-Content-Type-Options", + "value": "nosniff" + }, + { + "key": "X-Frame-Options", + "value": "SAMEORIGIN" + }, + { + "key": "X-XSS-Protection", + "value": "1; mode=block" + }, + { + "key": "Referrer-Policy", + "value": "strict-origin" + }, + { + "key": "Permissions-Policy", + "value": "geolocation=(self), microphone=()" + } + ] + }, + { + "source": "/docs/fonts/:all*(woff2)", + "headers": [ + { + "key": "Cache-Control", + "value": "public, max-age=31536000, immutable" + } + ] + } + ], + "trailingSlash": true, + "github": { + "enabled": false + } +}