diff --git a/lib/utils.sh b/lib/utils.sh index e462eea..805c313 100755 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -280,30 +280,24 @@ prompt_ollama_models_path() { --yesno "Standard-Speicherort für Ollama-Modelle:\n\n$default_path\n\nMöchtest du diesen Speicherort verwenden?" \ 12 70 || yesno_status=$? if [[ "$yesno_status" -eq 0 || "$yesno_status" -eq 255 ]]; then - # Yes, or ESC/Cancel (255) - fall back to the configured - # default, consistent with the inputbox dialog below where - # ESC/Cancel also keeps the default instead of asking again. + # Yes, or ESC/Cancel (255) - use the configured default, + # consistent with the inputbox fallback below where an + # empty or cancelled dialog also keeps the default instead + # of asking again. chosen="$default_path" - else + fi + + if [[ -z "$chosen" ]]; then local tui_tmp tui_tmp="$(mktemp)" if run_whiptail --output-fd 3 --title "Ollama KI-Modelle Speicherort" \ --inputbox "Bitte gib den Speicherort für die Ollama KI-Modelle an:" \ 10 70 "$default_path" \ 3> "$tui_tmp"; then - local tui_input - tui_input="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' < "$tui_tmp")" - if [[ -n "$tui_input" ]]; then - chosen="$tui_input" - else - chosen="$default_path" - fi - else - # Dialog cancelled - fall back to the configured default - # instead of dropping into the CLI prompt below too. - chosen="$default_path" + chosen="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' < "$tui_tmp")" fi rm -f "$tui_tmp" + [[ -z "$chosen" ]] && chosen="$default_path" fi fi