From dffc6bee74fdd4c3b973c3a9f608e85d3cc8bb52 Mon Sep 17 00:00:00 2001
From: Concedo <39025047+LostRuins@users.noreply.github.com>
Date: Sun, 1 Oct 2023 22:30:48 +0800
Subject: [PATCH] deprecate some launcher arguments.
---
klite.embd | 95 +++++++++++++++++++++++++++++++++++++++-------------
koboldcpp.py | 33 +++++++++++++-----
2 files changed, 95 insertions(+), 33 deletions(-)
diff --git a/klite.embd b/klite.embd
index 3a3864fe3..ccfedd89a 100644
--- a/klite.embd
+++ b/klite.embd
@@ -6,7 +6,7 @@ It requires no dependencies, installation or setup.
Just copy this single static HTML file anywhere and open it in a browser, or from a webserver.
Please go to https://github.com/LostRuins/lite.koboldai.net for updates on Kobold Lite.
Kobold Lite is under the AGPL v3.0 License for the purposes of koboldcpp. Please do not remove this line.
-Current version: 73
+Current version: 74
-Concedo
-->
@@ -2898,6 +2898,7 @@ Current version: 73
var horde_poll_nearly_completed = false; //if true, increase polling rate
var prev_hl_chunk = null; //will store the last highlighted element
var pending_context_preinjection = ""; //this will be injected before the AI's next RESPONSE
+ var last_reply_was_empty = false; //set to true if last reply is empty
var current_memory = ""; //stored memory
var current_anote = ""; //stored author note
var current_anotetemplate = "[Author\'s note: <|>]";
@@ -2951,7 +2952,7 @@ Current version: 73
autoscroll: true, //automatically scroll to bottom on render
trimsentences: true, //trim to last punctuation
trimwhitespace: false, //trim trailing whitespace
- unban_tokens: false, //allow the EOS token when using locally
+ eos_ban_mode: 0, //allow the EOS token when using locally 0=auto,1=unban,2=ban
opmode: 1, //what mode are we in? 1=story, 2=adventure, 3=chat, 4=instruct
adventure_is_action: false, //in adventure mode, determine story or action
adventure_context_mod: true, //extra injection for adventure mode
@@ -2966,6 +2967,7 @@ Current version: 73
beep_on: false,
image_styles: "",
grammar:"",
+ tokenstreaming: (localflag?true:false),
generate_images: (localflag?"":"stable_diffusion"), //"" is disabled and "*" is all, anything else is the model name pulled from stable horde
img_autogen: false,
img_allownsfw: true,
@@ -3105,12 +3107,6 @@ Current version: 73
}
}
- const tokenstreaming = urlParams.get('streaming');
- if(tokenstreaming)
- {
- document.getElementById("tokenstreaming").checked = true;
- }
-
const fromfile = ( window.location.protocol == 'file:' );
if(!dbgmode && !fromfile){
if(!window.console) window.console = {};
@@ -3145,6 +3141,12 @@ Current version: 73
console.log("Discarded invalid local save: " + e);
}
+ const tokenstreaming = urlParams.get('streaming');
+ if(tokenstreaming)
+ {
+ localsettings.tokenstreaming = true;
+ }
+
//toggle genimg btn
if (localsettings.generate_images) {
document.getElementById("btn_genimg").classList.remove("hidden");
@@ -3483,7 +3485,7 @@ Current version: 73
//0 is none, 1 is pseudostreaming, 2 is true streaming
function determine_streaming_type()
{
- let streamtype = (document.getElementById("tokenstreaming").checked ? 1 : 0);
+ let streamtype = (localsettings.tokenstreaming ? 1 : 0);
let pstreamamount = urlParams.get('streamamount');
if(streamtype==1 && is_using_kcpp_with_streaming() && (pstreamamount == null || pstreamamount <= 0))
{
@@ -3497,6 +3499,27 @@ Current version: 73
return streamtype;
}
+ function determine_if_ban_eos(input_was_empty) {
+ if (localsettings.eos_ban_mode == 0) {
+ if (localsettings.opmode == 1) {
+ return true; //story mode always ban
+ }
+ else if (localsettings.opmode == 3 && !localsettings.allow_continue_chat) {
+ return false; //chat mode always unban unless cont allowed
+ }
+ else if (!input_was_empty) //if user input is not empty, ALWAYS unban EOS.
+ {
+ return false;
+ }
+ else {
+ return last_reply_was_empty;
+ }
+ }
+ else {
+ return (localsettings.eos_ban_mode == 2 ? true : false);
+ }
+ }
+
function is_using_web_lite()
{
return (window.location.hostname.includes("koboldai.net") || window.location.hostname.includes("kaihordewebui.github.io"));
@@ -4703,6 +4726,15 @@ Current version: 73
}
}
}
+
+ function format_uptime(seconds)
+ {
+ const days = Math.floor(seconds / (3600 * 24));
+ const hours = Math.floor((seconds % (3600 * 24)) / 3600);
+ const minutes = Math.floor((seconds % 3600) / 60);
+ return days+"d "+hours+"h "+minutes+"m";
+ }
+
function show_workers() {
document.getElementById("workercontainer").classList.remove("hidden");
@@ -4729,7 +4761,7 @@ Current version: 73
allmdls += escapeHtml(elem.models[n].substring(0, 32));
}
- str += "
" + workerNameHtml + " | " + allmdls + " | " + elem.max_length + " / " + elem.max_context_length + " (" + tokenspersec + " T/s) | " + elem.uptime + " (" + elem.requests_fulfilled + " jobs) | " + elem.kudos_rewards.toFixed(0) + " | "+clustertag+" |
";
+ str += "" + workerNameHtml + " | " + allmdls + " | " + elem.max_length + " / " + elem.max_context_length + " (" + tokenspersec + " T/s) | " + format_uptime(elem.uptime) + " (" + elem.requests_fulfilled + " jobs) | " + elem.kudos_rewards.toFixed(0) + " | "+clustertag+" |
";
}
document.getElementById("workertable").innerHTML = str;
document.getElementById("worktitlecount").innerText = "Worker List - Total " + worker_data_showonly.length;
@@ -4757,7 +4789,7 @@ Current version: 73
let brokenstyle = (elem.maintenance_mode ? "style=\"color:#ee4444;\"" : "");
let workerNameHtml = escapeHtml(elem.name.substring(0, 32));
let eleminfo = ((elem.info && elem.info!="")?elem.info:"");
- str += "" + workerNameHtml + " | | " + elem.uptime + " (" + elem.requests_fulfilled + " jobs) | " + elem.kudos_rewards.toFixed(0) + " | "+(elem.online?"Online":"Offline")+" | |
";
+ str += "" + workerNameHtml + " | | " + format_uptime(elem.uptime) + " (" + elem.requests_fulfilled + " jobs) | " + elem.kudos_rewards.toFixed(0) + " | "+(elem.online?"Online":"Offline")+" | |
";
}
document.getElementById("myownworkertable").innerHTML = str;
@@ -5819,7 +5851,7 @@ Current version: 73
document.getElementById("invert_colors").checked = localsettings.invert_colors;
document.getElementById("trimsentences").checked = localsettings.trimsentences;
document.getElementById("trimwhitespace").checked = localsettings.trimwhitespace;
- document.getElementById("unban_tokens").checked = localsettings.unban_tokens;
+ document.getElementById("eos_ban_mode").value = localsettings.eos_ban_mode;
document.getElementById("persist_session").checked = localsettings.persist_session;
document.getElementById("opmode").value = localsettings.opmode;
document.getElementById("chatname").value = localsettings.chatname;
@@ -5912,6 +5944,7 @@ Current version: 73
sdmodelshtml += "