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
|
||||
})
|
||||
}).then(response => response.json()).then(data => {
|
||||
answer = data.choices[0].message.content;
|
||||
if(!data.error)
|
||||
answer = data.choices[0].message.content;
|
||||
else{
|
||||
console.error(data.error.code);
|
||||
answer = `Something went wrong. Got error code ${data.error.code}.`
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue