| 20 | } |
| 21 | |
| 22 | bool FunctionCallManager::registerFunctionCall(const FunctionCallConfig& config, IPlatformFunction* function) { |
| 23 | if (!config.isValid()) { |
| 24 | AGENUI_LOG("invalid config"); |
| 25 | return false; |
| 26 | } |
| 27 | if (!function) { |
| 28 | AGENUI_LOG("function is null"); |
| 29 | return false; |
| 30 | } |
| 31 | |
| 32 | std::lock_guard<std::recursive_mutex> lock(_mutex); |
| 33 | |
| 34 | FunctionCallEntry entry; |
| 35 | entry.config = config; |
| 36 | entry.function = function; |
| 37 | |
| 38 | // Register by short name so lookups use "toast" rather than "agenui.platform::toast" |
| 39 | const std::string& name = config.getName(); |
| 40 | std::string fullName = config.getFullName(); |
| 41 | _functionCalls[name] = entry; |
| 42 | |
| 43 | return true; |
| 44 | } |
| 45 | |
| 46 | bool FunctionCallManager::unregisterFunctionCall(const std::string& name) { |
| 47 | std::lock_guard<std::recursive_mutex> lock(_mutex); |