Merge branch 'UI2' of https://github.com/ebolam/KoboldAI into ui2-lorecard-img

This commit is contained in:
somebody
2022-11-26 22:19:20 -06:00
6 changed files with 50 additions and 18 deletions

View File

@@ -4716,7 +4716,7 @@ def actionsubmit(data, actionmode=0, force_submit=False, force_prompt_gen=False,
if(len(koboldai_vars.prompt.strip()) == 0):
koboldai_vars.prompt = data
else:
koboldai_vars.actions.append_submission(data)
koboldai_vars.actions.append(data, submission=True)
update_story_chunk('last')
send_debug()

View File

@@ -113,7 +113,6 @@ gensettingstf = [
"ui_level": 1
},
{
"UI_V2_Only": True,
"uitype": "slider",
"unit": "float",
"label": "Repetition Penalty",

View File

@@ -1400,16 +1400,15 @@ class KoboldStoryRegister(object):
ignore = self.koboldai_vars.calc_ai_text()
self.set_game_saved()
self.gen_all_audio()
def append_submission(self, text, action_id_offset=0, recalc=True):
self._append(text, action_id_offset=action_id_offset, recalc=recalc)
self.submission_id = self.action_count + action_id_offset
def append(self, text, action_id_offset=0, recalc=True):
self._append(text, action_id_offset=action_id_offset, recalc=recalc)
self.submission_id = 0
def append(self, text, action_id_offset=0, recalc=True, submission=False):
"""Create a new action and append it to the table of actions.
def _append(self, text, action_id_offset=0, recalc=True):
text: The text of the action.
action_id_offset: An optional offset added to action_count when assiging an action_id.
recalc: If True, recalculate the context and generate audio.
submission: If True, mark this action as a user submission.
"""
if self.koboldai_vars.remove_double_space:
while " " in text:
text = text.replace(" ", " ")
@@ -1441,7 +1440,12 @@ class KoboldStoryRegister(object):
"Probabilities": [],
"Time": int(time.time()),
}
if submission:
self.submission_id = action_id
else:
self.submission_id = 0
if self.story_settings is not None:
self.story_settings.assign_world_info_to_actions(action_id=action_id, no_transmit=True)
process_variable_changes(self.socketio, "story", 'actions', {"id": action_id, 'action': self.actions[action_id]}, None)

View File

@@ -1331,9 +1331,10 @@ body {
margin: auto auto auto auto;
display: flex;
flex-direction: column;
color: var(--flyout_text);
}
.delete_option_icon {
.option_icon {
font-size: 1.2em !important;
}

View File

@@ -282,6 +282,30 @@ function create_options(action) {
while (option_chunk.firstChild) {
option_chunk.removeChild(option_chunk.firstChild);
}
//Let's check if we only have a single redo option. In that case we din't show as the user can use the redo button
seen_prev_selection = false;
show_options = false;
console.log(action.action.Options);
for (item of action.action.Options) {
if (!(item['Previous Selection'])) {
console.log(item);
show_options = true;
break;
} else if (item['Previous Selection']) {
if (seen_prev_selection) {
show_options = true;
break;
} else {
seen_prev_selection = true;
}
}
}
console.log("seen_prev_selection: "+seen_prev_selection+" show_options: "+show_options);
if (!(show_options)) {
return;
}
var table = document.createElement("div");
table.classList.add("sequences");
//Add Redo options
@@ -302,10 +326,12 @@ function create_options(action) {
iconcell.classList.add("sequnce_icon");
var icon = document.createElement("span");
icon.id = "Pin_"+i;
icon.classList.add("oi");
icon.setAttribute('data-glyph', "loop-circular");
icon.classList.add("material-icons-outlined");
icon.classList.add("option_icon");
icon.classList.add("cursor");
icon.textContent = "cached";
iconcell.append(icon);
delete_icon = $e("span", iconcell, {"classes": ["material-icons-outlined", "cursor", 'delete_option_icon'],
delete_icon = $e("span", iconcell, {"classes": ["material-icons-outlined", "cursor", 'option_icon'],
"tooltip": "Delete Option", 'option_id': i,
'option_chunk': action.id, 'textContent': 'delete'});
delete_icon.onclick = function () {
@@ -338,8 +364,10 @@ function create_options(action) {
iconcell.classList.add("sequnce_icon");
var icon = document.createElement("span");
icon.id = "Pin_"+i;
icon.classList.add("oi");
icon.setAttribute('data-glyph', "pin");
icon.classList.add("material-icons-outlined");
icon.classList.add("option_icon");
icon.classList.add("cursor");
icon.textContent = "push_pin";
if (!(item.Pinned)) {
icon.setAttribute('style', "filter: brightness(50%);");
}

View File

@@ -285,7 +285,7 @@
<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 class="setting_container">
<div class="setting_container" ui_level=1>
<!---Top Row---->
<span class="setting_label">
<span>Game Text Size:&nbsp;</span><span class="helpicon material-icons-outlined" tooltip="Changes the font size of the game text.">help_icon</span>