Merge pull request #678 from kinance/kinance-resolve-debug-config-conflict

Resolve the conflict around debug mode flag after pull merge
This commit is contained in:
Toran Bruce Richards
2023-04-11 12:34:01 +01:00
committed by GitHub
3 changed files with 6 additions and 9 deletions

View File

@@ -33,7 +33,7 @@ class Config(metaclass=Singleton):
def __init__(self): def __init__(self):
"""Initialize the Config class""" """Initialize the Config class"""
self.debug = False self.debug_mode = False
self.continuous_mode = False self.continuous_mode = False
self.speak_mode = False self.speak_mode = False
@@ -131,4 +131,4 @@ class Config(metaclass=Singleton):
def set_debug_mode(self, value: bool): def set_debug_mode(self, value: bool):
"""Set the debug mode value.""" """Set the debug mode value."""
self.debug = value self.debug_mode = value

View File

@@ -88,7 +88,7 @@ def fix_invalid_escape(json_str: str, error_message: str) -> str:
json.loads(json_str) json.loads(json_str)
return json_str return json_str
except json.JSONDecodeError as e: except json.JSONDecodeError as e:
if cfg.debug: if cfg.debug_mode:
print('json loads error - fix invalid escape', e) print('json loads error - fix invalid escape', e)
error_message = str(e) error_message = str(e)
return json_str return json_str
@@ -103,12 +103,12 @@ def correct_json(json_str: str) -> str:
""" """
try: try:
if cfg.debug: if cfg.debug_mode:
print("json", json_str) print("json", json_str)
json.loads(json_str) json.loads(json_str)
return json_str return json_str
except json.JSONDecodeError as e: except json.JSONDecodeError as e:
if cfg.debug: if cfg.debug_mode:
print('json loads error', e) print('json loads error', e)
error_message = str(e) error_message = str(e)
if error_message.startswith('Invalid \\escape'): if error_message.startswith('Invalid \\escape'):
@@ -119,7 +119,7 @@ def correct_json(json_str: str) -> str:
json.loads(json_str) json.loads(json_str)
return json_str return json_str
except json.JSONDecodeError as e: except json.JSONDecodeError as e:
if cfg.debug: if cfg.debug_mode:
print('json loads error - add quotes', e) print('json loads error - add quotes', e)
error_message = str(e) error_message = str(e)
if balanced_str := balance_braces(json_str): if balanced_str := balance_braces(json_str):

View File

@@ -292,9 +292,6 @@ def parse_arguments():
print_to_console("GPT3.5 Only Mode: ", Fore.GREEN, "ENABLED") print_to_console("GPT3.5 Only Mode: ", Fore.GREEN, "ENABLED")
cfg.set_smart_llm_model(cfg.fast_llm_model) cfg.set_smart_llm_model(cfg.fast_llm_model)
if args.debug:
print_to_console("Debug Mode: ", Fore.GREEN, "ENABLED")
cfg.set_debug_mode(True)
# TODO: fill in llm values here # TODO: fill in llm values here