Skip to content

Commit aa5be2e

Browse files
authored
return build output (#5)
2 parents 8bf62f3 + bfa53f4 commit aa5be2e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

app/api/generate/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ export async function POST(request: NextRequest) {
2626
const generatedFiles = await generateApp(description);
2727

2828
// // Parse through schema before passing to repair
29-
// const validatedFiles = benchifyFileSchema.parse(generatedFiles);
29+
const validatedFiles = benchifyFileSchema.parse(generatedFiles);
3030

3131
// // Repair the generated code using Benchify's API
32-
// const repairedFiles = await repairCode(validatedFiles);
32+
const repairedFiles = await repairCode(validatedFiles);
3333

3434
const { sbxId, template, url } = await createSandbox({ files: generatedFiles });
3535

@@ -38,7 +38,7 @@ export async function POST(request: NextRequest) {
3838
// Return the results to the client
3939
return NextResponse.json({
4040
originalFiles: generatedFiles,
41-
// repairedFiles: repairedFiles,
41+
repairedFiles: repairedFiles,
4242
// buildOutput: '', // We don't get build output from Benchify in our current setup
4343
previewUrl: url,
4444
});

app/page.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
// app/page.tsx
22
'use client';
33

4-
import { useState } from 'react';
4+
import { useEffect, useState } from 'react';
55
import { PromptForm } from '@/components/ui-builder/prompt-form';
66
import { Card, CardContent } from '@/components/ui/card';
7-
87
export default function Home() {
98
const [result, setResult] = useState<any>(null);
109

10+
useEffect(() => {
11+
if (result) {
12+
console.log(result);
13+
}
14+
}, [result]);
15+
1116
return (
1217
<main className="min-h-screen flex flex-col items-center justify-center bg-background">
1318
<div className="w-full max-w-3xl mx-auto">

0 commit comments

Comments
 (0)