diff --git a/lib/benchify.ts b/lib/benchify.ts index cccac93..3c35a13 100644 --- a/lib/benchify.ts +++ b/lib/benchify.ts @@ -15,7 +15,7 @@ if (!BENCHIFY_API_KEY) { } // Repair code using Benchify Fixer API -export async function repairCode(files: z.infer): Promise> { +export async function repairCode(files: z.infer): Promise<{ repairedFiles: z.infer, buildOutput: string }> { try { // Simple build command to verify syntax const buildCmd = "npm run dev"; @@ -28,13 +28,13 @@ export async function repairCode(files: z.infer): Pro }); console.log('Sending request to Benchify:', { - url: `${BENCHIFY_API_URL}/v1/fixer`, + url: `${BENCHIFY_API_URL}/fixer`, filesCount: files.length, jobName: requestData.jobName }); // Send request to Benchify API - const response = await fetch(`${BENCHIFY_API_URL}/v1/fixer`, { + const response = await fetch(`${BENCHIFY_API_URL}/fixer`, { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -74,13 +74,13 @@ export async function repairCode(files: z.infer): Pro const patchResult = applyPatch(file.contents, result.diff); return { path: file.path, - contents: typeof patchResult === 'string' ? patchResult : file.contents + content: typeof patchResult === 'string' ? patchResult : file.content }; } return file; }); - return repairedFiles; + return { repairedFiles, buildOutput: result.build_output }; } catch (error) { if (error instanceof Error) { console.error('Benchify Processing Error:', { diff --git a/lib/e2b.ts b/lib/e2b.ts index 3a6749e..fbdad0c 100644 --- a/lib/e2b.ts +++ b/lib/e2b.ts @@ -15,7 +15,7 @@ export async function createSandbox({ files }: { files: z.infer ({ path: `/home/user/app/${file.path}`, - data: file.contents + data: file.content })) ); @@ -25,7 +25,7 @@ export async function createSandbox({ files }: { files: z.infer file.path === 'package.json'); if (packageJsonFile) { try { - const packageJson = JSON.parse(packageJsonFile.contents); + const packageJson = JSON.parse(packageJsonFile.content); const dependencies = packageJson.dependencies || {}; const devDependencies = packageJson.devDependencies || {}; diff --git a/lib/openai.ts b/lib/openai.ts index 196c66c..5bd23ec 100644 --- a/lib/openai.ts +++ b/lib/openai.ts @@ -13,13 +13,13 @@ if (!OPENAI_API_KEY) { // Schema for a single file const fileSchema = z.object({ path: z.string(), - contents: z.string() + content: z.string() }); // Generate a Vue application using AI SDK export async function generateApp( description: string, -): Promise> { +): Promise> { console.log("Creating app with description: ", description); try { diff --git a/lib/prompts.ts b/lib/prompts.ts index 866e621..f902bb5 100644 --- a/lib/prompts.ts +++ b/lib/prompts.ts @@ -19,7 +19,7 @@ RESPONSE FORMAT: You must return a valid JSON array of file objects. Each file object must have exactly this structure: { "path": "string (relative path to the file)", - "contents": "string (the complete file contents)" + "content": "string (the complete file content)" } Do not include any markdown formatting, code blocks, or explanatory text. The response must be pure JSON.`; diff --git a/lib/schemas.ts b/lib/schemas.ts index 6bd1d38..6688fe6 100644 --- a/lib/schemas.ts +++ b/lib/schemas.ts @@ -4,7 +4,7 @@ import { z } from 'zod'; // Benchify API schema - matching the exact format in the API docs export const benchifyFileSchema = z.array(z.object({ path: z.string(), - contents: z.string() + content: z.string() })); export const benchifyRequestSchema = z.object({ diff --git a/lib/types.ts b/lib/types.ts index fe353c8..312dd97 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -2,7 +2,7 @@ import { Process } from '@e2b/sdk'; export interface GeneratedFile { path: string; - contents: string; + content: string; } export interface SandboxFile {