data parsing improved

This commit is contained in:
mic 2025-01-06 21:49:05 +01:00
parent b235f803b7
commit dd48751adb

View file

@ -97,7 +97,7 @@ self.onmessage = async function(event) {
try{ try{
parsedLines = lines parsedLines = lines
.map((line) => line.replace(/^data: /, "").trim()) // Remove the "data: " prefix .map((line) => line.replace(/^data: /, "").trim()) // Remove the "data: " prefix
.filter((line) => line !== "" && line !== "[DONE]") // Remove empty lines and "[DONE]" .filter((line) => line !== "" ) // Remove empty lines
// .map((line) => JSON.parse(line)); // Parse the JSON string // .map((line) => JSON.parse(line)); // Parse the JSON string
.map((line) => { .map((line) => {
taLog.log("line: " + JSON.stringify(line)); taLog.log("line: " + JSON.stringify(line));