Update LLM_BASE_URL in environment files and rename restart command to reset in CLI

This commit is contained in:
dal 2025-05-07 23:34:59 -06:00
parent 011a10dd41
commit 6c037d992a
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
5 changed files with 28 additions and 14 deletions

View File

@ -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"

View File

@ -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!(

View File

@ -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 {

View File

@ -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:

View File

@ -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)