Update webapp.py

This commit is contained in:
Joseph Cheung 2023-02-21 23:44:29 +08:00
parent f1b4101e83
commit 827a22638c

View file

@ -915,11 +915,11 @@ const prev_chat = document.getElementById('chat').innerHTML;
return; return;
} }
const { choices } = JSON.parse(result); const { choices } = JSON.parse(result);
if(choices[0].logprobes.text_offset[0] > text_offset) if(choices[0].logprobs.text_offset[0] > text_offset)
{ {
chatTextRaw+=choices[0].text chatTextRaw+=choices[0].text
text_offset = choices[0].logprobes.text_offset[choices[0].logprobes.text_offset.length - 1] text_offset = choices[0].logprobs.text_offset[choices[0].logprobs.text_offset.length - 1]
} }
document.querySelector("#prompt").innerHTML=""; document.querySelector("#prompt").innerHTML="";
@ -1017,10 +1017,10 @@ let prompt = JSON.parse(document.querySelector("#prompt").textContent);
return; return;
} }
const { choices } = JSON.parse(result); const { choices } = JSON.parse(result);
if(choices[0].logprobes.text_offset[0] > text_offset) if(choices[0].logprobs.text_offset[0] > text_offset)
{ {
chatTextRaw+=choices[0].text chatTextRaw+=choices[0].text
text_offset = choices[0].logprobes.text_offset[choices[0].logprobes.text_offset.length - 1] text_offset = choices[0].logprobs.text_offset[choices[0].logprobs.text_offset.length - 1]
} }
markdownToHtml(beautify(chatTextRaw), document.getElementById('chat')); markdownToHtml(beautify(chatTextRaw), document.getElementById('chat'));