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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user