Explorar el Código

fix(paas): dedupe folder view and hide hidden paths

The directory view merges the same workspace path across runs instead of
listing repeated config/result files, and dot-prefixed folders such as
.obsidian no longer surface as artifacts.
241880436@seecoder.cn hace 2 días
padre
commit
21adef7ee4

+ 2 - 1
packages/app/src/pages/paas/README.md

@@ -62,7 +62,8 @@
 - 按来源会话分组;同一会话的多次运行合并,同名文件保留最新一版;每个分组只展开前 8 个文件,其余折叠(最多展开 200 个)。
 - 工作区列表中的虚拟环境、依赖目录(`site-packages`、`node_modules`、`venv`、`__pycache__` 等)不纳入成果。
 - 每个分组显示来源会话、任务状态、智能体、时间与文件数,可打开会话回到运行详情。
-- 支持“按会话”和“按目录”两种视图;目录视图按工作区的相对路径展开文件树,根目录文件单独列出。
+- 支持“按会话”和“按目录”两种视图;目录视图按工作区的相对路径展开文件树,根目录文件单独列出,并按路径合并同名文件。
+- 以点开头的隐藏目录与文件(如 `.obsidian`、`.env`)同样视为环境内容,不纳入成果。
 - 文件可直接在右侧预览或保存;预览沿用会话页的同一控制器与缓存,切换到其他页面会关闭预览栏。
 - 只聚合最近 40 个已结束任务;更早记录需在平台任务中查看。单任务读取失败不阻断其余成果,并明确列出未同步任务。
 - 运行中任务不纳入,避免把持续变化的中间文件当作成果。

+ 2 - 0
packages/app/src/pages/paas/artifact-library.test.ts

@@ -115,6 +115,8 @@ test("hides virtualenv and dependency internals from workspace listings", () =>
         { name: "matplotlib", path: "venv/lib/python3.12/site-packages/matplotlib" },
         { name: "module.pyc", path: "workspace/__pycache__/module.pyc" },
         { name: "state.json", path: "workspace/.ipynb_checkpoints/state.json" },
+        { name: "app.json", path: ".obsidian/app.json" },
+        { name: ".env", path: "workspace/.env" },
       ],
     },
   })

+ 1 - 1
packages/app/src/pages/paas/artifact-library.ts

@@ -191,7 +191,7 @@ const dependencySegments = new Set([
 function dependencyFile(path: string, name: string) {
   if (/\.pyc$/i.test(name) || /\.egg-info([\\/]|$)/i.test(path)) return true
   const segments = `${path}/${name}`.split(/[\\/]+/)
-  return segments.some((segment) => dependencySegments.has(segment.toLocaleLowerCase()))
+  return segments.some((segment) => segment.startsWith(".") || dependencySegments.has(segment.toLocaleLowerCase()))
 }
 
 export function artifactCategory(file: { name: string; mime?: string }): ArtifactCategory {

+ 5 - 0
packages/app/src/pages/paas/artifacts.tsx

@@ -43,7 +43,11 @@ type FolderNode = {
 
 function buildTree(entries: ArtifactEntry[]): FolderNode {
   const root: FolderNode = { name: "", path: "", folders: new Map(), files: [] }
+  const seen = new Set<string>()
   for (const entry of entries) {
+    const key = (entry.path || entry.name).trim().toLocaleLowerCase()
+    if (seen.has(key)) continue
+    seen.add(key)
     const segments = (entry.path || "").split(/[\\/]+/).filter(Boolean)
     segments.pop()
     let node = root
@@ -421,6 +425,7 @@ export function PaasArtifacts(props: {
           when={filters.view === "session"}
           fallback={
             <div class="paas-artifact-tree">
+              <p class="paas-muted paas-artifact-tree-note">目录视图按工作区路径合并同名文件。</p>
               <Show when={tree().files.length}>
                 <p class="paas-artifact-tree-label">根目录 · {tree().files.length} 个文件</p>
                 {fileList(sortedFiles(tree().files))}

+ 4 - 0
packages/app/src/pages/paas/studio.css

@@ -596,6 +596,10 @@
   background: var(--paas-surface);
   overflow: hidden;
 }
+.paas-artifact-tree > .paas-artifact-tree-note {
+  margin: 0 0 2px;
+  font-size: var(--paas-type-meta);
+}
 .paas-artifact-files {
   margin: 0;
   padding: 0;