@@ -19,19 +19,53 @@ elif [ -t 0 ]; then
1919 # Running interactively
2020 echo " [1] - Proceed to install and launch with default options - no model is loaded by default, but can be downloaded in the UI"
2121 echo " [2] - Proceed to install and not run."
22- echo " [3] - Exit script"
22+ echo " [3] - Select existing model to load (Requires already installed)"
23+ echo " [4] - Exit script"
2324 echo " --------------------------------------------"
24- read -p " Enter your choice [1-3 ]: " choice
25+ read -p " Enter your choice [1-4 ]: " choice
2526else
2627 # Non-interactive, default to choice 1
2728 echo " Defaulting to normal install and model download. Run script interactively for other options. Install will start in 3 seconds."
2829 choice=" 1"
2930 sleep 3
3031fi
3132
32- if [ " $choice " = " 3" ]; then
33+ # Determine script directory (works for both curl|sh and ./install.sh)
34+ if [ -f " $0 " ]; then
35+ SCRIPT_DIR=" $( cd " $( dirname " $0 " ) " && pwd) " # Normal execution (./install.sh)
36+ else
37+ SCRIPT_DIR=" $( pwd) " # Piped execution (curl | sh)
38+ fi
39+
40+ # handle user choice
41+ if [ " $choice " = " 4" ]; then
3342 echo " Exiting script. Goodbye!"
3443 exit 0
44+ elif [ " $choice " = " 3" ]; then
45+ echo " [*] Searching for .gguf model files in $SCRIPT_DIR ..."
46+ MODEL_FILES=$( find " $SCRIPT_DIR " -type f -maxdepth 1 -name " *.gguf" 2> /dev/null)
47+ if [ -z " $MODEL_FILES " ]; then
48+ echo " No .gguf model files found in $SCRIPT_DIR "
49+ exit 1
50+ fi
51+ echo " Available model files:"
52+ i=1
53+ for file in $MODEL_FILES ; do
54+ echo " [$i ] $file "
55+ eval " MODEL_$i =\" $file \" "
56+ i=$(( i+ 1 ))
57+ done
58+ read -p " Enter the number of the model you want to load: " model_choice
59+ # Validate input
60+ if ! [[ " $model_choice " =~ ^[0-9]+$ ]] || [ " $model_choice " -lt 1 ] || [ " $model_choice " -ge " $i " ]; then
61+ echo " Invalid selection."
62+ exit 1
63+ fi
64+ eval " SELECTED_MODEL=\$ MODEL_$model_choice "
65+ echo " Now launching with model $SELECTED_MODEL "
66+ python koboldcpp.py --model $SELECTED_MODEL
67+ exit 0
68+
3569elif [ " $choice " = " 2" ]; then
3670 echo " [*] Install without model download..."
3771 INSTALL_MODEL=false
5791 pkg upgrade -o Dpkg::Options::=" --force-confold" -y
5892fi
5993
60- # Determine script directory (works for both curl|sh and ./install.sh)
61- if [ -f " $0 " ]; then
62- SCRIPT_DIR=" $( cd " $( dirname " $0 " ) " && pwd) " # Normal execution (./install.sh)
63- else
64- SCRIPT_DIR=" $( pwd) " # Piped execution (curl | sh)
65- fi
6694# Check if koboldcpp.py already exists nearby
6795if [ -f " $SCRIPT_DIR /koboldcpp.py" ]; then
6896 echo " [*] Detected existing koboldcpp.py in $SCRIPT_DIR "
0 commit comments