mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Abort fixes (still not working)
This commit is contained in:
@@ -4042,6 +4042,8 @@ def actionsubmit(data, actionmode=0, force_submit=False, force_prompt_gen=False,
|
||||
koboldai_vars.submission = re.sub(r"[^\S\r\n]*([\r\n]*)$", r"\1", koboldai_vars.submission) # Remove trailing whitespace, excluding newlines
|
||||
data = koboldai_vars.submission
|
||||
if(not force_submit and len(data.strip()) == 0):
|
||||
set_aibusy(0)
|
||||
socketio.emit("error", "No prompt or random story theme entered", broadcast=True, room="UI_2")
|
||||
assert False
|
||||
# Start the game
|
||||
koboldai_vars.gamestarted = True
|
||||
@@ -7096,7 +7098,9 @@ def UI_2_submit(data):
|
||||
#==================================================================#
|
||||
@socketio.on('abort')
|
||||
def UI_2_abort(data):
|
||||
print("got abort")
|
||||
koboldai_vars.abort = True
|
||||
print(koboldai_vars.abort)
|
||||
|
||||
|
||||
#==================================================================#
|
||||
|
@@ -366,7 +366,7 @@ class settings(object):
|
||||
class model_settings(settings):
|
||||
local_only_variables = ['badwordsids', 'apikey', 'tqdm', 'socketio', 'default_preset']
|
||||
no_save_variables = ['tqdm', 'tqdm_progress', 'tqdm_rem_time', 'socketio', 'modelconfig', 'custmodpth', 'generated_tkns',
|
||||
'loaded_layers', 'total_layers', 'total_download_chunks', 'downloaded_chunks']
|
||||
'loaded_layers', 'total_layers', 'total_download_chunks', 'downloaded_chunks', 'presets', 'default_preset']
|
||||
settings_name = "model"
|
||||
def __init__(self, socketio):
|
||||
self.socketio = socketio
|
||||
@@ -733,9 +733,14 @@ class system_settings(settings):
|
||||
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
if name == "abort":
|
||||
print("setting abort")
|
||||
new_variable = name not in self.__dict__
|
||||
old_value = getattr(self, name, None)
|
||||
super().__setattr__(name, value)
|
||||
if name == "abort":
|
||||
print("set abort to {}".format(self.abort))
|
||||
|
||||
#Put variable change actions here
|
||||
if name == 'serverstarted':
|
||||
global serverstarted
|
||||
@@ -744,8 +749,12 @@ class system_settings(settings):
|
||||
process_variable_changes(self.socketio, self.__class__.__name__.replace("_settings", ""), name, value, old_value)
|
||||
|
||||
if name == "aibusy" and value == False:
|
||||
print("resetting abort as AI busy was set to false")
|
||||
koboldai_vars.abort = False
|
||||
|
||||
if name == "abort":
|
||||
print("set abort to {}".format(self.abort))
|
||||
|
||||
class KoboldStoryRegister(object):
|
||||
def __init__(self, socketio, story_settings, koboldai_vars, tokenizer=None, sequence=[]):
|
||||
self.socketio = socketio
|
||||
|
@@ -41,13 +41,13 @@
|
||||
<div class="gametext" id="Selected Text">
|
||||
<span id="story_prompt" class="var_sync_story_prompt var_sync_alt_story_prompt_length var_sync_alt_story_prompt_in_ai rawtext" contenteditable=true onblur="if (getAttribute(this, 'old_text') != this.textContent) {sync_to_server(this);}" onkeydown="detect_enter_text"></span>
|
||||
<span id="Delete Me">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -71,7 +71,7 @@
|
||||
<div class="inputrow" id="inputrow_container">
|
||||
<div id="random_game_prompt" class="hidden">
|
||||
<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>
|
||||
</div>
|
||||
<textarea autocomplete="off" row=5 id="input_text" placeholder="Enter Prompt Here" oninput='if (this.value != "") {
|
||||
@@ -79,7 +79,7 @@
|
||||
}'
|
||||
onkeyup="calc_token_usage()"></textarea>
|
||||
<div class="statusbar_outer hidden" id="status_bar" onclick="socket.emit('abort','');">
|
||||
<div class="statusbar_inner" style="width:0%">0%</div>
|
||||
<div class="statusbar_inner" style="width:0%" onclick="socket.emit('abort','');">0%</div>
|
||||
</div><br>
|
||||
<button type="button" class="btn action_button submit var_sync_alt_system_aibusy" system_aibusy=False id="btnsubmit"
|
||||
onclick="socket.emit('submit', {'data': document.getElementById('input_text').value, 'theme': document.getElementById('themetext').value});document.getElementById('input_text').value = '';document.getElementById('themetext').value = '';"
|
||||
|
Reference in New Issue
Block a user