diff --git a/wwwroot/api/workspace_tree.dspy b/wwwroot/api/workspace_tree.dspy index 8cd5f77..503400d 100644 --- a/wwwroot/api/workspace_tree.dspy +++ b/wwwroot/api/workspace_tree.dspy @@ -43,8 +43,14 @@ if not node_id: "is_leaf": False }] -# 展开节点 -scan_path = ws_dir + '/' + node_id +# 展开节点:__root__ 特殊处理,其余用相对路径 +if node_id == '__root__': + scan_path = ws_dir + id_prefix = '' +else: + scan_path = ws_dir + '/' + node_id + id_prefix = node_id + '/' + if not os.path.isdir(scan_path): return [] @@ -60,7 +66,7 @@ for name in entries: continue if os.path.isdir(full): items.append({ - "id": node_id + '/' + name, + "id": id_prefix + name, "parentid": node_id, "label": "📁 " + name, "path": full,