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_URL=https://gitlab.com
GITLAB_TOKEN=glpat-... # Création d'un jeton d'accès en role Reporter avec les accès read_api, read_repository
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.'}

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.3.3.tar.gz (100.7 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.3.3-py3-none-any.whl (116.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_lucy_assist-1.3.3.tar.gz
  • Upload date:
  • Size: 100.7 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.3.3.tar.gz
Algorithm Hash digest
SHA256 193e6022c3e57d3e6aafc6d55d70fc6b643cba83fb0fe9762915eee81af7a3f0
MD5 a52f83eaeecf6828e08893d2738e6668
BLAKE2b-256 80abec474cbccfb0239b9997cea7f9fe5f84041a6fc69efba0d972cad4e13c2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_lucy_assist-1.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8c1c118acf0d07eec59078542945bb923c00d5e344589ec4090edae6d6890a2f
MD5 2ba742e396520ef4cc692989ec5b3948
BLAKE2b-256 55614ff88d8b1b71796ef54300653640ac87c0c7e79f2e1b4661e4bb2e392e02

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