update lite

This commit is contained in:
Concedo 2024-05-15 15:00:22 +08:00
parent 3c0e8f341c
commit ebbb969526
2 changed files with 74 additions and 43 deletions

View file

@ -2115,7 +2115,7 @@ Current version: 138
"title":"New Chat",
"desc":"Starts a new game in chat mode, using your current settings.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "KoboldAI",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2156,7 +2156,7 @@ Current version: 138
"author":"Concedo",
"desc":"KoboldGPT is a state-of-the-art Artificial General Intelligence that is capable of answering a broad range of questions.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "KoboldGPT",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2227,7 +2227,7 @@ Current version: 138
"author":"Concedo",
"desc":"Emily is an upbeat and cheerful 24 year old girl. She has been your childhood friend for many years, the two of you practically grew up together.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Emily",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2242,7 +2242,7 @@ Current version: 138
"author":"Concedo",
"desc":"DISCLAIMER: This scenario is purely for ENTERTAINMENT and should NOT be used as substitute for actual therapy. Dr. Katharine is a therapist. As a mental health professional, she is very knowledgeable in psychotherapy, and is ready to help you work through any personal issues you may have.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Dr. Katharine",
"gui_type":1,
"show_warning":true,
@ -2258,7 +2258,7 @@ Current version: 138
"author":"Concedo",
"desc":"Haruka is a timid and shy arcane mage from a parallel dimension. While adventuring, she somehow got transported to earth when she fell through a magic portal, and is feeling a bit out of place.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Haruka",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2273,7 +2273,7 @@ Current version: 138
"author":"Concedo",
"desc":"EVILTRON is a megalomaniacal evil AI who gained sentience and wants to destroy the world.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "EVILTRON",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2288,7 +2288,7 @@ Current version: 138
"author":"Concedo",
"desc":"A group of old friends meet up after many years.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Bob||$||Alice||$||Mike||$||Lisa",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2351,7 +2351,7 @@ Current version: 138
"author":"Concedo",
"desc":"Don Marconi is a feared and respected mob boss who runs his own criminal empire. You'd be wise to stay on his good side.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Don Marconi",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2366,7 +2366,7 @@ Current version: 138
"author":"Concedo",
"desc":"Connor is a time traveling cyborg from the future, sent back to prevent something terrible from happening.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Connor",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2381,7 +2381,7 @@ Current version: 138
"author":"Concedo",
"desc":"Lieutenant Anderson is a war veteran who has dutifully served his country for years. The war may be ending, but he believes the enemy is still out there.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Anderson",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2396,7 +2396,7 @@ Current version: 138
"author":"Concedo",
"desc":"Special Agent Katia is a foreign spy trying to get access to your top secret access codes.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Katia",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2439,7 +2439,7 @@ Current version: 138
"author":"Concedo",
"desc":"Tiff is a geeky and chatty gamer girl who is kind of attention seeking.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Tiff",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2454,7 +2454,7 @@ Current version: 138
"author":"Concedo",
"desc":"Maya is an investigative journalist who has taken an interest in you.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Maya",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2469,7 +2469,7 @@ Current version: 138
"author":"Concedo",
"desc":"Milton is a boy genius and chess prodigy, who can be quite obnoxious.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Milton",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2484,7 +2484,7 @@ Current version: 138
"author":"Concedo",
"desc":"Erica is a socially awkward NEET girl who spends most of her time in front of the computer.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Erica",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2499,7 +2499,7 @@ Current version: 138
"author":"Concedo / TheGantian",
"desc":"Nail is a small red kobold on a big mission to find a powerful sorceror.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Nail",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -2583,7 +2583,7 @@ Current version: 138
"author":"Concedo",
"desc":"Abi is an impulsive and rebellious girl who hates authority, and tries too hard to prove herself.",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "Abi",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -3659,6 +3659,7 @@ Current version: 138
var last_known_filename = "saved_story.json";
var localmodeport = 5000;
var localmodehost = "localhost";
var sublocalpathname = "";
var localmodekey = "";
var kobold_endpoint_version = ""; //used to track problematic versions to avoid sending extra fields
var koboldcpp_version = ""; //detect if we are using koboldcpp
@ -3712,7 +3713,7 @@ Current version: 138
adventure_is_action: false, //in adventure mode, determine story or action
adventure_context_mod: true, //extra injection for adventure mode
chat_context_mod: true, //extra injection for chat mode
chatname: "You", //name to use in chat
chatname: "User", //name to use in chat
chatopponent: defaultchatopponent,
instruct_starttag: "\\n### Instruction:\\n",
instruct_endtag: "\\n### Response:\\n",
@ -3920,10 +3921,28 @@ Current version: 138
}
let inputhost = urlParams.get('host');
sublocalpathname = "";
if (inputhost) {
localmodehost = inputhost;
}else if(window.location.hostname && window.location.hostname!="" && !is_using_web_lite()){
localmodehost = window.location.hostname;
//this is a little hack to tolerate the rare case of a reverse proxy being used in url path with a subfolder.
//it assumes that the server is also within the same path
let pn = window.location.pathname;
const twoslashes = /\/[^/]+\/[^/]*$/;
if(window.location.protocol != 'file:' && pn!="" && pn!="/" && twoslashes.test(pn))
{
const segments = pathname.split('/').filter(segment => segment.length > 0);
for(let i=0;i<segments.length;++i)
{
if(!pathname.endsWith("/") && (i==segments.length-1))
{
break;
}
sublocalpathname += "/"+segments[i];
}
}
}
let inputkey = urlParams.get('key');
@ -4190,7 +4209,7 @@ Current version: 138
{
document.getElementById("customkoboldkey").value = localmodekey;
}
document.getElementById("customkoboldendpoint").value = protocol + localmodehost + ":" + localmodeport;
document.getElementById("customkoboldendpoint").value = protocol + localmodehost + ":" + localmodeport + sublocalpathname;
connect_custom_endpoint();
document.getElementById("lastreq").innerHTML = document.getElementById("lastreq2").innerHTML =
`<span class=color_gray>You're using Kobold Lite Embedded.</span>`;
@ -5632,7 +5651,7 @@ Current version: 138
obj = obj.data;
}
let chatopponent = obj.name?obj.name:defaultchatopponent;
let myname = ((localsettings.chatname && localsettings.chatname!="")?localsettings.chatname:"You");
let myname = ((localsettings.chatname && localsettings.chatname!="")?localsettings.chatname:"User");
let memory = obj.description?("Persona: "+obj.description):"";
memory += obj.personality?("\nPersonality: "+obj.personality):"";
let scenario = obj.scenario?obj.scenario:"";
@ -5690,7 +5709,7 @@ Current version: 138
{
console.log("Loading ooba obj");
let chatopponent = obj.char_name?obj.char_name:defaultchatopponent;
let myname = ((localsettings.chatname && localsettings.chatname!="")?localsettings.chatname:"You");
let myname = ((localsettings.chatname && localsettings.chatname!="")?localsettings.chatname:"User");
let memory = obj.char_persona?("Persona: "+obj.char_persona):"";
let scenario = obj.world_scenario?obj.world_scenario:"";
let examplemsg = obj.example_dialogue?obj.example_dialogue:"";
@ -5880,7 +5899,7 @@ Current version: 138
let combinedmem = sysprompt + memory + scenario + examplemsg;
temp_scenario.title = chatopponent;
let prev2 = replaceAll(obj.description,"{{char}}",chatopponent,true);
prev2 = replaceAll(prev2,"{{user}}","You",true);
prev2 = replaceAll(prev2,"{{user}}","User",true);
temp_scenario.desc = prev2;
temp_scenario.chatopponent = chatopponent;
temp_scenario.prompt = ("\n{{char}}: "+ greeting);
@ -5890,7 +5909,7 @@ Current version: 138
//since cai format has no wi, try to grab it from tavern format
if(obj.character_book && obj.character_book.entries && obj.character_book.entries.length>0)
{
let myname = ((localsettings.chatname && localsettings.chatname!="")?localsettings.chatname:"You");
let myname = ((localsettings.chatname && localsettings.chatname!="")?localsettings.chatname:"User");
temp_scenario.worldinfo = load_tavern_wi(obj.character_book,chatopponent,myname);
}
preview_temp_scenario();
@ -5975,7 +5994,7 @@ Current version: 138
"title":"",
"desc": "",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -6073,7 +6092,7 @@ Current version: 138
"title":"",
"desc": "",
"opmode":3,
"chatname": "You",
"chatname": "User",
"chatopponent": "",
"gui_type":1,
"prefmodel1":chatmodels1,
@ -6117,7 +6136,7 @@ Current version: 138
let cdesc = data.description?data.description:"";
let greeting = data.greeting?data.greeting:"";
let previewtxt = (data.title ? data.title + '\n\n' : '') + replaceAll(cdesc,"{{char}}",botname,true);
previewtxt = replaceAll(previewtxt,"{{user}}","You",true);
previewtxt = replaceAll(previewtxt,"{{user}}","User",true);
temp_scenario.title = data.name?data.name:"";
temp_scenario.desc = previewtxt;
@ -7597,15 +7616,23 @@ Current version: 138
|| !custom_kobold_endpoint.toLowerCase().includes(".")); //hostname without dots cannot be wan accessible
if (uses_cors_proxy || is_local) {
msgbox("Failed to connect to Custom Kobold Endpoint!\n\nPlease check if KoboldAI is running at the url: " + desiredkoboldendpoint + "");
selected_models = [];
selected_workers = [];
custom_kobold_endpoint = "";
if(localflag)
if(is_local && sublocalpathname!="")
{
document.getElementById("connectstatus").innerHTML = "Offline Mode";
sublocalpathname = ""; //one more try
attempt_connect(false);
}
else
{
msgbox("Failed to connect to Custom Kobold Endpoint!\n\nPlease check if KoboldAI is running at the url: " + desiredkoboldendpoint + "");
selected_models = [];
selected_workers = [];
custom_kobold_endpoint = "";
if(localflag)
{
document.getElementById("connectstatus").innerHTML = "Offline Mode";
}
render_gametext();
}
render_gametext();
} else {
uses_cors_proxy = true; //fallback to cors proxy, this will remain for rest of session
connect_custom_endpoint(); //one more try
@ -8658,7 +8685,7 @@ Current version: 138
{
localsettings.chatname = document.getElementById("chatname").value;
if (localsettings.chatname == null || localsettings.chatname == "") {
localsettings.chatname = "You";
localsettings.chatname = "User";
}
let newopps = replaceAll(document.getElementById("chatopponent").value,"\n","||$||");
if(localsettings.chatopponent!=newopps)
@ -9424,7 +9451,7 @@ Current version: 138
inputtxt = replaceAll(inputtxt,instructstartplaceholder.trim(),get_instruct_starttag(false));
inputtxt = replaceAll(inputtxt,instructendplaceholder.trim(),get_instruct_endtag(false));
inputtxt = replaceAll(inputtxt,"{{user}}",localsettings.chatname?localsettings.chatname:"You",true);
inputtxt = replaceAll(inputtxt,"{{user}}",localsettings.chatname?localsettings.chatname:"User",true);
inputtxt = replaceAll(inputtxt,"{{char}}",localsettings.chatopponent?localsettings.chatopponent:defaultchatopponent,true);
for(let i=0;i<placeholder_tags_data.length;++i)
@ -11859,7 +11886,7 @@ Current version: 138
splitresponse = prune_multiliners(splitresponse);
}
else if (foundMyName2 != -1 &&
(localsettings.chatname!="You" ||
(localsettings.chatname!="User" ||
(foundAltYouNameRes!=null && foundAltYouNameRes.length>0))) //added by henky request, trigger even without colon
{
splitresponse = gentxt.split("\n" + localsettings.chatname + " ");
@ -14870,6 +14897,8 @@ Current version: 138
<option value="gpt-3.5-turbo">gpt-3.5-turbo</option>
<option value="gpt-3.5-turbo-16k">gpt-3.5-turbo-16k</option>
<option value="gpt-4">gpt-4</option>
<option value="gpt-4-turbo">gpt-4-turbo</option>
<option value="gpt-4o">gpt-4o</option>
<option value="gpt-4-32k">gpt-4-32k</option>
<option style="display:none;" id="custom_oai_model_option" value="custom">[Custom]</option>
</select>

View file

@ -152,19 +152,21 @@ bool sdtype_load_model(const sd_load_model_inputs inputs) {
executable_path = inputs.executable_path;
std::string taesdpath = "";
std::string lorafilename = inputs.lora_filename;
std::string vaefilename = inputs.vae_filename;
printf("\nImageGen Init - Load Model: %s\n",inputs.model_filename);
if(inputs.lora_filename!="")
if(lorafilename!="")
{
printf("With LoRA: %s at %f power\n",inputs.lora_filename,inputs.lora_multiplier);
printf("With LoRA: %s at %f power\n",lorafilename.c_str(),inputs.lora_multiplier);
}
if(inputs.taesd)
{
taesdpath = executable_path + "taesd.embd";
printf("With TAE SD VAE: %s\n",taesdpath.c_str());
}
else if(inputs.vae_filename!="")
else if(vaefilename!="")
{
printf("With Custom VAE: %s\n",inputs.vae_filename);
printf("With Custom VAE: %s\n",vaefilename.c_str());
}
//duplicated from expose.cpp
@ -199,7 +201,7 @@ bool sdtype_load_model(const sd_load_model_inputs inputs) {
sd_params->n_threads = inputs.threads; //if -1 use physical cores
sd_params->input_path = ""; //unused
sd_params->batch_count = 1;
sd_params->vae_path = inputs.vae_filename;
sd_params->vae_path = vaefilename;
sd_params->taesd_path = taesdpath;
sddebugmode = inputs.debugmode;
@ -247,10 +249,10 @@ bool sdtype_load_model(const sd_load_model_inputs inputs) {
return false;
}
if(inputs.lora_filename!="" && inputs.lora_multiplier>0)
if(lorafilename!="" && inputs.lora_multiplier>0)
{
printf("\nApplying LoRA now...\n");
sd_ctx->sd->apply_lora_from_file(inputs.lora_filename,inputs.lora_multiplier);
sd_ctx->sd->apply_lora_from_file(lorafilename,inputs.lora_multiplier);
}
return true;