Fix ollama chunk wrapper

This commit is contained in:
Cohee
2023-12-19 19:17:19 +02:00
parent c7b93b690f
commit 6859e4443e

View File

@ -31,7 +31,8 @@ async function parseOllamaStream(jsonStream, request, response) {
break;
}
const text = json.response || '';
response.write(`data: {"choices": [{"text": "${text}"}]}\n\n`);
const chunk = { choices: [{ text }] };
response.write(`data: ${JSON.stringify(chunk)}\n\n`);
partialData = '';
}
});