From 289a9cf27f043d01cf67f3129896799beea32e5d Mon Sep 17 00:00:00 2001 From: Chaim Date: Thu, 9 Apr 2026 20:59:12 +0000 Subject: [PATCH] fix: deep-convert nested stdClass params in executeTool endpoint When the AI Gateway sends nested JSON objects (like legalAnalysis), PHP decodes them as stdClass. The previous (array) cast only converted the top level, leaving nested stdClass that caused "Cannot use object as array" fatal errors. Now uses json_decode(json_encode()) for recursive array conversion. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../Espo/Modules/SmartAssistant/Controllers/SmartAssistant.php | 2 +- manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/custom/Espo/Modules/SmartAssistant/Controllers/SmartAssistant.php b/files/custom/Espo/Modules/SmartAssistant/Controllers/SmartAssistant.php index ae4349c..e904d4b 100644 --- a/files/custom/Espo/Modules/SmartAssistant/Controllers/SmartAssistant.php +++ b/files/custom/Espo/Modules/SmartAssistant/Controllers/SmartAssistant.php @@ -186,7 +186,7 @@ class SmartAssistant } $tool = $data->tool; - $params = (array) ($data->params ?? []); + $params = json_decode(json_encode($data->params ?? []), true) ?? []; $caseId = $data->caseId ?? null; $executor = $this->injectableFactory->create(ActionExecutor::class); diff --git a/manifest.json b/manifest.json index 014b734..cfd5272 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "module": "SmartAssistant", "description": "Unified AI Assistant for Legal CRM — floating chat with case memory, office alerts, and AI Gateway integration", "author": "klear", - "version": "2.7.1", + "version": "2.7.2", "acceptableVersions": [ ">=8.0.0" ],