mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Checkin
This commit is contained in:
@@ -6270,6 +6270,7 @@ def UI_2_Set_Selected_Text(data):
|
||||
#==================================================================#
|
||||
@socketio.on('submit')
|
||||
def UI_2_submit(data):
|
||||
koboldai_vars.actions.clear_unused_options()
|
||||
koboldai_vars.lua_koboldbridge.feedback = None
|
||||
koboldai_vars.recentrng = koboldai_vars.recentrngm = None
|
||||
actionsubmit(data['data'], actionmode=koboldai_vars.actionmode)
|
||||
|
@@ -148,7 +148,7 @@ gensettingstf = [
|
||||
"menu_path": "Model",
|
||||
"sub_path": "Repetition",
|
||||
"classname": "model",
|
||||
"name": "repo_pen_slope"
|
||||
"name": "rep_pen_slope"
|
||||
},
|
||||
{
|
||||
"uitype": "slider",
|
||||
|
@@ -780,10 +780,14 @@ class KoboldStoryRegister(object):
|
||||
if len(text_list) > 1:
|
||||
if self.action_count+1 in self.actions:
|
||||
for i in range(len(text_list)):
|
||||
found = False
|
||||
for j in range(len(self.actions[self.action_count+1]['Options'])):
|
||||
if 'stream_id' in self.actions[self.action_count+1]['Options'][j]:
|
||||
if self.actions[self.action_count+1]['Options'][j]['stream_id'] == i:
|
||||
self.actions[self.action_count+1]['Options'][i]['text'] = "{}{}".format(self.actions[self.action_count+1]['Options'][i]['text'], text_list[i])
|
||||
found = True
|
||||
self.actions[self.action_count+1]['Options'][j]['text'] = "{}{}".format(self.actions[self.action_count+1]['Options'][i]['text'], text_list[i])
|
||||
if not found:
|
||||
self.actions[self.action_count+1]['Options'].append({"text": text_list[i], "Pinned": False, "Previous Selection": False, "Edited": False, "stream_id": i})
|
||||
else:
|
||||
self.actions[self.action_count+1] = {"Selected Text": "", "Selected Text Length": 0, "Options": []}
|
||||
for i in range(len(text_list)):
|
||||
|
@@ -24,7 +24,6 @@ socket.on("delete_new_world_info_entry", function(data){document.getElementById(
|
||||
socket.on("delete_world_info_entry", function(data){document.getElementById("world_info_"+data).remove();});
|
||||
//socket.onAny(function(event_name, data) {console.log({"event": event_name, "class": data.classname, "data": data});});
|
||||
|
||||
var backend_vars = {};
|
||||
var presets = {};
|
||||
var current_chunk_number = null;
|
||||
var ai_busy_start = Date.now();
|
||||
@@ -34,6 +33,7 @@ var popup_renameable = false;
|
||||
var shift_down = false;
|
||||
var world_info_data = {};
|
||||
var world_info_folder_data = {};
|
||||
var saved_settings = {};
|
||||
//-----------------------------------Server to UI Functions-----------------------------------------------
|
||||
function connect() {
|
||||
console.log("connected");
|
||||
@@ -194,7 +194,11 @@ function do_story_text_updates(data) {
|
||||
while (item.firstChild) {
|
||||
item.removeChild(item.firstChild);
|
||||
}
|
||||
if (data.value.text == null) {
|
||||
var text_array = [];
|
||||
} else {
|
||||
var text_array = data.value.text.split(" ");
|
||||
}
|
||||
text_array.forEach(function (text, i) {
|
||||
var word = document.createElement("span");
|
||||
word.classList.add("rawtext");
|
||||
@@ -1289,6 +1293,58 @@ function send_world_info(uid) {
|
||||
}
|
||||
|
||||
//--------------------------------------------General UI Functions------------------------------------
|
||||
function save_model_settings() {
|
||||
for (item of document.getElementsByClassName('setting_item_input')) {
|
||||
if (item.id.includes("model")) {
|
||||
if ((item.tagName.toLowerCase() === 'checkbox') || (item.tagName.toLowerCase() === 'input') || (item.tagName.toLowerCase() === 'select') || (item.tagName.toLowerCase() == 'textarea')) {
|
||||
if (item.getAttribute("type") == "checkbox") {
|
||||
value = item.checked;
|
||||
} else {
|
||||
value = item.value;
|
||||
}
|
||||
} else {
|
||||
value = item.textContent;
|
||||
}
|
||||
saved_settings[item.id] = value;
|
||||
}
|
||||
}
|
||||
for (item of document.getElementsByClassName('settings_select')) {
|
||||
if (item.id.includes("model")) {
|
||||
saved_settings[item.id] = item.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function restore_model_settings(settings = saved_settings) {
|
||||
for (const [key, value] of Object.entries(settings)) {
|
||||
item = document.getElementById(key);
|
||||
if ((item.tagName.toLowerCase() === 'input') || (item.tagName.toLowerCase() === 'select')) {
|
||||
if (item.getAttribute("type") == "checkbox") {
|
||||
if (item.checked != value) {
|
||||
//not sure why the bootstrap-toggle won't respect a standard item.checked = true/false, so....
|
||||
item.parentNode.click();
|
||||
}
|
||||
} else {
|
||||
item.value = fix_text(value);
|
||||
}
|
||||
} else {
|
||||
item.textContent = fix_text(value);
|
||||
}
|
||||
if (typeof item.onclick == "function") {
|
||||
item.onclick.apply(item);
|
||||
}
|
||||
if (typeof item.onblur == "function") {
|
||||
item.onblur.apply(item);
|
||||
}
|
||||
if (typeof item.onchange == "function") {
|
||||
item.onchange.apply(item);
|
||||
}
|
||||
if (typeof item.oninput == "function") {
|
||||
item.oninput.apply(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeA(arr) {
|
||||
var what, a = arguments, L = a.length, ax;
|
||||
while (L > 1 && arr.length) {
|
||||
|
@@ -87,6 +87,12 @@
|
||||
Text:
|
||||
<textarea id="world_info_entry_text_" class="world_info_text fullwidth"></textarea>
|
||||
</div>
|
||||
<div id="world_info_entry_w++_" class="hidden">
|
||||
<input type=text placeholder="Type"/><input type=text placeholder="Name"/>
|
||||
<div>
|
||||
<input type=text placeholder="attribute"/><input type=text placeholder="value"/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
Comment:
|
||||
<textarea rows=1 id="world_info_comment_" class="world_info_text fullwidth"></textarea>
|
||||
|
Reference in New Issue
Block a user