mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Merge branch 'UI2' of https://github.com/ebolam/KoboldAI into UI2
This commit is contained in:
12
aiserver.py
12
aiserver.py
@@ -6285,7 +6285,12 @@ def UI_2_var_change(data):
|
|||||||
|
|
||||||
#Now let's save except for story changes
|
#Now let's save except for story changes
|
||||||
if classname != "story_settings":
|
if classname != "story_settings":
|
||||||
with open("settings/{}.v2_settings".format(classname), "w") as settings_file:
|
if classname == "model_settings":
|
||||||
|
filename = "settings/{}.v2_settings".format(koboldai_vars.model.replace("/", "_"))
|
||||||
|
else:
|
||||||
|
filename = "settings/{}.v2_settings".format(classname)
|
||||||
|
|
||||||
|
with open(filename, "w") as settings_file:
|
||||||
settings_file.write(getattr(koboldai_vars, "_{}".format(classname)).to_json())
|
settings_file.write(getattr(koboldai_vars, "_{}".format(classname)).to_json())
|
||||||
|
|
||||||
return {'id': data['ID'], 'status': "Saved"}
|
return {'id': data['ID'], 'status': "Saved"}
|
||||||
@@ -6295,7 +6300,7 @@ def UI_2_var_change(data):
|
|||||||
#==================================================================#
|
#==================================================================#
|
||||||
@socketio.on('save_story')
|
@socketio.on('save_story')
|
||||||
def UI_2_save_story(data):
|
def UI_2_save_story(data):
|
||||||
|
print("Saving Story")
|
||||||
if data is None:
|
if data is None:
|
||||||
#We need to check to see if there is a file already and if it's not the same story so we can ask the client if this is OK
|
#We need to check to see if there is a file already and if it's not the same story so we can ask the client if this is OK
|
||||||
save_name = koboldai_vars.story_name if koboldai_vars.story_name != "" else "untitled"
|
save_name = koboldai_vars.story_name if koboldai_vars.story_name != "" else "untitled"
|
||||||
@@ -6599,11 +6604,14 @@ def UI_2_phrase_bias_update(biases):
|
|||||||
# Event triggered to rely a message
|
# Event triggered to rely a message
|
||||||
#==================================================================#
|
#==================================================================#
|
||||||
def socket_io_relay(queue, socketio):
|
def socket_io_relay(queue, socketio):
|
||||||
|
print("started relay")
|
||||||
while True:
|
while True:
|
||||||
if not queue.empty():
|
if not queue.empty():
|
||||||
|
print("got relay message")
|
||||||
data = queue.get()
|
data = queue.get()
|
||||||
#socketio.emit(data[0], data[1], **data[2])
|
#socketio.emit(data[0], data[1], **data[2])
|
||||||
socketio.emit(data[0], data[1], broadcast=True, room="UI_2")
|
socketio.emit(data[0], data[1], broadcast=True, room="UI_2")
|
||||||
|
print("sent")
|
||||||
time.sleep(0)
|
time.sleep(0)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -298,7 +298,7 @@ class settings(object):
|
|||||||
pickle.dump(data, output)
|
pickle.dump(data, output)
|
||||||
output.seek(0)
|
output.seek(0)
|
||||||
return "base64:{}".format(base64.encodebytes(output.read()).decode())
|
return "base64:{}".format(base64.encodebytes(output.read()).decode())
|
||||||
return json.dumps(json_data, default=to_base64)
|
return json.dumps(json_data, default=to_base64, indent="\t")
|
||||||
|
|
||||||
def from_json(self, data):
|
def from_json(self, data):
|
||||||
if isinstance(data, str):
|
if isinstance(data, str):
|
||||||
@@ -337,7 +337,8 @@ class settings(object):
|
|||||||
|
|
||||||
class model_settings(settings):
|
class model_settings(settings):
|
||||||
local_only_variables = ['badwordsids', 'apikey', 'tqdm', 'socketio', 'default_preset']
|
local_only_variables = ['badwordsids', 'apikey', 'tqdm', 'socketio', 'default_preset']
|
||||||
no_save_variables = ['tqdm', 'socketio']
|
no_save_variables = ['tqdm', 'tqdm_progress', 'tqdm_rem_time', 'socketio', 'modelconfig', 'custmodpth', 'generated_tkns',
|
||||||
|
'loaded_layers', 'total_layers', 'total_download_chunks', 'downloaded_chunks']
|
||||||
settings_name = "model"
|
settings_name = "model"
|
||||||
def __init__(self, socketio):
|
def __init__(self, socketio):
|
||||||
self.socketio = socketio
|
self.socketio = socketio
|
||||||
@@ -600,8 +601,8 @@ class story_settings(settings):
|
|||||||
self.actionmode = 0
|
self.actionmode = 0
|
||||||
|
|
||||||
class user_settings(settings):
|
class user_settings(settings):
|
||||||
local_only_variables = ['socketio']
|
local_only_variables = ['socketio', 'importjs']
|
||||||
no_save_variables = ['socketio']
|
no_save_variables = ['socketio', 'importnum', 'importjs', 'loadselect', 'spselect', 'svowname', 'saveow', 'laststory', 'sid']
|
||||||
settings_name = "user"
|
settings_name = "user"
|
||||||
def __init__(self, socketio):
|
def __init__(self, socketio):
|
||||||
self.socketio = socketio
|
self.socketio = socketio
|
||||||
|
@@ -331,7 +331,7 @@ input[type="range"]::-ms-fill-upper {
|
|||||||
grid-template-columns: 135px 42px;
|
grid-template-columns: 135px 42px;
|
||||||
row-gap: 0.2em;
|
row-gap: 0.2em;
|
||||||
background-color: var(--setting_background);
|
background-color: var(--setting_background);
|
||||||
color: var(--text);
|
color: var(--setting_text);
|
||||||
border-radius: var(--radius_settings_background);
|
border-radius: var(--radius_settings_background);
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
@@ -376,6 +376,7 @@ input[type="range"]::-ms-fill-upper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.setting_label {
|
.setting_label {
|
||||||
|
display: flex;
|
||||||
grid-area: label;
|
grid-area: label;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
@@ -407,46 +408,12 @@ input[type="range"]::-ms-fill-upper {
|
|||||||
}
|
}
|
||||||
/*-----------------------------------------------*/
|
/*-----------------------------------------------*/
|
||||||
.helpicon {
|
.helpicon {
|
||||||
display: inline-block;
|
color: var(--setting_text);
|
||||||
font-family: sans-serif;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
width: 2ex;
|
|
||||||
height: 2ex;
|
|
||||||
font-size: 1.8ex;
|
|
||||||
line-height: 1.8ex;
|
|
||||||
border-radius: 1.2ex;
|
|
||||||
margin-right: 4px;
|
|
||||||
padding: 1px;
|
|
||||||
color: var(--help_icon_text);
|
|
||||||
background: var(--help_icon);
|
|
||||||
border: 1px solid var(--help_icon_text);
|
|
||||||
text-decoration: none;
|
|
||||||
cursor: help;
|
cursor: help;
|
||||||
}
|
font-size: 14px !important;
|
||||||
|
flex: auto;
|
||||||
.helpicon .helptext {
|
width: 15px;
|
||||||
display: none;
|
align-self: flex-end;
|
||||||
font-family: sans-serif;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 100;
|
|
||||||
text-shadow: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.helpicon:hover .helptext {
|
|
||||||
display: inline-block;
|
|
||||||
position: fixed;
|
|
||||||
width: 250px;
|
|
||||||
background-color: var(--tooltip_background);
|
|
||||||
color: var(--tooltip_text);
|
|
||||||
font-size: 11pt;
|
|
||||||
z-index: 100;
|
|
||||||
font-weight: normal;
|
|
||||||
line-height: normal;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 5px;
|
|
||||||
margin-left:10px;
|
|
||||||
border: 1px solid var(--tooltip_text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------LEFT FLYOUT MENU------------------*/
|
/*----------------LEFT FLYOUT MENU------------------*/
|
||||||
@@ -1643,3 +1610,7 @@ body.NotConnected {
|
|||||||
/* Support for IE. */
|
/* Support for IE. */
|
||||||
font-feature-settings: 'liga';
|
font-feature-settings: 'liga';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h2 .material-icons-outlined {
|
||||||
|
font-size: 32px;
|
||||||
|
}
|
@@ -1247,10 +1247,10 @@ function world_info_folder(data) {
|
|||||||
title.addEventListener('drop', drop);
|
title.addEventListener('drop', drop);
|
||||||
collapse_icon = document.createElement("span");
|
collapse_icon = document.createElement("span");
|
||||||
collapse_icon.id = "world_info_folder_collapse_"+folder_name;
|
collapse_icon.id = "world_info_folder_collapse_"+folder_name;
|
||||||
collapse_icon.classList.add("oi");
|
|
||||||
collapse_icon.classList.add("wi_folder_collapser");
|
collapse_icon.classList.add("wi_folder_collapser");
|
||||||
collapse_icon.setAttribute("data-glyph", "chevron-bottom");
|
collapse_icon.classList.add("material-icons-outlined");
|
||||||
collapse_icon.setAttribute("folder", folder_name);
|
collapse_icon.setAttribute("folder", folder_name);
|
||||||
|
collapse_icon.textContent = "expand_more";
|
||||||
collapse_icon.onclick = function () {
|
collapse_icon.onclick = function () {
|
||||||
hide_wi_folder(this.getAttribute("folder"));
|
hide_wi_folder(this.getAttribute("folder"));
|
||||||
document.getElementById('world_info_folder_expand_'+this.getAttribute("folder")).classList.remove('hidden');
|
document.getElementById('world_info_folder_expand_'+this.getAttribute("folder")).classList.remove('hidden');
|
||||||
@@ -1259,10 +1259,10 @@ function world_info_folder(data) {
|
|||||||
title.append(collapse_icon);
|
title.append(collapse_icon);
|
||||||
expand_icon = document.createElement("span");
|
expand_icon = document.createElement("span");
|
||||||
expand_icon.id = "world_info_folder_expand_"+folder_name;
|
expand_icon.id = "world_info_folder_expand_"+folder_name;
|
||||||
expand_icon.classList.add("oi");
|
|
||||||
expand_icon.classList.add("wi_folder_collapser");
|
expand_icon.classList.add("wi_folder_collapser");
|
||||||
expand_icon.setAttribute("data-glyph", "chevron-right");
|
expand_icon.classList.add("material-icons-outlined");
|
||||||
expand_icon.setAttribute("folder", folder_name);
|
expand_icon.setAttribute("folder", folder_name);
|
||||||
|
expand_icon.textContent = "chevron_right";
|
||||||
expand_icon.onclick = function () {
|
expand_icon.onclick = function () {
|
||||||
unhide_wi_folder(this.getAttribute("folder"));
|
unhide_wi_folder(this.getAttribute("folder"));
|
||||||
document.getElementById('world_info_folder_collapse_'+this.getAttribute("folder")).classList.remove('hidden');
|
document.getElementById('world_info_folder_collapse_'+this.getAttribute("folder")).classList.remove('hidden');
|
||||||
@@ -1271,8 +1271,9 @@ function world_info_folder(data) {
|
|||||||
expand_icon.classList.add("hidden");
|
expand_icon.classList.add("hidden");
|
||||||
title.append(expand_icon);
|
title.append(expand_icon);
|
||||||
icon = document.createElement("span");
|
icon = document.createElement("span");
|
||||||
icon.classList.add("oi");
|
icon.classList.add("material-icons-outlined");
|
||||||
icon.setAttribute("data-glyph", "folder");
|
icon.setAttribute("folder", folder_name);
|
||||||
|
icon.textContent = "folder";
|
||||||
title.append(icon);
|
title.append(icon);
|
||||||
title_text = document.createElement("span");
|
title_text = document.createElement("span");
|
||||||
title_text.setAttribute("contenteditable", true);
|
title_text.setAttribute("contenteditable", true);
|
||||||
@@ -1287,16 +1288,20 @@ function world_info_folder(data) {
|
|||||||
title.append(title_text);
|
title.append(title_text);
|
||||||
folder.append(title);
|
folder.append(title);
|
||||||
//create add button
|
//create add button
|
||||||
|
new_icon = document.createElement("span");
|
||||||
|
new_icon.classList.add("wi_add_button");
|
||||||
add_icon = document.createElement("span");
|
add_icon = document.createElement("span");
|
||||||
add_icon.classList.add("oi");
|
add_icon.classList.add("material-icons-outlined");
|
||||||
add_icon.classList.add("wi_add_button");
|
add_icon.textContent = "post_add";
|
||||||
add_icon.setAttribute("data-glyph", "plus");
|
new_icon.append(add_icon);
|
||||||
add_icon.textContent = "Add World Info Entry";
|
add_text = document.createElement("span");
|
||||||
add_icon.setAttribute("folder", folder_name);
|
add_text.textContent = "Add World Info Entry";
|
||||||
add_icon.onclick = function() {
|
add_text.setAttribute("folder", folder_name);
|
||||||
|
add_text.onclick = function() {
|
||||||
create_new_wi_entry(this.getAttribute("folder"));
|
create_new_wi_entry(this.getAttribute("folder"));
|
||||||
}
|
}
|
||||||
folder.append(add_icon);
|
new_icon.append(add_text);
|
||||||
|
folder.append(new_icon);
|
||||||
|
|
||||||
//We want to insert this folder before the next folder
|
//We want to insert this folder before the next folder
|
||||||
if (i+1 < folders.length) {
|
if (i+1 < folders.length) {
|
||||||
@@ -1350,12 +1355,16 @@ function world_info_folder(data) {
|
|||||||
add_folder.id = "new_world_info_button";
|
add_folder.id = "new_world_info_button";
|
||||||
temp = document.createElement("h2");
|
temp = document.createElement("h2");
|
||||||
add_icon = document.createElement("span");
|
add_icon = document.createElement("span");
|
||||||
add_icon.classList.add("oi");
|
icon = document.createElement("span");
|
||||||
add_icon.setAttribute("data-glyph", "plus");
|
icon.classList.add("material-icons-outlined");
|
||||||
add_icon.textContent = "Add World Info Folder";
|
icon.textContent = "create_new_folder";
|
||||||
|
add_icon.append(icon);
|
||||||
|
text_span = document.createElement("span");
|
||||||
|
text_span.textContent = "Add World Info Folder";
|
||||||
add_icon.onclick = function() {
|
add_icon.onclick = function() {
|
||||||
socket.emit("create_world_info_folder", {});
|
socket.emit("create_world_info_folder", {});
|
||||||
}
|
}
|
||||||
|
add_icon.append(text_span);
|
||||||
temp.append(add_icon);
|
temp.append(add_icon);
|
||||||
add_folder.append(temp);
|
add_folder.append(temp);
|
||||||
document.getElementById("WI_Area").append(add_folder);
|
document.getElementById("WI_Area").append(add_folder);
|
||||||
|
@@ -63,7 +63,7 @@
|
|||||||
<div class="story_title_icons">
|
<div class="story_title_icons">
|
||||||
<span class="material-icons-outlined cursor" title="New Story" onclick="socket.emit('new_story', '');">description</span>
|
<span class="material-icons-outlined cursor" title="New Story" onclick="socket.emit('new_story', '');">description</span>
|
||||||
<span class="material-icons-outlined cursor" title="Load Story" onclick="socket.emit('load_story_list', '');">folder_open</span>
|
<span class="material-icons-outlined cursor" title="Load Story" onclick="socket.emit('load_story_list', '');">folder_open</span>
|
||||||
<span class="material-icons-outlined cursor var_sync_alt_story_gamesaved" title="Save Story">save</span>
|
<span class="material-icons-outlined cursor var_sync_alt_story_gamesaved" title="Save Story" onclick='socket.emit("save_story", null, (response) => {save_as_story(response);});'>save</span>
|
||||||
<span class="material-icons-outlined cursor" title="Import Story" onclick="document.getElementById('import_aidg_club_popup').classList.remove('hidden');">cloud_download</span>
|
<span class="material-icons-outlined cursor" title="Import Story" onclick="document.getElementById('import_aidg_club_popup').classList.remove('hidden');">cloud_download</span>
|
||||||
<span class="material-icons-outlined cursor" title="Download Story" onclick="document.getElementById('download_iframe').src = 'json';">file_download</span>
|
<span class="material-icons-outlined cursor" title="Download Story" onclick="document.getElementById('download_iframe').src = 'json';">file_download</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -99,18 +99,12 @@
|
|||||||
<div class="setting_container_single">
|
<div class="setting_container_single">
|
||||||
<!---Top Row---->
|
<!---Top Row---->
|
||||||
<span class="setting_label">
|
<span class="setting_label">
|
||||||
Sample Order:
|
<span>Sample Order: </span><span class="helpicon material-icons-outlined" title="Help Text Here">help_icon</span>
|
||||||
<span class="helpicon">
|
|
||||||
?
|
|
||||||
<span class="helptext">
|
|
||||||
Sample Order Tooltip
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</span>
|
</span>
|
||||||
<!---Bottom Row---->
|
<!---Bottom Row---->
|
||||||
<span class="setting_item">
|
<span class="setting_item">
|
||||||
<div style="display:flex;flex-direction:row;">
|
<div style="display:flex;flex-direction:row;">
|
||||||
<ul id="sample_order_list" style="width:calc(var(--flyout_menu_width) - 60px);">
|
<ul id="sample_order_list" style="width:calc(var(--flyout_menu_width) - 60px);list-style-position: inside; padding: 0;">
|
||||||
<li class="sample_order cursor" onclick="select_sample(this);">Top-k Sampling</li>
|
<li class="sample_order cursor" onclick="select_sample(this);">Top-k Sampling</li>
|
||||||
<li class="sample_order cursor" onclick="select_sample(this);">Top-a Sampling</li>
|
<li class="sample_order cursor" onclick="select_sample(this);">Top-a Sampling</li>
|
||||||
<li class="sample_order cursor" onclick="select_sample(this);">Top-p Sampling</li>
|
<li class="sample_order cursor" onclick="select_sample(this);">Top-p Sampling</li>
|
||||||
@@ -203,13 +197,7 @@
|
|||||||
{% endwith %}
|
{% endwith %}
|
||||||
<div class="setting_container">
|
<div class="setting_container">
|
||||||
<span class="setting_label">
|
<span class="setting_label">
|
||||||
Maximize Game Text Space:
|
<span>Maximize Game Text Space: </span><span class="helpicon material-icons-outlined" title="When enabled and both menus are un-pinned, the game screen will take up all avaialable space. When disabled, the game screen will be centered.">help_icon</span>
|
||||||
<span class="helpicon">
|
|
||||||
?
|
|
||||||
<span class="helptext">
|
|
||||||
When enabled and both menus are un-pinned, the game screen will take up all avaialable space. When disabled, the game screen will be centered.
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</span>
|
</span>
|
||||||
<span class="setting_item">
|
<span class="setting_item">
|
||||||
<input type=checkbox id="preserve_game_space_setting" data-size=mini data-onstyle=success data-toggle=toggle onchange="preserve_game_space(this.checked)"/>
|
<input type=checkbox id="preserve_game_space_setting" data-size=mini data-onstyle=success data-toggle=toggle onchange="preserve_game_space(this.checked)"/>
|
||||||
@@ -220,13 +208,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="setting_container">
|
<div class="setting_container">
|
||||||
<span class="setting_label">
|
<span class="setting_label">
|
||||||
Keep options on Right:
|
<span>Keep options on Right: </span><span class="helpicon material-icons-outlined" title="When enabled and only the story menu is pinned, the generated story options will be shown on the right instead of the left of the game text.">help_icon</span>
|
||||||
<span class="helpicon">
|
|
||||||
?
|
|
||||||
<span class="helptext">
|
|
||||||
When enabled and only the story menu is pinned, the generated story options will be shown on the right instead of the left of the game text.
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</span>
|
</span>
|
||||||
<span class="setting_item">
|
<span class="setting_item">
|
||||||
<input type=checkbox id="options_on_right" data-size=mini data-onstyle=success data-toggle=toggle onchange="options_on_right(this.checked)"/>
|
<input type=checkbox id="options_on_right" data-size=mini data-onstyle=success data-toggle=toggle onchange="options_on_right(this.checked)"/>
|
||||||
|
@@ -3,13 +3,7 @@
|
|||||||
<div class="setting_container">
|
<div class="setting_container">
|
||||||
<!---Top Row---->
|
<!---Top Row---->
|
||||||
<span class="setting_label">
|
<span class="setting_label">
|
||||||
{{ item['label'] }}:
|
<span>{{ item['label'] }}: </span><span class="helpicon material-icons-outlined" title="{{ item['tooltip'] }}">help_icon</span>
|
||||||
<span class="helpicon">
|
|
||||||
?
|
|
||||||
<span class="helptext">
|
|
||||||
{{ item['tooltip'] }}
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</span>
|
</span>
|
||||||
{% if (item['unit'] != 'bool') and (item['unit'] != 'text') %}
|
{% if (item['unit'] != 'bool') and (item['unit'] != 'text') %}
|
||||||
<input autocomplete="off" class="setting_value var_sync_{{ item['classname'] }}_{{ item['name'] }}" id="{{ item['classname'] }}_{{ item['name'] }}_cur"
|
<input autocomplete="off" class="setting_value var_sync_{{ item['classname'] }}_{{ item['name'] }}" id="{{ item['classname'] }}_{{ item['name'] }}_cur"
|
||||||
|
Reference in New Issue
Block a user