fix(api): return files download url for "files" output
This commit is contained in:
parent
61d3e2f65a
commit
3e55efe0a5
@ -48,13 +48,20 @@ export async function GET(request: Request) {
|
|||||||
for (let i = 0; i < run.outputs.length; i++) {
|
for (let i = 0; i < run.outputs.length; i++) {
|
||||||
const output = run.outputs[i];
|
const output = run.outputs[i];
|
||||||
|
|
||||||
if (output.data?.images === undefined) continue;
|
if (output.data?.images !== undefined) {
|
||||||
|
for (let j = 0; j < output.data?.images.length; j++) {
|
||||||
for (let j = 0; j < output.data?.images.length; j++) {
|
const element = output.data?.images[j];
|
||||||
const element = output.data?.images[j];
|
element.url = replaceCDNUrl(
|
||||||
element.url = replaceCDNUrl(
|
`${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}/outputs/runs/${run.id}/${element.filename}`
|
||||||
`${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}/outputs/runs/${run.id}/${element.filename}`
|
);
|
||||||
);
|
}
|
||||||
|
} else if (output.data?.files !== undefined) {
|
||||||
|
for (let j = 0; j < output.data?.files.length; j++) {
|
||||||
|
const element = output.data?.files[j];
|
||||||
|
element.url = replaceCDNUrl(
|
||||||
|
`${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}/outputs/runs/${run.id}/${element.filename}`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user