Skip to content

Commit

Permalink
Update chat.js
Browse files Browse the repository at this point in the history
Error from chat.js with the following error:
Uncaught (in promise) SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at chat.js:191:28
    at Array.forEach (<anonymous>)
    at promptGPT (chat.js:184:11)
Happening when 'data' value is 'data :', which corresponds to an empty json.

Signed-off-by: Xav-v <xavier.vauvelle@outlook.com>
  • Loading branch information
Xav-v authored May 21, 2024
1 parent 1a3dede commit 4810e42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/http/static/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function readInputImage() {
let dataDone = false;
const arr = value.split("\n");
arr.forEach((data) => {
if (data.length === 0) return;
if (data.length <= 6) return;
if (data.startsWith(":")) return;
if (data === "data: [DONE]") {
dataDone = true;
Expand Down

0 comments on commit 4810e42

Please sign in to comment.