Spaces:
Running
Running
Update app.js
Browse files
app.js
CHANGED
|
@@ -130,11 +130,11 @@ app.post('/api/generate', async (req, res) => {
|
|
| 130 |
// ONLY CHANGE THIS — everything else in /api/generate stays identical
|
| 131 |
|
| 132 |
// BEFORE — stops at first block, returns undefined if thinking block comes first
|
| 133 |
-
|
| 134 |
|
| 135 |
// AFTER — scans all blocks, concatenates every text block found, ignores reasoning blocks
|
| 136 |
const contentBlocks = response.output?.message?.content || [];
|
| 137 |
-
|
| 138 |
.filter(b => b.text)
|
| 139 |
.map(b => b.text)
|
| 140 |
.join("") || null;
|
|
|
|
| 130 |
// ONLY CHANGE THIS — everything else in /api/generate stays identical
|
| 131 |
|
| 132 |
// BEFORE — stops at first block, returns undefined if thinking block comes first
|
| 133 |
+
let text = response.output.message.content.find(b => b.text)?.text;
|
| 134 |
|
| 135 |
// AFTER — scans all blocks, concatenates every text block found, ignores reasoning blocks
|
| 136 |
const contentBlocks = response.output?.message?.content || [];
|
| 137 |
+
text = contentBlocks
|
| 138 |
.filter(b => b.text)
|
| 139 |
.map(b => b.text)
|
| 140 |
.join("") || null;
|