mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-11 16:26:59 +00:00
desktop: fix response parsing
This commit is contained in:
@@ -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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user