django-lucy-assist 1.1.1__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/PKG-INFO +39 -26
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/README.md +36 -23
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/django_lucy_assist.egg-info/PKG-INFO +39 -26
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/django_lucy_assist.egg-info/SOURCES.txt +1 -1
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/django_lucy_assist.egg-info/requires.txt +1 -1
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/__init__.py +2 -2
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/conf.py +18 -18
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/constantes.py +1 -1
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/context_processors.py +2 -2
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/services/__init__.py +3 -2
- django_lucy_assist-1.2.0/lucy_assist/services/mistral_service.py +489 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/services/tool_executor_service.py +10 -10
- django_lucy_assist-1.2.0/lucy_assist/services/tools_definition.py +288 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/views/api_views.py +7 -7
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/pyproject.toml +3 -4
- django_lucy_assist-1.1.1/lucy_assist/services/claude_service.py +0 -423
- django_lucy_assist-1.1.1/lucy_assist/services/tools_definition.py +0 -258
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/MANIFEST.in +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/django_lucy_assist.egg-info/dependency_links.txt +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/django_lucy_assist.egg-info/top_level.txt +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/admin.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/apps.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/migrations/0001_initial.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/migrations/0002_configurationlucyassist_prompt_complementaire.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/migrations/0003_configurationlucyassist_crud_views_mapping.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/migrations/__init__.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/models/__init__.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/models/base.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/models/configuration.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/models/conversation.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/models/message.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/models/project_context_cache.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/services/bug_notification_service.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/services/context_service.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/services/crud_service.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/services/gitlab_service.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/services/project_context_service.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/services/view_discovery_service.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/signals.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/static/lucy_assist/css/lucy-assist.css +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/static/lucy_assist/image/icon-lucy.png +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/static/lucy_assist/js/lucy-assist.js +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/templates/lucy_assist/chatbot_sidebar.html +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/templates/lucy_assist/partials/documentation_content.html +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/tests/__init__.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/tests/factories/__init__.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/tests/factories/lucy_assist_factories.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/tests/test_lucy_assist.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/urls.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/utils/__init__.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/utils/log_utils.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/utils/message_utils.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/utils/token_utils.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/lucy_assist/views/__init__.py +0 -0
- {django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: django-lucy-assist
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: Assistant IA intelligent Revolucy pour outil métier
|
|
5
5
|
Author-email: Revolucy <hello@revolucy.fr>
|
|
6
6
|
Maintainer-email: Maxence <hello@revolucy.fr>
|
|
@@ -9,7 +9,7 @@ Project-URL: Homepage, https://github.com/revolucy/django-lucy-assist
|
|
|
9
9
|
Project-URL: Documentation, https://github.com/revolucy/django-lucy-assist#readme
|
|
10
10
|
Project-URL: Repository, https://github.com/revolucy/django-lucy-assist.git
|
|
11
11
|
Project-URL: Issues, https://github.com/revolucy/django-lucy-assist/issues
|
|
12
|
-
Keywords: django,chatbot,ai,
|
|
12
|
+
Keywords: django,chatbot,ai,mistral,assistant,crm
|
|
13
13
|
Classifier: Development Status :: 4 - Beta
|
|
14
14
|
Classifier: Environment :: Web Environment
|
|
15
15
|
Classifier: Framework :: Django
|
|
@@ -30,7 +30,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
|
30
30
|
Requires-Python: >=3.9
|
|
31
31
|
Description-Content-Type: text/markdown
|
|
32
32
|
Requires-Dist: Django>=4.0
|
|
33
|
-
Requires-Dist:
|
|
33
|
+
Requires-Dist: mistralai>=1.0.0
|
|
34
34
|
Requires-Dist: requests>=2.28.0
|
|
35
35
|
Provides-Extra: dev
|
|
36
36
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
@@ -44,7 +44,7 @@ Requires-Dist: python-gitlab>=3.15.0; extra == "gitlab"
|
|
|
44
44
|
|
|
45
45
|
# Django Lucy Assist
|
|
46
46
|
|
|
47
|
-
Assistant IA intelligent
|
|
47
|
+
Assistant IA intelligent base sur Mistral AI, integrable dans n'importe quelle application Django.
|
|
48
48
|
|
|
49
49
|
## Installation
|
|
50
50
|
|
|
@@ -54,7 +54,7 @@ pip install django-lucy-assist
|
|
|
54
54
|
|
|
55
55
|
## Configuration
|
|
56
56
|
|
|
57
|
-
### 1. Ajouter l'application
|
|
57
|
+
### 1. Ajouter l'application a INSTALLED_APPS
|
|
58
58
|
|
|
59
59
|
```python
|
|
60
60
|
INSTALLED_APPS = [
|
|
@@ -69,11 +69,11 @@ Ajouter dans votre fichier `.env` :
|
|
|
69
69
|
|
|
70
70
|
```bash
|
|
71
71
|
# ======================================== LUCY ASSIST ========================================
|
|
72
|
-
|
|
72
|
+
MISTRAL_LUCY_API_KEY=votre-cle-api-mistral
|
|
73
73
|
GITLAB_TOKEN=glpat-...
|
|
74
74
|
GITLAB_PROJECT_ID=123
|
|
75
75
|
|
|
76
|
-
# SIREN client pour l'API Lucy CRM (Si non
|
|
76
|
+
# SIREN client pour l'API Lucy CRM (Si non present via le module de retour)
|
|
77
77
|
SIREN_CLIENT=123456789
|
|
78
78
|
```
|
|
79
79
|
|
|
@@ -84,11 +84,14 @@ import os
|
|
|
84
84
|
|
|
85
85
|
#############################################################################################################
|
|
86
86
|
# Lucy Assist
|
|
87
|
-
|
|
87
|
+
MISTRAL_LUCY_API_KEY = env('MISTRAL_LUCY_API_KEY', default=None)
|
|
88
88
|
GITLAB_URL = env('GITLAB_URL', default=None)
|
|
89
89
|
GITLAB_TOKEN = env('GITLAB_TOKEN', default=None)
|
|
90
90
|
GITLAB_PROJECT_ID = env('GITLAB_PROJECT_ID', default=None)
|
|
91
|
-
LUCY_ASSIST = {
|
|
91
|
+
LUCY_ASSIST = {
|
|
92
|
+
'PROJECT_APPS_PREFIX': 'apps.',
|
|
93
|
+
# 'MISTRAL_MODEL': 'mistral-large-latest', # Modele par defaut (le plus performant)
|
|
94
|
+
}
|
|
92
95
|
```
|
|
93
96
|
|
|
94
97
|
### 3. Ajouter les URLs
|
|
@@ -127,7 +130,7 @@ TEMPLATES = [
|
|
|
127
130
|
{% include 'lucy_assist/chatbot_sidebar.html' %}
|
|
128
131
|
```
|
|
129
132
|
|
|
130
|
-
### 6.
|
|
133
|
+
### 6. Executer les migrations
|
|
131
134
|
|
|
132
135
|
```bash
|
|
133
136
|
python manage.py migrate lucy_assist
|
|
@@ -135,21 +138,21 @@ python manage.py migrate lucy_assist
|
|
|
135
138
|
|
|
136
139
|
## Utilisation
|
|
137
140
|
|
|
138
|
-
Une fois
|
|
141
|
+
Une fois installe et configure, Lucy Assist apparaitra automatiquement sur toutes les pages de votre application avec un bouton flottant en bas a droite.
|
|
139
142
|
|
|
140
|
-
###
|
|
143
|
+
### Fonctionnalites
|
|
141
144
|
|
|
142
145
|
- **Chat IA contextuel** : Lucy comprend le contexte de la page actuelle
|
|
143
|
-
- **Actions CRUD** : Lucy peut
|
|
144
|
-
- **Analyse de bugs** : Connexion
|
|
146
|
+
- **Actions CRUD** : Lucy peut creer, modifier, rechercher et supprimer des objets
|
|
147
|
+
- **Analyse de bugs** : Connexion a GitLab pour analyser les problemes signales
|
|
145
148
|
- **Historique des conversations** : Sauvegarde automatique des conversations
|
|
146
|
-
- **Gestion des tokens** : Suivi de la consommation des tokens
|
|
149
|
+
- **Gestion des tokens** : Suivi de la consommation des tokens Mistral
|
|
147
150
|
|
|
148
|
-
## Configuration
|
|
151
|
+
## Configuration avancee
|
|
149
152
|
|
|
150
|
-
###
|
|
153
|
+
### Modele de base personnalise
|
|
151
154
|
|
|
152
|
-
Si vous utilisez un
|
|
155
|
+
Si vous utilisez un modele de base personnalise avec des champs d'audit (created_date, updated_date, etc.), vous pouvez le configurer :
|
|
153
156
|
|
|
154
157
|
```python
|
|
155
158
|
LUCY_ASSIST = {
|
|
@@ -157,14 +160,24 @@ LUCY_ASSIST = {
|
|
|
157
160
|
}
|
|
158
161
|
```
|
|
159
162
|
|
|
160
|
-
###
|
|
163
|
+
### Modele Mistral
|
|
164
|
+
|
|
165
|
+
Par defaut, Lucy Assist utilise `mistral-large-latest` (le modele le plus performant). Vous pouvez changer le modele :
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
LUCY_ASSIST = {
|
|
169
|
+
'MISTRAL_MODEL': 'mistral-large-latest', # Ou 'mistral-medium', 'mistral-small', etc.
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Personnalisation des questions frequentes
|
|
161
174
|
|
|
162
175
|
```python
|
|
163
176
|
LUCY_ASSIST = {
|
|
164
177
|
'QUESTIONS_FREQUENTES_DEFAULT': [
|
|
165
|
-
"Comment
|
|
178
|
+
"Comment creer un nouveau membre ?",
|
|
166
179
|
"Comment effectuer un paiement ?",
|
|
167
|
-
"Comment exporter des
|
|
180
|
+
"Comment exporter des donnees ?",
|
|
168
181
|
],
|
|
169
182
|
}
|
|
170
183
|
```
|
|
@@ -174,19 +187,19 @@ LUCY_ASSIST = {
|
|
|
174
187
|
Lucy Assist expose plusieurs endpoints API :
|
|
175
188
|
|
|
176
189
|
- `GET /lucy-assist/api/conversations/` - Liste des conversations
|
|
177
|
-
- `POST /lucy-assist/api/conversations/` -
|
|
178
|
-
- `GET /lucy-assist/api/conversations/<id>/` -
|
|
190
|
+
- `POST /lucy-assist/api/conversations/` - Creer une conversation
|
|
191
|
+
- `GET /lucy-assist/api/conversations/<id>/` - Detail d'une conversation
|
|
179
192
|
- `POST /lucy-assist/api/conversations/<id>/messages/` - Ajouter un message
|
|
180
|
-
- `POST /lucy-assist/api/
|
|
193
|
+
- `POST /lucy-assist/api/conversations/<id>/completion/` - Generer une reponse (streaming)
|
|
181
194
|
- `GET /lucy-assist/api/tokens/status/` - Statut des tokens
|
|
182
195
|
|
|
183
196
|
## Licence
|
|
184
197
|
|
|
185
198
|
[Revolucy](https://www.revolucy.fr)
|
|
186
199
|
|
|
187
|
-
##
|
|
200
|
+
## Deploiement Pypi
|
|
188
201
|
|
|
189
202
|
1. `docker-compose exec django pip install build twine`
|
|
190
203
|
2. `python -m build`
|
|
191
204
|
3. `python -m twine upload dist/*`
|
|
192
|
-
4. Indiquer le token
|
|
205
|
+
4. Indiquer le token present dans 1Password
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Django Lucy Assist
|
|
2
2
|
|
|
3
|
-
Assistant IA intelligent
|
|
3
|
+
Assistant IA intelligent base sur Mistral AI, integrable dans n'importe quelle application Django.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ pip install django-lucy-assist
|
|
|
10
10
|
|
|
11
11
|
## Configuration
|
|
12
12
|
|
|
13
|
-
### 1. Ajouter l'application
|
|
13
|
+
### 1. Ajouter l'application a INSTALLED_APPS
|
|
14
14
|
|
|
15
15
|
```python
|
|
16
16
|
INSTALLED_APPS = [
|
|
@@ -25,11 +25,11 @@ Ajouter dans votre fichier `.env` :
|
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
27
|
# ======================================== LUCY ASSIST ========================================
|
|
28
|
-
|
|
28
|
+
MISTRAL_LUCY_API_KEY=votre-cle-api-mistral
|
|
29
29
|
GITLAB_TOKEN=glpat-...
|
|
30
30
|
GITLAB_PROJECT_ID=123
|
|
31
31
|
|
|
32
|
-
# SIREN client pour l'API Lucy CRM (Si non
|
|
32
|
+
# SIREN client pour l'API Lucy CRM (Si non present via le module de retour)
|
|
33
33
|
SIREN_CLIENT=123456789
|
|
34
34
|
```
|
|
35
35
|
|
|
@@ -40,11 +40,14 @@ import os
|
|
|
40
40
|
|
|
41
41
|
#############################################################################################################
|
|
42
42
|
# Lucy Assist
|
|
43
|
-
|
|
43
|
+
MISTRAL_LUCY_API_KEY = env('MISTRAL_LUCY_API_KEY', default=None)
|
|
44
44
|
GITLAB_URL = env('GITLAB_URL', default=None)
|
|
45
45
|
GITLAB_TOKEN = env('GITLAB_TOKEN', default=None)
|
|
46
46
|
GITLAB_PROJECT_ID = env('GITLAB_PROJECT_ID', default=None)
|
|
47
|
-
LUCY_ASSIST = {
|
|
47
|
+
LUCY_ASSIST = {
|
|
48
|
+
'PROJECT_APPS_PREFIX': 'apps.',
|
|
49
|
+
# 'MISTRAL_MODEL': 'mistral-large-latest', # Modele par defaut (le plus performant)
|
|
50
|
+
}
|
|
48
51
|
```
|
|
49
52
|
|
|
50
53
|
### 3. Ajouter les URLs
|
|
@@ -83,7 +86,7 @@ TEMPLATES = [
|
|
|
83
86
|
{% include 'lucy_assist/chatbot_sidebar.html' %}
|
|
84
87
|
```
|
|
85
88
|
|
|
86
|
-
### 6.
|
|
89
|
+
### 6. Executer les migrations
|
|
87
90
|
|
|
88
91
|
```bash
|
|
89
92
|
python manage.py migrate lucy_assist
|
|
@@ -91,21 +94,21 @@ python manage.py migrate lucy_assist
|
|
|
91
94
|
|
|
92
95
|
## Utilisation
|
|
93
96
|
|
|
94
|
-
Une fois
|
|
97
|
+
Une fois installe et configure, Lucy Assist apparaitra automatiquement sur toutes les pages de votre application avec un bouton flottant en bas a droite.
|
|
95
98
|
|
|
96
|
-
###
|
|
99
|
+
### Fonctionnalites
|
|
97
100
|
|
|
98
101
|
- **Chat IA contextuel** : Lucy comprend le contexte de la page actuelle
|
|
99
|
-
- **Actions CRUD** : Lucy peut
|
|
100
|
-
- **Analyse de bugs** : Connexion
|
|
102
|
+
- **Actions CRUD** : Lucy peut creer, modifier, rechercher et supprimer des objets
|
|
103
|
+
- **Analyse de bugs** : Connexion a GitLab pour analyser les problemes signales
|
|
101
104
|
- **Historique des conversations** : Sauvegarde automatique des conversations
|
|
102
|
-
- **Gestion des tokens** : Suivi de la consommation des tokens
|
|
105
|
+
- **Gestion des tokens** : Suivi de la consommation des tokens Mistral
|
|
103
106
|
|
|
104
|
-
## Configuration
|
|
107
|
+
## Configuration avancee
|
|
105
108
|
|
|
106
|
-
###
|
|
109
|
+
### Modele de base personnalise
|
|
107
110
|
|
|
108
|
-
Si vous utilisez un
|
|
111
|
+
Si vous utilisez un modele de base personnalise avec des champs d'audit (created_date, updated_date, etc.), vous pouvez le configurer :
|
|
109
112
|
|
|
110
113
|
```python
|
|
111
114
|
LUCY_ASSIST = {
|
|
@@ -113,14 +116,24 @@ LUCY_ASSIST = {
|
|
|
113
116
|
}
|
|
114
117
|
```
|
|
115
118
|
|
|
116
|
-
###
|
|
119
|
+
### Modele Mistral
|
|
120
|
+
|
|
121
|
+
Par defaut, Lucy Assist utilise `mistral-large-latest` (le modele le plus performant). Vous pouvez changer le modele :
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
LUCY_ASSIST = {
|
|
125
|
+
'MISTRAL_MODEL': 'mistral-large-latest', # Ou 'mistral-medium', 'mistral-small', etc.
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Personnalisation des questions frequentes
|
|
117
130
|
|
|
118
131
|
```python
|
|
119
132
|
LUCY_ASSIST = {
|
|
120
133
|
'QUESTIONS_FREQUENTES_DEFAULT': [
|
|
121
|
-
"Comment
|
|
134
|
+
"Comment creer un nouveau membre ?",
|
|
122
135
|
"Comment effectuer un paiement ?",
|
|
123
|
-
"Comment exporter des
|
|
136
|
+
"Comment exporter des donnees ?",
|
|
124
137
|
],
|
|
125
138
|
}
|
|
126
139
|
```
|
|
@@ -130,19 +143,19 @@ LUCY_ASSIST = {
|
|
|
130
143
|
Lucy Assist expose plusieurs endpoints API :
|
|
131
144
|
|
|
132
145
|
- `GET /lucy-assist/api/conversations/` - Liste des conversations
|
|
133
|
-
- `POST /lucy-assist/api/conversations/` -
|
|
134
|
-
- `GET /lucy-assist/api/conversations/<id>/` -
|
|
146
|
+
- `POST /lucy-assist/api/conversations/` - Creer une conversation
|
|
147
|
+
- `GET /lucy-assist/api/conversations/<id>/` - Detail d'une conversation
|
|
135
148
|
- `POST /lucy-assist/api/conversations/<id>/messages/` - Ajouter un message
|
|
136
|
-
- `POST /lucy-assist/api/
|
|
149
|
+
- `POST /lucy-assist/api/conversations/<id>/completion/` - Generer une reponse (streaming)
|
|
137
150
|
- `GET /lucy-assist/api/tokens/status/` - Statut des tokens
|
|
138
151
|
|
|
139
152
|
## Licence
|
|
140
153
|
|
|
141
154
|
[Revolucy](https://www.revolucy.fr)
|
|
142
155
|
|
|
143
|
-
##
|
|
156
|
+
## Deploiement Pypi
|
|
144
157
|
|
|
145
158
|
1. `docker-compose exec django pip install build twine`
|
|
146
159
|
2. `python -m build`
|
|
147
160
|
3. `python -m twine upload dist/*`
|
|
148
|
-
4. Indiquer le token
|
|
161
|
+
4. Indiquer le token present dans 1Password
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: django-lucy-assist
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: Assistant IA intelligent Revolucy pour outil métier
|
|
5
5
|
Author-email: Revolucy <hello@revolucy.fr>
|
|
6
6
|
Maintainer-email: Maxence <hello@revolucy.fr>
|
|
@@ -9,7 +9,7 @@ Project-URL: Homepage, https://github.com/revolucy/django-lucy-assist
|
|
|
9
9
|
Project-URL: Documentation, https://github.com/revolucy/django-lucy-assist#readme
|
|
10
10
|
Project-URL: Repository, https://github.com/revolucy/django-lucy-assist.git
|
|
11
11
|
Project-URL: Issues, https://github.com/revolucy/django-lucy-assist/issues
|
|
12
|
-
Keywords: django,chatbot,ai,
|
|
12
|
+
Keywords: django,chatbot,ai,mistral,assistant,crm
|
|
13
13
|
Classifier: Development Status :: 4 - Beta
|
|
14
14
|
Classifier: Environment :: Web Environment
|
|
15
15
|
Classifier: Framework :: Django
|
|
@@ -30,7 +30,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
|
30
30
|
Requires-Python: >=3.9
|
|
31
31
|
Description-Content-Type: text/markdown
|
|
32
32
|
Requires-Dist: Django>=4.0
|
|
33
|
-
Requires-Dist:
|
|
33
|
+
Requires-Dist: mistralai>=1.0.0
|
|
34
34
|
Requires-Dist: requests>=2.28.0
|
|
35
35
|
Provides-Extra: dev
|
|
36
36
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
@@ -44,7 +44,7 @@ Requires-Dist: python-gitlab>=3.15.0; extra == "gitlab"
|
|
|
44
44
|
|
|
45
45
|
# Django Lucy Assist
|
|
46
46
|
|
|
47
|
-
Assistant IA intelligent
|
|
47
|
+
Assistant IA intelligent base sur Mistral AI, integrable dans n'importe quelle application Django.
|
|
48
48
|
|
|
49
49
|
## Installation
|
|
50
50
|
|
|
@@ -54,7 +54,7 @@ pip install django-lucy-assist
|
|
|
54
54
|
|
|
55
55
|
## Configuration
|
|
56
56
|
|
|
57
|
-
### 1. Ajouter l'application
|
|
57
|
+
### 1. Ajouter l'application a INSTALLED_APPS
|
|
58
58
|
|
|
59
59
|
```python
|
|
60
60
|
INSTALLED_APPS = [
|
|
@@ -69,11 +69,11 @@ Ajouter dans votre fichier `.env` :
|
|
|
69
69
|
|
|
70
70
|
```bash
|
|
71
71
|
# ======================================== LUCY ASSIST ========================================
|
|
72
|
-
|
|
72
|
+
MISTRAL_LUCY_API_KEY=votre-cle-api-mistral
|
|
73
73
|
GITLAB_TOKEN=glpat-...
|
|
74
74
|
GITLAB_PROJECT_ID=123
|
|
75
75
|
|
|
76
|
-
# SIREN client pour l'API Lucy CRM (Si non
|
|
76
|
+
# SIREN client pour l'API Lucy CRM (Si non present via le module de retour)
|
|
77
77
|
SIREN_CLIENT=123456789
|
|
78
78
|
```
|
|
79
79
|
|
|
@@ -84,11 +84,14 @@ import os
|
|
|
84
84
|
|
|
85
85
|
#############################################################################################################
|
|
86
86
|
# Lucy Assist
|
|
87
|
-
|
|
87
|
+
MISTRAL_LUCY_API_KEY = env('MISTRAL_LUCY_API_KEY', default=None)
|
|
88
88
|
GITLAB_URL = env('GITLAB_URL', default=None)
|
|
89
89
|
GITLAB_TOKEN = env('GITLAB_TOKEN', default=None)
|
|
90
90
|
GITLAB_PROJECT_ID = env('GITLAB_PROJECT_ID', default=None)
|
|
91
|
-
LUCY_ASSIST = {
|
|
91
|
+
LUCY_ASSIST = {
|
|
92
|
+
'PROJECT_APPS_PREFIX': 'apps.',
|
|
93
|
+
# 'MISTRAL_MODEL': 'mistral-large-latest', # Modele par defaut (le plus performant)
|
|
94
|
+
}
|
|
92
95
|
```
|
|
93
96
|
|
|
94
97
|
### 3. Ajouter les URLs
|
|
@@ -127,7 +130,7 @@ TEMPLATES = [
|
|
|
127
130
|
{% include 'lucy_assist/chatbot_sidebar.html' %}
|
|
128
131
|
```
|
|
129
132
|
|
|
130
|
-
### 6.
|
|
133
|
+
### 6. Executer les migrations
|
|
131
134
|
|
|
132
135
|
```bash
|
|
133
136
|
python manage.py migrate lucy_assist
|
|
@@ -135,21 +138,21 @@ python manage.py migrate lucy_assist
|
|
|
135
138
|
|
|
136
139
|
## Utilisation
|
|
137
140
|
|
|
138
|
-
Une fois
|
|
141
|
+
Une fois installe et configure, Lucy Assist apparaitra automatiquement sur toutes les pages de votre application avec un bouton flottant en bas a droite.
|
|
139
142
|
|
|
140
|
-
###
|
|
143
|
+
### Fonctionnalites
|
|
141
144
|
|
|
142
145
|
- **Chat IA contextuel** : Lucy comprend le contexte de la page actuelle
|
|
143
|
-
- **Actions CRUD** : Lucy peut
|
|
144
|
-
- **Analyse de bugs** : Connexion
|
|
146
|
+
- **Actions CRUD** : Lucy peut creer, modifier, rechercher et supprimer des objets
|
|
147
|
+
- **Analyse de bugs** : Connexion a GitLab pour analyser les problemes signales
|
|
145
148
|
- **Historique des conversations** : Sauvegarde automatique des conversations
|
|
146
|
-
- **Gestion des tokens** : Suivi de la consommation des tokens
|
|
149
|
+
- **Gestion des tokens** : Suivi de la consommation des tokens Mistral
|
|
147
150
|
|
|
148
|
-
## Configuration
|
|
151
|
+
## Configuration avancee
|
|
149
152
|
|
|
150
|
-
###
|
|
153
|
+
### Modele de base personnalise
|
|
151
154
|
|
|
152
|
-
Si vous utilisez un
|
|
155
|
+
Si vous utilisez un modele de base personnalise avec des champs d'audit (created_date, updated_date, etc.), vous pouvez le configurer :
|
|
153
156
|
|
|
154
157
|
```python
|
|
155
158
|
LUCY_ASSIST = {
|
|
@@ -157,14 +160,24 @@ LUCY_ASSIST = {
|
|
|
157
160
|
}
|
|
158
161
|
```
|
|
159
162
|
|
|
160
|
-
###
|
|
163
|
+
### Modele Mistral
|
|
164
|
+
|
|
165
|
+
Par defaut, Lucy Assist utilise `mistral-large-latest` (le modele le plus performant). Vous pouvez changer le modele :
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
LUCY_ASSIST = {
|
|
169
|
+
'MISTRAL_MODEL': 'mistral-large-latest', # Ou 'mistral-medium', 'mistral-small', etc.
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Personnalisation des questions frequentes
|
|
161
174
|
|
|
162
175
|
```python
|
|
163
176
|
LUCY_ASSIST = {
|
|
164
177
|
'QUESTIONS_FREQUENTES_DEFAULT': [
|
|
165
|
-
"Comment
|
|
178
|
+
"Comment creer un nouveau membre ?",
|
|
166
179
|
"Comment effectuer un paiement ?",
|
|
167
|
-
"Comment exporter des
|
|
180
|
+
"Comment exporter des donnees ?",
|
|
168
181
|
],
|
|
169
182
|
}
|
|
170
183
|
```
|
|
@@ -174,19 +187,19 @@ LUCY_ASSIST = {
|
|
|
174
187
|
Lucy Assist expose plusieurs endpoints API :
|
|
175
188
|
|
|
176
189
|
- `GET /lucy-assist/api/conversations/` - Liste des conversations
|
|
177
|
-
- `POST /lucy-assist/api/conversations/` -
|
|
178
|
-
- `GET /lucy-assist/api/conversations/<id>/` -
|
|
190
|
+
- `POST /lucy-assist/api/conversations/` - Creer une conversation
|
|
191
|
+
- `GET /lucy-assist/api/conversations/<id>/` - Detail d'une conversation
|
|
179
192
|
- `POST /lucy-assist/api/conversations/<id>/messages/` - Ajouter un message
|
|
180
|
-
- `POST /lucy-assist/api/
|
|
193
|
+
- `POST /lucy-assist/api/conversations/<id>/completion/` - Generer une reponse (streaming)
|
|
181
194
|
- `GET /lucy-assist/api/tokens/status/` - Statut des tokens
|
|
182
195
|
|
|
183
196
|
## Licence
|
|
184
197
|
|
|
185
198
|
[Revolucy](https://www.revolucy.fr)
|
|
186
199
|
|
|
187
|
-
##
|
|
200
|
+
## Deploiement Pypi
|
|
188
201
|
|
|
189
202
|
1. `docker-compose exec django pip install build twine`
|
|
190
203
|
2. `python -m build`
|
|
191
204
|
3. `python -m twine upload dist/*`
|
|
192
|
-
4. Indiquer le token
|
|
205
|
+
4. Indiquer le token present dans 1Password
|
{django_lucy_assist-1.1.1 → django_lucy_assist-1.2.0}/django_lucy_assist.egg-info/SOURCES.txt
RENAMED
|
@@ -26,10 +26,10 @@ lucy_assist/models/message.py
|
|
|
26
26
|
lucy_assist/models/project_context_cache.py
|
|
27
27
|
lucy_assist/services/__init__.py
|
|
28
28
|
lucy_assist/services/bug_notification_service.py
|
|
29
|
-
lucy_assist/services/claude_service.py
|
|
30
29
|
lucy_assist/services/context_service.py
|
|
31
30
|
lucy_assist/services/crud_service.py
|
|
32
31
|
lucy_assist/services/gitlab_service.py
|
|
32
|
+
lucy_assist/services/mistral_service.py
|
|
33
33
|
lucy_assist/services/project_context_service.py
|
|
34
34
|
lucy_assist/services/tool_executor_service.py
|
|
35
35
|
lucy_assist/services/tools_definition.py
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Lucy Assist - Assistant IA intelligent pour applications Django.
|
|
3
3
|
|
|
4
|
-
Un chatbot IA
|
|
4
|
+
Un chatbot IA base sur Mistral AI, integrable dans n'importe quelle
|
|
5
5
|
application Django pour fournir une assistance contextuelle aux utilisateurs.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
__version__ = '1.
|
|
8
|
+
__version__ = '1.2.0'
|
|
9
9
|
__author__ = 'Revolucy'
|
|
10
10
|
|
|
11
11
|
default_app_config = 'lucy_assist.apps.LucyAssistConfig'
|
|
@@ -11,17 +11,17 @@ class LucyAssistSettings:
|
|
|
11
11
|
Lit les settings depuis LUCY_ASSIST dans settings.py.
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
-
# Valeurs par
|
|
14
|
+
# Valeurs par defaut
|
|
15
15
|
DEFAULTS = {
|
|
16
|
-
#
|
|
17
|
-
# Peut
|
|
16
|
+
# Modele de base pour les modeles Lucy Assist (None = utilise le modele par defaut)
|
|
17
|
+
# Peut etre une string "mon_app.models.MonModele" ou une classe directement
|
|
18
18
|
'BASE_MODEL': None,
|
|
19
19
|
|
|
20
|
-
#
|
|
21
|
-
'
|
|
20
|
+
# Cle API Mistral (peut aussi etre definie via MISTRAL_LUCY_API_KEY)
|
|
21
|
+
'MISTRAL_LUCY_API_KEY': None,
|
|
22
22
|
|
|
23
|
-
#
|
|
24
|
-
'
|
|
23
|
+
# Modele Mistral a utiliser (mistral-large-latest = le plus performant)
|
|
24
|
+
'MISTRAL_MODEL': 'mistral-large-latest',
|
|
25
25
|
|
|
26
26
|
# Configuration GitLab pour l'analyse de bugs
|
|
27
27
|
'GITLAB_URL': None,
|
|
@@ -34,8 +34,8 @@ class LucyAssistSettings:
|
|
|
34
34
|
# Email de fallback pour les feedbacks
|
|
35
35
|
'FEEDBACK_EMAIL': 'support@revolucy.fr',
|
|
36
36
|
|
|
37
|
-
#
|
|
38
|
-
# Ex: 'apps.' pour filtrer les apps
|
|
37
|
+
# Prefixe des apps du projet pour le mapping modele -> app
|
|
38
|
+
# Ex: 'apps.' pour filtrer les apps commencant par 'apps.'
|
|
39
39
|
'PROJECT_APPS_PREFIX': None,
|
|
40
40
|
|
|
41
41
|
# URL de base de l'API Lucy CRM
|
|
@@ -47,20 +47,20 @@ class LucyAssistSettings:
|
|
|
47
47
|
# Nombre moyen de tokens par conversation
|
|
48
48
|
'TOKENS_MOYENS_PAR_CONVERSATION': 2000,
|
|
49
49
|
|
|
50
|
-
# Questions
|
|
50
|
+
# Questions frequentes par defaut (generiques)
|
|
51
51
|
'QUESTIONS_FREQUENTES_DEFAULT': [
|
|
52
|
-
"Comment
|
|
52
|
+
"Comment creer un nouveau client ?",
|
|
53
53
|
"Comment effectuer une recherche ?",
|
|
54
|
-
"Comment exporter des
|
|
54
|
+
"Comment exporter des donnees ?",
|
|
55
55
|
"Comment modifier mon profil ?",
|
|
56
|
-
"
|
|
56
|
+
"Ou trouver la liste des reservations ?",
|
|
57
57
|
],
|
|
58
58
|
|
|
59
59
|
# Chemin vers le module contenant set_current_user pour le ThreadLocal
|
|
60
60
|
# Ex: 'alyse.middleware.middleware' pour le projet Alyse
|
|
61
61
|
'THREAD_LOCAL_MODULE': None,
|
|
62
62
|
|
|
63
|
-
# Attributs de l'utilisateur
|
|
63
|
+
# Attributs de l'utilisateur a copier vers la requete
|
|
64
64
|
# Ex: ['franchise', 'tenant', 'organization']
|
|
65
65
|
'REQUEST_USER_ATTRS': [],
|
|
66
66
|
}
|
|
@@ -70,15 +70,15 @@ class LucyAssistSettings:
|
|
|
70
70
|
|
|
71
71
|
def __getattr__(self, name):
|
|
72
72
|
if name in self.DEFAULTS:
|
|
73
|
-
#
|
|
73
|
+
# Verifier d'abord dans LUCY_ASSIST settings
|
|
74
74
|
if name in self._settings:
|
|
75
75
|
return self._settings[name]
|
|
76
76
|
|
|
77
|
-
# Cas
|
|
78
|
-
if name == '
|
|
77
|
+
# Cas speciaux pour les settings qui peuvent etre definis au niveau global
|
|
78
|
+
if name == 'MISTRAL_LUCY_API_KEY':
|
|
79
79
|
# Chercher dans plusieurs variables possibles
|
|
80
80
|
return (
|
|
81
|
-
getattr(settings, '
|
|
81
|
+
getattr(settings, 'MISTRAL_LUCY_API_KEY', None) or
|
|
82
82
|
self.DEFAULTS[name]
|
|
83
83
|
)
|
|
84
84
|
|
|
@@ -51,7 +51,7 @@ class LucyAssistConstantes:
|
|
|
51
51
|
(ARCHIVEE, 'Archivée'),
|
|
52
52
|
]
|
|
53
53
|
|
|
54
|
-
# Prompts
|
|
54
|
+
# Prompts systeme pour Mistral
|
|
55
55
|
SYSTEM_PROMPTS = {
|
|
56
56
|
'default': """Tu es Lucy, un assistant IA intégré dans un CRM métier (UNAF-CRM).
|
|
57
57
|
Tu as la capacité d'EXÉCUTER des actions directement dans l'application grâce aux tools disponibles.
|
|
@@ -37,8 +37,8 @@ def lucy_assist_context(request):
|
|
|
37
37
|
# Récupérer la configuration
|
|
38
38
|
config = ConfigurationLucyAssist.get_config()
|
|
39
39
|
|
|
40
|
-
#
|
|
41
|
-
api_key_configured = bool(getattr(settings, '
|
|
40
|
+
# Verifier si Lucy Assist est configure (cle API presente)
|
|
41
|
+
api_key_configured = bool(getattr(settings, 'MISTRAL_LUCY_API_KEY', ''))
|
|
42
42
|
|
|
43
43
|
if config and config.actif:
|
|
44
44
|
context['lucy_assist_enabled'] = True
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from .
|
|
1
|
+
from .mistral_service import MistralService, ClaudeService # ClaudeService est un alias pour compatibilite
|
|
2
2
|
from .gitlab_service import GitLabService
|
|
3
3
|
from .context_service import ContextService
|
|
4
4
|
from .crud_service import CRUDService
|
|
@@ -8,7 +8,8 @@ from .tools_definition import LUCY_ASSIST_TOOLS, get_app_for_model
|
|
|
8
8
|
from .bug_notification_service import BugNotificationService
|
|
9
9
|
|
|
10
10
|
__all__ = [
|
|
11
|
-
'
|
|
11
|
+
'MistralService',
|
|
12
|
+
'ClaudeService', # Alias pour compatibilite
|
|
12
13
|
'GitLabService',
|
|
13
14
|
'ContextService',
|
|
14
15
|
'CRUDService',
|