mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Chat and Adventure mode Fix
This commit is contained in:
@@ -345,13 +345,13 @@ gensettingstf = [
|
|||||||
"uitype": "dropdown",
|
"uitype": "dropdown",
|
||||||
"unit": "text",
|
"unit": "text",
|
||||||
"label": "Story Mode",
|
"label": "Story Mode",
|
||||||
"id": "actionmode",
|
"id": "storymode",
|
||||||
"default": 0,
|
"default": 0,
|
||||||
"tooltip": "Choose the mode of KoboldAI.",
|
"tooltip": "Choose the mode of KoboldAI.",
|
||||||
"menu_path": "Home",
|
"menu_path": "Home",
|
||||||
"sub_path": "",
|
"sub_path": "",
|
||||||
"classname": "story",
|
"classname": "story",
|
||||||
"name": "actionmode",
|
"name": "storymode",
|
||||||
'children': [{'text': 'Story', 'value': 0}, {'text':'Adventure','value':1}, {'text':'Chat', 'value':2}]
|
'children': [{'text': 'Story', 'value': 0}, {'text':'Adventure','value':1}, {'text':'Chat', 'value':2}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -431,7 +431,7 @@ class model_settings(settings):
|
|||||||
self.badwordsids = []
|
self.badwordsids = []
|
||||||
self.fp32_model = False # Whether or not the most recently loaded HF model was in fp32 format
|
self.fp32_model = False # Whether or not the most recently loaded HF model was in fp32 format
|
||||||
self.modeldim = -1 # Embedding dimension of your model (e.g. it's 4096 for GPT-J-6B and 2560 for GPT-Neo-2.7B)
|
self.modeldim = -1 # Embedding dimension of your model (e.g. it's 4096 for GPT-J-6B and 2560 for GPT-Neo-2.7B)
|
||||||
self.sampler_order = [0, 1, 2, 3, 4, 5]
|
self.sampler_order = [6, 0, 1, 2, 3, 4, 5]
|
||||||
self.newlinemode = "n"
|
self.newlinemode = "n"
|
||||||
self.lazy_load = True # Whether or not to use torch_lazy_loader.py for transformers models in order to reduce CPU memory usage
|
self.lazy_load = True # Whether or not to use torch_lazy_loader.py for transformers models in order to reduce CPU memory usage
|
||||||
self.revision = None
|
self.revision = None
|
||||||
@@ -552,6 +552,7 @@ class story_settings(settings):
|
|||||||
self.chatname = "You"
|
self.chatname = "You"
|
||||||
self.adventure = False
|
self.adventure = False
|
||||||
self.actionmode = 0
|
self.actionmode = 0
|
||||||
|
self.storymode = 0
|
||||||
self.dynamicscan = False
|
self.dynamicscan = False
|
||||||
self.recentedit = False
|
self.recentedit = False
|
||||||
self.notes = "" #Notes for the story. Does nothing but save
|
self.notes = "" #Notes for the story. Does nothing but save
|
||||||
@@ -638,7 +639,7 @@ class story_settings(settings):
|
|||||||
ignore = self.koboldai_vars.calc_ai_text()
|
ignore = self.koboldai_vars.calc_ai_text()
|
||||||
|
|
||||||
#Because we have seperate variables for action types, this syncs them
|
#Because we have seperate variables for action types, this syncs them
|
||||||
elif name == 'actionmode':
|
elif name == 'storymode':
|
||||||
if value == 0:
|
if value == 0:
|
||||||
self.adventure = False
|
self.adventure = False
|
||||||
self.chatmode = False
|
self.chatmode = False
|
||||||
@@ -650,14 +651,14 @@ class story_settings(settings):
|
|||||||
self.chatmode = True
|
self.chatmode = True
|
||||||
elif name == 'adventure' and value == True:
|
elif name == 'adventure' and value == True:
|
||||||
self.chatmode = False
|
self.chatmode = False
|
||||||
self.actionmode = 1
|
self.storymode = 1
|
||||||
elif name == 'adventure' and value == False and self.chatmode == False:
|
elif name == 'adventure' and value == False and self.chatmode == False:
|
||||||
self.actionmode = 0
|
self.storymode = 0
|
||||||
elif name == 'chatmode' and value == True:
|
elif name == 'chatmode' and value == True:
|
||||||
self.adventure = False
|
self.adventure = False
|
||||||
self.actionmode = 2
|
self.storymode = 2
|
||||||
elif name == 'chatmode' and value == False and self.adventure == False:
|
elif name == 'chatmode' and value == False and self.adventure == False:
|
||||||
self.actionmode = 0
|
self.storymode = 0
|
||||||
|
|
||||||
class user_settings(settings):
|
class user_settings(settings):
|
||||||
local_only_variables = ['socketio', 'importjs']
|
local_only_variables = ['socketio', 'importjs']
|
||||||
|
@@ -199,6 +199,10 @@ border-top-right-radius: var(--tabs_rounding);
|
|||||||
margin: 2px;
|
margin: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat_mode[story_chatmode="false"] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
#story_menu_author .setting_container {
|
#story_menu_author .setting_container {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-areas: "label value"
|
grid-template-areas: "label value"
|
||||||
@@ -1305,6 +1309,17 @@ body {
|
|||||||
gap: 1px;
|
gap: 1px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inputrow[story_storymode="1"] {
|
||||||
|
grid-template-areas: "adventure_mode textarea statusbar statusbar statusbar"
|
||||||
|
"adventure_mode textarea submit submit submit"
|
||||||
|
"adventure_mode textarea back redo retry";
|
||||||
|
grid-template-columns: 80px auto 30px 30px 30px;
|
||||||
|
grid-template-rows: 0px 60px 40px;
|
||||||
|
gap: 1px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#random_game_prompt{
|
#random_game_prompt{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -1319,6 +1334,16 @@ body {
|
|||||||
border-radius: var(--radius_inputbox);
|
border-radius: var(--radius_inputbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#adventure_mode {
|
||||||
|
grid-area: adventure_mode
|
||||||
|
}
|
||||||
|
|
||||||
|
#adventure_mode[story_storymode]:not([story_storymode="1"]) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#input_text {
|
#input_text {
|
||||||
grid-area: textarea;
|
grid-area: textarea;
|
||||||
background-color: var(--input_background);
|
background-color: var(--input_background);
|
||||||
|
@@ -511,6 +511,14 @@ function var_changed(data) {
|
|||||||
//Special case for context viewer
|
//Special case for context viewer
|
||||||
} else if (data.classname == "story" && data.name == "context") {
|
} else if (data.classname == "story" && data.name == "context") {
|
||||||
update_context(data.value);
|
update_context(data.value);
|
||||||
|
//special case for story_actionmode
|
||||||
|
} else if (data.classname == "story" && data.name == "actionmode") {
|
||||||
|
const button = document.getElementById('adventure_mode');
|
||||||
|
if (data.value == 1) {
|
||||||
|
button.childNodes[1].textContent = "Adventure";
|
||||||
|
} else {
|
||||||
|
button.childNodes[1].textContent = "Story";
|
||||||
|
}
|
||||||
//Basic Data Syncing
|
//Basic Data Syncing
|
||||||
} else {
|
} else {
|
||||||
var elements_to_change = document.getElementsByClassName("var_sync_"+data.classname.replace(" ", "_")+"_"+data.name.replace(" ", "_"));
|
var elements_to_change = document.getElementsByClassName("var_sync_"+data.classname.replace(" ", "_")+"_"+data.name.replace(" ", "_"));
|
||||||
@@ -2012,6 +2020,25 @@ function load_tweaks(data) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggle_adventure_mode(button) {
|
||||||
|
if (button.textContent == "Mode: Story") {
|
||||||
|
button.childNodes[1].textContent = "Adventure";
|
||||||
|
var actionmode = 1
|
||||||
|
} else {
|
||||||
|
button.childNodes[1].textContent = "Story";
|
||||||
|
var actionmode = 0
|
||||||
|
}
|
||||||
|
button.classList.add("pulse");
|
||||||
|
socket.emit("var_change", {"ID": "story_actionmode", "value": actionmode}, (response) => {
|
||||||
|
if ('status' in response) {
|
||||||
|
if (response['status'] == 'Saved') {
|
||||||
|
document.getElementById("adventure_mode").classList.remove("pulse");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------General UI Functions------------------------------------
|
//--------------------------------------------General UI Functions------------------------------------
|
||||||
function autoResize(element) {
|
function autoResize(element) {
|
||||||
element.style.height = 'auto';
|
element.style.height = 'auto';
|
||||||
|
@@ -69,12 +69,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!------------ Input Area--------------------->
|
<!------------ Input Area--------------------->
|
||||||
<div class="inputrow" id="inputrow_container">
|
<div class="inputrow var_sync_alt_story_storymode" id="inputrow_container">
|
||||||
<div id="random_game_prompt" class="hidden">
|
<div id="random_game_prompt" class="hidden">
|
||||||
<input type="text" autocomplete="off" id="themetext" placeholder="Theme for Random Story" oninput='if (this.value != "") {
|
<input type="text" autocomplete="off" id="themetext" placeholder="Theme for Random Story" oninput='if (this.value != "") {
|
||||||
document.getElementById("input_text").value = "";}'/>
|
document.getElementById("input_text").value = "";}'/>
|
||||||
<span class="help_text" style="margin:0px;margin-top:5px;">The AI can create a prompt for you! Optionally type in one or more themes above, or let the AI do it's thing.</span>
|
<span class="help_text" style="margin:0px;margin-top:5px;">The AI can create a prompt for you! Optionally type in one or more themes above, or let the AI do it's thing.</span>
|
||||||
</div>
|
</div>
|
||||||
|
<button class="var_sync_alt_story_storymode action_button" id="adventure_mode" onclick="toggle_adventure_mode(this);"><span style="font-weight: bold;">Mode: </span><span>Story</span></button>
|
||||||
<textarea autocomplete="off" row=5 id="input_text" placeholder="Enter Prompt Here" oninput='if (this.value != "") {
|
<textarea autocomplete="off" row=5 id="input_text" placeholder="Enter Prompt Here" oninput='if (this.value != "") {
|
||||||
document.getElementById("themetext").value = "";
|
document.getElementById("themetext").value = "";
|
||||||
}'
|
}'
|
||||||
|
@@ -76,8 +76,6 @@
|
|||||||
<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">save</span>
|
||||||
<span class="button_label">Save Story</span>
|
<span class="button_label">Save Story</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
@@ -88,6 +86,20 @@
|
|||||||
{% include 'settings item.html' %}
|
{% include 'settings item.html' %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
<div class="setting_container chat_mode var_sync_alt_story_chatmode">
|
||||||
|
<!---Top Row---->
|
||||||
|
<span class="setting_label">
|
||||||
|
<span style="white-space: pre-wrap;">Chat Name: </span>
|
||||||
|
<span class="helpicon material-icons-outlined" title="Your name for chat mode.">help_icon</span>
|
||||||
|
</span>
|
||||||
|
<!---Bottom Row---->
|
||||||
|
<span class="setting_item" style="height: 25px;">
|
||||||
|
<input autocomplete="off" id="var_sync_story_chatname" class="var_sync_story_chatname settings_select" onclick="sync_to_server(this);">
|
||||||
|
</span>
|
||||||
|
<!---Slider Labels--->
|
||||||
|
<span class="setting_minlabel"><span style="top: -4px; position: relative;"></span></span>
|
||||||
|
<span class="setting_maxlabel"><span style="top: -4px; position: relative;"></span></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="probabilities">
|
<div id="probabilities">
|
||||||
|
|
||||||
@@ -112,6 +124,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="setting_tile_area">
|
<div class="setting_tile_area">
|
||||||
<span class="help_text">Change how the AI decides what to say.</span>
|
<span class="help_text">Change how the AI decides what to say.</span>
|
||||||
|
{% with sub_path='Sampling' %}
|
||||||
|
{% include 'settings item.html' %}
|
||||||
|
{% endwith %}
|
||||||
<div class="setting_container_single">
|
<div class="setting_container_single">
|
||||||
<!---Top Row---->
|
<!---Top Row---->
|
||||||
<span class="setting_label">
|
<span class="setting_label">
|
||||||
@@ -137,9 +152,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{% with sub_path='Sampling' %}
|
|
||||||
{% include 'settings item.html' %}
|
|
||||||
{% endwith %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="collapsable_header" onclick="toggle_setting_category(this);">
|
<div class="collapsable_header" onclick="toggle_setting_category(this);">
|
||||||
|
Reference in New Issue
Block a user