From f8fe5ce1672c8fd2b7af6b91e2cfed6094bfa394 Mon Sep 17 00:00:00 2001 From: erew123 <35898566+erew123@users.noreply.github.com> Date: Sun, 26 Jan 2025 00:36:27 +0000 Subject: [PATCH] Ensure no blank character name/output file --- system/TGWUI_Extension/script.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/system/TGWUI_Extension/script.py b/system/TGWUI_Extension/script.py index 2bb1dca..7646574 100644 --- a/system/TGWUI_Extension/script.py +++ b/system/TGWUI_Extension/script.py @@ -763,11 +763,10 @@ def output_modifier(string, state): # Lock and process TTS request if process_lock.acquire(blocking=False): try: - output_file = ( - state["character_menu"] if "character_menu" in state else str("TTSOUT_") - ) + output_file = (state["character_menu"] if "character_menu" in state else str("TTSOUT_")) + output_file = (state["character_menu"] if "character_menu" in state and state["character_menu"] is not None else "TTSOUT_") # Ensure the file name matches the allowed pattern of AllTalk - output_file = re.sub(r"[^a-zA-Z0-9_]", "", output_file) + output_file = re.sub(r"[^a-zA-Z0-9_]", "", output_file) or "TTSOUT_" # Fallback if empty generate_response, status_message = send_and_generate( cleaned_text,