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:
@@ -1020,8 +1020,10 @@ class story_settings(settings):
|
|||||||
logger.debug("Calcing WI Assignment for action_id: {} wuid: {}".format(action_id, wuid))
|
logger.debug("Calcing WI Assignment for action_id: {} wuid: {}".format(action_id, wuid))
|
||||||
if action_id != -1 and (action_id is None or action_id not in self.actions.actions):
|
if action_id != -1 and (action_id is None or action_id not in self.actions.actions):
|
||||||
actions_to_check = self.actions.actions
|
actions_to_check = self.actions.actions
|
||||||
else:
|
elif action_id == -1:
|
||||||
actions_to_check = {}
|
actions_to_check = {}
|
||||||
|
else:
|
||||||
|
actions_to_check = {action_id: self.actions.actions[action_id]}
|
||||||
if wuid is None or wuid not in self.worldinfo_v2.world_info:
|
if wuid is None or wuid not in self.worldinfo_v2.world_info:
|
||||||
wi_to_check = self.worldinfo_v2.world_info
|
wi_to_check = self.worldinfo_v2.world_info
|
||||||
else:
|
else:
|
||||||
@@ -1369,6 +1371,7 @@ class KoboldStoryRegister(object):
|
|||||||
|
|
||||||
def add_wi_to_action(self, action_id, key, content, uid, no_transmit=False):
|
def add_wi_to_action(self, action_id, key, content, uid, no_transmit=False):
|
||||||
old = self.story_settings.prompt_wi_highlighted_text.copy() if action_id == -1 else self.actions[action_id].copy()
|
old = self.story_settings.prompt_wi_highlighted_text.copy() if action_id == -1 else self.actions[action_id].copy()
|
||||||
|
force_changed = False
|
||||||
#First check to see if we have the wi_highlighted_text variable
|
#First check to see if we have the wi_highlighted_text variable
|
||||||
if action_id != -1:
|
if action_id != -1:
|
||||||
if 'wi_highlighted_text' not in self.actions[action_id]:
|
if 'wi_highlighted_text' not in self.actions[action_id]:
|
||||||
@@ -1399,14 +1402,18 @@ class KoboldStoryRegister(object):
|
|||||||
if post_text is not None:
|
if post_text is not None:
|
||||||
action.insert(i+adder, {"text": post_text, "WI matches": None, "WI Text": ""})
|
action.insert(i+adder, {"text": post_text, "WI matches": None, "WI Text": ""})
|
||||||
break;
|
break;
|
||||||
|
elif action[i]['WI matches'] == uid:
|
||||||
|
action[i]['WI Text'] = content
|
||||||
|
force_changed = True
|
||||||
|
i+=1
|
||||||
else:
|
else:
|
||||||
i+=1
|
i+=1
|
||||||
if action_id != -1:
|
if action_id != -1:
|
||||||
if old != self.actions[action_id]:
|
if old != self.actions[action_id] or force_changed:
|
||||||
if not no_transmit:
|
if not no_transmit:
|
||||||
process_variable_changes(self.socketio, "story", 'actions', {"id": action_id, 'action': self.actions[action_id]}, old)
|
process_variable_changes(self.socketio, "story", 'actions', {"id": action_id, 'action': self.actions[action_id]}, old)
|
||||||
else:
|
else:
|
||||||
if old != self.story_settings.prompt_wi_highlighted_text:
|
if old != self.story_settings.prompt_wi_highlighted_text or force_changed:
|
||||||
if not no_transmit:
|
if not no_transmit:
|
||||||
process_variable_changes(self.socketio, "story", 'prompt_wi_highlighted_text', self.story_settings.prompt_wi_highlighted_text, old)
|
process_variable_changes(self.socketio, "story", 'prompt_wi_highlighted_text', self.story_settings.prompt_wi_highlighted_text, old)
|
||||||
|
|
||||||
@@ -1451,6 +1458,8 @@ class KoboldStoryRegister(object):
|
|||||||
old_text = self.actions[i]["Selected Text"]
|
old_text = self.actions[i]["Selected Text"]
|
||||||
if self.actions[i]["Selected Text"] != text:
|
if self.actions[i]["Selected Text"] != text:
|
||||||
self.actions[i]["Selected Text"] = text
|
self.actions[i]["Selected Text"] = text
|
||||||
|
if 'wi_highlighted_text' in self.actions[i]:
|
||||||
|
del self.actions[i]['wi_highlighted_text']
|
||||||
if self.koboldai_vars.tokenizer is not None:
|
if self.koboldai_vars.tokenizer is not None:
|
||||||
tokens = self.koboldai_vars.tokenizer.encode(text)
|
tokens = self.koboldai_vars.tokenizer.encode(text)
|
||||||
if 'Probabilities' in self.actions[i]:
|
if 'Probabilities' in self.actions[i]:
|
||||||
|
@@ -556,11 +556,6 @@ function do_story_text_updates(action) {
|
|||||||
item = document.createElement("span");
|
item = document.createElement("span");
|
||||||
item.id = 'Selected Text Chunk '+action.id;
|
item.id = 'Selected Text Chunk '+action.id;
|
||||||
item.classList.add("rawtext");
|
item.classList.add("rawtext");
|
||||||
item.addEventListener("paste", function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var text = e.clipboardData.getData("text/plain");
|
|
||||||
document.execCommand("insertHTML", false, text);
|
|
||||||
});
|
|
||||||
item.setAttribute("chunk", action.id);
|
item.setAttribute("chunk", action.id);
|
||||||
//need to find the closest element
|
//need to find the closest element
|
||||||
next_id = action.id+1;
|
next_id = action.id+1;
|
||||||
@@ -6544,11 +6539,6 @@ function addMessage(author, content, actionId, afterMsgEl=null, time=null) {
|
|||||||
// Insertion location
|
// Insertion location
|
||||||
insertionLocation,
|
insertionLocation,
|
||||||
);
|
);
|
||||||
message.addEventListener("paste", function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var text = e.clipboardData.getData("text/plain");
|
|
||||||
document.execCommand("insertHTML", false, text);
|
|
||||||
});
|
|
||||||
|
|
||||||
const leftContainer = $e("div", message, {classes: ["chat-left-container"]});
|
const leftContainer = $e("div", message, {classes: ["chat-left-container"]});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user