vishvaV
BuildShip2y ago
7 replies
vishva

chat bot with nextjs

i have created workflow chat wi supabse and in text mode working fine but if I implement this in nextjs app and start chat that show error I was attaching image here.
this is error wile chat with bot
 { "error": { "status": 400, "headers": { "alt-svc": "h3=\":443\"; ma=86400", "cf-cache-status": "DYNAMIC", "cf-ray": "8ac736299cfb6326-ORD", "connection": "keep-alive", "content-length": "203", "content-type": "application/json", "date": "Thu, 01 Aug 2024 16:30:14 GMT", "openai-organization": "user-tecqq7ghzy7wyosafoigsw2v", "openai-processing-ms": "23", "openai-version": "2020-10-01", "server": "cloudflare", "set-cookie": "__cf_bm=TjvnW71eNe7KTRlK8dIfFTtW7nj3Y1jD2tRgO9e.dEY-1722529814-1.0.1.1-TyrZHDcuBxeZjUfOIt01wIlczQ2nY8WgYwRJIRja8rAz5sWsagqiG8KLx_9C3rBWvvy4Gi1NdZyFjOcPCc9IUQ; path=/; expires=Thu, 01-Aug-24 17:00:14 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None, _cfuvid=7Ip47q2TY8pp2awgE99XA8qmHKTUi_n2ogEKbdpfnr8-1722529814098-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None", "strict-transport-security": "max-age=15552000; includeSubDomains; preload", "x-content-type-options": "nosniff", "x-request-id": "req_d07b3718076ef9cdcf4466aceca53162" }, "error": { "message": "Missing required parameter: 'messages[0].content'.", "type": "invalid_request_error", "param": "messages[0].content", "code": "missing_required_parameter" }, "code": "missing_required_parameter", "param": "messages[0].content", "type": "invalid_request_error" }, "label": "OpenAI Assistant", "message": "400 Missing required parameter: 'messages[0].content'." 
Screenshot_2024-08-01_220528.png
Solution
In your workflow you are taking the prompt form the query not from the body. change the prompt to (x)Body.message, it should work then, note here that the body is the variable from the Rest API Request.
Was this page helpful?