Procházet zdrojové kódy

Merge pull request #848 from Patrice-Gaudicheau/feat-makefile-llm-update

Timothy Jaeryang Baek před 1 rokem
rodič
revize
941ab5d6cf
3 změnil soubory, kde provedl 43 přidání a 0 odebrání
  1. 25 0
      Makefile
  2. 8 0
      confirm_remove.sh
  3. 10 0
      update_ollama_models.sh

+ 25 - 0
Makefile

@@ -0,0 +1,25 @@
+install:
+	@docker-compose up -d
+
+remove:
+	@chmod +x confirm_remove.sh
+	@./confirm_remove.sh
+
+
+start:
+	@docker-compose start
+
+stop:
+	@docker-compose stop
+
+update:
+	# Calls the LLM update script
+	chmod +x update_ollama_models.sh
+	@./update_ollama_models.sh
+	@git pull
+	@docker-compose down
+	# Make sure the ollama-webui container is stopped before rebuilding
+	@docker stop open-webui || true
+	@docker-compose up --build -d
+	@docker-compose start
+

+ 8 - 0
confirm_remove.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+echo "Warning: This will remove all containers and volumes, including persistent data. Do you want to continue? [Y/N]"
+read ans
+if [ "$ans" == "Y" ] || [ "$ans" == "y" ]; then
+  docker-compose down -v
+else
+  echo "Operation cancelled."
+fi

+ 10 - 0
update_ollama_models.sh

@@ -0,0 +1,10 @@
+#!/bin/bash
+# update_llm.sh
+
+# Retrieves the list of LLMs installed in the Docker container
+llm_list=$(docker exec ollama ollama list | tail -n +2 | awk '{print $1}')
+
+# Loop over each LLM to update it
+for llm in $llm_list; do
+  docker exec ollama ollama pull $llm
+done