https://discord.gg/botpress logo
#🤝help
Problem with API
# 🤝help
b

breezy-tomato-78619

07/24/2023, 5:06 PM
I am using botpress to connect to customgpt via api. The user will submit a question in botpress which is then sent to customgpt. The answer from customgpt is then retrieved by botpress and written to the user. What I have now works well when the responses are short, but when the responses are longer , I will get an error. Here is the JavaScript code I am using: const projectID = workflow.projectId; const sessionId = workflow.sessionId; const apikey = workflow.apikey; const question = workflow.question; const options = { method: 'POST', url:
https://app.customgpt.ai/api/v1/projects/${projectID}/conversations/${sessionId}/messages
, params: {stream: 'false', lang: 'da'}, headers: { accept: 'application/json', 'content-type': 'application/json', authorization:
Bearer ${apikey}
}, data: {prompt:
${question}
}, //timeout: 10000 // sets timeout to 10 seconds }; try { const response = await axios.request(options); workflow.openaiResponse = response.data.data["openai_response"]; } catch (error) { throw new Error(
customGPT-error: ${error}
) } And here is the error message: Request: prompt:"hvad koster det at klatre?" Error: Network Error Logs (4 items - 2 error) Execute code "inline-ins-e77c8d316d.js" [AxiosError: Network Error] Error executing action "inline-ins-e77c8d316d.js" in flow:Main:node:qToCustomGPT [Error, customGPT-error: AxiosError: Network Error] Entering workflow (flow:Error) [node:Entry] from (flow:Main) [node:qToCustomGPT]
f

famous-jewelry-85388

07/24/2023, 5:07 PM
Sorry, this is the error coming from customGPT, can you check with their team or on their community?
b

breezy-tomato-78619

07/24/2023, 6:25 PM
Thanks. I will try to contact them.