Spaces:
Building
Building
Update server.js
Browse files
server.js
CHANGED
@@ -24,9 +24,11 @@ app.post('/chat', async (req, res) => {
|
|
24 |
'Content-Type': 'application/json'
|
25 |
}
|
26 |
});
|
|
|
27 |
res.json(response.data);
|
28 |
} catch (error) {
|
29 |
-
|
|
|
30 |
}
|
31 |
});
|
32 |
|
|
|
24 |
'Content-Type': 'application/json'
|
25 |
}
|
26 |
});
|
27 |
+
|
28 |
res.json(response.data);
|
29 |
} catch (error) {
|
30 |
+
console.error('Error: ', error.response ? error.response.data : error.message);
|
31 |
+
res.status(500).send('Error: ' + (error.response ? error.response.data : error.message));
|
32 |
}
|
33 |
});
|
34 |
|