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:
@@ -95,8 +95,12 @@ export function validateCredentials(type: string, credentials: Record<string, an
|
||||
return post('/api/v1/datasource/validate-credentials', { type, credentials })
|
||||
}
|
||||
|
||||
export function listResources(id: string) {
|
||||
return get(`/api/v1/datasource/${id}/resources`, { timeout: 120000 })
|
||||
// listResources lists selectable resources for a data source. Pass parentId to
|
||||
// lazily load the direct children of a resource (e.g. expanding a Feishu wiki
|
||||
// space/node), which avoids traversing the whole tree up front.
|
||||
export function listResources(id: string, parentId?: string) {
|
||||
const query = parentId ? `?parent_id=${encodeURIComponent(parentId)}` : ''
|
||||
return get(`/api/v1/datasource/${id}/resources${query}`, { timeout: 120000 })
|
||||
}
|
||||
|
||||
export function triggerSync(id: string) {
|
||||
|
||||
Reference in New Issue
Block a user