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:
+21
-1
@@ -255,8 +255,16 @@ prompt_ollama_models_path() {
|
|||||||
tty_out="/dev/stderr"
|
tty_out="/dev/stderr"
|
||||||
fi
|
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 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
|
local tui_tmp
|
||||||
tui_tmp="$(mktemp)"
|
tui_tmp="$(mktemp)"
|
||||||
if run_whiptail --output-fd 3 --title "Ollama KI-Modelle Speicherort" \
|
if run_whiptail --output-fd 3 --title "Ollama KI-Modelle Speicherort" \
|
||||||
@@ -270,14 +278,25 @@ prompt_ollama_models_path() {
|
|||||||
else
|
else
|
||||||
chosen="$default_path"
|
chosen="$default_path"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
# Dialog cancelled - fall back to the configured default
|
||||||
|
# instead of dropping into the CLI prompt below too.
|
||||||
|
chosen="$default_path"
|
||||||
fi
|
fi
|
||||||
rm -f "$tui_tmp"
|
rm -f "$tui_tmp"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# CLI fallback if whiptail was not used or failed
|
# CLI fallback if whiptail was not used or failed
|
||||||
if [[ -z "$chosen" ]]; then
|
if [[ -z "$chosen" ]]; then
|
||||||
printf "\n%bOllama KI-Modelle Speicherort:%b\n" "${CLR_CYAN}" "${CLR_RESET}" > "$tty_out"
|
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"
|
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=""
|
local input_path=""
|
||||||
read -r -p "Speicherort für Ollama-Modelle eingeben [$default_path]: " input_path < "$tty_in" > "$tty_out" 2>&1 || true
|
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:]]*$//')"
|
input_path="$(echo "$input_path" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
|
||||||
@@ -287,6 +306,7 @@ prompt_ollama_models_path() {
|
|||||||
chosen="$default_path"
|
chosen="$default_path"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
chosen="$default_path"
|
chosen="$default_path"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user