Info:RAG:script d'intégration

De wiki_pcwiki2
Aller à la navigationAller à la recherche

KEYWORDS: RAG: SCRIPT, INTÉGRATION, AUTOMATIQUE, PCWIKI

Le 21/04/2026:
#!/bin/bash
set -euo pipefail

SYNC_DIR="/root/IA/wiki-sync"
VENV_DIR="/root/IA/open-webui.debian12/venv"
MAIL_TO="pchevalier@pcstreet.fr"

set -a
source "$SYNC_DIR/.env"
set +a

source "$VENV_DIR/bin/activate"
python3 "$SYNC_DIR/wiki_sync.py" "$@" 2>&1 | tee "$SYNC_DIR/last_run.log"

if grep -q "Synchronisé" "$SYNC_DIR/last_run.log"; then
    PAGES=$(grep "Synchronisé" "$SYNC_DIR/last_run.log" | sed 's/.*Synchronisé: /  - /')
    COUNT=$(grep -c "Synchronisé" "$SYNC_DIR/last_run.log")
    {
        echo "To: $MAIL_TO"
        echo "From: pchevalier@pcstreet.fr"
        echo "Subject: [Wiki Sync] $COUNT page(s) synchronisee(s)"
        echo "Content-Type: text/plain; charset=UTF-8"
        echo ""
        echo "Synchronisation wiki terminee le $(date '+%d/%m/%Y a %H:%M')"
        echo ""
        echo "Pages mises a jour dans le RAG wiki PCStreet: ($COUNT) :"
        echo "$PAGES"
        echo ""
        echo "-- wiki_sync sur srv18"
    } | ssmtp "$MAIL_TO"
fi