Fix for horde/API

This commit is contained in:
ebolam
2022-10-14 13:16:07 -04:00
parent dffbd63f46
commit 759dbc3c54
3 changed files with 45 additions and 30 deletions

View File

@@ -5052,7 +5052,7 @@ def core_generate(text: list, min: int, max: int, found_entries: set, is_core: b
do_dynamic_wi=koboldai_vars.dynamicscan, do_dynamic_wi=koboldai_vars.dynamicscan,
batch_count=numseqs, batch_count=numseqs,
# Real max length is handled by CoreStopper. # Real max length is handled by CoreStopper.
bypass_hf_maxlength=True, bypass_hf_maxlength=koboldai_vars.dynamicscan,
is_core=True, is_core=True,
) )

View File

@@ -1642,6 +1642,7 @@ function world_info_entry(data) {
title.ondragstart=function() {event.preventDefault();event.stopPropagation();}; title.ondragstart=function() {event.preventDefault();event.stopPropagation();};
title.onblur = function () { title.onblur = function () {
this.parentElement.parentElement.setAttribute('draggable', 'true'); this.parentElement.parentElement.setAttribute('draggable', 'true');
this.setAttribute('draggable', 'true');
if (this.textContent != this.getAttribute("original_text")) { if (this.textContent != this.getAttribute("original_text")) {
world_info_data[this.getAttribute('uid')]['title'] = this.textContent; world_info_data[this.getAttribute('uid')]['title'] = this.textContent;
send_world_info(this.getAttribute('uid')); send_world_info(this.getAttribute('uid'));
@@ -1742,8 +1743,9 @@ function world_info_entry(data) {
input = document.createElement("input"); input = document.createElement("input");
input.setAttribute("contenteditable", true); input.setAttribute("contenteditable", true);
input.ondragstart=function() {event.preventDefault();event.stopPropagation();}; input.ondragstart=function() {event.preventDefault();event.stopPropagation();};
input.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; input.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');};
input.onblur=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');}; input.onblur=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');this.setAttribute('draggable', 'true');};
input.ondragstart=function() {event.preventDefault();event.stopPropagation();};
input.value = attribute; input.value = attribute;
input.type = "text"; input.type = "text";
input.setAttribute("uid", data.uid); input.setAttribute("uid", data.uid);
@@ -1764,8 +1766,9 @@ function world_info_entry(data) {
input.setAttribute("contenteditable", true); input.setAttribute("contenteditable", true);
input.ondragstart=function() {event.preventDefault();event.stopPropagation();}; input.ondragstart=function() {event.preventDefault();event.stopPropagation();};
input.onchange = function() {do_wpp(this.parentElement.parentElement)}; input.onchange = function() {do_wpp(this.parentElement.parentElement)};
input.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; input.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');};
input.onblur=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');}; input.onblur=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');this.setAttribute('draggable', 'true');};
input.ondragstart=function() {event.preventDefault();event.stopPropagation();};
input.value = value; input.value = value;
input.setAttribute("uid", data.uid); input.setAttribute("uid", data.uid);
input.setAttribute("data_type", "value"); input.setAttribute("data_type", "value");
@@ -1781,8 +1784,9 @@ function world_info_entry(data) {
input.type = "text"; input.type = "text";
input.setAttribute("contenteditable", true); input.setAttribute("contenteditable", true);
input.ondragstart=function() {event.preventDefault();event.stopPropagation();}; input.ondragstart=function() {event.preventDefault();event.stopPropagation();};
input.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; input.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');};
input.onblur=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');}; input.onblur=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');this.setAttribute('draggable', 'true');};
input.ondragstart=function() {event.preventDefault();event.stopPropagation();};
input.setAttribute("uid", data.uid); input.setAttribute("uid", data.uid);
input.setAttribute("data_type", "value"); input.setAttribute("data_type", "value");
input.id = "wpp_"+data.uid+"_value_"+i+"_blank"; input.id = "wpp_"+data.uid+"_value_"+i+"_blank";
@@ -1802,8 +1806,8 @@ function world_info_entry(data) {
input.type = "text"; input.type = "text";
input.setAttribute("contenteditable", true); input.setAttribute("contenteditable", true);
input.ondragstart=function() {event.preventDefault();event.stopPropagation();}; input.ondragstart=function() {event.preventDefault();event.stopPropagation();};
input.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; input.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');};
input.onblur=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');}; input.onblur=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');this.setAttribute('draggable', 'true');};
input.setAttribute("uid", data.uid); input.setAttribute("uid", data.uid);
input.setAttribute("value_num", i); input.setAttribute("value_num", i);
input.setAttribute("data_type", "attribute"); input.setAttribute("data_type", "attribute");
@@ -3056,8 +3060,6 @@ function add_tags(tags, data) {
for (tag of data.key) { for (tag of data.key) {
tag_item = document.createElement("span"); tag_item = document.createElement("span");
tag_item.classList.add("tag"); tag_item.classList.add("tag");
tag_item.setAttribute("draggable", true);
tag_item.ondragstart=function() {event.preventDefault();event.stopPropagation();};
x = document.createElement("span"); x = document.createElement("span");
x.textContent = "x "; x.textContent = "x ";
x.classList.add("delete_icon"); x.classList.add("delete_icon");
@@ -3074,9 +3076,12 @@ function add_tags(tags, data) {
text.setAttribute("uid", data.uid); text.setAttribute("uid", data.uid);
text.setAttribute("tag", tag); text.setAttribute("tag", tag);
text.id = "world_info_tags_text_"+data.uid+"_"+tag; text.id = "world_info_tags_text_"+data.uid+"_"+tag;
text.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; text.ondragstart=function() {event.preventDefault();event.stopPropagation();};
text.setAttribute("draggable", "true");
text.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');};
text.onblur = function () { text.onblur = function () {
this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true'); this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');
this.setAttribute('draggable', 'true');
for (var i = 0; i < world_info_data[this.getAttribute('uid')]['key'].length; i++) { for (var i = 0; i < world_info_data[this.getAttribute('uid')]['key'].length; i++) {
if (world_info_data[this.getAttribute('uid')]['key'][i] == this.getAttribute("tag")) { if (world_info_data[this.getAttribute('uid')]['key'][i] == this.getAttribute("tag")) {
world_info_data[this.getAttribute('uid')]['key'][i] = this.textContent; world_info_data[this.getAttribute('uid')]['key'][i] = this.textContent;
@@ -3102,9 +3107,12 @@ function add_tags(tags, data) {
text.setAttribute("uid", data.uid); text.setAttribute("uid", data.uid);
text.setAttribute("contenteditable", true); text.setAttribute("contenteditable", true);
text.id = "world_info_tags_text_"+data.uid+"_blank"; text.id = "world_info_tags_text_"+data.uid+"_blank";
text.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; text.ondragstart=function() {event.preventDefault();event.stopPropagation();};
text.setAttribute("draggable", "true");
text.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');};
text.onblur = function () { text.onblur = function () {
this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true'); this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');
this.setAttribute('draggable', 'true');
if (this.textContent != "") { if (this.textContent != "") {
//console.log(this.textContent); //console.log(this.textContent);
on_new_wi_item = this.id; on_new_wi_item = this.id;
@@ -3127,7 +3135,6 @@ function add_secondary_tags(tags, data) {
for (tag of data.keysecondary) { for (tag of data.keysecondary) {
tag_item = document.createElement("span"); tag_item = document.createElement("span");
tag_item.classList.add("tag"); tag_item.classList.add("tag");
tag_item.ondragstart=function() {event.preventDefault();event.stopPropagation();};
x = document.createElement("span"); x = document.createElement("span");
x.textContent = "x "; x.textContent = "x ";
x.classList.add("delete_icon"); x.classList.add("delete_icon");
@@ -3144,9 +3151,12 @@ function add_secondary_tags(tags, data) {
text.setAttribute("uid", data.uid); text.setAttribute("uid", data.uid);
text.setAttribute("tag", tag); text.setAttribute("tag", tag);
text.id = "world_info_secondtags_text_"+data.uid+"_"+tag; text.id = "world_info_secondtags_text_"+data.uid+"_"+tag;
text.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; text.ondragstart=function() {event.preventDefault();event.stopPropagation();};
text.setAttribute("draggable", "true");
text.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');};
text.onblur = function () { text.onblur = function () {
this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true'); this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');
this.setAttribute('draggable', 'true');
for (var i = 0; i < world_info_data[this.getAttribute('uid')]['keysecondary'].length; i++) { for (var i = 0; i < world_info_data[this.getAttribute('uid')]['keysecondary'].length; i++) {
if (world_info_data[this.getAttribute('uid')]['keysecondary'][i] == this.getAttribute("tag")) { if (world_info_data[this.getAttribute('uid')]['keysecondary'][i] == this.getAttribute("tag")) {
world_info_data[this.getAttribute('uid')]['keysecondary'][i] = this.textContent; world_info_data[this.getAttribute('uid')]['keysecondary'][i] = this.textContent;
@@ -3172,9 +3182,12 @@ function add_secondary_tags(tags, data) {
text.setAttribute("uid", data.uid); text.setAttribute("uid", data.uid);
text.setAttribute("contenteditable", true); text.setAttribute("contenteditable", true);
text.id = "world_info_secondtags_text_"+data.uid+"_blank"; text.id = "world_info_secondtags_text_"+data.uid+"_blank";
text.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');}; text.ondragstart=function() {event.preventDefault();event.stopPropagation();};
text.setAttribute("draggable", "true");
text.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');};
text.onblur = function () { text.onblur = function () {
this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true'); this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');
this.setAttribute('draggable', 'true');
if (this.textContent != "") { if (this.textContent != "") {
on_new_wi_item = this.id; on_new_wi_item = this.id;
world_info_data[this.getAttribute('uid')]['keysecondary'].push(this.textContent); world_info_data[this.getAttribute('uid')]['keysecondary'].push(this.textContent);

View File

@@ -1,7 +1,7 @@
<div draggable="true" class="world_info_card" id="world_info_"> <div draggable="true" class="world_info_card" id="world_info_">
<div class="world_info_title_area"> <div class="world_info_title_area">
<h4 draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" id="world_info_title_" <h4 draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" id="world_info_title_"
class="world_info_title" onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');"></h4> class="world_info_title" onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');"></h4>
<span id="world_info_delete_" class="world_info_delete">X</span> <span id="world_info_delete_" class="world_info_delete">X</span>
</div> </div>
<div class="world_info_tag_area" id="world_info_toggle_area_"> <div class="world_info_tag_area" id="world_info_toggle_area_">
@@ -25,17 +25,18 @@
<table> <table>
<tr> <tr>
<td>Type:</td> <td>Type:</td>
<td><input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text id="wpp_type_" <td><input draggable="true" type=text id="wpp_type_"
onchange="do_wpp(this.parentElement.parentElement.parentElement.parentElement.parentElement)" onchange="do_wpp(this.parentElement.parentElement.parentElement.parentElement.parentElement)"
onfocus="this.parentElement.parentElement.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');" onfocus="console.log('focus');this.parentElement.parentElement.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');"
onblur="this.parentElement.parentElement.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');"></td> onblur="console.log('blur');this.parentElement.parentElement.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');this.setAttribute('draggable', 'true');"
ondragstart="event.preventDefault();event.stopPropagation();" ></td>
</tr> </tr>
<tr> <tr>
<td>Name:</td> <td>Name:</td>
<td><input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text id="wpp_name_" <td><input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text id="wpp_name_"
onchange="do_wpp(this.parentElement.parentElement.parentElement.parentElement.parentElement)" onchange="do_wpp(this.parentElement.parentElement.parentElement.parentElement.parentElement)"
onfocus="this.parentElement.parentElement.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');" onfocus="this.parentElement.parentElement.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');"
onblur="this.parentElement.parentElement.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');"></td> onblur="this.parentElement.parentElement.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');this.setAttribute('draggable', 'true');"></td>
</tr> </tr>
</table> </table>
@@ -43,19 +44,20 @@
<div id="world_info_basic_text_"> <div id="world_info_basic_text_">
Text: Text:
<textarea draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" id="world_info_entry_text_" class="world_info_text fullwidth" oninput="autoResize(this, 60)" <textarea draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" id="world_info_entry_text_" class="world_info_text fullwidth" oninput="autoResize(this, 60)"
onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');autoResize(this, 60)" onblur="this.parentElement.parentElement.setAttribute('draggable', 'true');this.style.height='60px';"></textarea> onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');autoResize(this, 60)"
onblur="this.parentElement.parentElement.setAttribute('draggable', 'true');this.setAttribute('draggable', 'true');this.style.height='60px';"></textarea>
</div> </div>
<div id="world_info_entry_w++_" class="hidden"> <div id="world_info_entry_w++_" class="hidden">
<input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text placeholder="Type" <input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text placeholder="Type"
onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');" onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');"
onblur="this.parentElement.parentElement.setAttribute('draggable', 'false');"/> onblur="this.parentElement.parentElement.setAttribute('draggable', 'true');this.setAttribute('draggable', 'true');"/>
<input type=text placeholder="Name" <input type=text placeholder="Name"
onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');" onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');"
onblur="this.parentElement.parentElement.setAttribute('draggable', 'false');"/> onblur="this.parentElement.parentElement.setAttribute('draggable', 'true');"/>
<div> <div>
<input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text placeholder="attribute" <input draggable="true" ondragstart="event.preventDefault();event.stopPropagation();" type=text placeholder="attribute"
onfocus="this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');" onfocus="this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');"
onblur="this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');"/> onblur="this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');this.setAttribute('draggable', 'true');"/>
<input type=text placeholder="value"/> <input type=text placeholder="value"/>
</div> </div>
</div> </div>
@@ -63,8 +65,8 @@
Comment: Comment:
<textarea draggable="true" ondragstartondragstart="event.preventDefault();event.stopPropagation();" rows=1 id="world_info_comment_" <textarea draggable="true" ondragstartondragstart="event.preventDefault();event.stopPropagation();" rows=1 id="world_info_comment_"
class="world_info_text fullwidth" oninput="autoResize(this, 60)" onfocus="autoResize(this, 60)" onblur="this.style.height='60px';" class="world_info_text fullwidth" oninput="autoResize(this, 60)" onfocus="autoResize(this, 60)" onblur="this.style.height='60px';"
onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');" onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');;"
onblur="this.parentElement.parentElement.setAttribute('draggable', 'false');"></textarea> onblur="this.parentElement.parentElement.setAttribute('draggable', 'true');this.setAttribute('draggable', 'true');"></textarea>
</div> </div>
</div> </div>
<div id="empty_bias"> <div id="empty_bias">