This commit is contained in:
shaoyongjun 2024-05-20 11:18:28 +08:00
parent f7d1730c8f
commit 9b2676e8a0

View File

@ -184,14 +184,14 @@
} }
// 历史消息 // 历史消息
const messagesList = []; // const messagesList = [];
// 调用api // 调用api
function chatApi(msg) { function chatApi(msg) {
slideBottom(); slideBottom();
messagesList.push({role: "user", content: msg}); // messagesList.push({role: "user", content: msg});
const body = JSON.stringify({model: "google/gemma-7b-it:free", messages: messagesList}); const body = JSON.stringify({model: "google/gemma-7b-it:free", messages: [{role: "user", content: msg}]});
// alert(body) // alert(body)
$.ajax({ $.ajax({
method: 'POST', method: 'POST',
@ -254,7 +254,7 @@
}); });
// 回车监听事件 // 回车监听事件
document.addEventListener("keydown", function (event) { document.addEventListener("keydown", function (event) {
if (event.keyCode === 13) { if (event.key === 'Enter') {
console.log(focus); console.log(focus);
if (focus) { if (focus) {
submit.click(); submit.click();