Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5c60f4272 | |||
| 21c3e33635 | |||
| ffbb648dd5 | |||
| f915faafdc | |||
| b9abe5f921 | |||
| a3801deb55 | |||
| 300cc58a97 | |||
| c1ea2b7868 | |||
| 184cd19285 | |||
| 2c34d56c64 | |||
| d5c8a60193 | |||
| 96e7c8e9e0 | |||
| f3805424d3 | |||
| 1eea85da2b | |||
| fbe4f82517 | |||
| 95ca8a0af4 | |||
| bd1cd17490 | |||
| ffd966a4f0 |
@@ -0,0 +1,122 @@
|
|||||||
|
# SmartAssistant - עוזר חכם
|
||||||
|
|
||||||
|
**גרסה:** 1.0.3 | **מחבר:** klear | **EspoCRM:** >= 8.0.0
|
||||||
|
|
||||||
|
## תיאור
|
||||||
|
עוזר AI מאוחד למשרד עורכי דין. מספק ממשק צ'אט צף עם שני מצבי עבודה: **מצב משרד** (סקירה כללית, התראות, סטטיסטיקות) ו**מצב תיק** (סיוע מעמיק בתיק ספציפי). כולל מערכת זיכרון תיק מובנית, ביצוע פעולות באישור המשתמש, ואינטגרציה עם Stream של EspoCRM.
|
||||||
|
|
||||||
|
מחליף את CrmAssistant + OfficeAssistant (deprecated).
|
||||||
|
|
||||||
|
## תלויות
|
||||||
|
- Webhook חיצוני (n8n או דומה) לעיבוד AI
|
||||||
|
- NetworkStorageIntegration / NextCloudIntegration (אופציונלי — לניתוח מסמכים)
|
||||||
|
|
||||||
|
## התקנה
|
||||||
|
1. התקנה דרך Admin > Extensions
|
||||||
|
2. הגדרת Webhook: Admin > Integrations > Smart Assistant
|
||||||
|
|
||||||
|
## הגדרות אינטגרציה
|
||||||
|
|
||||||
|
| שדה | תיאור | דוגמה |
|
||||||
|
|------|--------|--------|
|
||||||
|
| webhookUrl | כתובת Webhook לשירות AI | `https://n8n.example.com/webhook/assistant/chat` |
|
||||||
|
| apiKey | מפתח אימות (אופציונלי) | `sk-...` |
|
||||||
|
| maxMessagesPerHour | הגבלת קצב הודעות | `30` |
|
||||||
|
| inactivityWarningDays | סף אזהרה לחוסר פעילות בתיק | `14` |
|
||||||
|
| inactivityCriticalDays | סף קריטי לחוסר פעילות | `30` |
|
||||||
|
| upcomingHearingDays | חלון דיונים קרובים (ימים) | `7` |
|
||||||
|
|
||||||
|
## אנטיטי: CaseMemory — זיכרון תיק
|
||||||
|
|
||||||
|
מאגר ידע מובנה לכל תיק, מחולק לקטגוריות:
|
||||||
|
|
||||||
|
| קטגוריה | תיאור |
|
||||||
|
|----------|--------|
|
||||||
|
| key_facts | עובדות מפתח |
|
||||||
|
| strategy | אסטרטגיה |
|
||||||
|
| decisions | החלטות |
|
||||||
|
| contacts_notes | הערות על אנשי קשר |
|
||||||
|
| timeline | ציר זמן |
|
||||||
|
| documents_notes | הערות על מסמכים |
|
||||||
|
| billing_notes | הערות חיוב |
|
||||||
|
|
||||||
|
**מקורות:** ידני (manual), עוזר AI (assistant), אוטומטי (auto — hooks)
|
||||||
|
|
||||||
|
**רמות חשיבות:** low, normal, high, critical
|
||||||
|
|
||||||
|
## רכיבים
|
||||||
|
|
||||||
|
### Backend (PHP)
|
||||||
|
|
||||||
|
| רכיב | קובץ | תיאור |
|
||||||
|
|-------|------|--------|
|
||||||
|
| Controller | `Controllers/SmartAssistant.php` | API endpoints |
|
||||||
|
| שירות ראשי | `Services/SmartAssistantService.php` | תזמור צ'אט, שיחות, פעולות |
|
||||||
|
| בונה הקשר תיק | `Services/CaseContextBuilder.php` | אוסף נתוני תיק מלאים (אנשי קשר, משימות, מסמכים, זיכרון) |
|
||||||
|
| בונה הקשר משרד | `Services/OfficeContextBuilder.php` | סטטיסטיקות, התראות, עומס עבודה |
|
||||||
|
| מחשבון התראות | `Services/AlertCalculator.php` | זיהוי תיקים לא פעילים, משימות באיחור, דיונים קרובים |
|
||||||
|
| מבצע פעולות | `Services/ActionExecutor.php` | ביצוע פעולות שאושרו (משימה, פתק, דיון, שינוי סטטוס) |
|
||||||
|
| שירות זיכרון | `Services/CaseMemoryService.php` | CRUD לזיכרון תיק |
|
||||||
|
| ספק הקשר זיכרון | `Services/CaseMemoryContextProvider.php` | הזרקת זיכרון להקשר AI |
|
||||||
|
| מאגר שיחות | `Services/ConversationRepository.php` | שמירה ואחזור שיחות |
|
||||||
|
| מנתח מסמכים | `Services/DocumentAnalyzer.php` | סריקת מסמכים וסיווג |
|
||||||
|
|
||||||
|
### Hooks
|
||||||
|
|
||||||
|
| Hook | תיאור |
|
||||||
|
|------|--------|
|
||||||
|
| `Case/CaseFieldChangeMemory` | יצירת זיכרון אוטומטית בשינוי שדות תיק (סטטוס, שופט, דיון) |
|
||||||
|
| `Meeting/HearingScheduledMemory` | יצירת זיכרון בקביעת דיון חדש |
|
||||||
|
|
||||||
|
### Frontend (JavaScript)
|
||||||
|
|
||||||
|
| רכיב | תיאור |
|
||||||
|
|-------|--------|
|
||||||
|
| `floating-chat.js` | ממשק צ'אט צף (FAB) עם מגירת היסטוריה וזיכרון |
|
||||||
|
| `dashlets/smart-assistant.js` | דשלט עם מדדים והתראות |
|
||||||
|
| `stream/notes/smart-request.js` | תצוגת הודעת משתמש ב-Stream |
|
||||||
|
| `stream/notes/smart-response.js` | תצוגת תשובת עוזר ב-Stream |
|
||||||
|
| `stream/notes/smart-action.js` | תצוגת פעולה שבוצעה ב-Stream |
|
||||||
|
| `case/modals/add-memory.js` | מודל להוספת זיכרון ידנית |
|
||||||
|
| `site/navbar.js` | אינטגרציית התראות בסרגל ניווט |
|
||||||
|
|
||||||
|
## API Routes
|
||||||
|
|
||||||
|
| נתיב | Method | תיאור |
|
||||||
|
|-------|--------|--------|
|
||||||
|
| `/SmartAssistant/action/chat` | POST | שליחת הודעה לעוזר |
|
||||||
|
| `/SmartAssistant/action/execute` | POST | ביצוע פעולה שאושרה |
|
||||||
|
| `/SmartAssistant/action/summary` | GET | סיכום משרדי + התראות |
|
||||||
|
| `/SmartAssistant/action/alerts` | GET | רשימת התראות |
|
||||||
|
| `/SmartAssistant/action/history` | GET | היסטוריית שיחות |
|
||||||
|
| `/SmartAssistant/action/conversations` | GET | רשימת שיחות אחרונות |
|
||||||
|
| `/SmartAssistant/action/conversationMessages` | GET | הודעות שיחה ספציפית |
|
||||||
|
| `/SmartAssistant/action/searchHistory` | GET | חיפוש בשיחות |
|
||||||
|
| `/SmartAssistant/action/caseMemory` | GET | אחזור זיכרון תיק |
|
||||||
|
| `/SmartAssistant/action/saveMemory` | POST | שמירת זיכרון ידנית |
|
||||||
|
|
||||||
|
## פעולות עוזר
|
||||||
|
|
||||||
|
### פעולות מיידיות (ללא אישור)
|
||||||
|
- `list_documents` — רשימת מסמכים בתיק
|
||||||
|
- `save_memory` — שמירת זיכרון תיק
|
||||||
|
|
||||||
|
### פעולות הדורשות אישור
|
||||||
|
- `create_task` — יצירת משימה
|
||||||
|
- `add_note` — הוספת הערה
|
||||||
|
- `change_status` — שינוי סטטוס תיק
|
||||||
|
- `create_meeting` — יצירת פגישה
|
||||||
|
- `schedule_hearing` — קביעת דיון
|
||||||
|
- `analyze_document` — ניתוח מסמך
|
||||||
|
- `rename_document` — שינוי שם מסמך
|
||||||
|
|
||||||
|
## מערכת התראות
|
||||||
|
|
||||||
|
| סוג | סף ברירת מחדל | חומרה |
|
||||||
|
|------|----------------|--------|
|
||||||
|
| תיק לא פעיל | 14 יום | אזהרה |
|
||||||
|
| תיק לא פעיל | 30 יום | קריטי |
|
||||||
|
| משימה באיחור | תאריך יעד עבר | קריטי |
|
||||||
|
| דיון קרוב | 7 ימים | אזהרה |
|
||||||
|
| תיק ללא שיוך | חדש ללא assignedUser | אזהרה |
|
||||||
|
| משימה בעדיפות גבוהה | 5 ימים | אזהרה |
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -4,6 +4,11 @@ set -euo pipefail
|
|||||||
VERSION=$(python3 -c "import json; print(json.load(open('manifest.json'))['version'])")
|
VERSION=$(python3 -c "import json; print(json.load(open('manifest.json'))['version'])")
|
||||||
MODULE=$(python3 -c "import json; m=json.load(open('manifest.json')); print(m.get('module', m['name']))")
|
MODULE=$(python3 -c "import json; m=json.load(open('manifest.json')); print(m.get('module', m['name']))")
|
||||||
ZIPNAME="${MODULE}-${VERSION}.zip"
|
ZIPNAME="${MODULE}-${VERSION}.zip"
|
||||||
|
|
||||||
|
# Update version in README.md if it exists
|
||||||
|
if [[ -f README.md ]]; then
|
||||||
|
sed -i "s/\*\*גרסה:\*\* [^ |]*/\*\*גרסה:\*\* ${VERSION}/" README.md
|
||||||
|
fi
|
||||||
echo "Building $ZIPNAME..."
|
echo "Building $ZIPNAME..."
|
||||||
rm -f "$ZIPNAME"
|
rm -f "$ZIPNAME"
|
||||||
zip -r "$ZIPNAME" manifest.json files/ \
|
zip -r "$ZIPNAME" manifest.json files/ \
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "espocrm-extensions/smart-assistant",
|
||||||
|
"description": "Unified AI Assistant for Legal CRM — floating chat with case memory, office alerts, and n8n integration",
|
||||||
|
"type": "espocrm-extension",
|
||||||
|
"license": "proprietary",
|
||||||
|
"authors": [{"name": "klear"}],
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"espocrm-module": "SmartAssistant",
|
||||||
|
"espocrm-min-version": ">=8.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
define('custom:modules/smart-assistant/views/case/modals/add-memory', ['views/modal'], function (ModalView) {
|
define('modules/smart-assistant/views/case/modals/add-memory', ['views/modal'], function (ModalView) {
|
||||||
|
|
||||||
return ModalView.extend({
|
return ModalView.extend({
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
define('custom:modules/smart-assistant/views/dashlets/options/smart-assistant', ['views/dashlets/options/base'], function (BaseView) {
|
define('modules/smart-assistant/views/dashlets/options/smart-assistant', ['views/dashlets/options/base'], function (BaseView) {
|
||||||
|
|
||||||
return BaseView.extend({
|
return BaseView.extend({
|
||||||
|
|
||||||
+14
-1
@@ -1,4 +1,4 @@
|
|||||||
define('custom:modules/smart-assistant/views/dashlets/smart-assistant', ['view'], function (View) {
|
define('modules/smart-assistant/views/dashlets/smart-assistant', ['view'], function (View) {
|
||||||
|
|
||||||
return View.extend({
|
return View.extend({
|
||||||
|
|
||||||
@@ -72,5 +72,18 @@ define('custom:modules/smart-assistant/views/dashlets/smart-assistant', ['view']
|
|||||||
actionRefresh: function () {
|
actionRefresh: function () {
|
||||||
this.loadSummary();
|
this.loadSummary();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getActionItemDataList: function () {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: 'refresh',
|
||||||
|
iconHtml: '<span class="fas fa-sync-alt"></span>',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
|
||||||
|
getColor: function () {
|
||||||
|
return '#5c6bc0';
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
define('custom:modules/smart-assistant/views/floating-chat', ['view'], function (View) {
|
define('modules/smart-assistant/views/floating-chat', ['view'], function (View) {
|
||||||
|
|
||||||
return View.extend({
|
return View.extend({
|
||||||
|
|
||||||
@@ -562,7 +562,7 @@ define('custom:modules/smart-assistant/views/floating-chat', ['view'], function
|
|||||||
if (!this.currentCaseId) return;
|
if (!this.currentCaseId) return;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.createView('addMemoryModal', 'custom:modules/smart-assistant/views/case/modals/add-memory', {
|
this.createView('addMemoryModal', 'modules/smart-assistant/views/case/modals/add-memory', {
|
||||||
caseId: this.currentCaseId,
|
caseId: this.currentCaseId,
|
||||||
}, function (view) {
|
}, function (view) {
|
||||||
view.render();
|
view.render();
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
define('custom:modules/smart-assistant/views/site/navbar', ['views/site/navbar'], function (NavbarView) {
|
define('modules/smart-assistant/views/site/navbar', ['views/site/navbar'], function (NavbarView) {
|
||||||
|
|
||||||
return NavbarView.extend({
|
return NavbarView.extend({
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ define('custom:modules/smart-assistant/views/site/navbar', ['views/site/navbar']
|
|||||||
$('body').append($container);
|
$('body').append($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.createView('floatingChat', 'custom:modules/smart-assistant/views/floating-chat', {
|
this.createView('floatingChat', 'modules/smart-assistant/views/floating-chat', {
|
||||||
el: '.smart-assistant-fab-container',
|
el: '.smart-assistant-fab-container',
|
||||||
}, function (view) {
|
}, function (view) {
|
||||||
view.render();
|
view.render();
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
define('custom:modules/smart-assistant/views/stream/notes/smart-action', ['views/stream/note'], function (NoteView) {
|
define('modules/smart-assistant/views/stream/notes/smart-action', ['views/stream/note'], function (NoteView) {
|
||||||
|
|
||||||
return NoteView.extend({
|
return NoteView.extend({
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
define('custom:modules/smart-assistant/views/stream/notes/smart-request', ['views/stream/note'], function (NoteView) {
|
define('modules/smart-assistant/views/stream/notes/smart-request', ['views/stream/note'], function (NoteView) {
|
||||||
|
|
||||||
return NoteView.extend({
|
return NoteView.extend({
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
define('custom:modules/smart-assistant/views/stream/notes/smart-response', ['views/stream/note'], function (NoteView) {
|
define('modules/smart-assistant/views/stream/notes/smart-response', ['views/stream/note'], function (NoteView) {
|
||||||
|
|
||||||
return NoteView.extend({
|
return NoteView.extend({
|
||||||
|
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
{"labels":{"Create AssistantConversation":"New Conversation"},"fields":{"name":"Title","conversationKey":"Conversation Key","conversationType":"Type","status":"Status","assignedUser":"User","case":"Case","caseName":"Case Name","messageCount":"Messages","messagesData":"Messages Data","lastMessageAt":"Last Message","lastMessagePreview":"Preview","createdAt":"Created At","modifiedAt":"Modified At","createdBy":"Created By","modifiedBy":"Modified By"},"links":{"assignedUser":"User","case":"Case"},"options":{"conversationType":{"office":"Office","case":"Case"}}}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
{"labels":{"Create AssistantConversation":"שיחה חדשה"},"fields":{"name":"כותרת","conversationKey":"מזהה שיחה","conversationType":"סוג","status":"סטטוס","assignedUser":"משתמש","case":"תיק","caseName":"שם התיק","messageCount":"הודעות","messagesData":"נתוני הודעות","lastMessageAt":"הודעה אחרונה","lastMessagePreview":"תצוגה מקדימה","createdAt":"נוצר ב","modifiedAt":"עודכן ב","createdBy":"נוצר על ידי","modifiedBy":"עודכן על ידי"},"links":{"assignedUser":"משתמש","case":"תיק"},"options":{"conversationType":{"office":"משרד","case":"תיק"}}}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"navbarView": "custom:modules/smart-assistant/views/site/navbar"
|
"navbarView": "modules/smart-assistant/views/site/navbar"
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"view": "custom:modules/smart-assistant/views/dashlets/smart-assistant",
|
"view": "modules/smart-assistant/views/dashlets/smart-assistant",
|
||||||
"optionsView": "custom:modules/smart-assistant/views/dashlets/options/smart-assistant",
|
"optionsView": "modules/smart-assistant/views/dashlets/options/smart-assistant",
|
||||||
"aclScope": "Case"
|
"aclScope": "Case"
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
{"fields":{"name":{"type":"varchar","maxLength":255,"required":true},"conversationKey":{"type":"varchar","maxLength":255,"required":true},"conversationType":{"type":"enum","options":["office","case"],"default":"office","required":true},"status":{"type":"varchar","maxLength":50,"default":"Active"},"assignedUser":{"type":"link"},"case":{"type":"link"},"caseName":{"type":"varchar","maxLength":255},"messageCount":{"type":"int","default":0},"messagesData":{"type":"jsonArray"},"lastMessageAt":{"type":"datetime"},"lastMessagePreview":{"type":"text","maxLength":200},"createdAt":{"type":"datetime","readOnly":true},"modifiedAt":{"type":"datetime","readOnly":true},"createdBy":{"type":"link","readOnly":true},"modifiedBy":{"type":"link","readOnly":true}},"links":{"assignedUser":{"type":"belongsTo","entity":"User"},"case":{"type":"belongsTo","entity":"Case"},"createdBy":{"type":"belongsTo","entity":"User"},"modifiedBy":{"type":"belongsTo","entity":"User"}},"collection":{"orderBy":"lastMessageAt","order":"desc","textFilterFields":["name","lastMessagePreview"]},"indexes":{"conversationKey":{"columns":["conversationKey","deleted"],"type":"unique"},"assignedUser":{"columns":["assignedUserId","deleted"]},"caseId":{"columns":["caseId","deleted"]},"conversationType":{"columns":["conversationType","deleted"]}}}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
{"entity":true,"object":true,"module":"SmartAssistant","acl":true,"aclActionList":["create","read","edit","delete"],"aclLevelList":["all","team","own","no"],"tab":false,"stream":false,"disabled":false,"importable":false,"customizable":false}
|
||||||
@@ -5,5 +5,6 @@
|
|||||||
"espocrm": ">=8.0.0"
|
"espocrm": ">=8.0.0"
|
||||||
},
|
},
|
||||||
"author": "klear",
|
"author": "klear",
|
||||||
"description": "Unified AI Assistant for Legal CRM"
|
"description": "Unified AI Assistant for Legal CRM",
|
||||||
|
"clientModule": "smart-assistant"
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-4
@@ -3,8 +3,12 @@
|
|||||||
"module": "SmartAssistant",
|
"module": "SmartAssistant",
|
||||||
"description": "Unified AI Assistant for Legal CRM — floating chat with case memory, office alerts, and n8n integration",
|
"description": "Unified AI Assistant for Legal CRM — floating chat with case memory, office alerts, and n8n integration",
|
||||||
"author": "klear",
|
"author": "klear",
|
||||||
"version": "1.0.0",
|
"version": "1.0.6",
|
||||||
"acceptableVersions": [">=8.0.0"],
|
"acceptableVersions": [
|
||||||
"releaseDate": "2026-03-23",
|
">=8.0.0"
|
||||||
"php": [">=8.1"]
|
],
|
||||||
|
"releaseDate": "2026-03-31",
|
||||||
|
"php": [
|
||||||
|
">=8.1"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user