From b601dc94c3a4be0d37351234fc11cda3d6196890 Mon Sep 17 00:00:00 2001 From: ymq Date: Sat, 15 Aug 2026 01:45:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20workspace=5Ftree=20=E5=8F=B6=E5=AD=90?= =?UTF-8?q?=E5=88=A4=E5=AE=9A=E6=8E=92=E9=99=A4=20=5F=5Fpycache=5F=5F?= =?UTF-8?q?=EF=BC=88=E4=B8=8E=E6=89=AB=E6=8F=8F=E4=B8=80=E8=87=B4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tests/detector 仅含 __pycache__ 子目录,之前 is_leaf 判定把它算作子目录导致误标非叶子。 修正:叶子判定排除隐藏目录和 __pycache__,与下方目录扫描规则一致。 --- wwwroot/api/workspace_tree.dspy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wwwroot/api/workspace_tree.dspy b/wwwroot/api/workspace_tree.dspy index 601ad37..a1774e3 100644 --- a/wwwroot/api/workspace_tree.dspy +++ b/wwwroot/api/workspace_tree.dspy @@ -50,11 +50,14 @@ for name in entries: if name.startswith('.') or name == '__pycache__': continue if os.path.isdir(full): - # 叶子判定:目录下是否还有子目录(排除隐藏目录)。无子目录 → 叶子(不可展开) + # 叶子判定:目录下是否还有「可见」子目录(排除隐藏目录和 __pycache__,与下方扫描一致)。 + # 无可见子目录 → 叶子(不可展开) has_subdir = False try: for sub in os.listdir(full): - if not sub.startswith('.') and os.path.isdir(os.path.join(full, sub)): + if sub.startswith('.') or sub == '__pycache__': + continue + if os.path.isdir(os.path.join(full, sub)): has_subdir = True break except Exception: