diff --git a/src/pages/background/lib/infra/chatGPT.ts b/src/pages/background/lib/infra/chatGPT.ts index 3a4d1e6..307f14e 100644 --- a/src/pages/background/lib/infra/chatGPT.ts +++ b/src/pages/background/lib/infra/chatGPT.ts @@ -99,7 +99,8 @@ async function parseResult( let result = ""; while (reader) { - const { value, done } = await reader.read(); + const { value: _value, done } = await reader.read(); + const value = (_value as string).trim(); if (done) { break; } @@ -125,7 +126,8 @@ async function parseResult( const parseToJSON = (line: string) => { try { return JSON.parse(line); - } catch { + } catch (e) { + console.error(e); return; } };