From 6c037d992a04466b89c01674a3e75bb9096bddc3 Mon Sep 17 00:00:00 2001 From: dal Date: Wed, 7 May 2025 23:34:59 -0600 Subject: [PATCH] Update LLM_BASE_URL in environment files and rename restart command to reset in CLI --- .env.example | 2 +- cli/cli/src/commands/run.rs | 20 ++++++++++---------- cli/cli/src/main.rs | 4 ++-- docker-compose.yml | 14 ++++++++++++++ supabase/.env.example | 2 +- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/.env.example b/.env.example index 04012d965..2d1362e35 100644 --- a/.env.example +++ b/.env.example @@ -15,7 +15,7 @@ RERANK_API_KEY="your_rerank_api_key" RERANK_MODEL="rerank-v3.5" RERANK_BASE_URL="https://api.cohere.com/v2/rerank" LLM_API_KEY="your_llm_api_key" -LLM_BASE_URL="http://localhost:4000" +LLM_BASE_URL="http://buster-litellm:4001" # WEB VARS NEXT_PUBLIC_API_URL="http://127.0.0.1:3001" diff --git a/cli/cli/src/commands/run.rs b/cli/cli/src/commands/run.rs index 3b39a89a1..6a71d00d0 100644 --- a/cli/cli/src/commands/run.rs +++ b/cli/cli/src/commands/run.rs @@ -159,18 +159,18 @@ pub async fn stop() -> Result<(), BusterError> { run_docker_compose_command(&["down"], "Stopping").await } -pub async fn restart() -> Result<(), BusterError> { - println!("WARNING: This command will stop all Buster services, attempt to remove their current images, and then restart them."); +pub async fn reset() -> Result<(), BusterError> { + println!("WARNING: This command will stop all Buster services, attempt to remove their current images, and then restart them from scratch."); println!("This can lead to a complete wipe of the Buster database and any other local service data."); println!("This action is irreversible."); - print!("Are you sure you want to proceed? (yes/No): "); + print!("Are you sure you want to proceed with resetting? (yes/No): "); io::stdout().flush().map_err(|e| BusterError::CommandError(format!("Failed to flush stdout: {}", e)))?; let mut confirmation = String::new(); io::stdin().read_line(&mut confirmation).map_err(|e| BusterError::CommandError(format!("Failed to read user input: {}", e)))?; if confirmation.trim().to_lowercase() != "yes" { - println!("Restart cancelled by user."); + println!("Reset cancelled by user."); return Ok(()); } @@ -185,7 +185,7 @@ pub async fn restart() -> Result<(), BusterError> { .expect("Failed to set progress bar style"), ); - pb.set_message("Rebuilding Buster services (step 1/4): Stopping services..."); + pb.set_message("Resetting Buster services (step 1/4): Stopping services..."); let mut down_cmd = Command::new("docker"); down_cmd.current_dir(&persistent_app_dir) @@ -215,7 +215,7 @@ Stderr: return Err(BusterError::CommandError(err_msg)); } - pb.set_message("Rebuilding Buster services (step 2/4): Identifying service images..."); + pb.set_message("Resetting Buster services (step 2/4): Identifying service images..."); let mut config_images_cmd = Command::new("docker"); config_images_cmd.current_dir(&persistent_app_dir) .arg("compose") @@ -251,14 +251,14 @@ Stderr: if image_names.is_empty() { pb.println("No images identified by docker-compose config --images. Skipping image removal."); } else { - pb.set_message(format!("Rebuilding Buster services (step 3/4): Removing {} service image(s)...", image_names.len())); + pb.set_message(format!("Resetting Buster services (step 3/4): Removing {} service image(s)...", image_names.len())); for (index, image_name) in image_names.iter().enumerate() { let current_image_name = image_name.trim(); if current_image_name.is_empty() { continue; } pb.set_message(format!( - "Rebuilding Buster services (step 3/4): Removing image {}/{} ('{}')...", + "Resetting Buster services (step 3/4): Removing image {}/{} ('{}')...", index + 1, image_names.len(), current_image_name @@ -278,7 +278,7 @@ Stderr: } } - pb.set_message("Rebuilding Buster services (step 4/4): Starting services (pulling images if needed)..."); + pb.set_message("Resetting Buster services (step 4/4): Starting services (pulling images if needed)..."); let mut up_cmd = Command::new("docker"); up_cmd.current_dir(&persistent_app_dir) .arg("compose") @@ -296,7 +296,7 @@ Stderr: let up_output = up_cmd.output().map_err(|e| BusterError::CommandError(format!("Failed to execute docker compose up: {}", e)))?; if up_output.status.success() { - pb.finish_with_message("Buster services rebuilt and started successfully."); + pb.finish_with_message("Buster services reset and started successfully."); Ok(()) } else { let err_msg = format!( diff --git a/cli/cli/src/main.rs b/cli/cli/src/main.rs index 5ed284f80..182f3a82f 100644 --- a/cli/cli/src/main.rs +++ b/cli/cli/src/main.rs @@ -85,7 +85,7 @@ pub enum Commands { /// Stop the Buster services Stop, /// Restart the Buster services - Restart, + Reset, } #[derive(Parser)] @@ -144,7 +144,7 @@ async fn main() { Commands::Parse { path } => commands::parse::parse_models_command(path).await, Commands::Start => run::start().await.map_err(anyhow::Error::from), Commands::Stop => run::stop().await.map_err(anyhow::Error::from), - Commands::Restart => run::restart().await.map_err(anyhow::Error::from), + Commands::Reset => run::reset().await.map_err(anyhow::Error::from), }; if let Err(e) = result { diff --git a/docker-compose.yml b/docker-compose.yml index 5ce16d86e..250583c4c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -59,5 +59,19 @@ services: condition: service_healthy network_mode: "service:api" + litellm: + image: ghcr.io/berriai/litellm:main-latest + container_name: buster-litellm + ports: + - "4001:4001" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:4001/health/readiness"] + interval: 30s + timeout: 10s + retries: 3 + depends_on: + api: + condition: service_healthy + volumes: buster_redis_data: \ No newline at end of file diff --git a/supabase/.env.example b/supabase/.env.example index 5048b562e..d2cb2c943 100644 --- a/supabase/.env.example +++ b/supabase/.env.example @@ -20,7 +20,7 @@ EMBEDDING_MODEL="mxbai-embed-large" COHERE_API_KEY="" OPENAI_API_KEY="" # For OpenAI models or Supabase Studio assistant LLM_API_KEY="test-key" -LLM_BASE_URL="http://litellm:4001" +LLM_BASE_URL="http://buster-litellm:4001" # --- Web Client (Next.js) Specific --- NEXT_PUBLIC_API_URL="http://localhost:3001" # External URL for the API service (buster-api)