django-lucy-assist 1.0.5__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.
Files changed (51) hide show
  1. django_lucy_assist-1.0.5/MANIFEST.in +23 -0
  2. django_lucy_assist-1.0.5/PKG-INFO +191 -0
  3. django_lucy_assist-1.0.5/README.md +148 -0
  4. django_lucy_assist-1.0.5/django_lucy_assist.egg-info/PKG-INFO +191 -0
  5. django_lucy_assist-1.0.5/django_lucy_assist.egg-info/SOURCES.txt +49 -0
  6. django_lucy_assist-1.0.5/django_lucy_assist.egg-info/dependency_links.txt +1 -0
  7. django_lucy_assist-1.0.5/django_lucy_assist.egg-info/requires.txt +14 -0
  8. django_lucy_assist-1.0.5/django_lucy_assist.egg-info/top_level.txt +1 -0
  9. django_lucy_assist-1.0.5/lucy_assist/__init__.py +11 -0
  10. django_lucy_assist-1.0.5/lucy_assist/admin.py +22 -0
  11. django_lucy_assist-1.0.5/lucy_assist/apps.py +10 -0
  12. django_lucy_assist-1.0.5/lucy_assist/conf.py +102 -0
  13. django_lucy_assist-1.0.5/lucy_assist/constantes.py +120 -0
  14. django_lucy_assist-1.0.5/lucy_assist/context_processors.py +65 -0
  15. django_lucy_assist-1.0.5/lucy_assist/migrations/0001_initial.py +92 -0
  16. django_lucy_assist-1.0.5/lucy_assist/migrations/0002_configurationlucyassist_prompt_complementaire.py +18 -0
  17. django_lucy_assist-1.0.5/lucy_assist/migrations/__init__.py +0 -0
  18. django_lucy_assist-1.0.5/lucy_assist/models/__init__.py +14 -0
  19. django_lucy_assist-1.0.5/lucy_assist/models/base.py +54 -0
  20. django_lucy_assist-1.0.5/lucy_assist/models/configuration.py +178 -0
  21. django_lucy_assist-1.0.5/lucy_assist/models/conversation.py +54 -0
  22. django_lucy_assist-1.0.5/lucy_assist/models/message.py +45 -0
  23. django_lucy_assist-1.0.5/lucy_assist/models/project_context_cache.py +213 -0
  24. django_lucy_assist-1.0.5/lucy_assist/services/__init__.py +21 -0
  25. django_lucy_assist-1.0.5/lucy_assist/services/bug_notification_service.py +188 -0
  26. django_lucy_assist-1.0.5/lucy_assist/services/claude_service.py +423 -0
  27. django_lucy_assist-1.0.5/lucy_assist/services/context_service.py +370 -0
  28. django_lucy_assist-1.0.5/lucy_assist/services/crud_service.py +396 -0
  29. django_lucy_assist-1.0.5/lucy_assist/services/gitlab_service.py +248 -0
  30. django_lucy_assist-1.0.5/lucy_assist/services/project_context_service.py +412 -0
  31. django_lucy_assist-1.0.5/lucy_assist/services/tool_executor_service.py +343 -0
  32. django_lucy_assist-1.0.5/lucy_assist/services/tools_definition.py +228 -0
  33. django_lucy_assist-1.0.5/lucy_assist/signals.py +25 -0
  34. django_lucy_assist-1.0.5/lucy_assist/static/lucy_assist/css/lucy-assist.css +920 -0
  35. django_lucy_assist-1.0.5/lucy_assist/static/lucy_assist/image/icon-lucy.png +0 -0
  36. django_lucy_assist-1.0.5/lucy_assist/static/lucy_assist/js/lucy-assist.js +824 -0
  37. django_lucy_assist-1.0.5/lucy_assist/templates/lucy_assist/chatbot_sidebar.html +415 -0
  38. django_lucy_assist-1.0.5/lucy_assist/templates/lucy_assist/partials/documentation_content.html +107 -0
  39. django_lucy_assist-1.0.5/lucy_assist/tests/__init__.py +0 -0
  40. django_lucy_assist-1.0.5/lucy_assist/tests/factories/__init__.py +15 -0
  41. django_lucy_assist-1.0.5/lucy_assist/tests/factories/lucy_assist_factories.py +109 -0
  42. django_lucy_assist-1.0.5/lucy_assist/tests/test_lucy_assist.py +186 -0
  43. django_lucy_assist-1.0.5/lucy_assist/urls.py +36 -0
  44. django_lucy_assist-1.0.5/lucy_assist/utils/__init__.py +7 -0
  45. django_lucy_assist-1.0.5/lucy_assist/utils/log_utils.py +59 -0
  46. django_lucy_assist-1.0.5/lucy_assist/utils/message_utils.py +169 -0
  47. django_lucy_assist-1.0.5/lucy_assist/utils/token_utils.py +87 -0
  48. django_lucy_assist-1.0.5/lucy_assist/views/__init__.py +13 -0
  49. django_lucy_assist-1.0.5/lucy_assist/views/api_views.py +601 -0
  50. django_lucy_assist-1.0.5/pyproject.toml +110 -0
  51. django_lucy_assist-1.0.5/setup.cfg +4 -0
