From f268dec80c48a88032915b955510e00aa10c596d Mon Sep 17 00:00:00 2001 From: Finley Ge <32237950+FinleyGe@users.noreply.github.com> Date: Mon, 9 Mar 2026 17:39:53 +0800 Subject: [PATCH] docs: typo & api dataset doc & fix: custom domain fe logic (#6528) * fix: typo * chore: update doc * docs: api dataset * fix: custom domain add button/ empty tip logic --- .../guide/knowledge_base/api_dataset.en.mdx | 79 +++++++++++++++---- .../guide/knowledge_base/api_dataset.mdx | 74 ++++++++++++++--- .../docs/self-host/upgrading/4-14/4148.mdx | 2 +- .../docs/self-host/upgrading/4-14/41481.mdx | 2 + document/data/doc-last-modified.json | 8 +- .../src/pages/account/customDomain/index.tsx | 6 +- 6 files changed, 137 insertions(+), 34 deletions(-) diff --git a/document/content/docs/introduction/guide/knowledge_base/api_dataset.en.mdx b/document/content/docs/introduction/guide/knowledge_base/api_dataset.en.mdx index 515080fcb8..0bf12cadb4 100644 --- a/document/content/docs/introduction/guide/knowledge_base/api_dataset.en.mdx +++ b/document/content/docs/introduction/guide/knowledge_base/api_dataset.en.mdx @@ -17,11 +17,12 @@ The API File Library lets you integrate your existing document library seamlessl ## How to Use the API File Library -When creating a knowledge base, select the API File Library type and configure two key parameters: the baseURL of your file service and the request header for authentication. As long as your endpoints conform to FastGPT's specification, the system will automatically fetch and display the complete file list for selective import. +When creating a knowledge base, select the API File Library type and configure the key parameters: the baseURL of your file service and the request header for authentication. As long as your endpoints conform to FastGPT's specification, the system will automatically fetch and display the complete file list for selective import. -You need to provide two parameters: +You need to provide three parameters: - baseURL: The base URL of your file service - authorization: The authentication request header, sent as `Authorization: Bearer ` +- basePath: Optional, the root directory path to specify the starting position of the file tree ## API Specification @@ -46,6 +47,7 @@ type FileListItem = { type: 'file' | 'folder'; updateTime: Date; createTime: Date; + hasChild?: boolean; // Optional, whether it has child nodes, defaults to true for folder type } ``` @@ -57,7 +59,7 @@ type FileListItem = { -- parentId - Parent ID, optional or null. +- parentId - Parent ID, optional. If not provided or null, the configured basePath will be used as the root directory - searchKey - Search keyword, optional @@ -79,17 +81,17 @@ curl --location --request POST '{{baseURL}}/v1/file/list' \ ```json { - "code": 200, "success": true, "message": "", "data": [ { "id": "xxxx", "parentId": "xxxx", - "type": "file", // file | folder + "type": "file", "name":"test.json", "updateTime":"2024-11-26T03:05:24.759Z", - "createTime":"2024-11-26T03:05:24.759Z" + "createTime":"2024-11-26T03:05:24.759Z", + "hasChild": false } ] } @@ -118,24 +120,25 @@ curl --location --request GET '{{baseURL}}/v1/file/content?id=xx' \ ```json { - "code": 200, "success": true, "message": "", "data": { "title": "Document Title", - "content": "FastGPT is an LLM-based knowledge base Q&A system with out-of-the-box data processing and model invocation capabilities. It also supports visual workflow orchestration via Flow for complex Q&A scenarios!\n", - "previewUrl": "xxxx" + "content": "FastGPT is an LLM-based knowledge base Q&A system with out-of-the-box data processing and model invocation capabilities. It also supports visual workflow orchestration via Flow for complex Q&A scenarios!\n" } } ``` -- title - File title. -- content - File content, used directly. -- previewUrl - File link; the system will request this URL to fetch the file content. +- **title** - File title, optional. Used to display the file name. If not provided, the system will attempt to parse the filename from `previewUrl`. +- **content** - The text content of the file, optional. Returns the complete text content of the file directly, which the system will use for indexing and retrieval. +- **previewUrl** - The access link to the file, optional. Provides an accessible file URL, and the system will automatically request this address to download the file and extract its content. Supports various file formats (such as PDF, Word, Markdown, etc.). -Return either `content` or `previewUrl`. If both are returned, `content` takes priority. When `previewUrl` is returned, the system will access that link to read the document content. +**Important Notes:** +- Either `content` or `previewUrl` must be returned, **at least one is required**, otherwise an error will occur. +- If both `content` and `previewUrl` are returned, `content` takes priority and the system will use the `content` directly. +- When `previewUrl` is returned, the system will access the link to read and parse the document content, and will cache the parsing results to improve performance. @@ -165,7 +168,6 @@ curl --location --request GET '{{baseURL}}/v1/file/read?id=xx' \ ```json { - "code": 200, "success": true, "message": "", "data": { @@ -181,3 +183,52 @@ curl --location --request GET '{{baseURL}}/v1/file/read?id=xx' \ + + +### 4. Get File Details + + + + + +id is the file's ID. + +```bash +curl --location --request GET '{{baseURL}}/v1/file/detail?id=xx' \ +--header 'Authorization: Bearer {{authorization}}' +``` + + + + + + + +```json +{ + "success": true, + "message": "", + "data": { + "id": "xxxx", + "name": "test.json", + "parentId": "xxxx", + "type": "file", + "updateTime": "2024-11-26T03:05:24.759Z", + "createTime": "2024-11-26T03:05:24.759Z" + } +} +``` + + +- id - File ID +- name - File name +- parentId - Parent ID, null indicates root directory +- type - File type, file or folder +- updateTime - Update time +- createTime - Creation time + + + + + + diff --git a/document/content/docs/introduction/guide/knowledge_base/api_dataset.mdx b/document/content/docs/introduction/guide/knowledge_base/api_dataset.mdx index cff7df280f..91c1aa3ba8 100644 --- a/document/content/docs/introduction/guide/knowledge_base/api_dataset.mdx +++ b/document/content/docs/introduction/guide/knowledge_base/api_dataset.mdx @@ -19,9 +19,10 @@ API 文件库能够让用户轻松对接已有的文档库,只需要按照 Fas 创建知识库时,选择 API 文件库类型,然后需要配置两个关键参数:文件服务接口的 baseURL 和用于身份验证的请求头信息。只要提供的接口规范符合 FastGPT 的要求,系统就能自动获取并展示完整的文件列表,可以根据需要选择性地将文件导入到知识库中。 -你需要提供两个参数: +你需要提供三个参数: - baseURL: 文件服务接口的 baseURL - authorization: 用于身份验证的请求头信息,实际请求格式为 `Authorization: Bearer ` +- basePath: 可选,根目录路径,用于指定文件树的起始位置 ## 接口规范 @@ -46,6 +47,7 @@ type FileListItem = { type: 'file' | 'folder'; updateTime: Date; createTime: Date; + hasChild?: boolean; // 可选,是否有子节点,默认 folder 类型为 true } ``` @@ -57,7 +59,7 @@ type FileListItem = { -- parentId - 父级 id,可选,或者 null。 +- parentId - 父级 id,可选。如果不传或传 null,则使用配置的 basePath 作为根目录 - searchKey - 检索词,可选 @@ -79,17 +81,17 @@ curl --location --request POST '{{baseURL}}/v1/file/list' \ ```json { - "code": 200, "success": true, "message": "", "data": [ { "id": "xxxx", "parentId": "xxxx", - "type": "file", // file | folder + "type": "file", "name":"test.json", "updateTime":"2024-11-26T03:05:24.759Z", - "createTime":"2024-11-26T03:05:24.759Z" + "createTime":"2024-11-26T03:05:24.759Z", + "hasChild": false } ] } @@ -118,24 +120,25 @@ curl --location --request GET '{{baseURL}}/v1/file/content?id=xx' \ ```json { - "code": 200, "success": true, "message": "", "data": { "title": "文档标题", - "content": "FastGPT 是一个基于 LLM 大语言模型的知识库问答系统,提供开箱即用的数据处理、模型调用等能力。同时可以通过 Flow 可视化进行工作流编排,从而实现复杂的问答场景!\n", - "previewUrl": "xxxx" + "content": "FastGPT 是一个基于 LLM 大语言模型的知识库问答系统,提供开箱即用的数据处理、模型调用等能力。同时可以通过 Flow 可视化进行工作流编排,从而实现复杂的问答场景!\n" } } ``` -- title - 文件标题。 -- content - 文件内容,直接拿来用。 -- previewUrl - 文件链接,系统会请求该地址获取文件内容。 +- **title** - 文件标题,可选。用于显示文件名称,如果不提供,系统会尝试从 `previewUrl` 中解析文件名。 +- **content** - 文件的文本内容,可选。直接返回文件的完整文本内容,系统会直接使用该内容进行索引和检索。 +- **previewUrl** - 文件的访问链接,可选。提供一个可访问的文件 URL,系统会自动请求该地址下载文件并提取内容。支持各种文件格式(如 PDF、Word、Markdown 等)。 -`content`和`previewUrl`二选一返回,如果同时返回则 `content` 优先级更高,返回 `previewUrl`时,则会访问该链接进行文档内容读取。 +**重要说明:** +- `content` 和 `previewUrl` 二选一返回,**必须至少返回其中一个**,否则会报错。 +- 如果同时返回 `content` 和 `previewUrl`,则 `content` 优先级更高,系统会直接使用 `content` 的内容。 +- 返回 `previewUrl` 时,系统会访问该链接进行文档内容读取和解析,并会缓存解析结果以提高性能。 @@ -165,7 +168,6 @@ curl --location --request GET '{{baseURL}}/v1/file/read?id=xx' \ ```json { - "code": 200, "success": true, "message": "", "data": { @@ -183,3 +185,49 @@ curl --location --request GET '{{baseURL}}/v1/file/read?id=xx' \ +### 4. 获取文件详情 + + + + + +id 为文件的 id。 + +```bash +curl --location --request GET '{{baseURL}}/v1/file/detail?id=xx' \ +--header 'Authorization: Bearer {{authorization}}' +``` + + + + + + + +```json +{ + "success": true, + "message": "", + "data": { + "id": "xxxx", + "name": "test.json", + "parentId": "xxxx", + "type": "file", + "updateTime": "2024-11-26T03:05:24.759Z", + "createTime": "2024-11-26T03:05:24.759Z" + } +} +``` + + +- id - 文件 id +- name - 文件名称 +- parentId - 父级 id,null 表示根目录 +- type - 文件类型,file 或 folder +- updateTime - 更新时间 +- createTime - 创建时间 + + + + + diff --git a/document/content/docs/self-host/upgrading/4-14/4148.mdx b/document/content/docs/self-host/upgrading/4-14/4148.mdx index bf4128bbcd..a9dc56a532 100644 --- a/document/content/docs/self-host/upgrading/4-14/4148.mdx +++ b/document/content/docs/self-host/upgrading/4-14/4148.mdx @@ -23,7 +23,7 @@ description: 'FastGPT V4.14.8 更新说明' ## ⚙️ 优化 1. 兼容 MCP 中 JSON Schema type 类型不在枚举类型里。 -2. 知识库搜索 变量应用文案修改为更直观的描述。 +2. 知识库搜索 变量引用文案修改为更直观的描述。 ## 🐛 修复 diff --git a/document/content/docs/self-host/upgrading/4-14/41481.mdx b/document/content/docs/self-host/upgrading/4-14/41481.mdx index adfc5625ad..a9b5da6bfa 100644 --- a/document/content/docs/self-host/upgrading/4-14/41481.mdx +++ b/document/content/docs/self-host/upgrading/4-14/41481.mdx @@ -19,6 +19,8 @@ description: 'FastGPT V4.14.8.1 更新说明' ## ⚙️ 优化 +1. api文件库接口返回 title 值 fallback 为 url + ## 🐛 修复 1. 修复工作流编排中获取不到 agent 工具的版本列表的问题。 diff --git a/document/data/doc-last-modified.json b/document/data/doc-last-modified.json index 9cef9e49c5..819e690cd1 100644 --- a/document/data/doc-last-modified.json +++ b/document/data/doc-last-modified.json @@ -232,7 +232,9 @@ "document/content/docs/self-host/upgrading/4-14/4147.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/4-14/4147.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/4-14/4148.en.mdx": "2026-03-06T19:32:23+08:00", - "document/content/docs/self-host/upgrading/4-14/4148.mdx": "2026-03-06T19:32:23+08:00", + "document/content/docs/self-host/upgrading/4-14/4148.mdx": "2026-03-09T12:04:22+08:00", + "document/content/docs/self-host/upgrading/4-14/41481.en.mdx": "2026-03-09T12:02:02+08:00", + "document/content/docs/self-host/upgrading/4-14/41481.mdx": "2026-03-09T14:24:27+08:00", "document/content/docs/self-host/upgrading/outdated/40.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/outdated/40.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/outdated/41.en.mdx": "2026-03-03T17:39:47+08:00", @@ -373,8 +375,8 @@ "document/content/docs/self-host/upgrading/outdated/499.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/upgrade-intruction.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/upgrade-intruction.mdx": "2026-03-03T17:39:47+08:00", - "document/content/docs/toc.en.mdx": "2026-03-03T17:39:47+08:00", - "document/content/docs/toc.mdx": "2026-03-03T17:39:47+08:00", + "document/content/docs/toc.en.mdx": "2026-03-09T12:02:02+08:00", + "document/content/docs/toc.mdx": "2026-03-09T12:02:02+08:00", "document/content/docs/use-cases/app-cases/dalle3.en.mdx": "2026-02-26T22:14:30+08:00", "document/content/docs/use-cases/app-cases/dalle3.mdx": "2025-07-23T21:35:03+08:00", "document/content/docs/use-cases/app-cases/english_essay_correction_bot.en.mdx": "2026-02-26T22:14:30+08:00", diff --git a/projects/app/src/pages/account/customDomain/index.tsx b/projects/app/src/pages/account/customDomain/index.tsx index b835efc174..c7b074ee61 100644 --- a/projects/app/src/pages/account/customDomain/index.tsx +++ b/projects/app/src/pages/account/customDomain/index.tsx @@ -73,7 +73,7 @@ const CustomDomain = () => { const [editDomain, setEditDomain] = useState(undefined); - // 检查用户是否有 advanced 套餐 + // 检查用户是否支持使用自定义域名 const isSupportCustomDomain = useMemo(() => { const plan = teamPlanStatus?.standard; if (!plan) return false; @@ -100,7 +100,7 @@ const CustomDomain = () => { @@ -185,7 +185,7 @@ const CustomDomain = () => { > {t('account:upgrade_to_use_custom_domain')}