fix(datasource): lazy-load Feishu wiki resources to avoid listing timeout (#1672)

Listing resources for a Feishu data source eagerly walked the entire wiki
tree (one API call per node across every space), which exceeded the request
timeout for large knowledge bases. ListResources now takes a parentID and
returns a single level at a time: empty lists the wiki spaces, a space/node
ID lists only its direct children. The frontend fetches children on demand
when a node is expanded. Notion (full tree in one call) and Yuque (flat)
keep their existing behavior by ignoring non-empty parentID.

Refs: https://github.com/Tencent/WeKnora/issues/1672
This commit is contained in:
wizardchen
2026-06-22 17:41:18 +08:00
committed by lyingbug
parent 74c845a1f4
commit d8f13ada4a
12 changed files with 204 additions and 62 deletions
+8 -1
View File
@@ -18,7 +18,14 @@ type Connector interface {
// ListResources lists available resources that can be synced (documents, spaces, folders, etc.)
// Returns a list of Resource objects that the user can select for syncing.
ListResources(ctx context.Context, config *types.DataSourceConfig) ([]types.Resource, error)
//
// parentID controls lazy (on-demand) loading of hierarchical resources:
// - parentID == "" → return the top-level resources (e.g. Feishu wiki spaces).
// - parentID != "" → return only the direct children of that resource.
// Connectors whose listing is already flat or returns the full tree in a single
// call may ignore parentID for the root call and return an empty slice for any
// non-empty parentID.
ListResources(ctx context.Context, config *types.DataSourceConfig, parentID string) ([]types.Resource, error)
// FetchAll performs a full sync of the specified resources.
// Returns all items from the given resource IDs.