feat(web): add custom file download button for runs output
This commit is contained in:
@@ -6,12 +6,13 @@ import { z } from "zod";
|
||||
const Request = z.object({
|
||||
file_name: z.string(),
|
||||
run_id: z.string(),
|
||||
type: z.enum(["image/png", "image/jpeg"]),
|
||||
type: z.string(),
|
||||
});
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
console.log("yo hello");
|
||||
const [data, error] = await parseDataSafe(Request, request);
|
||||
if (!data || error) return error;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ export async function POST(request: Request) {
|
||||
|
||||
const { run_id, status, output_data } = data;
|
||||
|
||||
console.log(run_id, status, output_data);
|
||||
// console.log(run_id, status, output_data);
|
||||
|
||||
if (output_data) {
|
||||
const workflow_run_output = await db.insert(workflowRunOutputs).values({
|
||||
@@ -25,7 +25,7 @@ export async function POST(request: Request) {
|
||||
data: output_data,
|
||||
});
|
||||
} else if (status) {
|
||||
console.log("status", status);
|
||||
// console.log("status", status);
|
||||
const workflow_run = await db
|
||||
.update(workflowRunsTable)
|
||||
.set({
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import { replaceCDNUrl } from "@/server/resource";
|
||||
import { NextResponse, type NextRequest } from "next/server";
|
||||
import { getFileDownloadUrl } from "../../../server/getFileDownloadUrl";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const file = new URL(request.url).searchParams.get("file");
|
||||
// console.log(`${process.env.SPACES_ENDPOINT}/comfyui-deploy/${file}`);
|
||||
return NextResponse.redirect(
|
||||
replaceCDNUrl(
|
||||
`${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}/${file}`
|
||||
)
|
||||
);
|
||||
}
|
||||
if (!file) return NextResponse.redirect("/");
|
||||
return NextResponse.redirect(getFileDownloadUrl(file));
|
||||
}
|
||||
Reference in New Issue
Block a user