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.1.tar.gz (81.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.2.1-py3-none-any.whl (94.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_lucy_assist-1.2.1.tar.gz
  • Upload date:
  • Size: 81.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.2.1.tar.gz
Algorithm Hash digest
SHA256 b001ea06a1bc2a4f26feccc6962985edb72de46f4a7ebb9d82b4fba28f083da7
MD5 4e3efd43f6479471fbe89d40388ab568
BLAKE2b-256 46dee76a23e0ed186746b174de5cbec81c1c859eef5e7920eca9e66c5b9c1a9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_lucy_assist-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 597d4ef272ef140063eccb1629cabe54de33c649c57d874deccab7fa9ed6f5a6
MD5 01bd016120bcd1ead61914363fb95f46
BLAKE2b-256 b5e4520c374bd88a1eb8565f8f5f690799460f0221cd687f431169e58a6fd3f6

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