add my fixes

This commit is contained in:
Wlad
2023-04-12 10:56:54 +02:00
parent edf364efe8
commit 4063483b87
3 changed files with 15 additions and 9 deletions

View File

@@ -67,7 +67,7 @@ def print_to_console(
print()
def attempt_to_fix_json_by_finding_outermost_brackets(json_string):
if cfg.speak_mode and cfg.debug:
if cfg.speak_mode and cfg.debug_mode:
speak.say_text("I have received an invalid JSON response from the OpenAI API. Trying to fix it now.")
print_to_console("Attempting to fix JSON by finding outermost brackets\n", Fore.RED, "")
@@ -81,7 +81,7 @@ def attempt_to_fix_json_by_finding_outermost_brackets(json_string):
# Extract the valid JSON object from the string
json_string = json_match.group(0)
print_to_console("Apparently json was fixed.", Fore.GREEN,"")
if cfg.speak_mode and cfg.debug:
if cfg.speak_mode and cfg.debug_mode:
speak.say_text("Apparently json was fixed.")
else:
raise ValueError("No valid JSON object found")