diff --git a/.env.example b/.env.example index a476049..7cf366d 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,12 @@ SEARXNG_BASE_URL="http://127.0.0.1:8080" REDIS_BASE_URL="redis://redis:6379/0" -WORK_DIR_HOST="/Users/mlg/Documents/workspace_for_ai" +WORK_DIR="/Users/username/Documents/workspace_with_my_files" +OLLAMA_PORT="11434" +LM_STUDIO_PORT="1234" +CUSTOM_ADDITIONAL_LLM_PORT="11435" OPENAI_API_KEY='xxxxx' DEEPSEEK_API_KEY='xxxxx' OPENROUTER_API_KEY='xxxxx' -TOGETHER_API_KEY='xxxx' +TOGETHER_API_KEY='xxxxx' GOOGLE_API_KEY='xxxxx' ANTHROPIC_API_KEY='xxxxx' \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 5c8f408..ddaec26 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -76,10 +76,13 @@ services: context: . dockerfile: Dockerfile.backend ports: - - ${BACKEND_PORT:-8000}:${BACKEND_PORT:-8000} + - ${BACKEND_PORT:-7777}:${BACKEND_PORT:-7777} + - ${OLLAMA_PORT:-11434}:${OLLAMA_PORT:-11434} + - ${LM_STUDIO_PORT:-1234}:${LM_STUDIO_PORT:-1234} + - ${CUSTOM_ADDITIONAL_LLM_PORT:-8000}:${CUSTOM_ADDITIONAL_LLM_PORT:-8000} volumes: - ./:/app - - ${WORK_DIR_HOST:-.}:/opt/workspace + - ${WORK_DIR:-.}:/opt/workspace command: python3 api.py environment: - SEARXNG_URL=${SEARXNG_BASE_URL:-http://searxng:8080} @@ -91,6 +94,8 @@ services: - TOGETHER_API_KEY=${TOGETHER_API_KEY} - GOOGLE_API_KEY=${GOOGLE_API_KEY} - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} + - HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY} + - DSK_DEEPSEEK_API_KEY=${DSK_DEEPSEEK_API_KEY} network_mode: "host" volumes: diff --git a/frontend/agentic-seek-front/src/App.js b/frontend/agentic-seek-front/src/App.js index a9e6407..ed64d08 100644 --- a/frontend/agentic-seek-front/src/App.js +++ b/frontend/agentic-seek-front/src/App.js @@ -4,7 +4,7 @@ import axios from 'axios'; import './App.css'; import { colors } from './colors'; -const BACKEND_URL = process.env.REACT_APP_BACKEND_URL || 'http://0.0.0.0:8000'; +const BACKEND_URL = process.env.BACKEND_PORT || 'http://0.0.0.0:8000'; function App() { const [query, setQuery] = useState(''); diff --git a/start_services.cmd b/start_services.cmd index 94e8649..b069390 100644 --- a/start_services.cmd +++ b/start_services.cmd @@ -1,10 +1,22 @@ @echo off -docker-compose up -if %ERRORLEVEL% neq 0 ( - echo Error: Failed to start containers. Check Docker logs with 'docker compose logs'. - echo Possible fixes: Ensure Docker Desktop is running or check if port 8080 is free. - exit /b 1 +if "%1"=="full" ( + echo Starting full deployment... +) else ( + echo Starting partial deployment... (backend run on host), use "full" to run all services in containers ) -timeout /t 10 /nobreak >nul \ No newline at end of file +REM Stop all containers +echo Stopping containers... +docker stop $(docker ps -aq) >nul 2>&1 + +REM Generate secret key +for /f %%i in ('powershell -command "[System.Web.Security.Membership]::GeneratePassword(64,0)"') do set SEARXNG_SECRET_KEY=%%i + +if "%1"=="full" ( + docker compose up -d backend + timeout /t 5 /nobreak >nul + docker compose --profile full up +) else ( + docker compose --profile core up +) \ No newline at end of file diff --git a/start_services.sh b/start_services.sh index d9cc98c..f3b632a 100755 --- a/start_services.sh +++ b/start_services.sh @@ -5,17 +5,32 @@ source .env command_exists() { command -v "$1" &> /dev/null } +if [ -z "$WORK_DIR" ]; then + echo "Error: WORK_DIR environment variable is not set. Please set it in your .env file." + exit 1 +fi + +if [[ "$OSTYPE" == "darwin"* ]]; then + dir_size_bytes=$(du -s -b "$WORK_DIR" 2>/dev/null | awk '{print $1}') +else + dir_size_bytes=$(du -s --bytes "$WORK_DIR" 2>/dev/null | awk '{print $1}') +fi + +max_size_bytes=$((2 * 1024 * 1024 * 1024)) + +echo "Mounting $WORK_DIR ($dir_size_bytes bytes) to docker." + +if [ "$dir_size_bytes" -gt "$max_size_bytes" ]; then + echo "Error: WORK_DIR ($WORK_DIR) contains more than 2GB of data ($(du -sh "$WORK_DIR" 2>/dev/null | awk '{print $1}'))." + exit 1 +fi if [ "$1" = "full" ]; then echo "Starting full deployment with backend and all services..." else - echo "Starting core deployment with frontend and search services only..." + echo "Starting core deployment with frontend and search services only... use ./start_services.sh full to start backend as well" fi -# -# Check if Docker is installed é running -# - if ! command_exists docker; then echo "Error: Docker is not installed. Please install Docker first." echo "On Ubuntu: sudo apt install docker.io" @@ -68,28 +83,6 @@ if [ ! -f "docker-compose.yml" ]; then exit 1 fi -# bundle based approach, commented out in favor of direct download for now -# Download and extract Chrome bundle if not present -#echo "Checking Chrome bundle..." -#if [ ! -d "chrome_bundle/chrome136" ]; then -# echo "Chrome bundle not found. Downloading..." -# mkdir -p chrome_bundle -# curl -L https://github.com/Fosowl/agenticSeek/releases/download/utility/chrome136.zip -o /tmp/chrome136.zip -# if [ $? -ne 0 ]; then -# echo "Error: Failed to download Chrome bundle" -# exit 1 -# fi -# unzip -q /tmp/chrome136.zip -d chrome_bundle/ -# if [ $? -ne 0 ]; then -# echo "Error: Failed to extract Chrome bundle" -# exit 1 -# fi -# rm /tmp/chrome136.zip -# echo "Chrome bundle downloaded and extracted successfully" -#else -# echo "Chrome bundle already exists" -#fi - # Stop all running containers to ensure a clean state echo "Warning: stopping all docker containers (t-4 seconds)..." sleep 4