Browse Source

desktop: fix response parsing

Jeffrey Morgan 1 năm trước cách đây
mục cha
commit
1459ffc9f3
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      desktop/src/app.tsx

+ 2 - 1
desktop/src/app.tsx

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