Procházet zdrojové kódy

fix(paas): tolerate runs without artifact lists

241880436@seecoder.cn před 4 dny
rodič
revize
5878f16cc6
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2 2
      packages/app/src/pages/paas/generated-files.tsx

+ 2 - 2
packages/app/src/pages/paas/generated-files.tsx

@@ -50,7 +50,7 @@ export function PaasGeneratedFiles(props: {
       api.request({ action: "run-files", agentID: props.agentID, runID }).catch(() => undefined),
       api.request({ action: "run-files", agentID: props.agentID, runID }).catch(() => undefined),
     ]).then(([run, work]) => {
     ]).then(([run, work]) => {
       if (current !== request) return
       if (current !== request) return
-      const artifacts = paasRows(run, "artifacts").flatMap((value) => {
+      const artifacts = (Array.isArray(paasRecord(run)?.artifacts) ? paasRows(run, "artifacts") : []).flatMap((value) => {
         const file = paasRecord(value)
         const file = paasRecord(value)
         const name = paasText(file?.name) || paasText(file?.artifact_id)
         const name = paasText(file?.name) || paasText(file?.artifact_id)
         if (!file || !name) return []
         if (!file || !name) return []
@@ -64,7 +64,7 @@ export function PaasGeneratedFiles(props: {
         ]
         ]
       })
       })
       const artifactNames = new Set(artifacts.map((file) => file.name))
       const artifactNames = new Set(artifacts.map((file) => file.name))
-      const workspace = paasRows(work, "files").flatMap((value) => {
+      const workspace = (Array.isArray(paasRecord(work)?.files) ? paasRows(work, "files") : []).flatMap((value) => {
         const file = paasRecord(value)
         const file = paasRecord(value)
         const name = paasText(file?.name) || paasText(file?.path)?.split("/").at(-1)
         const name = paasText(file?.name) || paasText(file?.path)?.split("/").at(-1)
         if (!file || !name || internal.has(name.toLowerCase()) || artifactNames.has(name)) return []
         if (!file || !name || internal.has(name.toLowerCase()) || artifactNames.has(name)) return []