diff --git a/README.md b/README.md index c466a2b..ce48def 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # SmartAssistant - עוזר חכם -**גרסה:** 1.1.5 | **מחבר:** klear | **EspoCRM:** >= 8.0.0 +**גרסה:** 1.1.6 | **מחבר:** klear | **EspoCRM:** >= 8.0.0 ## תיאור עוזר AI מאוחד למשרד עורכי דין. מספק ממשק צ'אט צף עם שני מצבי עבודה: **מצב משרד** (סקירה כללית, התראות, סטטיסטיקות) ו**מצב תיק** (סיוע מעמיק בתיק ספציפי). כולל מערכת זיכרון תיק מובנית, ביצוע פעולות באישור המשתמש, ואינטגרציה עם Stream של EspoCRM. diff --git a/files/custom/Espo/Modules/SmartAssistant/Services/ConversationRepository.php b/files/custom/Espo/Modules/SmartAssistant/Services/ConversationRepository.php index 1cb1301..5e5d956 100644 --- a/files/custom/Espo/Modules/SmartAssistant/Services/ConversationRepository.php +++ b/files/custom/Espo/Modules/SmartAssistant/Services/ConversationRepository.php @@ -55,8 +55,7 @@ class ConversationRepository if (!$entity) return; } - $messages = $entity->get('messagesData') ?? []; - if (is_object($messages)) $messages = (array) $messages; + $messages = json_decode(json_encode($entity->get('messagesData') ?? []), true); $newMessage = ['role' => $role, 'content' => $content, 'timestamp' => date('Y-m-d H:i:s')]; if (!empty($actions)) $newMessage['actions'] = $actions; @@ -81,8 +80,7 @@ class ConversationRepository $entity = $this->entityManager->getRDBRepository('AssistantConversation') ->where(['conversationKey' => $conversationKey, 'deleted' => false])->findOne(); if (!$entity) return []; - $messages = $entity->get('messagesData') ?? []; - return is_object($messages) ? (array) $messages : $messages; + return json_decode(json_encode($entity->get('messagesData') ?? []), true); } public function getRecentConversations(?string $type = null, ?string $caseId = null, int $limit = 20): array @@ -137,8 +135,7 @@ class ConversationRepository ->where(['conversationKey' => $conversationKey, 'deleted' => false])->findOne(); if (!$entity) return; - $data = $entity->get('messagesData') ?? []; - if (is_object($data)) $data = (array) $data; + $data = json_decode(json_encode($entity->get('messagesData') ?? []), true); for ($i = count($data) - 1; $i >= 0; $i--) { if (($data[$i]['role'] ?? '') === 'assistant') { $data[$i]['pendingActions'] = $actions; break; } } diff --git a/manifest.json b/manifest.json index b431214..a07eb8e 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 n8n integration", "author": "klear", - "version": "1.1.5", + "version": "1.1.6", "acceptableVersions": [ ">=8.0.0" ],