Refactor AIEngine and registry to improve function ID generation and support legacy names

- Updated AIEngine to normalize function names by replacing underscores with hyphens in generated function IDs for better consistency with frontend tracking.
- Enhanced registry to resolve function name aliases, allowing for backward compatibility with legacy function names when retrieving function instances.
This commit is contained in:
Desktop
2025-11-10 19:41:58 +05:00
parent 5d9db50c64
commit 1d51c667b1
2 changed files with 12 additions and 2 deletions

View File

@@ -54,7 +54,15 @@ def list_functions() -> list:
def get_function_instance(name: str) -> Optional[BaseAIFunction]:
"""Get function instance by name - lazy loads if needed"""
fn_class = get_function(name)
# Resolve alias first to support legacy function names
try:
from igny8_core.ai.settings import FUNCTION_ALIASES
except ImportError:
FUNCTION_ALIASES = {}
actual_name = FUNCTION_ALIASES.get(name, name)
fn_class = get_function(actual_name)
if fn_class:
return fn_class()
return None