Paperless-AI: Add RAG chat (#4635)

* Add RAG

* Oops
This commit is contained in:
Slaviša Arežina
2025-05-22 09:08:19 +02:00
committed by GitHub
parent c7afd9c427
commit ec186b0288
2 changed files with 49 additions and 11 deletions

View File

@@ -27,6 +27,9 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
if ! dpkg -s python3-pip >/dev/null 2>&1; then
$STD apt-get install -y python3-pip
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/clusterzx/paperless-ai/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_info "Stopping $APP"
@@ -42,6 +45,25 @@ function update_script() {
mkdir -p /opt/paperless-ai/data
cp -a /opt/paperless-ai_bak/data/. /opt/paperless-ai/data/
cd /opt/paperless-ai
if [[ ! -f /etc/systemd/system/paperless-rag.service ]]; then
cat <<EOF >/etc/systemd/system/paperless-rag.service
[Unit]
Description=PaperlessAI-RAG Service
After=network.target
[Service]
WorkingDirectory=/opt/paperless-ai
ExecStart=/usr/bin/python3 main.py --host 0.0.0.0 --port 8000 --initialize
Restart=always
[Install]
WantedBy=multi-user.target
EOF
echo "RAG_SERVICE_URL=http://localhost:8000" >>/opt/paperless-ai/data/.env
echo "RAG_SERVICE_ENABLED=true" >>/opt/paperless-ai/data/.env
fi
$STD pip install --no-cache-dir -r requirements.txt
mkdir -p data/chromadb
$STD npm install
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated $APP to v${RELEASE}"