Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f9d06739e | |||
| bd1d484e74 |
+10
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"controller": "controllers/record",
|
||||||
|
"color": "#9b59b6",
|
||||||
|
"iconClass": "fas fa-brain",
|
||||||
|
"boolFilterList": ["onlyMy"],
|
||||||
|
"filterList": [
|
||||||
|
{"name": "pinned"},
|
||||||
|
{"name": "byCategory"}
|
||||||
|
]
|
||||||
|
}
|
||||||
+3
-1
@@ -7,5 +7,7 @@
|
|||||||
"aclLevelList": ["all", "team", "own", "no"],
|
"aclLevelList": ["all", "team", "own", "no"],
|
||||||
"stream": false,
|
"stream": false,
|
||||||
"tab": true,
|
"tab": true,
|
||||||
"disabled": false
|
"disabled": false,
|
||||||
|
"importable": false,
|
||||||
|
"customizable": true
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
"module": "SmartAssistant",
|
"module": "SmartAssistant",
|
||||||
"description": "Unified AI Assistant for Legal CRM — floating chat with case memory, office alerts, and AI Gateway integration",
|
"description": "Unified AI Assistant for Legal CRM — floating chat with case memory, office alerts, and AI Gateway integration",
|
||||||
"author": "klear",
|
"author": "klear",
|
||||||
"version": "2.10.1",
|
"version": "2.10.3",
|
||||||
"acceptableVersions": [
|
"acceptableVersions": [
|
||||||
">=8.0.0"
|
">=8.0.0"
|
||||||
],
|
],
|
||||||
|
|||||||
+17
-24
@@ -1,16 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
namespace Espo\Modules\SmartAssistant\Scripts;
|
* AfterInstall script for SmartAssistant extension 2.10.x.
|
||||||
|
*
|
||||||
|
* Idempotently seeds the AssistantPrompt entity with 7 default prompt
|
||||||
|
* sections (tool_rules, writing_style, legal_assistance, personality_case,
|
||||||
|
* personality_office, other_rules_case, other_rules_office). If a row with
|
||||||
|
* the same `key` already exists it is left alone — admin edits win.
|
||||||
|
*
|
||||||
|
* Class must be named `AfterInstall` with NO namespace — that's what the
|
||||||
|
* EspoCRM extension installer looks for in scripts/AfterInstall.php.
|
||||||
|
* See application/Espo/Core/Upgrades/ExtensionManager.php scriptNames map.
|
||||||
|
*/
|
||||||
|
|
||||||
use Espo\Core\Container;
|
use Espo\Core\Container;
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs after the extension is installed/upgraded.
|
|
||||||
*
|
|
||||||
* Idempotent: only inserts AssistantPrompt rows whose `key` doesn't exist yet.
|
|
||||||
* If the row exists (even with edits), we leave it alone — the user's
|
|
||||||
* customizations win.
|
|
||||||
*/
|
|
||||||
class AfterInstall
|
class AfterInstall
|
||||||
{
|
{
|
||||||
public function run(Container $container, $params = null): void
|
public function run(Container $container, $params = null): void
|
||||||
@@ -18,21 +21,11 @@ class AfterInstall
|
|||||||
$entityManager = $container->get('entityManager');
|
$entityManager = $container->get('entityManager');
|
||||||
$log = $container->get('log');
|
$log = $container->get('log');
|
||||||
|
|
||||||
$resourceFile = __DIR__ . '/../files/custom/Espo/Modules/SmartAssistant/Resources/data/default-prompts.json';
|
// The JSON file lives inside the installed module resources at runtime.
|
||||||
|
|
||||||
if (!is_file($resourceFile)) {
|
|
||||||
// Fall back to the module Resources path when the extension is
|
|
||||||
// installed (Resources/ is the canonical location at runtime).
|
|
||||||
$resourceFile = dirname(__DIR__) . '/files/custom/Espo/Modules/SmartAssistant/Resources/data/default-prompts.json';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_file($resourceFile)) {
|
|
||||||
// Final fallback: the module's installed Resources path.
|
|
||||||
$resourceFile = 'custom/Espo/Modules/SmartAssistant/Resources/data/default-prompts.json';
|
$resourceFile = 'custom/Espo/Modules/SmartAssistant/Resources/data/default-prompts.json';
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_file($resourceFile)) {
|
if (!is_file($resourceFile)) {
|
||||||
$log->warning("[SmartAssistant] AfterInstall: default-prompts.json not found, skipping seed");
|
$log->warning("[SmartAssistant] AfterInstall: $resourceFile not found, skipping seed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +33,7 @@ class AfterInstall
|
|||||||
$defaults = json_decode($json, true);
|
$defaults = json_decode($json, true);
|
||||||
|
|
||||||
if (!is_array($defaults)) {
|
if (!is_array($defaults)) {
|
||||||
$log->warning("[SmartAssistant] AfterInstall: default-prompts.json invalid JSON");
|
$log->warning("[SmartAssistant] AfterInstall: invalid JSON in $resourceFile");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,8 +66,8 @@ class AfterInstall
|
|||||||
'isActive' => true,
|
'isActive' => true,
|
||||||
]);
|
]);
|
||||||
// skipAll bypasses beforeSave hooks that require a logged-in user
|
// skipAll bypasses beforeSave hooks that require a logged-in user
|
||||||
// service (install runs without a session) and ACL checks (we're
|
// service (installer runs without an HTTP session) and ACL checks
|
||||||
// seeding firm-wide defaults; no user is implicated).
|
// (we're seeding firm-wide defaults; no user is implicated).
|
||||||
$entityManager->saveEntity($entity, ['skipAll' => true]);
|
$entityManager->saveEntity($entity, ['skipAll' => true]);
|
||||||
$created++;
|
$created++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user