Update webapp.py

This commit is contained in:
Joseph Cheung 2023-02-24 10:57:55 +08:00
parent 6b5e7b523f
commit 4c4219027a

View file

@ -1168,22 +1168,7 @@ function chatmore()
chatTextRawPlusComment = chatTextRaw+"\n\n"; chatTextRawPlusComment = chatTextRaw+"\n\n";
text_offset = -1; text_offset = -1;
const optionsPlus = {
method: "POST",
headers: headers,
body: JSON.stringify({
"prompt": "围绕关键词 ''' + original_search_query + r'''结合你的知识总结归纳发表评论可以用emoji不得重复提及已有内容\n" + document.querySelector("#chat").innerHTML.replace(/<a.*?>.*?<\/a.*?>/g, '').replace(/<hr.*/gs, '').replace(/<[^>]+>/g,"").replace(/\n\n/g,"\n") +"\n",
"max_tokens": 1500,
"temperature": 0.7,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 2,
"best_of": 1,
"echo": false,
"logprobs": 0,
"stream": true
})
};
} }
@ -1249,6 +1234,22 @@ fetch("https://api.openai.com/v1/engines/text-davinci-003/completions", optionsI
document.querySelector("#chat_more").innerHTML = "" document.querySelector("#chat_more").innerHTML = ""
chatmore() chatmore()
const optionsPlus = {
method: "POST",
headers: headers,
body: JSON.stringify({
"prompt": "围绕关键词 ''' + original_search_query + r'''结合你的知识总结归纳发表评论可以用emoji不得重复提及已有内容\n" + document.querySelector("#chat").innerHTML.replace(/<a.*?>.*?<\/a.*?>/g, '').replace(/<hr.*/gs, '').replace(/<[^>]+>/g,"").replace(/\n\n/g,"\n") +"\n",
"max_tokens": 1500,
"temperature": 0.7,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 2,
"best_of": 1,
"echo": false,
"logprobs": 0,
"stream": true
})
};
fetch("https://api.openai.com/v1/engines/text-davinci-003/completions", optionsPlus) fetch("https://api.openai.com/v1/engines/text-davinci-003/completions", optionsPlus)
.then((responsePlusComment) => { .then((responsePlusComment) => {
const readerPlusComment = responsePlusComment.body.getReader(); const readerPlusComment = responsePlusComment.body.getReader();