feat: export optimized article files
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
saveQaReport,
|
||||
updateArticleJob,
|
||||
} from "../../../../../lib/db/repositories";
|
||||
import { writeJobExports } from "../../../../../lib/workflow/exporter";
|
||||
import { runOptimizationWorkflow } from "../../../../../lib/workflow/orchestrator";
|
||||
|
||||
interface RouteContext {
|
||||
@@ -45,13 +46,23 @@ export async function POST(_request: Request, context: RouteContext) {
|
||||
optimizedArticle.revision ?? 1,
|
||||
result.qaReport,
|
||||
);
|
||||
const exportPaths =
|
||||
qaReport.overall_status === "fail"
|
||||
? {}
|
||||
: await writeJobExports({
|
||||
jobId,
|
||||
article: optimizedArticle,
|
||||
qaReport,
|
||||
});
|
||||
updateArticleJob(undefined, jobId, {
|
||||
status: qaReport.overall_status === "fail" ? "qa_failed" : "optimized",
|
||||
export_paths: exportPaths,
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
optimizedArticle,
|
||||
qaReport,
|
||||
exportPaths,
|
||||
rewriteRounds: result.rewrite_rounds,
|
||||
stoppedAfterMaxRewrites: result.stopped_after_max_rewrites,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user