diff --git a/lollms/personality.py b/lollms/personality.py index afc1df7..2c3de08 100644 --- a/lollms/personality.py +++ b/lollms/personality.py @@ -46,6 +46,12 @@ from lollms.com import LoLLMsCom from lollms.helpers import trace_exception from lollms.utilities import PackageManager +import pipmaster as pm + +if not pm.is_installed("inspect"): + pm.install("inspect") +import inspect + from lollms.code_parser import compress_js, compress_python, compress_html @@ -2057,11 +2063,18 @@ class StateMachine: for cmd, func in commands.items(): if cmd == command[0:len(cmd)]: - try: - func(command, full_context, callback, context_state, client) - except:# retrocompatibility - func(command, full_context, client) - return + # Get the number of parameters the function expects + param_count = len(inspect.signature(func).parameters) + + if param_count == 3: + # Old version of the function + return func(command, full_context, client) + elif param_count == 5: + # New version of the function + return func(command, full_context, callback, context_state, client) + else: + raise ValueError(f"Unexpected number of parameters for function {func.__name__}. Expected 3 or 5, got {param_count}") + default_func = current_state.get("default") if default_func is not None: diff --git a/lollms/services/tts/xtts/lollms_xtts.py b/lollms/services/tts/xtts/lollms_xtts.py index 02debd7..1399412 100644 --- a/lollms/services/tts/xtts/lollms_xtts.py +++ b/lollms/services/tts/xtts/lollms_xtts.py @@ -20,7 +20,7 @@ import pipmaster as pm if version.parse(str(pm.get_installed_version("numpy"))) > version.parse(str("1.26.9")): pm.install_version("numpy", "1.26.4") -if pm.is_installed("pydub"): +if not pm.is_installed("pydub"): pm.install("pydub") import numpy as np diff --git a/requirements.txt b/requirements.txt index d57a700..744ac50 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,4 +21,6 @@ python-socketio[client] python-socketio[asyncio_client] freedom-search -scrapemaster \ No newline at end of file +scrapemaster + +inspect \ No newline at end of file