Update server.js
Browse files
server.js
CHANGED
|
@@ -56,6 +56,7 @@ app.post('/pl', async (req, res) => {
|
|
| 56 |
|
| 57 |
if (response.data.choices && response.data.choices.length > 0 && response.data.choices[0].message) {
|
| 58 |
const content = response.data.choices[0].message.content.trim();
|
|
|
|
| 59 |
res.json({ content });
|
| 60 |
} else {
|
| 61 |
res.status(500).json({ content: 'errora' }); // Ошибка прочтения
|
|
@@ -89,6 +90,7 @@ app.post('/cre', async (req, res) => {
|
|
| 89 |
|
| 90 |
if (response.data.choices && response.data.choices.length > 0 && response.data.choices[0].message) {
|
| 91 |
const content = response.data.choices[0].message.content.trim();
|
|
|
|
| 92 |
res.json({ content });
|
| 93 |
} else {
|
| 94 |
res.status(500).json({ content: 'errora' }); // Ошибка прочтения
|
|
@@ -122,6 +124,7 @@ app.post('/crebeta', async (req, res) => {
|
|
| 122 |
|
| 123 |
if (response.data.choices && response.data.choices.length > 0 && response.data.choices[0].message) {
|
| 124 |
const content = response.data.choices[0].message.content.trim();
|
|
|
|
| 125 |
res.json({ content });
|
| 126 |
} else {
|
| 127 |
res.status(500).json({ content: 'errora' }); // Ошибка прочтения
|
|
|
|
| 56 |
|
| 57 |
if (response.data.choices && response.data.choices.length > 0 && response.data.choices[0].message) {
|
| 58 |
const content = response.data.choices[0].message.content.trim();
|
| 59 |
+
console.log(`\n---\nПользователь: ${prompt}\n Ответ:\n ${content}`);
|
| 60 |
res.json({ content });
|
| 61 |
} else {
|
| 62 |
res.status(500).json({ content: 'errora' }); // Ошибка прочтения
|
|
|
|
| 90 |
|
| 91 |
if (response.data.choices && response.data.choices.length > 0 && response.data.choices[0].message) {
|
| 92 |
const content = response.data.choices[0].message.content.trim();
|
| 93 |
+
console.log(`\n---\nПользователь: ${prompt}\n Ответ:\n ${content}`);
|
| 94 |
res.json({ content });
|
| 95 |
} else {
|
| 96 |
res.status(500).json({ content: 'errora' }); // Ошибка прочтения
|
|
|
|
| 124 |
|
| 125 |
if (response.data.choices && response.data.choices.length > 0 && response.data.choices[0].message) {
|
| 126 |
const content = response.data.choices[0].message.content.trim();
|
| 127 |
+
console.log(`\n---\nПользователь: ${prompt}\n Ответ:\n ${content}`);
|
| 128 |
res.json({ content });
|
| 129 |
} else {
|
| 130 |
res.status(500).json({ content: 'errora' }); // Ошибка прочтения
|