Spaces:
Sleeping
Sleeping
Update index.js
Browse files
index.js
CHANGED
@@ -580,13 +580,13 @@ async function handleResponse(response, model, res, isStream) {
|
|
580 |
for (const line of lines) {
|
581 |
if (!line.trim()) continue;
|
582 |
const trimmedLine = line.trim();
|
|
|
583 |
if (trimmedLine.startsWith('data: ')) {
|
584 |
const data = trimmedLine.substring(6);
|
585 |
try {
|
586 |
if (!data.trim()) continue;
|
587 |
if(data === "[DONE]") continue;
|
588 |
const linejosn = JSON.parse(data);
|
589 |
-
console.log(linejosn)
|
590 |
if (linejosn?.error) {
|
591 |
Logger.error(JSON.stringify(linejosn,null,2), 'Server');
|
592 |
stream.destroy();
|
|
|
580 |
for (const line of lines) {
|
581 |
if (!line.trim()) continue;
|
582 |
const trimmedLine = line.trim();
|
583 |
+
console.log(trimmedLine)
|
584 |
if (trimmedLine.startsWith('data: ')) {
|
585 |
const data = trimmedLine.substring(6);
|
586 |
try {
|
587 |
if (!data.trim()) continue;
|
588 |
if(data === "[DONE]") continue;
|
589 |
const linejosn = JSON.parse(data);
|
|
|
590 |
if (linejosn?.error) {
|
591 |
Logger.error(JSON.stringify(linejosn,null,2), 'Server');
|
592 |
stream.destroy();
|