diff --git a/index.js b/index.js index 8381914..0ab2fed 100644 --- a/index.js +++ b/index.js @@ -213,7 +213,7 @@ function initChat() { }); } }); - const chatArgs = `-m "${modelPath}" --temp 0.3 --top_k 420 --top_p 0.9 --threads ${threads} --repeat_last_n 64`; + const chatArgs = `-m "${modelPath}" --temp 0.9 --top_k 420 --top_p 0.9 --threads ${threads} --repeat_last_n 64 --repeat_penalty 1.5`; if (platform == "win32") { runningShell.write(`[System.Console]::OutputEncoding=[System.Console]::InputEncoding=[System.Text.Encoding]::UTF8; ."${path.resolve(__dirname, "bin", supportsAVX2 ? "" : "no_avx2", "chat.exe")}" ${chatArgs}\r`); } else if (platform == "darwin") { diff --git a/src/renderer.js b/src/renderer.js index 03a4a71..9604210 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -304,7 +304,6 @@ ipcRenderer.on("result", async (_event, { data }) => { form.setAttribute("class", isRunningModel ? "running-model" : ""); }, 200); } else { - console.log(data); document.body.classList.remove("llama"); document.body.classList.remove("alpaca"); isRunningModel = true; @@ -315,9 +314,6 @@ ipcRenderer.on("result", async (_event, { data }) => { if (!responses[id]) { responses[id] = document.querySelector(`[data-id='${id}']`).innerHTML; } - response = response.replaceAll(//g, ">"); - console.log(response); responses[id] = responses[id] + response; @@ -354,6 +350,11 @@ ipcRenderer.on("result", async (_event, { data }) => { responses[id] = responses[id].replaceAll("\\begin{code}", `
`); //start codeblock
responses[id] = responses[id].replaceAll("\\end{code}", `
`); //end codeblock
+
+ //escape html tag
+ responses[id] = responses[id].replaceAll(//g, ">");
+
// if scroll is within 8px of the bottom, scroll to bottom
if (document.getElementById("bottom").getBoundingClientRect().y - 40 < window.innerHeight) {
setTimeout(() => {
@@ -501,6 +502,11 @@ document.getElementById("clear-chat").addEventListener("click", () => {
document.querySelectorAll("#messages li").forEach((element) => {
element.remove();
});
+ setTimeout(() => {
+ document.querySelectorAll("#messages li").forEach((element) => {
+ element.remove();
+ });
+ }, 100);
});
document.getElementById("change-model").addEventListener("click", () => {
ipcRenderer.send("getCurrentModel");