Feat: Bestätigungsabfrage vor Ollama-Speicherort-Dialog hinzufügen

prompt_ollama_models_path() fragt jetzt zuerst per Ja/Nein, ob der
konfigurierte Standard-Speicherort (OLLAMA_MODELS_DEFAULT) verwendet werden
soll - analog zum bestehenden Muster in tui_prompt_target_user(). Nur bei
"Eigenen Pfad angeben" erscheint der Eingabedialog, vorbelegt mit genau
diesem Standardpfad. Gilt für whiptail-TUI und den CLI-Fallback gleichermaßen.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WMUd2fGsPCtTCVQkSS5TA
This commit is contained in:
2026-09-06 21:15:29 +02:00
co-authored by Claude Sonnet 5
parent 1723803e9c
commit d9ec12dba3
+21 -1
View File
@@ -255,8 +255,16 @@ prompt_ollama_models_path() {
tty_out="/dev/stderr"
fi
# If whiptail is available and running on an active terminal, use whiptail dialog
# If whiptail is available and running on an active terminal, first ask
# whether the configured default path should be used, and only show
# the free-text path dialog (pre-filled with that default) if not.
if command_exists whiptail && has_tty; then
if run_whiptail --title "Ollama KI-Modelle Speicherort" \
--yes-button "Standard verwenden" --no-button "Eigenen Pfad angeben" \
--yesno "Standard-Speicherort für Ollama-Modelle:\n\n$default_path\n\nMöchtest du diesen Speicherort verwenden?" \
12 70; then
chosen="$default_path"
else
local tui_tmp
tui_tmp="$(mktemp)"
if run_whiptail --output-fd 3 --title "Ollama KI-Modelle Speicherort" \
@@ -270,14 +278,25 @@ prompt_ollama_models_path() {
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"
fi
rm -f "$tui_tmp"
fi
fi
# CLI fallback if whiptail was not used or failed
if [[ -z "$chosen" ]]; then
printf "\n%bOllama KI-Modelle Speicherort:%b\n" "${CLR_CYAN}" "${CLR_RESET}" > "$tty_out"
printf "Standard-Pfad: %b%s%b\n" "${CLR_BOLD}" "$default_path" "${CLR_RESET}" > "$tty_out"
local use_default=""
read -r -p "Standard-Speicherort verwenden? [J/n]: " use_default < "$tty_in" > "$tty_out" 2>&1 || use_default="j"
use_default="$(echo "$use_default" | xargs)"
if [[ -z "$use_default" || "$use_default" =~ ^[JjYy] ]]; then
chosen="$default_path"
else
local input_path=""
read -r -p "Speicherort für Ollama-Modelle eingeben [$default_path]: " input_path < "$tty_in" > "$tty_out" 2>&1 || true
input_path="$(echo "$input_path" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
@@ -287,6 +306,7 @@ prompt_ollama_models_path() {
chosen="$default_path"
fi
fi
fi
else
chosen="$default_path"
fi