Skip to main content

Assistant IA intelligent Revolucy pour outil métier

Project description

Django Lucy Assist

Assistant IA intelligent basé sur Claude d'Anthropic, intégrable dans n'importe quelle application Django.

Installation

pip install django-lucy-assist

Configuration

1. Ajouter l'application à INSTALLED_APPS

INSTALLED_APPS = [
    ...
    'lucy_assist',
]

2. Configurer les variables d'environnement

Ajouter dans votre fichier .env :

# ======================================== LUCY ASSIST ========================================
CLAUDE_LUCY_ASSIST_API_KEY=sk-ant-...
GITLAB_TOKEN=glpat-...
GITLAB_PROJECT_ID=123

# SIREN client pour l'API Lucy CRM  (Si non présent via le module de retour)
SIREN_CLIENT=123456789

Puis dans votre settings.py :

import os

#############################################################################################################
# Lucy Assist
CLAUDE_LUCY_ASSIST_API_KEY = env('CLAUDE_LUCY_ASSIST_API_KEY', default=None)
GITLAB_URL = env('GITLAB_URL', default=None)
GITLAB_TOKEN = env('GITLAB_TOKEN', default=None)
GITLAB_PROJECT_ID = env('GITLAB_PROJECT_ID', default=None)
LUCY_ASSIST = {'PROJECT_APPS_PREFIX': 'apps.'}

3. Ajouter les URLs

# urls.py
from django.urls import path, include

urlpatterns = [
    ...
    path('lucy-assist/', include('lucy_assist.urls')),
]

4. Ajouter le context processor

# settings.py
TEMPLATES = [
    {
        ...
        'OPTIONS': {
            'context_processors': [
                ...
                'lucy_assist.context_processors.lucy_assist_context',
            ],
        },
    },
]

5. Inclure le template dans votre base.html

<!-- templates/base.html -->
{% include 'lucy_assist/chatbot_sidebar.html' %}

6. Exécuter les migrations

python manage.py migrate lucy_assist

Utilisation

Une fois installé et configuré, Lucy Assist apparaîtra automatiquement sur toutes les pages de votre application avec un bouton flottant en bas à droite.

Fonctionnalités

  • Chat IA contextuel : Lucy comprend le contexte de la page actuelle
  • Actions CRUD : Lucy peut créer, modifier, rechercher et supprimer des objets
  • Analyse de bugs : Connexion à GitLab pour analyser les problèmes signalés
  • Historique des conversations : Sauvegarde automatique des conversations
  • Gestion des tokens : Suivi de la consommation des tokens Claude

Configuration avancée

Modèle de base personnalisé

Si vous utilisez un modèle de base personnalisé avec des champs d'audit (created_date, updated_date, etc.), vous pouvez le configurer :

LUCY_ASSIST = {
    'BASE_MODEL': 'mon_app.models.MonModeleBase',
}

Personnalisation des questions fréquentes

LUCY_ASSIST = {
    'QUESTIONS_FREQUENTES_DEFAULT': [
        "Comment créer un nouveau membre ?",
        "Comment effectuer un paiement ?",
        "Comment exporter des données ?",
    ],
}

API

Lucy Assist expose plusieurs endpoints API :

  • GET /lucy-assist/api/conversations/ - Liste des conversations
  • POST /lucy-assist/api/conversations/ - Créer une conversation
  • GET /lucy-assist/api/conversations/<id>/ - Détail d'une conversation
  • POST /lucy-assist/api/conversations/<id>/messages/ - Ajouter un message
  • POST /lucy-assist/api/convers2ations/<id>/completion/ - Générer une réponse (streaming)
  • GET /lucy-assist/api/tokens/status/ - Statut des tokens

Licence

Revolucy

Déploiement Pypi

  1. docker-compose exec django pip install build twine
  2. python -m build
  3. python -m twine upload dist/*
  4. Indiquer le token présent dans 1Password

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_lucy_assist-1.0.8.tar.gz (79.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_lucy_assist-1.0.8-py3-none-any.whl (93.0 kB view details)

Uploaded Python 3

File details

Details for the file django_lucy_assist-1.0.8.tar.gz.

File metadata

  • Download URL: django_lucy_assist-1.0.8.tar.gz
  • Upload date:
  • Size: 79.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for django_lucy_assist-1.0.8.tar.gz
Algorithm Hash digest
SHA256 a7c31d94d78bcc2f38ef548b0040cc6544c65d87818966dc3a81d2375bf710bf
MD5 9bb211f210bb1d5f835c10a9054d66e4
BLAKE2b-256 06a751bd8360abe4071c55fa451a29bfd33229507568d9b37a5e976a6500d9d7

See more details on using hashes here.

File details

Details for the file django_lucy_assist-1.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for django_lucy_assist-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 c3141303658d1593708cbbf9e85a3cb62a8c3cf5b8baa8d2aaffca25a7063343
MD5 bbc5d075923822a4df40812dd39de101
BLAKE2b-256 bb16622b75708a334af5561961616d66fd85c17e2e58bf7c416bccb445b9fb51

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page