Skip to content

Commit 477d2ea

Browse files
Update app/api/sandbox/route.ts
Co-authored-by: Copilot <[email protected]>
1 parent eba7fde commit 477d2ea

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/api/sandbox/route.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,16 @@ export async function POST(req: Request) {
8181
await sbx.files.write(file.file_path, file.file_content)
8282
}))
8383
} else {
84+
} else if (fragment.code !== null && fragment.code !== undefined) {
8485
await sbx.files.write(fragment.file_path, fragment.code)
86+
} else {
87+
return new Response(
88+
JSON.stringify({
89+
error: 'Missing code data',
90+
type: 'validation_error'
91+
}),
92+
{ status: 400, headers: { 'Content-Type': 'application/json' } }
93+
)
8594
}
8695

8796
if (fragment.template === 'code-interpreter-v1') {

0 commit comments

Comments
 (0)