Skip to content

Commit

Permalink
fixed chubai wi import
Browse files Browse the repository at this point in the history
  • Loading branch information
Concedo authored and Concedo committed Dec 3, 2023
1 parent 3a43fbc commit d1f2468
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4816,7 +4816,7 @@
function load_agnai_wi(obj,chatopponent,myname)
{
console.log("Append Agnai WI");
current_wi = [];
let loadedwi = [];
for (let key in obj.entries) {
var itm = obj.entries[key];
var karr = itm.keywords;
Expand All @@ -4829,13 +4829,14 @@
"selective": false,
"constant": false
};
current_wi.push(nwi);
loadedwi.push(nwi);
}
return loadedwi;
}
function load_tavern_wi(obj,chatopponent,myname)
{
console.log("Append Tavern WI");
current_wi = [];
let loadedwi = [];
for (let key in obj.entries) {
var itm = obj.entries[key];
var karr = itm.key;
Expand All @@ -4857,8 +4858,9 @@
"selective": itm.selective,
"constant": itm.constant
};
current_wi.push(nwi);
loadedwi.push(nwi);
}
return loadedwi;
}
function load_tavern_obj(obj)
{
Expand Down Expand Up @@ -4894,11 +4896,11 @@
//check if it's a world info only card, if so, do not restart game
if(combinedmem.trim()=="" && greeting=="" && obj.entries)
{
load_tavern_wi(obj,chatopponent,myname);
current_wi = load_tavern_wi(obj,chatopponent,myname);
}
else if(agnaidatafieldsempty.trim()=="" && obj.entries && obj.kind=="memory")
{
load_agnai_wi(obj,chatopponent,myname);
current_wi = load_agnai_wi(obj,chatopponent,myname);
}
else
{
Expand All @@ -4913,11 +4915,11 @@
//handle character book
if(obj.character_book && obj.character_book.entries && obj.character_book.entries.length>0)
{
load_tavern_wi(obj.character_book,chatopponent,myname);
current_wi = load_tavern_wi(obj.character_book,chatopponent,myname);
}
else if(obj.entries && obj.entries.length>0)
{
load_agnai_wi(obj,chatopponent,myname);
current_wi = load_agnai_wi(obj,chatopponent,myname);
}
}
render_gametext();
Expand Down Expand Up @@ -4993,7 +4995,16 @@
let keys = data.worldInfos[w].keys;
let entry = data.worldInfos[w].entry;

temp_scenario.worldinfo.push({"key":(keys?keys:""),"content":(entry?entry:"")})
let nwi = {
"key": (keys ? keys : ""),
"keysecondary": "",
"content": (entry ? entry : ""),
"comment": "",
"folder": null,
"selective": false,
"constant": false
};
temp_scenario.worldinfo.push(nwi);
}
}
preview_temp_scenario();
Expand Down Expand Up @@ -5136,6 +5147,11 @@
temp_scenario.chatopponent = chatopponent;
temp_scenario.prompt = ("\n{{char}}: "+ greeting);
temp_scenario.memory = combinedmem;
if(obj.character_book && obj.character_book.entries && obj.character_book.entries.length>0)
{
let myname = ((localsettings.chatname && localsettings.chatname!="")?localsettings.chatname:"You");
temp_scenario.worldinfo = load_tavern_wi(obj.character_book,chatopponent,myname);
}
preview_temp_scenario();
}

Expand Down Expand Up @@ -5233,21 +5249,7 @@
refreshPreview(true);
}
if (temp_scenario.worldinfo && temp_scenario.worldinfo.length > 0) {
current_wi = [];
for (let x = 0; x < temp_scenario.worldinfo.length; ++x) {
let key = temp_scenario.worldinfo[x].key;
let content = temp_scenario.worldinfo[x].content;
let nwi = {
"key": (key ? key : ""),
"keysecondary": "",
"content": (content ? content : ""),
"comment": "",
"folder": null,
"selective": false,
"constant": false
};
current_wi.push(nwi);
}
current_wi = temp_scenario.worldinfo;
}

localsettings.opmode = temp_scenario.opmode;
Expand Down

0 comments on commit d1f2468

Please sign in to comment.