Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Send prompt to api in correct format

Vasek Mlejnsky219bfb6870d6
diff --git a/api/generate.py b/api/generate.py
index 8ab462c0c..6ef628115 100644
--- a/api/generate.py
+++ b/api/generate.py
@@ -22,9 +22,13 @@ class handler(BaseHTTPRequestHandler):
print(js_code)
self.send_response(200)
- self.send_header('Content-type', 'text/plain')
+ self.send_header('Content-Type', 'application/json')
self.end_headers()
- self.wfile.write(js_code.encode())
+ self.wfile.write(
+ simplejson.dumps(
+ {'code': js_code}
+ ).encode()
+ )
return
def do_GET(self):
diff --git a/components/Editor/index.tsx b/components/Editor/index.tsx
index a446179ab..fdfa8f945 100644
--- a/components/Editor/index.tsx
+++ b/components/Editor/index.tsx
@@ -29,9 +29,13 @@ async function handlePostGenerate(url: string, { arg }: {
method: Method,
}
}) {
+ let prompt = ''
+ for (const block of arg.blocks) {
+ prompt += block.prompt
+ }
return await fetch(url, {
method: 'POST',
- body: JSON.stringify(arg),
+ body: JSON.stringify({ prompt }),
headers: {
'Content-Type': 'application/json',