diff --git a/aiserver.py b/aiserver.py index 78242c3b..00075ccb 100644 --- a/aiserver.py +++ b/aiserver.py @@ -8701,9 +8701,9 @@ def UI_2_redo(data): @logger.catch def UI_2_retry(data): - koboldai_vars.actions.clear_unused_options() if len(koboldai_vars.actions.get_current_options_no_edits()) == 0: - ignore = koboldai_vars.actions.pop(keep=False) + ignore = koboldai_vars.actions.pop(keep=True) + koboldai_vars.actions.clear_unused_options() koboldai_vars.lua_koboldbridge.feedback = None koboldai_vars.recentrng = koboldai_vars.recentrngm = None actionsubmit("", actionmode=koboldai_vars.actionmode) @@ -10331,7 +10331,9 @@ def UI_2_action_image(): filename, mimetype="image/jpeg") else: - return None + return send_file( + "static/blank.png", + mimetype="image/png") #==================================================================# # display messages if they have never been sent before on this install diff --git a/koboldai_settings.py b/koboldai_settings.py index 57472c13..071c7670 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -2103,8 +2103,8 @@ class KoboldStoryRegister(object): if self.story_settings.gen_audio and self.koboldai_vars.experimental_features: for i in reversed([-1]+list(self.actions.keys())): self.gen_audio(i, overwrite=False) - else: - print("{} and {}".format(self.story_settings.gen_audio, self.koboldai_vars.experimental_features)) + #else: + # print("{} and {}".format(self.story_settings.gen_audio, self.koboldai_vars.experimental_features)) def set_picture(self, action_id, filename, prompt): if action_id == -1: @@ -2124,7 +2124,22 @@ class KoboldStoryRegister(object): filename = os.path.join(self.koboldai_vars.save_paths.generated_images, self.actions[action_id]['picture_filename']) prompt = self.actions[action_id]['picture_prompt'] else: - return None, None + #Let's find the last picture if there is one + found = False + for i in reversed(range(-1, action_id)): + if i in self.actions and 'picture_filename' in self.actions[i]: + filename = os.path.join(self.koboldai_vars.save_paths.generated_images, self.actions[i]['picture_filename']) + prompt = self.actions[i]['picture_prompt'] + found = True + break + elif i == -1: + if self.story_settings.prompt_picture_filename == "": + return None, None + filename = os.path.join(self.koboldai_vars.save_paths.generated_images, self.story_settings.prompt_picture_filename) + prompt = self.story_settings.prompt_picture_prompt + found = True + if not found: + return None, None if os.path.exists(filename): return filename, prompt diff --git a/static/blank.png b/static/blank.png new file mode 100644 index 00000000..994c3ba3 Binary files /dev/null and b/static/blank.png differ diff --git a/templates/settings flyout.html b/templates/settings flyout.html index b5307461..fbc0f955 100644 --- a/templates/settings flyout.html +++ b/templates/settings flyout.html @@ -103,7 +103,7 @@ - +