diff --git a/index.html b/index.html
index 8ff0fee..988aa3d 100644
--- a/index.html
+++ b/index.html
@@ -6,7 +6,7 @@
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 unless otherwise exempted. Please do not remove this line.
-Current version: 98
+Current version: 99
-Concedo
-->
@@ -2523,6 +2523,21 @@
}
}
+ function readTavernPngFromBlob(blob, onDone)
+ {
+ var fileReader = new FileReader();
+ fileReader.onload = function(event) {
+ var data = event.target.result;
+ var arr = new Uint8Array(data);
+ var result = convertTavernPng(arr);
+ if(onDone)
+ {
+ onDone(result);
+ }
+ };
+ fileReader.readAsArrayBuffer(blob);
+ }
+
//import tavern png data. adapted from png-chunks-extract under MIT license
//accepts png input data, and returns the extracted JSON
function convertTavernPng(data)
@@ -5052,6 +5067,7 @@
"authorsnote": "",
"worldinfo": [],
};
+ let card_is_defective = (data.name==""&&previewtxt==""&&greeting==""&&cdesc==""&&cdef=="");
//try to obtain the full portrait image
fetch("https://api.chub.ai/api/characters/download", {
@@ -5076,6 +5092,50 @@
})
.then(blob => {
preview_temp_scenario();
+
+ if(card_is_defective)
+ {
+ readTavernPngFromBlob(blob,(obj)=>{
+ if(obj!=null)
+ {
+ //a lightweight tavern card loader, not fully compliant
+ if(obj.spec=="chara_card_v2" && obj.data!=null)
+ {
+ obj = obj.data;
+ }
+ let chatopponent = obj.name?obj.name:"Bot";
+ let memory = obj.description?("Persona: "+obj.description):"";
+ memory += obj.personality?("\nPersonality: "+obj.personality):"";
+ let scenario = obj.scenario?obj.scenario:"";
+ let examplemsg = obj.mes_example?obj.mes_example:"";
+ let greeting = obj.first_mes?obj.first_mes:"";
+ let sysprompt = obj.system_prompt?obj.system_prompt:"";
+
+ if(scenario!="")
+ {
+ scenario = "\n[Scenario: "+scenario+"]";
+ }
+ if(examplemsg!="")
+ {
+ examplemsg = "\n"+examplemsg;
+ }
+ if(sysprompt!="")
+ {
+ sysprompt = sysprompt+"\n";
+ }
+ let combinedmem = sysprompt + memory + scenario + examplemsg;
+ temp_scenario.title = chatopponent;
+ let prev2 = replaceAll(obj.description,"{{char}}",chatopponent,true);
+ prev2 = replaceAll(prev2,"{{user}}","You",true);
+ temp_scenario.desc = prev2;
+ temp_scenario.chatopponent = chatopponent;
+ temp_scenario.prompt = ("\n{{char}}: "+ greeting);
+ temp_scenario.memory = combinedmem;
+ preview_temp_scenario();
+ }
+
+ });
+ }
const objectURL = URL.createObjectURL(blob);
const compressedImg = compressImage(objectURL, (compressedImageURI, aspectratio)=>{
temp_scenario.image = compressedImageURI;
diff --git a/koboldcpp_api.html b/koboldcpp_api.html
index 746dea4..da19cee 100644
--- a/koboldcpp_api.html
+++ b/koboldcpp_api.html
@@ -367,9 +367,19 @@
"content": {
"application/json": {
"example": {
- "prompt": "Niko the kobold stalked carefully down the alley, his small scaly figure obscured by a dusky cloak that fluttered lightly in the cold winter breeze.",
- "temperature": 0.5,
- "top_p": 0.9
+ "max_context_length": 2048,
+ "max_length": 100,
+ "prompt": "Niko the kobold stalked carefully down the alley, his small scaly figure obscured by a dusky cloak that fluttered lightly in the cold winter breeze.",
+ "quiet": false,
+ "rep_pen": 1.1,
+ "rep_pen_range": 256,
+ "rep_pen_slope": 1,
+ "temperature": 0.5,
+ "tfs": 1.0,
+ "top_a": 0,
+ "top_k": 100,
+ "top_p": 0.9,
+ "typical": 1.0
},
"schema": {
"$ref": "#/components/schemas/GenerationInput"