feat: add task workflow and asset downloads

This commit is contained in:
inman
2026-05-29 12:32:02 +08:00
parent f9c3393f84
commit 63e62d444c
61 changed files with 2773 additions and 2181 deletions

View File

@@ -1,17 +1,14 @@
import { deleteAsset, deleteGenerationJob, getAsset, getGenerationJob } from "@/lib/server/data-store";
import { jsonError, jsonOk } from "@/lib/server/api";
import { requestOrigin } from "@/lib/server/runtime";
import { syncImageJob } from "@/lib/server/generation-service";
import { deleteStoredAsset } from "@/lib/server/storage";
export const runtime = "nodejs";
export async function GET(request: Request, context: { params: Promise<{ id: string }> }) {
export async function GET(_request: Request, context: { params: Promise<{ id: string }> }) {
try {
const { id } = await context.params;
const existing = await getGenerationJob(id);
if (!existing) return jsonError(new Error("Generation job not found."), 404);
const job = await syncImageJob(id, requestOrigin(request));
const job = await getGenerationJob(id);
if (!job) return jsonError(new Error("Generation job not found."), 404);
return jsonOk({ job });
} catch (error) {
return jsonError(error, 500);

View File

@@ -1,15 +1,14 @@
import { deleteAsset, deleteGenerationJob, getAsset, getGenerationJob } from "@/lib/server/data-store";
import { jsonError, jsonOk } from "@/lib/server/api";
import { requestOrigin } from "@/lib/server/runtime";
import { syncVideoJob } from "@/lib/server/video-generation-service";
import { deleteStoredAsset } from "@/lib/server/storage";
export const runtime = "nodejs";
export async function GET(request: Request, context: { params: Promise<{ id: string }> }) {
export async function GET(_request: Request, context: { params: Promise<{ id: string }> }) {
try {
const { id } = await context.params;
const job = await syncVideoJob(id, requestOrigin(request));
const job = await getGenerationJob(id);
if (!job) return jsonError(new Error("Generation job not found."), 404);
return jsonOk({ job });
} catch (error) {
return jsonError(error, 500);