feat: 递归导入只需输入NodeToken,自动获取SpaceID

- feishu_service.py: import_nodes_from_parent 去掉 space_id 参数,
  通过 get_node_info 自动获取 space_id
- admin_knowledge.py: import API 去掉 spaceId 参数
- App.vue: 前端去掉 SpaceID 输入框,只需输入 NodeToken
This commit is contained in:
2026-07-08 18:54:09 +08:00
parent 3598e34819
commit 76da6dd65a
3 changed files with 18 additions and 14 deletions

View File

@@ -28,12 +28,11 @@ def import_knowledge_from_space(
db: Session = Depends(get_db),
current_admin: Admin = Depends(get_current_admin),
) -> dict:
space_id = payload.get("spaceId", "").strip()
parent_node_token = payload.get("parent_node_token", "").strip()
if not space_id or not parent_node_token:
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="SpaceID 和父节点 Token 不能为空")
if not parent_node_token:
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="父节点 NodeToken 不能为空")
nodes = FeishuKnowledgeService.import_nodes_from_parent(space_id, parent_node_token, db)
nodes = FeishuKnowledgeService.import_nodes_from_parent(parent_node_token, db)
if not nodes:
return api_success({"imported": 0, "skipped": 0, "nodes": []})