Skip to main content

Assistant IA intelligent Revolucy pour outil métier

Project description

Django Lucy Assist

Assistant IA intelligent base sur Mistral AI, integrable dans n'importe quelle application Django.

Installation

pip install django-lucy-assist

Configuration

1. Ajouter l'application a INSTALLED_APPS

INSTALLED_APPS = [
    ...
    'lucy_assist',
]

2. Configurer les variables d'environnement

Ajouter dans votre fichier .env :

# ======================================== LUCY ASSIST ========================================
MISTRAL_LUCY_API_KEY=votre-cle-api-mistral
GITLAB_TOKEN=glpat-...
GITLAB_PROJECT_ID=123

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

Puis dans votre settings.py :

import os

#############################################################################################################
# Lucy Assist
MISTRAL_LUCY_API_KEY = env('MISTRAL_LUCY_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.',
    # 'MISTRAL_MODEL': 'mistral-large-latest',  # Modele par defaut (le plus performant)
}

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. Executer les migrations

python manage.py migrate lucy_assist

Utilisation

Une fois installe et configure, Lucy Assist apparaitra automatiquement sur toutes les pages de votre application avec un bouton flottant en bas a droite.

Fonctionnalites

  • Chat IA contextuel : Lucy comprend le contexte de la page actuelle
  • Actions CRUD : Lucy peut creer, modifier, rechercher et supprimer des objets
  • Analyse de bugs : Connexion a GitLab pour analyser les problemes signales
  • Historique des conversations : Sauvegarde automatique des conversations
  • Gestion des tokens : Suivi de la consommation des tokens Mistral

Configuration avancee

Modele de base personnalise

Si vous utilisez un modele de base personnalise avec des champs d'audit (created_date, updated_date, etc.), vous pouvez le configurer :

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

Modele Mistral

Par defaut, Lucy Assist utilise mistral-large-latest (le modele le plus performant). Vous pouvez changer le modele :

LUCY_ASSIST = {
    'MISTRAL_MODEL': 'mistral-large-latest',  # Ou 'mistral-medium', 'mistral-small', etc.
}

Personnalisation des questions frequentes

LUCY_ASSIST = {
    'QUESTIONS_FREQUENTES_DEFAULT': [
        "Comment creer un nouveau membre ?",
        "Comment effectuer un paiement ?",
        "Comment exporter des donnees ?",
    ],
}

API

Lucy Assist expose plusieurs endpoints API :

  • GET /lucy-assist/api/conversations/ - Liste des conversations
  • POST /lucy-assist/api/conversations/ - Creer une conversation
  • GET /lucy-assist/api/conversations/<id>/ - Detail d'une conversation
  • POST /lucy-assist/api/conversations/<id>/messages/ - Ajouter un message
  • POST /lucy-assist/api/conversations/<id>/completion/ - Generer une reponse (streaming)
  • GET /lucy-assist/api/tokens/status/ - Statut des tokens

Licence

Revolucy

Deploiement Pypi

  1. docker-compose exec django pip install build twine
  2. python -m build
  3. python -m twine upload dist/*
  4. Indiquer le token present 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.2.3.tar.gz (83.0 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.2.3-py3-none-any.whl (97.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_lucy_assist-1.2.3.tar.gz
  • Upload date:
  • Size: 83.0 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.2.3.tar.gz
Algorithm Hash digest
SHA256 05ceb4c622715030156370e928532b9ce3eacfb2b73f30292c477ec36d13a4ec
MD5 45f24713d57b81088a93d1258ab827ff
BLAKE2b-256 d6d13d10a65e230a1796b8d35a7b2ef9ca2a1bd2e1685d8017c132a79eb54ee9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_lucy_assist-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1b9bd91fe1ad769e5cdf8070c05c4bedc821361e90c41cc58832f71fe0cf19d1
MD5 1b9907006862f8b9ef11b710d2c88d26
BLAKE2b-256 c6255c55d307db58f8d0313e093b95b6492e9fa221fa49df188f43eb0d5f3fb7

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