I am trying to make link this to the click of a button on my ReactJS site. When I click the button I receive the error "uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol')"
async function call () {
try {
axios({
method: 'post',
url: url,
header: {
"Content-Type": 'application/json',
"Authorization": `Bearer ${USER_KEY}`
},
data: {
prompt: script,
temperature: 0,
max_dist: 60,
stat_request: 1.0,
divider: ["\"\"\""]
}
}).then(
res => {
console.log(res.json())
}
);
} catch (error) {
return {statusCode: 500, body: error.toString()}
}
}
I am trying to convert the following curl call
curl https://myurlpath.com/test/call \
-H "Content-Type: application/json" \
-H "Authorization: Bearer USERS_KEY" \
-d '{
"prompt": "Please enter your thoughts:\n\"\"\"\nSome Generic paragraph.\n\"\"\"\n",
"temperature": 0,
"max_dist": 60,
"stat_request": 1.0,
"divider": ["\"\"\""]
}'