IntegrationsOfficial documentation6 min readIntegrations

Add Third-Party Document Library Server Types

This guide covers the core process for extending FastGPT's dataset functionality by adding custom third-party document library server type definitions.

This guide covers the core process for extending FastGPT's dataset functionality by adding custom third-party document library server type definitions.

Locate Type Definition File

All third-party document library server type definitions are managed in a dedicated core file within the FastGPT project. Navigate to FastGPT\packages\global\core\dataset\apiDataset.d.ts to access this file. This is the official location for defining authentication and configuration fields for external document library integrations.

Define Custom Server Type

Use TypeScript to define the required fields for your third-party document library. For example, the Yuque Dataset requires authentication and configuration fields, which can be implemented with the following code:

export type YuqueServer = {
  userId: string;
  token?: string;
  basePath?: string;
};

Below is a breakdown of each supported field:

Field NameTypeRequirementPurpose
userIdstringRequiredAuthenticate requests to the third-party document library
tokenstringOptionalAdd secure supplementary authentication, if supported by the library
basePathstringOptionalEnable root directory selection for the connected document library

Root Directory Configuration Requirements

🤖 Success: If your third-party document library includes a root directory selection feature, you must include the basePath field in your server type definition. For full details on integrating the root directory configuration form, refer to the root directory feature documentation.

Validate Implementation

After defining your custom server type, you can reference the provided example visual aid at /imgs/thirddataset-1.png to confirm your code aligns with FastGPT's expected third-party dataset system structure. This image illustrates the standard implementation pattern for custom external document library integrations.

Source: FastGPT official source

Applicability and version scope

Use this page for the documented Integrations scenario. Confirm the FastGPT, dependency, API, and deployment versions in the official source before applying a change.

Safety guardrails

Use [REDACTED_CREDENTIAL] for credentials and private data. Confirm the documented environment and version before review.

Rollback guidance

Restore the prior technical-content authority snapshot. Restore saved configuration and data snapshots, then repeat the smallest verification scenario.