#!/bin/bash is_installed() { command -v $1 >/dev/null 2>&1 || { echo >&2 "Ошибка: $1 не установлен"; exit 1; } } is_installed curl is_installed jq is_installed python3 is_installed pip echo "Поиск зависимостей..." python3 -m venv venv source venv/bin/activate [ "$(pip install --dry-run chromadb 2>&1 | grep -c 'Would install')" -gt 0 ] && pip install chromadb [ "$(pip install --dry-run numpy 2>&1 | grep -c 'Would install')" -gt 0 ] && pip install numpy [ "$(pip install --dry-run requests 2>&1 | grep -c 'Would install')" -gt 0 ] && pip install requests [ "$(pip install --dry-run beautifulsoup4 2>&1 | grep -c 'Would install')" -gt 0 ] && pip install beautifulsoup4 echo "Начало работы" cd ..; ./up; cd - ./1_download_page.sh "$@" || exit 1 python3 ./2_html_to_md.py python3 ./3_rag.py --action build python3 ./3_rag.py --action interactive