desktop: fix response parsing

This commit is contained in:
Jeffrey Morgan 2023-06-27 17:39:26 -04:00
parent 01d2667f8b
commit 1459ffc9f3

View file

@ -39,7 +39,8 @@ async function generate(prompt: string, model: string, callback: (res: string) =
let decoder = new TextDecoder() let decoder = new TextDecoder()
let str = decoder.decode(value) let str = decoder.decode(value)
let re = /}{/g
let re = /}\s*{/g
str = '[' + str.replace(re, '},{') + ']' str = '[' + str.replace(re, '},{') + ']'
let messages = JSON.parse(str) let messages = JSON.parse(str)