mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Update webapp.py
This commit is contained in:
parent
297db17e6b
commit
f1b4101e83
1 changed files with 2 additions and 1 deletions
|
@ -880,7 +880,6 @@ function send_chat()
|
||||||
if(word.length==0 || word.length > 140) return;
|
if(word.length==0 || word.length > 140) return;
|
||||||
if(word_last.length>500)word_last.slice(500)
|
if(word_last.length>500)word_last.slice(500)
|
||||||
let prompt = "已知:"+knowledge+"\n" + word_last +"\n"+"提问:" + word + "\n回答:";
|
let prompt = "已知:"+knowledge+"\n" + word_last +"\n"+"提问:" + word + "\n回答:";
|
||||||
word_last += word;
|
|
||||||
const options = {
|
const options = {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: headers,
|
headers: headers,
|
||||||
|
@ -911,12 +910,14 @@ const prev_chat = document.getElementById('chat').innerHTML;
|
||||||
if(v.length>6) result = v.slice(6);
|
if(v.length>6) result = v.slice(6);
|
||||||
if(result == "[DONE]")
|
if(result == "[DONE]")
|
||||||
{
|
{
|
||||||
|
word_last += chatTextRaw
|
||||||
document.querySelector("#chat_input").value="";
|
document.querySelector("#chat_input").value="";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { choices } = JSON.parse(result);
|
const { choices } = JSON.parse(result);
|
||||||
if(choices[0].logprobes.text_offset[0] > text_offset)
|
if(choices[0].logprobes.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].logprobes.text_offset[choices[0].logprobes.text_offset.length - 1]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue