🚀 Auto-deploy: BrainWind atualizado em 15/07/2026 14:30:52

This commit is contained in:
2026-07-15 14:30:52 +00:00
parent 310a19c001
commit 5f0329c400
2 changed files with 68 additions and 3 deletions
+7 -3
View File
@@ -151,13 +151,17 @@ async function callMinimax(
const reader = response.body.getReader();
const decoder = new TextDecoder('utf-8');
let fullText = '';
let buffer = '';
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value, { stream: true });
const lines = chunk.split('\n').filter(l => l.trim().startsWith('data: '));
for (const line of lines) {
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split('\n');
buffer = lines.pop() || '';
for (const rawLine of lines) {
const line = rawLine.trim();
if (!line.startsWith('data: ')) continue;
const jsonStr = line.replace(/^data: /, '').trim();
if (jsonStr === '[DONE]') continue;
try {