|
|
@@ -114,7 +114,7 @@ export function PaasRunPanel(props: {
|
|
|
if (!lifecycle.active || epoch !== lifecycle.epoch) return
|
|
|
if (request.action === "run-files") setState({ files: paasRows(result, "files"), filesLoaded: true })
|
|
|
else if (request.action === "download") {
|
|
|
- if (paasRecord(result)?.saved) setState("message", "文件已保存。")
|
|
|
+ setState("message", paasRecord(result)?.saved ? "文件已保存。" : "平台未返回保存确认,请检查下载目录。")
|
|
|
} else {
|
|
|
setState("message", "操作已提交,正在同步任务状态。")
|
|
|
await refresh(true)
|
|
|
@@ -144,9 +144,17 @@ export function PaasRunPanel(props: {
|
|
|
requestID: crypto.randomUUID(),
|
|
|
})
|
|
|
const artifacts = () =>
|
|
|
- Array.isArray(state.run.artifacts)
|
|
|
- ? state.run.artifacts.flatMap((value) => (paasRecord(value) ? [paasRecord(value)!] : []))
|
|
|
- : []
|
|
|
+ (Array.isArray(state.run.artifacts) ? state.run.artifacts : []).flatMap((value) => {
|
|
|
+ const file = paasRecord(value)
|
|
|
+ if (!file) return []
|
|
|
+ const name = paasText(file.name) || paasText(file.artifact_id)
|
|
|
+ return name ? [{ name, artifactID: paasText(file.artifact_id) }] : []
|
|
|
+ })
|
|
|
+ const workFiles = () =>
|
|
|
+ state.files.flatMap((file) => {
|
|
|
+ const name = paasText(file.name) || paasText(file.path)
|
|
|
+ return name ? [{ name, path: paasText(file.path) }] : []
|
|
|
+ })
|
|
|
|
|
|
return (
|
|
|
<section
|
|
|
@@ -273,48 +281,55 @@ export function PaasRunPanel(props: {
|
|
|
<PaasMarkdown text={paasText(state.run.output)} />
|
|
|
</details>
|
|
|
</Show>
|
|
|
- <section class="paas-run-results" aria-label="成果">
|
|
|
- <Show when={props.showGoal}>
|
|
|
- <h3>成果{artifacts().length ? ` · ${artifacts().length}` : ""}</h3>
|
|
|
- </Show>
|
|
|
- <For each={artifacts()}>
|
|
|
- {(file) => (
|
|
|
- <div class="paas-actions">
|
|
|
- <span>{paasText(file.name)}</span>
|
|
|
- <Show when={paasText(file.artifact_id)}>
|
|
|
- <button
|
|
|
- type="button"
|
|
|
- disabled={!!state.busy}
|
|
|
- onClick={() =>
|
|
|
- void perform("下载", {
|
|
|
- action: "download",
|
|
|
- agentID: props.agentID,
|
|
|
- runID: props.runID,
|
|
|
- artifactID: paasText(file.artifact_id),
|
|
|
- name: paasText(file.name),
|
|
|
- })
|
|
|
- }
|
|
|
- >
|
|
|
- 保存成果
|
|
|
- </button>
|
|
|
- </Show>
|
|
|
- </div>
|
|
|
- )}
|
|
|
- </For>
|
|
|
+ <Show when={artifacts().length}>
|
|
|
+ <section class="paas-run-results" aria-label="成果">
|
|
|
+ <h3>成果 · {artifacts().length}</h3>
|
|
|
+ <For each={artifacts()}>
|
|
|
+ {(file) => (
|
|
|
+ <div class="paas-actions">
|
|
|
+ <span>{file.name}</span>
|
|
|
+ <Show when={file.artifactID}>
|
|
|
+ <button
|
|
|
+ type="button"
|
|
|
+ disabled={!!state.busy}
|
|
|
+ onClick={() =>
|
|
|
+ void perform("下载", {
|
|
|
+ action: "download",
|
|
|
+ agentID: props.agentID,
|
|
|
+ runID: props.runID,
|
|
|
+ artifactID: file.artifactID,
|
|
|
+ name: file.name,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ >
|
|
|
+ 保存成果
|
|
|
+ </button>
|
|
|
+ </Show>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </For>
|
|
|
+ </section>
|
|
|
+ </Show>
|
|
|
+ <div class="paas-actions paas-run-files">
|
|
|
<button
|
|
|
type="button"
|
|
|
disabled={!!state.busy}
|
|
|
onClick={() => void perform("读取文件", { action: "run-files", agentID: props.agentID, runID: props.runID })}
|
|
|
>
|
|
|
- 查看工作文件
|
|
|
+ {state.filesLoaded ? "刷新工作文件" : "查看工作文件"}
|
|
|
</button>
|
|
|
- <Show when={state.filesLoaded && !state.files.length}>
|
|
|
- <p>目前还没有工作文件。</p>
|
|
|
+ <Show when={state.filesLoaded && !workFiles().length}>
|
|
|
+ <span class="paas-muted">没有可保存的工作文件。</span>
|
|
|
</Show>
|
|
|
- <For each={state.files}>
|
|
|
- {(file) => (
|
|
|
- <div class="paas-actions">
|
|
|
- <span>{paasText(file.name) || paasText(file.path)}</span>
|
|
|
+ </div>
|
|
|
+ <For each={workFiles()}>
|
|
|
+ {(file) => (
|
|
|
+ <div class="paas-actions paas-run-file">
|
|
|
+ <span>{file.name}</span>
|
|
|
+ <Show
|
|
|
+ when={file.path}
|
|
|
+ fallback={<span class="paas-muted">平台未返回可下载路径。</span>}
|
|
|
+ >
|
|
|
<button
|
|
|
type="button"
|
|
|
disabled={!!state.busy}
|
|
|
@@ -323,17 +338,17 @@ export function PaasRunPanel(props: {
|
|
|
action: "download",
|
|
|
agentID: props.agentID,
|
|
|
runID: props.runID,
|
|
|
- path: paasText(file.path),
|
|
|
- name: paasText(file.name) || paasText(file.path),
|
|
|
+ path: file.path,
|
|
|
+ name: file.name,
|
|
|
})
|
|
|
}
|
|
|
>
|
|
|
保存文件
|
|
|
</button>
|
|
|
- </div>
|
|
|
- )}
|
|
|
- </For>
|
|
|
- </section>
|
|
|
+ </Show>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </For>
|
|
|
<details class="paas-run-technical">
|
|
|
<summary>技术信息</summary>
|
|
|
<dl>
|