Merge pull request #244 from pi6am/fix/load-non-started

Fix loading a non-started V1 story json in UI2
This commit is contained in:
henk717
2023-01-06 16:29:52 +01:00
committed by GitHub

View File

@@ -4816,6 +4816,11 @@ def actionsubmit(data, actionmode=0, force_submit=False, force_prompt_gen=False,
execute_inmod()
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 koboldai_vars.prompt:
# This will happen only when loading a non-started save game (i.e. one consisting only of a saved prompt).
# In this case, prepend the prompt to the sumission. This allows the player to submit a blank initial submission
# (preserving the prompt), or to add to the prompt by submitting non-empty data.
data = koboldai_vars.prompt + data
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")