Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsPi3141 committed Mar 26, 2023
1 parent a43e117 commit cfbe2f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
14 changes: 10 additions & 4 deletions src/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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, "&lt;");
response = response.replaceAll(/>/g, "&gt;");
console.log(response);

responses[id] = responses[id] + response;

Expand Down Expand Up @@ -354,6 +350,11 @@ ipcRenderer.on("result", async (_event, { data }) => {
responses[id] = responses[id].replaceAll("\\begin{code}", `<pre><code>`); //start codeblock

responses[id] = responses[id].replaceAll("\\end{code}", `</code></pre>`); //end codeblock

//escape html tag
responses[id] = responses[id].replaceAll(/</g, "&lt;");
responses[id] = responses[id].replaceAll(/>/g, "&gt;");

// if scroll is within 8px of the bottom, scroll to bottom
if (document.getElementById("bottom").getBoundingClientRect().y - 40 < window.innerHeight) {
setTimeout(() => {
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit cfbe2f6

Please sign in to comment.