Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
@@ -82,11 +82,11 @@ app.post('/gen', async (req, res) => {
|
|
82 |
});
|
83 |
|
84 |
if (response.data.choices && response.data.choices.length > 0 && response.data.choices[0].message) {
|
85 |
-
const content = response.data
|
86 |
-
console.log(
|
87 |
-
res.json({ content });
|
88 |
} else {
|
89 |
-
const content = response
|
90 |
console.log(content);
|
91 |
res.json({ content: '+ошибка+❌ Не удалось прочитать ответ.-ошибка-' });
|
92 |
}
|
|
|
82 |
});
|
83 |
|
84 |
if (response.data.choices && response.data.choices.length > 0 && response.data.choices[0].message) {
|
85 |
+
const content = JSON.parse(response.data);
|
86 |
+
console.log(response.data);
|
87 |
+
res.json({ content.candidates[0].content.parts.map(part => part.text).join(''); });
|
88 |
} else {
|
89 |
+
const content = response;
|
90 |
console.log(content);
|
91 |
res.json({ content: '+ошибка+❌ Не удалось прочитать ответ.-ошибка-' });
|
92 |
}
|