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
827a22638c
commit
6ebf81098d
1 changed files with 4 additions and 1 deletions
|
@ -872,9 +872,10 @@ def search():
|
|||
<script>
|
||||
|
||||
var word_last="";
|
||||
|
||||
var lock_chat=0;
|
||||
function send_chat()
|
||||
{
|
||||
if(lock_chat!=0) return;
|
||||
const knowledge = document.querySelector("#chat > p").innerHTML.replace(/<.*?>.*?<\/.*?>/g, '');
|
||||
let word = document.querySelector("#chat_input").value;
|
||||
if(word.length==0 || word.length > 140) return;
|
||||
|
@ -899,6 +900,7 @@ function send_chat()
|
|||
chatTextRaw = "提问:" + word + "\n回答:";
|
||||
text_offset = -1;
|
||||
const prev_chat = document.getElementById('chat').innerHTML;
|
||||
lock_chat=1
|
||||
fetch("https://api.openai.com/v1/engines/text-davinci-003/completions", options)
|
||||
.then((response) => {
|
||||
const reader = response.body.getReader();
|
||||
|
@ -911,6 +913,7 @@ const prev_chat = document.getElementById('chat').innerHTML;
|
|||
if(result == "[DONE]")
|
||||
{
|
||||
word_last += chatTextRaw
|
||||
lock_chat=0
|
||||
document.querySelector("#chat_input").value="";
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue