This commit is contained in:
Saifeddine ALOUI 2024-10-06 22:59:07 +02:00
parent 78f736ccec
commit 3a066c8b70
3 changed files with 22 additions and 7 deletions

View File

@ -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:

View File

@ -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

View File

@ -21,4 +21,6 @@ python-socketio[client]
python-socketio[asyncio_client]
freedom-search
scrapemaster
scrapemaster
inspect