mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Fix for random spaces being added
Added try at better error handling.
This commit is contained in:
15
aiserver.py
15
aiserver.py
@@ -6168,7 +6168,7 @@ def load_story_v1(js):
|
|||||||
if "actions_metadata" in js:
|
if "actions_metadata" in js:
|
||||||
if type(js["actions_metadata"]) == dict:
|
if type(js["actions_metadata"]) == dict:
|
||||||
for key in js["actions_metadata"]:
|
for key in js["actions_metadata"]:
|
||||||
if js["actions_metadata"][key]["Alternative Text"] != [] and js["actions_metadata"][key]["Alternative Text"] != {}:
|
if js["actions_metadata"][key]["Alternative Text"] != []:
|
||||||
data = js["actions_metadata"][key]["Alternative Text"]
|
data = js["actions_metadata"][key]["Alternative Text"]
|
||||||
data["text"] = data.pop("Text")
|
data["text"] = data.pop("Text")
|
||||||
koboldai_vars.actions.set_options(self, data, key)
|
koboldai_vars.actions.set_options(self, data, key)
|
||||||
@@ -7305,6 +7305,19 @@ def my_except_hook(exctype, value, traceback):
|
|||||||
sys.__excepthook__(exctype, value, traceback)
|
sys.__excepthook__(exctype, value, traceback)
|
||||||
sys.excepthook = my_except_hook
|
sys.excepthook = my_except_hook
|
||||||
|
|
||||||
|
from werkzeug.exceptions import HTTPException
|
||||||
|
|
||||||
|
@app.errorhandler(Exception)
|
||||||
|
def handle_exception(e):
|
||||||
|
# pass through HTTP errors
|
||||||
|
if isinstance(e, HTTPException):
|
||||||
|
return e
|
||||||
|
|
||||||
|
# now you're handling non-HTTP exceptions only
|
||||||
|
print("sending error to clients")
|
||||||
|
socketio.emit("error", "{}: {}".format(e.message, e.args), broadcast=True, room="UI_2")
|
||||||
|
return render_template("500_generic.html", e=e), 500
|
||||||
|
|
||||||
|
|
||||||
#==================================================================#
|
#==================================================================#
|
||||||
# Event triggered when Softprompt is clicked
|
# Event triggered when Softprompt is clicked
|
||||||
|
@@ -2417,7 +2417,7 @@ function assign_world_info_to_action(action_item, uid) {
|
|||||||
if (end_word-passed_words <= span_text.length) {
|
if (end_word-passed_words <= span_text.length) {
|
||||||
highlight_text += " ";
|
highlight_text += " ";
|
||||||
}
|
}
|
||||||
var after_highlight_text = span_text.slice((end_word-passed_words)).join(" ")+" ";
|
var after_highlight_text = span_text.slice((end_word-passed_words)).join(" ");
|
||||||
//console.log(span.textContent);
|
//console.log(span.textContent);
|
||||||
//console.log(keyword);
|
//console.log(keyword);
|
||||||
//console.log(before_highlight_text);
|
//console.log(before_highlight_text);
|
||||||
|
Reference in New Issue
Block a user