This commit is contained in:
parent
8501be8882
commit
c2e21659bf
1 changed files with 6 additions and 1 deletions
|
@ -36,7 +36,12 @@ module.exports = {
|
||||||
"max_tokens": 250
|
"max_tokens": 250
|
||||||
})
|
})
|
||||||
}).then(response => response.json()).then(data => {
|
}).then(response => response.json()).then(data => {
|
||||||
|
if(!data.error)
|
||||||
answer = data.choices[0].message.content;
|
answer = data.choices[0].message.content;
|
||||||
|
else{
|
||||||
|
console.error(data.error.code);
|
||||||
|
answer = `Something went wrong. Got error code ${data.error.code}.`
|
||||||
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue