mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-05-19 16:31:59 +00:00
add toggle for jinja tools
This commit is contained in:
parent
95291a93df
commit
357bef3082
2 changed files with 262 additions and 74 deletions
|
|
@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
|
|||
-->
|
||||
|
||||
<script id="init-config">
|
||||
const LITEVER = 296;
|
||||
const LITEVER = 297;
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
var localflag = urlParams.get('local'); //this will be replaced automatically in embedded kcpp
|
||||
const STORAGE_PREFIX = (localflag?"e_":"")+"kaihordewebui_";
|
||||
|
|
@ -232,6 +232,31 @@ Current version indicated by LITEVER below.
|
|||
--theme_color_topmenu: #002b36;
|
||||
}
|
||||
|
||||
.theme-6
|
||||
{
|
||||
--theme_color_bg_dark: #000000;
|
||||
--theme_color_bg: #151515;
|
||||
--theme_color_bg_outer: #000000;
|
||||
--theme_color_main: #6c224a;
|
||||
--theme_color_footer: #2c0c1d;
|
||||
--theme_color_text: #ffa8e2;
|
||||
--theme_color_input_text: #ffa8e2;
|
||||
--theme_color_highlight: #ba0f6c;
|
||||
--theme_color_border: #ba0f6c;
|
||||
--theme_color_border_highlight: #be347f;
|
||||
--theme_color_input_bg: #4f0336;
|
||||
--theme_color_disabled_bg: #3c0028;
|
||||
--theme_color_disabled_fg: #17000f;
|
||||
--theme_color_topbtn: #943267;
|
||||
--theme_color_topbtn_highlight: #943267;
|
||||
--theme_color_tabs: #540831;
|
||||
--theme_color_tabs_highlight: #d3348a;
|
||||
--theme_color_tabs_text: #e674c0;
|
||||
--theme_color_glow_text: #f399ca;
|
||||
--theme_color_placeholder_text: #9e9e9e;
|
||||
--theme_color_topmenu: #000000;
|
||||
}
|
||||
|
||||
body.connected.corpoui .topmenu {
|
||||
--theme_color_topmenu: #337ab7;
|
||||
}
|
||||
|
|
@ -703,11 +728,6 @@ Current version indicated by LITEVER below.
|
|||
gap: 2px;
|
||||
font-size: 12px;
|
||||
}
|
||||
@media (max-width: 340px) {
|
||||
.saveloadgrid {
|
||||
font-size: 8px;
|
||||
}
|
||||
}
|
||||
.btnicon-save
|
||||
{
|
||||
width: 16px;
|
||||
|
|
@ -1352,6 +1372,15 @@ Current version indicated by LITEVER below.
|
|||
.scenarioitem.yellow:focus {
|
||||
background-image: var(--img_compass),linear-gradient(to right, #6b5530, #6b5530);
|
||||
}
|
||||
.scenarioitem.brown {
|
||||
background-image: none, linear-gradient(to right, #a26f41, #73572f);
|
||||
}
|
||||
.scenarioitem.brown:hover {
|
||||
background-image: none, linear-gradient(to right, #ba7f4c, #8a693a);
|
||||
}
|
||||
.scenarioitem.brown:focus {
|
||||
background-image: none, linear-gradient(to right, #845a35, #523e22);
|
||||
}
|
||||
|
||||
.branchmenu {
|
||||
position: absolute;
|
||||
|
|
@ -2922,7 +2951,7 @@ Current version indicated by LITEVER below.
|
|||
|
||||
// whitelisted auto selected horde model names
|
||||
const defaultmodels = ["gpt4all","supercot","pygmalion-6","pygmalion-v8","pygmalion-2","hermes","airoboros","chrono","wizard","mantis","vicuna","manticore","alpaca","myth","xwin","spicyboros","mlewd","mxlewd","westlake","anubis","skyfall","llama2","llama3","llama-2","llama-3-","llama-3.","mistral","maid","mixtral","estopia","fighter","fimbul","euryale","nemo","gemma","lunaris","stheno","magnum","cydonia","qwen2.5-32b","behemoth","exaone","glm4","glm-4","tutu","deepseek"];
|
||||
const ignoredmodels = ["tinyllama","debug-","-1b"]; //blacklisted model names
|
||||
const ignoredmodels = ["tinyllama","debug-","-1b","-270m"]; //blacklisted model names
|
||||
|
||||
const instructstartplaceholder = "\n{{[INPUT]}}\n";
|
||||
const instructendplaceholder = "\n{{[OUTPUT]}}\n";
|
||||
|
|
@ -3546,6 +3575,7 @@ Current version indicated by LITEVER below.
|
|||
const PREVIEW_RES_PX = 200;
|
||||
const AVATAR_PX = 384;
|
||||
const SAVE_SLOTS = 12;
|
||||
const SCENARIO_SLOTS = 6;
|
||||
const num_regex_rows = 4;
|
||||
const default_websearch_template = "### New Task:\nFrom above text, rephrase the search engine query \"{{QUERY}}\" as a single short phrase (for search engines) using proper nouns, references and names to avoid ambiguity.\n\n### Rephrased Search Query Created:\n";
|
||||
|
||||
|
|
@ -3828,6 +3858,7 @@ Current version indicated by LITEVER below.
|
|||
no_compress_audio: false,
|
||||
autoguess_third_party:false,
|
||||
legacy_savefile:false,
|
||||
allow_continue_user_turn: false,
|
||||
|
||||
//section migrated from story itself
|
||||
extrastopseq: "",
|
||||
|
|
@ -8940,6 +8971,73 @@ Current version indicated by LITEVER below.
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
function kai_scenario_load(storyobj) //retain all current settings, but overwrite story and a few key items
|
||||
{
|
||||
temp_scenario = {
|
||||
"title":"Custom Scenario",
|
||||
"author":"Unknown",
|
||||
"desc":"Unknown",
|
||||
"prompt":"",
|
||||
"memory":"",
|
||||
"authorsnote": "",
|
||||
"worldinfo": []
|
||||
};
|
||||
if (storyobj.prompt != "") {
|
||||
temp_scenario.prompt += storyobj.prompt;
|
||||
}
|
||||
for (var i = 0; i < storyobj.actions.length; ++i) {
|
||||
temp_scenario.prompt += storyobj.actions[i];
|
||||
}
|
||||
if (storyobj.authorsnote) {
|
||||
temp_scenario.authorsnote = storyobj.authorsnote;
|
||||
}
|
||||
if (storyobj.memory) {
|
||||
temp_scenario.memory = storyobj.memory;
|
||||
}
|
||||
if (storyobj.worldinfo) {
|
||||
temp_scenario.worldinfo = storyobj.worldinfo;
|
||||
}
|
||||
if (storyobj.savedsettings) {
|
||||
if(storyobj.savedsettings.opmode)
|
||||
{
|
||||
temp_scenario.opmode = storyobj.savedsettings.opmode;
|
||||
}
|
||||
if(temp_scenario.opmode==1) //story
|
||||
{
|
||||
temp_scenario.gui_type = storyobj.savedsettings.gui_type_story?storyobj.savedsettings.gui_type_story:0;
|
||||
}
|
||||
else if(temp_scenario.opmode==2) //adventure
|
||||
{
|
||||
temp_scenario.adventure_context_mod = storyobj.savedsettings.adventure_context_mod?true:false;
|
||||
temp_scenario.adventure_switch_mode = 1;
|
||||
temp_scenario.gui_type = storyobj.savedsettings.gui_type_adventure?storyobj.savedsettings.gui_type_adventure:0;
|
||||
}
|
||||
else if(temp_scenario.opmode==3) //chat
|
||||
{
|
||||
temp_scenario.gui_type = storyobj.savedsettings.gui_type_chat?storyobj.savedsettings.gui_type_chat:0;
|
||||
}
|
||||
else if(temp_scenario.opmode==4) //instruct
|
||||
{
|
||||
temp_scenario.gui_type = storyobj.savedsettings.gui_type_instruct?storyobj.savedsettings.gui_type_instruct:0;
|
||||
}
|
||||
|
||||
if(temp_scenario.opmode==3 || (temp_scenario.opmode==4 && storyobj.savedsettings.inject_chatnames_instruct))
|
||||
{
|
||||
if(storyobj.savedsettings.chatopponent)
|
||||
{
|
||||
temp_scenario.chatopponent = storyobj.savedsettings.chatopponent;
|
||||
}
|
||||
if(storyobj.savedaestheticsettings && storyobj.savedaestheticsettings.AI_portrait && storyobj.savedaestheticsettings.portrait_ratio_AI)
|
||||
{
|
||||
temp_scenario.image = storyobj.savedaestheticsettings.AI_portrait;
|
||||
temp_scenario.image_aspect = parseFloat(storyobj.savedaestheticsettings.portrait_ratio_AI);
|
||||
}
|
||||
}
|
||||
}
|
||||
complete_load_scenario();
|
||||
}
|
||||
|
||||
function has_tavern_wi_check(obj)
|
||||
{
|
||||
let checkresult = false;
|
||||
|
|
@ -10323,7 +10421,8 @@ Current version indicated by LITEVER below.
|
|||
document.getElementById("quickstartcontainer").classList.remove("hidden");
|
||||
|
||||
let scenarios = ``;
|
||||
scenarios += `<button type="button" name="" class="scenarioitem purple btn btn-primary" onclick="hide_popups();document.getElementById('loadfileinput').click()">Load Save File or Character Card</button>`;
|
||||
scenarios += `<button type="button" name="" class="scenarioitem purple btn btn-primary" onclick="hide_popups();document.getElementById('loadfileinput').click()">Load Character Card or JSON File</button>`;
|
||||
scenarios += `<button type="button" name="" class="scenarioitem purple btn btn-primary" onclick="hide_popups();display_scenariolibrary();">Load or Save Custom Scenario</button>`;
|
||||
scenarios += `<button type="button" name="" class="scenarioitem purple btn btn-primary" onclick="character_creator()">New Character Creator</button>`;
|
||||
|
||||
for(let i=0;i<scenario_sources.length;++i) {
|
||||
|
|
@ -12677,6 +12776,7 @@ Current version indicated by LITEVER below.
|
|||
|
||||
var cachedsaveslotlabels = [];
|
||||
var netsaveslotlabels = [];
|
||||
var cachedsavescenariolabels = [];
|
||||
function saveloadchangeslot(updatelist=false)
|
||||
{
|
||||
let selectedslot = document.getElementById("saveslotselecteddropdown").value;
|
||||
|
|
@ -12684,8 +12784,10 @@ Current version indicated by LITEVER below.
|
|||
let selectedslotlabel = null;
|
||||
let choices = "";
|
||||
let foundoption = false;
|
||||
if(selectedlocation=="1") //local
|
||||
let locationdesc = document.getElementById("saveslotlocationtext");
|
||||
if(selectedlocation=="1") //local save
|
||||
{
|
||||
locationdesc.innerText = "Local Browser Storage stores the story and all settings.\nData is saved to a temporary cache and can be deleted by your browser. To avoid losing data, use the download save button.";
|
||||
for(let i=0;i<cachedsaveslotlabels.length;++i)
|
||||
{
|
||||
let testslot = cachedsaveslotlabels[i];
|
||||
|
|
@ -12700,6 +12802,7 @@ Current version indicated by LITEVER below.
|
|||
choices += `<option value=${i}${(selectedslot==i)?" selected":""}>${slotname}</option>`;
|
||||
}
|
||||
} else if(selectedlocation=="2") { //remote saves
|
||||
locationdesc.innerText = "KoboldCpp Remote Storage stores the story and all settings.\nData is saved to a database file in your KoboldCpp server.";
|
||||
for(let i=0;i<netsaveslotlabels.length;++i)
|
||||
{
|
||||
let testslot = netsaveslotlabels[i];
|
||||
|
|
@ -12713,6 +12816,23 @@ Current version indicated by LITEVER below.
|
|||
let slotname = (testslot?`Server Slot `+(lbl)+` - `+tsdesc+``:`Server Slot `+(lbl)+` - [ Empty ]`);
|
||||
choices += `<option value=${i}${(selectedslot==i)?" selected":""}>${slotname}</option>`;
|
||||
}
|
||||
}
|
||||
else if(selectedlocation=="3") //local scenario
|
||||
{
|
||||
locationdesc.innerText = "Local Scenario Library stores your story as a Custom Scenario, without any generation settings.\nData is saved to a temporary cache and can be deleted by your browser. To avoid losing data, use the download save button.";
|
||||
for(let i=0;i<cachedsavescenariolabels.length;++i)
|
||||
{
|
||||
let testslot = cachedsavescenariolabels[i];
|
||||
if(selectedslot==i)
|
||||
{
|
||||
selectedslotlabel = testslot;
|
||||
foundoption = true;
|
||||
}
|
||||
let lbl = (i+1);
|
||||
let tsdesc = (testslot.length>50)?testslot.substring(0,50)+"...":testslot;
|
||||
let slotname = (testslot?`Local Scenario `+(lbl)+` - `+tsdesc+``:`Local Scenario `+(lbl)+` - [ Empty ]`);
|
||||
choices += `<option value=${i}${(selectedslot==i)?" selected":""}>${slotname}</option>`;
|
||||
}
|
||||
}
|
||||
document.getElementById("loadfromslot").disabled = (selectedslotlabel?false:true);
|
||||
document.getElementById("downloadslot").disabled = (selectedslotlabel?false:true);
|
||||
|
|
@ -12747,6 +12867,11 @@ Current version indicated by LITEVER below.
|
|||
onDoneCallback(esid);
|
||||
});
|
||||
}
|
||||
function display_scenariolibrary()
|
||||
{
|
||||
document.getElementById("saveslotlocationdropdown").value = 3; //scenario library
|
||||
display_saveloadcontainer();
|
||||
}
|
||||
function display_saveloadcontainer()
|
||||
{
|
||||
mainmenu_untab(true);
|
||||
|
|
@ -12759,15 +12884,24 @@ Current version indicated by LITEVER below.
|
|||
}
|
||||
|
||||
let slotpromises = [];
|
||||
let scenariopromises = [];
|
||||
for(let i=0;i<SAVE_SLOTS;++i)
|
||||
{
|
||||
slotpromises.push(indexeddb_load("slot_"+i+"_meta",""));
|
||||
}
|
||||
for(let i=0;i<SCENARIO_SLOTS;++i)
|
||||
{
|
||||
scenariopromises.push(indexeddb_load("scenario_"+i+"_meta",""));
|
||||
}
|
||||
Promise.all(slotpromises).then(slotlabels=>
|
||||
{
|
||||
cachedsaveslotlabels = slotlabels;
|
||||
saveloadchangeslot(true);
|
||||
populate_corpo_leftpanel();
|
||||
Promise.all(scenariopromises).then(scenariolabels=>
|
||||
{
|
||||
cachedsaveslotlabels = slotlabels;
|
||||
cachedsavescenariolabels = scenariolabels;
|
||||
saveloadchangeslot(true);
|
||||
populate_corpo_leftpanel();
|
||||
});
|
||||
});
|
||||
if(is_using_kcpp_with_savedatafile())
|
||||
{
|
||||
|
|
@ -12796,7 +12930,7 @@ Current version indicated by LITEVER below.
|
|||
find_unused_saveslot((slot)=>{
|
||||
if(slot!=-1)
|
||||
{
|
||||
save_to_slot(slot,true,false);
|
||||
save_to_slot(slot,true,false,false);
|
||||
}else
|
||||
{
|
||||
msgbox("Unable to Save - No Available New Slots.","Storage Slots Full");
|
||||
|
|
@ -12810,40 +12944,47 @@ Current version indicated by LITEVER below.
|
|||
}
|
||||
else
|
||||
{
|
||||
save_to_slot(last_used_saveslot,true,false);
|
||||
save_to_slot(last_used_saveslot,true,false,false);
|
||||
}
|
||||
}
|
||||
function quickdelete()
|
||||
{
|
||||
if(last_used_saveslot!=-1)
|
||||
{
|
||||
delete_from_slot(last_used_saveslot,true,false);
|
||||
delete_from_slot(last_used_saveslot,true,false,false);
|
||||
}else
|
||||
{
|
||||
msgbox("Nothing to delete - Select a slot first.","No Action Taken");
|
||||
}
|
||||
}
|
||||
function save_to_slot(slot,islocal,showcontainer)
|
||||
function save_to_slot(slot,islocal,isscenario,showcontainer)
|
||||
{
|
||||
let defaultsavename = (localsettings.opmode==1?"Untitled Story":(localsettings.opmode==2?"Untitled Adventure":(localsettings.opmode==3?"Untitled Chat":"Untitled Instruct")));
|
||||
let savename = defaultsavename + " " + new Date().toLocaleString();
|
||||
let slotnumshown = (parseInt(slot)+1);
|
||||
let newcompressedstory = generate_compressed_story(true, true, true);
|
||||
if(islocal)
|
||||
if(islocal || isscenario)
|
||||
{
|
||||
indexeddb_load("slot_"+slot+"_meta","").then(testslot=>{
|
||||
if(isscenario)
|
||||
{
|
||||
savename = `Custom Scenario ${slotnumshown}`;
|
||||
}
|
||||
let metakey = (isscenario?"scenario_"+slot+"_meta":"slot_"+slot+"_meta");
|
||||
let datakey = (isscenario?"scenario_"+slot+"_data":"slot_"+slot+"_data");
|
||||
let lbltype = (isscenario?"Scenario":"Browser Storage Slot");
|
||||
indexeddb_load(metakey,"").then(testslot=>{
|
||||
if (testslot) {
|
||||
savename = testslot;
|
||||
}
|
||||
const slotwrite = function () {
|
||||
warn_unsaved = false;
|
||||
inputBox("Enter a label for this Browser Storage Slot data", "Enter a label", savename, defaultsavename, () => {
|
||||
inputBox(`Enter a label for this ${lbltype} data`, "Enter a label", savename, defaultsavename, () => {
|
||||
let userinput = getInputBoxValue();
|
||||
if (userinput.trim() == "") {
|
||||
userinput = defaultsavename;
|
||||
}
|
||||
indexeddb_save("slot_" + slot + "_data", newcompressedstory)
|
||||
indexeddb_save("slot_" + slot + "_meta", userinput).then(()=>{
|
||||
indexeddb_save(datakey, newcompressedstory)
|
||||
indexeddb_save(metakey, userinput).then(()=>{
|
||||
if(showcontainer)
|
||||
{
|
||||
display_saveloadcontainer();
|
||||
|
|
@ -12855,11 +12996,14 @@ Current version indicated by LITEVER below.
|
|||
}
|
||||
});
|
||||
});
|
||||
last_used_saveslot = slot;
|
||||
if(!isscenario)
|
||||
{
|
||||
last_used_saveslot = slot;
|
||||
}
|
||||
}
|
||||
|
||||
if (testslot) {
|
||||
msgboxYesNo("Overwrite existing story in Browser Storage Slot " + slotnumshown + "?", "Overwrite Browser Storage Slot " + slotnumshown, () => {
|
||||
msgboxYesNo(`Overwrite existing data in ${lbltype} ${slotnumshown}?`, `Overwrite ${lbltype} ${slotnumshown}`, () => {
|
||||
slotwrite();
|
||||
}, null);
|
||||
}
|
||||
|
|
@ -12922,17 +13066,29 @@ Current version indicated by LITEVER below.
|
|||
}
|
||||
}
|
||||
}
|
||||
function load_from_slot(slot,islocal,switch_to_corpo)
|
||||
function load_from_slot(slot,islocal,isscenario,switch_to_corpo)
|
||||
{
|
||||
const proceed_load_from_slot = function() {
|
||||
if(islocal)
|
||||
if(islocal || isscenario)
|
||||
{
|
||||
indexeddb_load("slot_"+slot+"_data","").then(loadedstorycompressed=>{
|
||||
let datakey = (isscenario?"scenario_"+slot+"_data":"slot_"+slot+"_data");
|
||||
indexeddb_load(datakey,"").then(loadedstorycompressed=>{
|
||||
if(loadedstorycompressed)
|
||||
{
|
||||
hide_popups();
|
||||
import_compressed_story(loadedstorycompressed,false);
|
||||
last_used_saveslot = slot;
|
||||
if(isscenario)
|
||||
{
|
||||
var story = decompress_story(loadedstorycompressed);
|
||||
if (story != null) {
|
||||
kai_scenario_load(story);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
import_compressed_story(loadedstorycompressed,false);
|
||||
last_used_saveslot = slot;
|
||||
}
|
||||
|
||||
if(switch_to_corpo)
|
||||
{
|
||||
localsettings.gui_type_chat = 3;
|
||||
|
|
@ -12981,10 +13137,17 @@ Current version indicated by LITEVER below.
|
|||
proceed_load_from_slot();
|
||||
}
|
||||
}
|
||||
function download_from_slot(slot,islocal)
|
||||
function download_from_slot(slot,islocal,isscenario)
|
||||
{
|
||||
let slotlabel = "";
|
||||
if(islocal)
|
||||
if(isscenario)
|
||||
{
|
||||
if(cachedsavescenariolabels && slot<cachedsavescenariolabels.length)
|
||||
{
|
||||
slotlabel = cachedsavescenariolabels[slot];
|
||||
}
|
||||
}
|
||||
else if(islocal)
|
||||
{
|
||||
if(cachedsaveslotlabels && slot<cachedsaveslotlabels.length)
|
||||
{
|
||||
|
|
@ -13012,9 +13175,10 @@ Current version indicated by LITEVER below.
|
|||
}
|
||||
};
|
||||
|
||||
if(islocal)
|
||||
if(islocal || isscenario)
|
||||
{
|
||||
indexeddb_load("slot_"+slot+"_data","").then(loadedstorycompressed=>{
|
||||
let datakey = (isscenario?"scenario_"+slot+"_data":"slot_"+slot+"_data");
|
||||
indexeddb_load(datakey,"").then(loadedstorycompressed=>{
|
||||
ondl(loadedstorycompressed);
|
||||
});
|
||||
}
|
||||
|
|
@ -13044,10 +13208,13 @@ Current version indicated by LITEVER below.
|
|||
});
|
||||
}
|
||||
}
|
||||
function delete_from_slot(slot,islocal,showcontainer)
|
||||
function delete_from_slot(slot,islocal,isscenario,showcontainer)
|
||||
{
|
||||
let slotnumshown = (parseInt(slot)+1);
|
||||
if (islocal) {
|
||||
if (islocal || isscenario) {
|
||||
let metakey = (isscenario?"scenario_"+slot+"_meta":"slot_"+slot+"_meta");
|
||||
let datakey = (isscenario?"scenario_"+slot+"_data":"slot_"+slot+"_data");
|
||||
let lbltype = (isscenario?"Scenario":"Browser Storage Slot");
|
||||
let postdel = function(){
|
||||
if(showcontainer)
|
||||
{
|
||||
|
|
@ -13059,11 +13226,11 @@ Current version indicated by LITEVER below.
|
|||
populate_corpo_leftpanel();
|
||||
}
|
||||
};
|
||||
msgboxYesNo("Delete story in Browser Storage Slot " + slotnumshown + "?", "Delete Browser Storage Slot " + slotnumshown, () => {
|
||||
indexeddb_save("slot_" + slot + "_data", "");
|
||||
indexeddb_save("slot_" + slot + "_meta", "").then(() => {
|
||||
msgboxYesNo(`Delete data in ${lbltype} ${slotnumshown}?`, `Delete ${lbltype} ${slotnumshown}`, () => {
|
||||
indexeddb_save(datakey, "");
|
||||
indexeddb_save(metakey, "").then(() => {
|
||||
postdel();
|
||||
if(slot==last_used_saveslot)
|
||||
if(!isscenario && slot==last_used_saveslot)
|
||||
{
|
||||
last_used_saveslot = -1;
|
||||
}
|
||||
|
|
@ -13113,28 +13280,32 @@ Current version indicated by LITEVER below.
|
|||
let selectedslot = document.getElementById("saveslotselecteddropdown").value;
|
||||
let selectedlocation = document.getElementById("saveslotlocationdropdown").value;
|
||||
let islocal = (selectedlocation=="1");
|
||||
save_to_slot(selectedslot,islocal,true);
|
||||
let isscenario = (selectedlocation=="3");
|
||||
save_to_slot(selectedslot,islocal,isscenario,true);
|
||||
}
|
||||
function load_from_curr_slot()
|
||||
{
|
||||
let selectedslot = document.getElementById("saveslotselecteddropdown").value;
|
||||
let selectedlocation = document.getElementById("saveslotlocationdropdown").value;
|
||||
let islocal = (selectedlocation=="1");
|
||||
load_from_slot(selectedslot,islocal,false);
|
||||
let isscenario = (selectedlocation=="3");
|
||||
load_from_slot(selectedslot,islocal,isscenario,false);
|
||||
}
|
||||
function download_from_curr_slot()
|
||||
{
|
||||
let selectedslot = document.getElementById("saveslotselecteddropdown").value;
|
||||
let selectedlocation = document.getElementById("saveslotlocationdropdown").value;
|
||||
let islocal = (selectedlocation=="1");
|
||||
download_from_slot(selectedslot,islocal);
|
||||
let isscenario = (selectedlocation=="3");
|
||||
download_from_slot(selectedslot,islocal,isscenario);
|
||||
}
|
||||
function delete_from_curr_slot()
|
||||
{
|
||||
let selectedslot = document.getElementById("saveslotselecteddropdown").value;
|
||||
let selectedlocation = document.getElementById("saveslotlocationdropdown").value;
|
||||
let islocal = (selectedlocation=="1");
|
||||
delete_from_slot(selectedslot,islocal,true);
|
||||
let isscenario = (selectedlocation=="3");
|
||||
delete_from_slot(selectedslot,islocal,isscenario,true);
|
||||
}
|
||||
|
||||
var cached_model_list = null;
|
||||
|
|
@ -13661,6 +13832,7 @@ Current version indicated by LITEVER below.
|
|||
document.getElementById("no_compress_audio").checked = localsettings.no_compress_audio;
|
||||
document.getElementById("autoguess_third_party").checked = localsettings.autoguess_third_party;
|
||||
document.getElementById("legacy_savefile").checked = localsettings.legacy_savefile;
|
||||
document.getElementById("allow_continue_user_turn").checked = localsettings.allow_continue_user_turn;
|
||||
document.getElementById("render_streaming_markdown").checked = localsettings.render_streaming_markdown;
|
||||
document.getElementById("min_p").value = localsettings.min_p;
|
||||
document.getElementById("dynatemp_range").value = localsettings.dynatemp_range;
|
||||
|
|
@ -14121,31 +14293,14 @@ Current version indicated by LITEVER below.
|
|||
document.body.classList.remove("invert_colors");
|
||||
}
|
||||
|
||||
document.body.classList.remove("theme-1");
|
||||
document.body.classList.remove("theme-2");
|
||||
document.body.classList.remove("theme-3");
|
||||
document.body.classList.remove("theme-4");
|
||||
document.body.classList.remove("theme-5");
|
||||
if(localsettings.colortheme==1)
|
||||
for(let i=1;i<=6;++i) //increment as more themes are added
|
||||
{
|
||||
document.body.classList.add("theme-1");
|
||||
}
|
||||
else if(localsettings.colortheme==2)
|
||||
{
|
||||
document.body.classList.add("theme-2");
|
||||
}
|
||||
else if(localsettings.colortheme==3)
|
||||
{
|
||||
document.body.classList.add("theme-3");
|
||||
}
|
||||
else if(localsettings.colortheme==4)
|
||||
{
|
||||
document.body.classList.add("theme-4");
|
||||
}
|
||||
else if(localsettings.colortheme==5)
|
||||
{
|
||||
document.body.classList.add("theme-5");
|
||||
}
|
||||
document.body.classList.remove(`theme-${i}`);
|
||||
if(localsettings.colortheme==i)
|
||||
{
|
||||
document.body.classList.add(`theme-${i}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function update_genimg_button_visiblility()
|
||||
|
|
@ -14268,6 +14423,7 @@ Current version indicated by LITEVER below.
|
|||
localsettings.no_compress_audio = (document.getElementById("no_compress_audio").checked ? true : false);
|
||||
localsettings.autoguess_third_party = (document.getElementById("autoguess_third_party").checked ? true : false);
|
||||
localsettings.legacy_savefile = (document.getElementById("legacy_savefile").checked ? true : false);
|
||||
localsettings.allow_continue_user_turn = (document.getElementById("allow_continue_user_turn").checked ? true : false);
|
||||
localsettings.render_streaming_markdown = (document.getElementById("render_streaming_markdown").checked ? true : false);
|
||||
if(document.getElementById("opmode").value==1)
|
||||
{
|
||||
|
|
@ -17163,7 +17319,7 @@ Current version indicated by LITEVER below.
|
|||
{
|
||||
newgen = wrap_newgen_instruct_format(newgen,true);
|
||||
let latest_human = is_instruct_latest_human_turn();
|
||||
if(newgen=="" && latest_human) //assume the user is trying to get the AI to respond even though there's no output tag
|
||||
if(!localsettings.allow_continue_user_turn && newgen=="" && latest_human) //assume the user is trying to get the AI to respond even though there's no output tag
|
||||
{
|
||||
//so we force one
|
||||
let iet = get_instructendplaceholder();
|
||||
|
|
@ -23006,7 +23162,7 @@ Current version indicated by LITEVER below.
|
|||
let entry = "";
|
||||
if(testslot)
|
||||
{
|
||||
entry = `<div onclick="load_from_slot(`+i+`, true, true)" class="corpo_leftpanel_btn" type="button">`+testslot+`</div>`;
|
||||
entry = `<div onclick="load_from_slot(`+i+`, true, false, true)" class="corpo_leftpanel_btn" type="button">`+testslot+`</div>`;
|
||||
}
|
||||
panelitems += entry;
|
||||
}
|
||||
|
|
@ -27252,6 +27408,7 @@ Current version indicated by LITEVER below.
|
|||
<option value="3">Shadow</option>
|
||||
<option value="4">Candy</option>
|
||||
<option value="5">Aqua</option>
|
||||
<option value="6">CherryPink</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -27287,6 +27444,11 @@ Current version indicated by LITEVER below.
|
|||
class="helptext">Adds extra data to the savefile for better legacy support. Will make your savefile much larger.</span></span></div>
|
||||
<input title="Legacy Savefile" type="checkbox" id="legacy_savefile" style="margin:0px 0px 0px 0px;">
|
||||
</div>
|
||||
<div class="settinglabel">
|
||||
<div class="justifyleft settingsmall">AllowContinueUserTurn <span class="helpicon">?<span
|
||||
class="helptext">In instruct mode, allows the AI to continue generating the user's turn when pressing Generate More.</span></span></div>
|
||||
<input title="Legacy Savefile" type="checkbox" id="allow_continue_user_turn" style="margin:0px 0px 0px 0px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settingitem wide">
|
||||
|
|
@ -27559,19 +27721,24 @@ Current version indicated by LITEVER below.
|
|||
<div style="overflow: auto;">
|
||||
<div id="saveloadentries" class="menutext saveloadgrid">
|
||||
<div style="display:flex">
|
||||
<button type="button" style="font-size:12px; margin:2px; padding-left:2px; padding-right:2px; width:33%" name="localsave" class="btn btn-primary" onclick="hide_popups();save_file_button()">💾<br>Download SaveFile</button>
|
||||
<button type="button" style="font-size:12px; margin:2px; padding-left:2px; padding-right:2px; width:33%" name="localsave" class="btn btn-primary" onclick="hide_popups();save_file_button()">💾<br>Download Save</button>
|
||||
<button type="button" style="font-size:12px; margin:2px; padding-left:2px; padding-right:2px; width:33%" name="localload" class="btn btn-primary" onclick="hide_popups();load_file_button()">📁<br>Open File</button>
|
||||
<button type="button" style="font-size:12px; margin:2px; padding-left:2px; padding-right:2px; width:34%" name="shareurl" class="btn btn-primary" onclick="hide_popups();share_story_button()">🌐<br>Share</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top:3px; text-align: center; align-self: center; width: 100%">
|
||||
<span style="font-weight:bold;text-decoration: underline;">Slot Storage Option</span>
|
||||
<span style="float:right; text-align: right;">
|
||||
<button type="button" class="btn btn-primary" style="font-size:10px;padding:2px 5px;margin-left:4px;margin:2px;" onclick="hide_popups();display_settings();display_settings_tab(4);">Configure</button>
|
||||
</span>
|
||||
</div>
|
||||
<div style="display:flex;">
|
||||
<div style="width: 92px; margin:8px; margin-left: 4px; margin-right: 4px; font-size: 14px;">Data Location</div>
|
||||
<div style="margin:3px; text-align: center; align-self: center; width: calc(100% - 94px);">
|
||||
<select title="Select Slot Location" style="padding:4px;" class="form-control" id="saveslotlocationdropdown" onchange="saveloadchangeslot(true)">
|
||||
<option value="1">Local Browser Cache</option>
|
||||
<option value="1">Local Browser Storage</option>
|
||||
<option value="2" id="kcppsaveavailable" class="hidden">KoboldCpp Server Storage</option>
|
||||
<option value="3">Local Scenario Library</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -27589,7 +27756,7 @@ Current version indicated by LITEVER below.
|
|||
<button type="button" id="deleteslot" title="Delete Slot" class="btn btn-primary" onclick="delete_from_curr_slot()"><img class="btnicon-delete"/> Delete Slot</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="menutext"><p style="padding:6px;font-size: 10px;" class="color_red">Caution: Local Storage Slots are saved to a temporary cache and can be deleted by your browser. KoboldCpp remote storage will save data to a file in your KoboldCpp server. To avoid losing data, use the download file button.</p></div>
|
||||
<div class="menutext"><p style="padding:6px;font-size: 10px;" id="saveslotlocationtext"></p></div>
|
||||
<div class="popupfooter">
|
||||
<button type="button" class="btn btn-primary" id=""
|
||||
onclick="hide_popups()">Back</button>
|
||||
|
|
|
|||
25
koboldcpp.py
25
koboldcpp.py
|
|
@ -4207,6 +4207,10 @@ Change Mode<br>
|
|||
is_embeddings = False
|
||||
response_body = None
|
||||
use_jinja = args.jinja
|
||||
if use_jinja and not args.jinja_tools:
|
||||
tmptools = genparams.get('tools', [])
|
||||
if tmptools and len(tmptools) > 0:
|
||||
use_jinja = False # not allowed to use tools with jinja
|
||||
|
||||
if self.path.endswith('/api/admin/check_state'):
|
||||
if global_memory and args.admin and args.admindir and os.path.exists(args.admindir) and self.check_header_password(args.adminpassword):
|
||||
|
|
@ -4902,6 +4906,7 @@ def show_gui():
|
|||
togglectxshift(1,1,1)
|
||||
togglehorde(1,1,1)
|
||||
toggletaesd(1,1,1)
|
||||
togglejinja(1,1,1)
|
||||
tabbuttonaction(tabnames[curr_tab_idx])
|
||||
|
||||
if sys.platform=="darwin":
|
||||
|
|
@ -5001,6 +5006,7 @@ def show_gui():
|
|||
customrope_nativectx = ctk.StringVar(value=str(default_native_ctx))
|
||||
chatcompletionsadapter_var = ctk.StringVar(value="AutoGuess")
|
||||
jinja_var = ctk.IntVar(value=0)
|
||||
jinja_tools_var = ctk.IntVar(value=0)
|
||||
moeexperts_var = ctk.StringVar(value=str(-1))
|
||||
moecpu_var = ctk.StringVar(value=str(0))
|
||||
defaultgenamt_var = ctk.StringVar(value=str(768))
|
||||
|
|
@ -5713,7 +5719,16 @@ def show_gui():
|
|||
quantkv_var.trace_add("write", toggleflashattn)
|
||||
makecheckbox(tokens_tab, "No BOS Token", nobostoken_var, 43, tooltiptxt="Prevents BOS token from being added at the start of any prompt. Usually NOT recommended for most models.")
|
||||
makecheckbox(tokens_tab, "Enable Guidance", enableguidance_var, 43,padx=(200 if corrupt_scaler else 140), tooltiptxt="Enables the use of Classifier-Free-Guidance, which allows the use of negative prompts. Has performance and memory impact.")
|
||||
makecheckbox(tokens_tab, "Use Jinja", jinja_var, row=45, tooltiptxt="Enables using jinja chat template formatting for chat completions endpoint. Other endpoints are unaffected.")
|
||||
def togglejinja(a,b,c):
|
||||
if jinja_var.get()==1:
|
||||
jinjatoolsbox.grid()
|
||||
else:
|
||||
jinja_tools_var.set(0)
|
||||
jinjatoolsbox.grid_remove()
|
||||
changed_gpulayers_estimate()
|
||||
makecheckbox(tokens_tab, "Use Jinja", jinja_var, row=45, command=togglejinja, tooltiptxt="Enables using jinja chat template formatting for chat completions endpoint. Other endpoints are unaffected.")
|
||||
jinjatoolsbox = makecheckbox(tokens_tab, "Jinja for Tools", jinja_tools_var, row=45 ,padx=(200 if corrupt_scaler else 140), tooltiptxt="Allows jinja even with tool calls. If unchecked, jinja will be disabled when tools are used.")
|
||||
jinja_var.trace_add("write", togglejinja)
|
||||
makelabelentry(tokens_tab, "MoE Experts:", moeexperts_var, row=55, padx=(220 if corrupt_scaler else 120), singleline=True, tooltip="Override number of MoE experts.")
|
||||
makelabelentry(tokens_tab, "MoE CPU Layers:", moecpu_var, row=55, padx=(490 if corrupt_scaler else 320), singleline=True, tooltip="Force Mixture of Experts (MoE) weights of the first N layers to the CPU.\nSetting it higher than GPU layers has no effect.", labelpadx=(300 if corrupt_scaler else 210))
|
||||
makelabelentry(tokens_tab, "Override KV:", override_kv_var, row=57, padx=(220 if corrupt_scaler else 120), singleline=True, width=150, tooltip="Override metadata value by key. Separate multiple values with commas. Format is name=type:value. Types: int, float, bool, str")
|
||||
|
|
@ -5914,6 +5929,7 @@ def show_gui():
|
|||
toggleflashattn(1,1,1)
|
||||
togglectxshift(1,1,1)
|
||||
togglehorde(1,1,1)
|
||||
togglejinja(1,1,1)
|
||||
|
||||
# launch
|
||||
def guilaunch():
|
||||
|
|
@ -6026,6 +6042,7 @@ def show_gui():
|
|||
args.genlimit = int(genlimit_var.get()) if genlimit_var.get()!="" else 0
|
||||
args.nobostoken = (nobostoken_var.get()==1)
|
||||
args.jinja = (jinja_var.get()==1)
|
||||
args.jinja_tools = (jinja_tools_var.get()==1)
|
||||
args.enableguidance = (enableguidance_var.get()==1)
|
||||
args.overridekv = None if override_kv_var.get() == "" else override_kv_var.get()
|
||||
args.overridetensors = None if override_tensors_var.get() == "" else override_tensors_var.get()
|
||||
|
|
@ -6266,6 +6283,7 @@ def show_gui():
|
|||
genlimit_var.set(str(0))
|
||||
nobostoken_var.set(dict["nobostoken"] if ("nobostoken" in dict) else 0)
|
||||
jinja_var.set(dict["jinja"] if ("jinja" in dict) else 0)
|
||||
jinja_tools_var.set(dict["jinja_tools"] if ("jinja_tools" in dict) else 0)
|
||||
enableguidance_var.set(dict["enableguidance"] if ("enableguidance" in dict) else 0)
|
||||
if "overridekv" in dict and dict["overridekv"]:
|
||||
override_kv_var.set(dict["overridekv"])
|
||||
|
|
@ -6725,6 +6743,8 @@ def convert_invalid_args(args):
|
|||
dict["sdclip1"] = dict["sdclipl"]
|
||||
if "sdclipg" in dict and "sdclip2" not in dict:
|
||||
dict["sdclip2"] = dict["sdclipg"]
|
||||
if "jinja_tools" in dict and dict["jinja_tools"]:
|
||||
dict["jinja"] = True
|
||||
return args
|
||||
|
||||
def setuptunnel(global_memory, has_sd):
|
||||
|
|
@ -8156,7 +8176,8 @@ if __name__ == '__main__':
|
|||
advparser.add_argument("--ratelimit", metavar=('[seconds]'), help="If enabled, rate limit generative request by IP address. Each IP can only send a new request once per X seconds.", type=int, default=0)
|
||||
advparser.add_argument("--ignoremissing", help="Ignores all missing non-essential files, just skipping them instead.", action='store_true')
|
||||
advparser.add_argument("--chatcompletionsadapter", metavar=('[filename]'), help="Select an optional ChatCompletions Adapter JSON file to force custom instruct tags.", default="AutoGuess")
|
||||
advparser.add_argument("--jinja", help="Enables using jinja chat template formatting for chat completions endpoint. Other endpoints are unaffected.", action='store_true')
|
||||
advparser.add_argument("--jinja", help="Enables using jinja chat template formatting for chat completions endpoint. Other endpoints are unaffected. Tool calls are done without jinja.", action='store_true')
|
||||
advparser.add_argument("--jinja_tools","--jinja-tools", help="Enables using jinja chat template formatting for chat completions endpoint. Other endpoints are unaffected. Tool calls are done with jinja.", action='store_true')
|
||||
advparser.add_argument("--flashattention","--flash-attn","-fa", help="Enables flash attention.", action='store_true')
|
||||
advparser.add_argument("--lowvram","-nkvo","--no-kv-offload", help="If supported by the backend, do not offload KV to GPU (lowvram mode). Not recommended, will be slow.", action='store_true')
|
||||
advparser.add_argument("--quantkv", help="Sets the KV cache data type quantization, 0=f16, 1=q8, 2=q4. Requires Flash Attention for full effect, otherwise only K cache is quantized.",metavar=('[quantization level 0/1/2]'), type=int, choices=[0,1,2], default=0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue