forked from XiaoMo/ChatGPT-Next-Web
commit
4618c624c8
@ -103,12 +103,16 @@ export class ChatGPTApi implements LLMApi {
|
|||||||
return finish();
|
return finish();
|
||||||
}
|
}
|
||||||
if (text.length === 0) continue;
|
if (text.length === 0) continue;
|
||||||
|
try {
|
||||||
const json = JSON.parse(text);
|
const json = JSON.parse(text);
|
||||||
const delta = json.choices[0].delta.content;
|
const delta = json.choices[0].delta.content;
|
||||||
if (delta) {
|
if (delta) {
|
||||||
responseText += delta;
|
responseText += delta;
|
||||||
options.onUpdate?.(responseText, delta);
|
options.onUpdate?.(responseText, delta);
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("[Request] parse error", text, chunk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user