@@ -0,0 +1,23 @@
1
+ # Include templates
2
+ recursive-include lucy_assist/templates *
3
+
4
+ # Include static files
5
+ recursive-include lucy_assist/static *
6
+
7
+ # Include migrations
8
+ recursive-include lucy_assist/migrations *.py
9
+
10
+ # Include documentation
11
+ include README.md
12
+ include LICENSE
13
+
14
+ # Exclude development and test files
15
+ exclude .gitignore
16
+ exclude .pre-commit-config.yaml
17
+ prune tests
18
+ prune .git
19
+ prune .github
20
+ prune __pycache__
21
+ global-exclude *.py[cod]
22
+ global-exclude __pycache__
23
+ global-exclude .DS_Store
@@ -0,0 +1,191 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-lucy-assist
3
+ Version: 1.0.5
4
+ Summary: Assistant IA intelligent Revolucy pour outil métier
5
+ Author-email: Revolucy <hello@revolucy.fr>
6
+ Maintainer-email: Maxence <hello@revolucy.fr>
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/revolucy/django-lucy-assist
9
+ Project-URL: Documentation, https://github.com/revolucy/django-lucy-assist#readme
10
+ Project-URL: Repository, https://github.com/revolucy/django-lucy-assist.git
11
+ Project-URL: Issues, https://github.com/revolucy/django-lucy-assist/issues
12
+ Keywords: django,chatbot,ai,claude,anthropic,assistant,crm
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Web Environment
15
+ Classifier: Framework :: Django
16
+ Classifier: Framework :: Django :: 4.2
17
+ Classifier: Framework :: Django :: 5.0
18
+ Classifier: Framework :: Django :: 5.1
19
+ Classifier: Intended Audience :: Developers
20
+ Classifier: License :: OSI Approved :: MIT License
21
+ Classifier: Operating System :: OS Independent
22
+ Classifier: Programming Language :: Python
23
+ Classifier: Programming Language :: Python :: 3
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Topic :: Internet :: WWW/HTTP
28
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
29
+ Requires-Python: >=3.10
30
+ Description-Content-Type: text/markdown
31
+ Requires-Dist: Django>=4.0
32
+ Requires-Dist: anthropic>=0.20.0
33
+ Requires-Dist: requests>=2.28.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
36
+ Requires-Dist: pytest-django>=4.5.0; extra == "dev"
37
+ Requires-Dist: factory-boy>=3.3.0; extra == "dev"
38
+ Requires-Dist: black>=23.0.0; extra == "dev"
39
+ Requires-Dist: isort>=5.12.0; extra == "dev"
40
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
41
+ Provides-Extra: gitlab
42
+ Requires-Dist: python-gitlab>=3.15.0; extra == "gitlab"
43
+
44
+ # Django Lucy Assist
45
+
46
+ Assistant IA intelligent basé sur Claude d'Anthropic, intégrable dans n'importe quelle application Django.
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ pip install django-lucy-assist
52
+ ```
53
+
54
+ ## Configuration
55
+
56
+ ### 1. Ajouter l'application à INSTALLED_APPS
57
+
58
+ ```python
59
+ INSTALLED_APPS = [
60
+ ...
61
+ 'lucy_assist',
62
+ ]
63
+ ```
64
+
65
+ ### 2. Configurer les variables d'environnement
66
+
67
+ Ajouter dans votre fichier `.env` :
68
+
69
+ ```bash
70
+ # ======================================== LUCY ASSIST ========================================
71
+ CLAUDE_LUCY_ASSIST_API_KEY=sk-ant-...
72
+ GITLAB_TOKEN=glpat-...
73
+ GITLAB_PROJECT_ID=123
74
+
75
+ # SIREN client pour l'API Lucy CRM (Si non présent via le module de retour)
76
+ SIREN_CLIENT=123456789
77
+ ```
78
+
79
+ Puis dans votre `settings.py` :
80
+
81
+ ```python
82
+ import os
83
+
84
+ #############################################################################################################
85
+ # Lucy Assist
86
+ CLAUDE_LUCY_ASSIST_API_KEY = env('CLAUDE_LUCY_ASSIST_API_KEY', default=None)
87
+ GITLAB_URL = env('GITLAB_URL', default=None)
88
+ GITLAB_TOKEN = env('GITLAB_TOKEN', default=None)
89
+ GITLAB_PROJECT_ID = env('GITLAB_PROJECT_ID', default=None)
90
+ LUCY_ASSIST = {'PROJECT_APPS_PREFIX': 'apps.'}
91
+ ```
92
+
93
+ ### 3. Ajouter les URLs
94
+
95
+ ```python
96
+ # urls.py
97
+ from django.urls import path, include
98
+
99
+ urlpatterns = [
100
+ ...
101
+ path('lucy-assist/', include('lucy_assist.urls')),
102
+ ]
103
+ ```
104
+
105
+ ### 4. Ajouter le context processor
106
+
107
+ ```python
108
+ # settings.py
109
+ TEMPLATES = [
110
+ {
111
+ ...
112
+ 'OPTIONS': {
113
+ 'context_processors': [
114
+ ...
115
+ 'lucy_assist.context_processors.lucy_assist_context',
116
+ ],
117
+ },
118
+ },
119
+ ]
120
+ ```
121
+
122
+ ### 5. Inclure le template dans votre base.html
123
+
124
+ ```html
125
+ <!-- templates/base.html -->
126
+ {% include 'lucy_assist/chatbot_sidebar.html' %}
127
+ ```
128
+
129
+ ### 6. Exécuter les migrations
130
+
131
+ ```bash
132
+ python manage.py migrate lucy_assist
133
+ ```
134
+
135
+ ## Utilisation
136
+
137
+ Une fois installé et configuré, Lucy Assist apparaîtra automatiquement sur toutes les pages de votre application avec un bouton flottant en bas à droite.
138
+
139
+ ### Fonctionnalités
140
+
141
+ - **Chat IA contextuel** : Lucy comprend le contexte de la page actuelle
142
+ - **Actions CRUD** : Lucy peut créer, modifier, rechercher et supprimer des objets
143
+ - **Analyse de bugs** : Connexion à GitLab pour analyser les problèmes signalés
144
+ - **Historique des conversations** : Sauvegarde automatique des conversations
145
+ - **Gestion des tokens** : Suivi de la consommation des tokens Claude
146
+
147
+ ## Configuration avancée
148
+
149
+ ### Modèle de base personnalisé
150
+
151
+ Si vous utilisez un modèle de base personnalisé avec des champs d'audit (created_date, updated_date, etc.), vous pouvez le configurer :
152
+
153
+ ```python
154
+ LUCY_ASSIST = {
155
+ 'BASE_MODEL': 'mon_app.models.MonModeleBase',
156
+ }
157
+ ```
158
+
159
+ ### Personnalisation des questions fréquentes
160
+
161
+ ```python
162
+ LUCY_ASSIST = {
163
+ 'QUESTIONS_FREQUENTES_DEFAULT': [
164
+ "Comment créer un nouveau membre ?",
165
+ "Comment effectuer un paiement ?",
166
+ "Comment exporter des données ?",
167
+ ],
168
+ }
169
+ ```
170
+
171
+ ## API
172
+
173
+ Lucy Assist expose plusieurs endpoints API :
174
+
175
+ - `GET /lucy-assist/api/conversations/` - Liste des conversations
176
+ - `POST /lucy-assist/api/conversations/` - Créer une conversation
177
+ - `GET /lucy-assist/api/conversations/<id>/` - Détail d'une conversation
178
+ - `POST /lucy-assist/api/conversations/<id>/messages/` - Ajouter un message
179
+ - `POST /lucy-assist/api/conversations/<id>/completion/` - Générer une réponse (streaming)
180
+ - `GET /lucy-assist/api/tokens/status/` - Statut des tokens
181
+
182
+ ## Licence
183
+
184
+ [Revolucy](https://www.revolucy.fr)
185
+
186
+ ## Déploiement Pypi
187
+
188
+ 1. `docker-compose exec django pip install build twine`
189
+ 2. `python -m build`
190
+ 3. `python -m twine upload dist/*`
191
+ 4. Indiquer le token présent dans 1Password
@@ -0,0 +1,148 @@
1
+ # Django Lucy Assist
2
+
3
+ Assistant IA intelligent basé sur Claude d'Anthropic, intégrable dans n'importe quelle application Django.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install django-lucy-assist
9
+ ```
10
+
11
+ ## Configuration
12
+
13
+ ### 1. Ajouter l'application à INSTALLED_APPS
14
+
15
+ ```python
16
+ INSTALLED_APPS = [
17
+ ...
18
+ 'lucy_assist',
19
+ ]
20
+ ```
21
+
22
+ ### 2. Configurer les variables d'environnement
23
+
24
+ Ajouter dans votre fichier `.env` :
25
+
26
+ ```bash
27
+ # ======================================== LUCY ASSIST ========================================
28
+ CLAUDE_LUCY_ASSIST_API_KEY=sk-ant-...
29
+ GITLAB_TOKEN=glpat-...
30
+ GITLAB_PROJECT_ID=123
31
+
32
+ # SIREN client pour l'API Lucy CRM (Si non présent via le module de retour)
33
+ SIREN_CLIENT=123456789
34
+ ```
35
+
36
+ Puis dans votre `settings.py` :
37
+
38
+ ```python
39
+ import os
40
+
41
+ #############################################################################################################
42
+ # Lucy Assist
43
+ CLAUDE_LUCY_ASSIST_API_KEY = env('CLAUDE_LUCY_ASSIST_API_KEY', default=None)
44
+ GITLAB_URL = env('GITLAB_URL', default=None)
45
+ GITLAB_TOKEN = env('GITLAB_TOKEN', default=None)
46
+ GITLAB_PROJECT_ID = env('GITLAB_PROJECT_ID', default=None)
47
+ LUCY_ASSIST = {'PROJECT_APPS_PREFIX': 'apps.'}
48
+ ```
49
+
50
+ ### 3. Ajouter les URLs
51
+
52
+ ```python
53
+ # urls.py
54
+ from django.urls import path, include
55
+
56
+ urlpatterns = [
57
+ ...
58
+ path('lucy-assist/', include('lucy_assist.urls')),
59
+ ]
60
+ ```
61
+
62
+ ### 4. Ajouter le context processor
63
+
64
+ ```python
65
+ # settings.py
66
+ TEMPLATES = [
67
+ {
68
+ ...
69
+ 'OPTIONS': {
70
+ 'context_processors': [
71
+ ...
72
+ 'lucy_assist.context_processors.lucy_assist_context',
73
+ ],
74
+ },
75
+ },
76
+ ]
77
+ ```
78
+
79
+ ### 5. Inclure le template dans votre base.html
80
+
81
+ ```html
82
+ <!-- templates/base.html -->
83
+ {% include 'lucy_assist/chatbot_sidebar.html' %}
84
+ ```
85
+
86
+ ### 6. Exécuter les migrations
87
+
88
+ ```bash
89
+ python manage.py migrate lucy_assist
90
+ ```
91
+
92
+ ## Utilisation
93
+
94
+ Une fois installé et configuré, Lucy Assist apparaîtra automatiquement sur toutes les pages de votre application avec un bouton flottant en bas à droite.
95
+
96
+ ### Fonctionnalités
97
+
98
+ - **Chat IA contextuel** : Lucy comprend le contexte de la page actuelle
99
+ - **Actions CRUD** : Lucy peut créer, modifier, rechercher et supprimer des objets
100
+ - **Analyse de bugs** : Connexion à GitLab pour analyser les problèmes signalés
101
+ - **Historique des conversations** : Sauvegarde automatique des conversations
102
+ - **Gestion des tokens** : Suivi de la consommation des tokens Claude
103
+
104
+ ## Configuration avancée
105
+
106
+ ### Modèle de base personnalisé
107
+
108
+ Si vous utilisez un modèle de base personnalisé avec des champs d'audit (created_date, updated_date, etc.), vous pouvez le configurer :
109
+
110
+ ```python
111
+ LUCY_ASSIST = {
112
+ 'BASE_MODEL': 'mon_app.models.MonModeleBase',
113
+ }
114
+ ```
115
+
116
+ ### Personnalisation des questions fréquentes
117
+
118
+ ```python
119
+ LUCY_ASSIST = {
120
+ 'QUESTIONS_FREQUENTES_DEFAULT': [
121
+ "Comment créer un nouveau membre ?",
122
+ "Comment effectuer un paiement ?",
123
+ "Comment exporter des données ?",
124
+ ],
125
+ }
126
+ ```
127
+
128
+ ## API
129
+
130
+ Lucy Assist expose plusieurs endpoints API :
131
+
132
+ - `GET /lucy-assist/api/conversations/` - Liste des conversations
133
+ - `POST /lucy-assist/api/conversations/` - Créer une conversation
134
+ - `GET /lucy-assist/api/conversations/<id>/` - Détail d'une conversation
135
+ - `POST /lucy-assist/api/conversations/<id>/messages/` - Ajouter un message
136
+ - `POST /lucy-assist/api/conversations/<id>/completion/` - Générer une réponse (streaming)
137
+ - `GET /lucy-assist/api/tokens/status/` - Statut des tokens
138
+
139
+ ## Licence
140
+
141
+ [Revolucy](https://www.revolucy.fr)
142
+
143
+ ## Déploiement Pypi
144
+
145
+ 1. `docker-compose exec django pip install build twine`
146
+ 2. `python -m build`
147
+ 3. `python -m twine upload dist/*`
148
+ 4. Indiquer le token présent dans 1Password
@@ -0,0 +1,191 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-lucy-assist
3
+ Version: 1.0.5
4
+ Summary: Assistant IA intelligent Revolucy pour outil métier
5
+ Author-email: Revolucy <hello@revolucy.fr>
6
+ Maintainer-email: Maxence <hello@revolucy.fr>
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/revolucy/django-lucy-assist
9
+ Project-URL: Documentation, https://github.com/revolucy/django-lucy-assist#readme
10
+ Project-URL: Repository, https://github.com/revolucy/django-lucy-assist.git
11
+ Project-URL: Issues, https://github.com/revolucy/django-lucy-assist/issues
12
+ Keywords: django,chatbot,ai,claude,anthropic,assistant,crm
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Web Environment
15
+ Classifier: Framework :: Django
16
+ Classifier: Framework :: Django :: 4.2
17
+ Classifier: Framework :: Django :: 5.0
18
+ Classifier: Framework :: Django :: 5.1
19
+ Classifier: Intended Audience :: Developers
20
+ Classifier: License :: OSI Approved :: MIT License
21
+ Classifier: Operating System :: OS Independent
22
+ Classifier: Programming Language :: Python
23
+ Classifier: Programming Language :: Python :: 3
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Topic :: Internet :: WWW/HTTP
28
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
29
+ Requires-Python: >=3.10
30
+ Description-Content-Type: text/markdown
31
+ Requires-Dist: Django>=4.0
32
+ Requires-Dist: anthropic>=0.20.0
33
+ Requires-Dist: requests>=2.28.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
36
+ Requires-Dist: pytest-django>=4.5.0; extra == "dev"
37
+ Requires-Dist: factory-boy>=3.3.0; extra == "dev"
38
+ Requires-Dist: black>=23.0.0; extra == "dev"
39
+ Requires-Dist: isort>=5.12.0; extra == "dev"
40
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
41
+ Provides-Extra: gitlab
42
+ Requires-Dist: python-gitlab>=3.15.0; extra == "gitlab"
43
+
44
+ # Django Lucy Assist
45
+
46
+ Assistant IA intelligent basé sur Claude d'Anthropic, intégrable dans n'importe quelle application Django.
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ pip install django-lucy-assist
52
+ ```
53
+
54
+ ## Configuration
55
+
56
+ ### 1. Ajouter l'application à INSTALLED_APPS
57
+
58
+ ```python
59
+ INSTALLED_APPS = [
60
+ ...
61
+ 'lucy_assist',
62
+ ]
63
+ ```
64
+
65
+ ### 2. Configurer les variables d'environnement
66
+
67
+ Ajouter dans votre fichier `.env` :
68
+
69
+ ```bash
70
+ # ======================================== LUCY ASSIST ========================================
71
+ CLAUDE_LUCY_ASSIST_API_KEY=sk-ant-...
72
+ GITLAB_TOKEN=glpat-...
73
+ GITLAB_PROJECT_ID=123
74
+
75
+ # SIREN client pour l'API Lucy CRM (Si non présent via le module de retour)
76
+ SIREN_CLIENT=123456789
77
+ ```
78
+
79
+ Puis dans votre `settings.py` :
80
+
81
+ ```python
82
+ import os
83
+
84
+ #############################################################################################################
85
+ # Lucy Assist
86
+ CLAUDE_LUCY_ASSIST_API_KEY = env('CLAUDE_LUCY_ASSIST_API_KEY', default=None)
87
+ GITLAB_URL = env('GITLAB_URL', default=None)
88
+ GITLAB_TOKEN = env('GITLAB_TOKEN', default=None)
89
+ GITLAB_PROJECT_ID = env('GITLAB_PROJECT_ID', default=None)
90
+ LUCY_ASSIST = {'PROJECT_APPS_PREFIX': 'apps.'}
91
+ ```
92
+
93
+ ### 3. Ajouter les URLs
94
+
95
+ ```python
96
+ # urls.py
97
+ from django.urls import path, include
98
+
99
+ urlpatterns = [
100
+ ...
101
+ path('lucy-assist/', include('lucy_assist.urls')),
102
+ ]
103
+ ```
104
+
105
+ ### 4. Ajouter le context processor
106
+
107
+ ```python
108
+ # settings.py
109
+ TEMPLATES = [
110
+ {
111
+ ...
112
+ 'OPTIONS': {
113
+ 'context_processors': [
114
+ ...
115
+ 'lucy_assist.context_processors.lucy_assist_context',
116
+ ],
117
+ },
118
+ },
119
+ ]
120
+ ```
121
+
122
+ ### 5. Inclure le template dans votre base.html
123
+
124
+ ```html
125
+ <!-- templates/base.html -->
126
+ {% include 'lucy_assist/chatbot_sidebar.html' %}
127
+ ```
128
+
129
+ ### 6. Exécuter les migrations
130
+
131
+ ```bash
132
+ python manage.py migrate lucy_assist
133
+ ```
134
+
135
+ ## Utilisation
136
+
137
+ Une fois installé et configuré, Lucy Assist apparaîtra automatiquement sur toutes les pages de votre application avec un bouton flottant en bas à droite.
138
+
139
+ ### Fonctionnalités
140
+
141
+ - **Chat IA contextuel** : Lucy comprend le contexte de la page actuelle
142
+ - **Actions CRUD** : Lucy peut créer, modifier, rechercher et supprimer des objets
143
+ - **Analyse de bugs** : Connexion à GitLab pour analyser les problèmes signalés
144
+ - **Historique des conversations** : Sauvegarde automatique des conversations
145
+ - **Gestion des tokens** : Suivi de la consommation des tokens Claude
146
+
147
+ ## Configuration avancée
148
+
149
+ ### Modèle de base personnalisé
150
+
151
+ Si vous utilisez un modèle de base personnalisé avec des champs d'audit (created_date, updated_date, etc.), vous pouvez le configurer :
152
+
153
+ ```python
154
+ LUCY_ASSIST = {
155
+ 'BASE_MODEL': 'mon_app.models.MonModeleBase',
156
+ }
157
+ ```
158
+
159
+ ### Personnalisation des questions fréquentes
160
+
161
+ ```python
162
+ LUCY_ASSIST = {
163
+ 'QUESTIONS_FREQUENTES_DEFAULT': [
164
+ "Comment créer un nouveau membre ?",
165
+ "Comment effectuer un paiement ?",
166
+ "Comment exporter des données ?",
167
+ ],
168
+ }
169
+ ```
170
+
171
+ ## API
172
+
173
+ Lucy Assist expose plusieurs endpoints API :
174
+
175
+ - `GET /lucy-assist/api/conversations/` - Liste des conversations
176
+ - `POST /lucy-assist/api/conversations/` - Créer une conversation
177
+ - `GET /lucy-assist/api/conversations/<id>/` - Détail d'une conversation
178
+ - `POST /lucy-assist/api/conversations/<id>/messages/` - Ajouter un message
179
+ - `POST /lucy-assist/api/conversations/<id>/completion/` - Générer une réponse (streaming)
180
+ - `GET /lucy-assist/api/tokens/status/` - Statut des tokens
181
+
182
+ ## Licence
183
+
184
+ [Revolucy](https://www.revolucy.fr)
185
+
186
+ ## Déploiement Pypi
187
+
188
+ 1. `docker-compose exec django pip install build twine`
189
+ 2. `python -m build`
190
+ 3. `python -m twine upload dist/*`
191
+ 4. Indiquer le token présent dans 1Password
@@ -0,0 +1,49 @@
1
+ MANIFEST.in
2
+ README.md
3
+ pyproject.toml
4
+ django_lucy_assist.egg-info/PKG-INFO
5
+ django_lucy_assist.egg-info/SOURCES.txt
6
+ django_lucy_assist.egg-info/dependency_links.txt
7
+ django_lucy_assist.egg-info/requires.txt
8
+ django_lucy_assist.egg-info/top_level.txt
9
+ lucy_assist/__init__.py
10
+ lucy_assist/admin.py
11
+ lucy_assist/apps.py
12
+ lucy_assist/conf.py
13
+ lucy_assist/constantes.py
14
+ lucy_assist/context_processors.py
15
+ lucy_assist/signals.py
16
+ lucy_assist/urls.py
17
+ lucy_assist/migrations/0001_initial.py
18
+ lucy_assist/migrations/0002_configurationlucyassist_prompt_complementaire.py
19
+ lucy_assist/migrations/__init__.py
20
+ lucy_assist/models/__init__.py
21
+ lucy_assist/models/base.py
22
+ lucy_assist/models/configuration.py
23
+ lucy_assist/models/conversation.py
24
+ lucy_assist/models/message.py
25
+ lucy_assist/models/project_context_cache.py
26
+ lucy_assist/services/__init__.py
27
+ lucy_assist/services/bug_notification_service.py
28
+ lucy_assist/services/claude_service.py
29
+ lucy_assist/services/context_service.py
30
+ lucy_assist/services/crud_service.py
31
+ lucy_assist/services/gitlab_service.py
32
+ lucy_assist/services/project_context_service.py
33
+ lucy_assist/services/tool_executor_service.py
34
+ lucy_assist/services/tools_definition.py
35
+ lucy_assist/static/lucy_assist/css/lucy-assist.css
36
+ lucy_assist/static/lucy_assist/image/icon-lucy.png
37
+ lucy_assist/static/lucy_assist/js/lucy-assist.js
38
+ lucy_assist/templates/lucy_assist/chatbot_sidebar.html
39
+ lucy_assist/templates/lucy_assist/partials/documentation_content.html
40
+ lucy_assist/tests/__init__.py
41
+ lucy_assist/tests/test_lucy_assist.py
42
+ lucy_assist/tests/factories/__init__.py
43
+ lucy_assist/tests/factories/lucy_assist_factories.py
44
+ lucy_assist/utils/__init__.py
45
+ lucy_assist/utils/log_utils.py
46
+ lucy_assist/utils/message_utils.py
47
+ lucy_assist/utils/token_utils.py
48
+ lucy_assist/views/__init__.py
49
+ lucy_assist/views/api_views.py
@@ -0,0 +1,14 @@
1
+ Django>=4.0
2
+ anthropic>=0.20.0
3
+ requests>=2.28.0
4
+
5
+ [dev]
6
+ pytest>=7.0.0
7
+ pytest-django>=4.5.0
8
+ factory-boy>=3.3.0
9
+ black>=23.0.0
10
+ isort>=5.12.0
11
+ flake8>=6.0.0
12
+
13
+ [gitlab]
14
+ python-gitlab>=3.15.0
@@ -0,0 +1,11 @@
1
+ """
2
+ Lucy Assist - Assistant IA intelligent pour applications Django.
3
+
4
+ Un chatbot IA basé sur Claude d'Anthropic, intégrable dans n'importe quelle
5
+ application Django pour fournir une assistance contextuelle aux utilisateurs.
6
+ """
7
+
8
+ __version__ = '1.0.5'
9
+ __author__ = 'Revolucy'
10
+
11
+ default_app_config = 'lucy_assist.apps.LucyAssistConfig'
@@ -0,0 +1,22 @@
1
+ from django.contrib import admin
2
+
3
+ from lucy_assist.models import Conversation, Message, ConfigurationLucyAssist
4
+
5
+
6
+ class BlockMessage(admin.StackedInline):
7
+ model = Message
8
+ extra = 1
9
+
10
+
11
+ @admin.register(Conversation)
12
+ class ConversationAdmin(admin.ModelAdmin):
13
+ list_display = ('id', 'utilisateur', 'titre', 'created_date', 'is_active')
14
+ list_filter = ('is_active', 'created_date')
15
+ search_fields = ('utilisateur__email', 'titre')
16
+ ordering = ('-created_date',)
17
+ inlines = [BlockMessage]
18
+
19
+
20
+ @admin.register(ConfigurationLucyAssist)
21
+ class ConfigurationLucyAssistAdmin(admin.ModelAdmin):
22
+ list_display = ('id', 'tokens_disponibles', 'prix_par_million_tokens', 'updated_date')
@@ -0,0 +1,10 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class LucyAssistConfig(AppConfig):
5
+ default_auto_field = "django.db.models.BigAutoField"
6
+ name = "lucy_assist"
7
+ verbose_name = "Lucy Assist - Chatbot IA"
8
+
9
+ def ready(self):
10
+ import lucy_assist.signals # noqa