Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Send prompt to api in correct format
Vasek Mlejnsky219bfb6870d6
diff --git a/api/generate.py b/api/generate.pyindex 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()+ )returndef do_GET(self):diff --git a/components/Editor/index.tsx b/components/Editor/index.tsxindex 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',