Fix: Ollama-eigenen Standardpfad statt /mnt/Data als Vorschlag anbieten
Bisher wurde in allen drei Dialogvarianten (whiptail-Yesno, whiptail- Inputbox, CLI-Fallback) derselbe konfigurierte Pfad (/mnt/Data/Software/ollama/models) sowohl als "Standard" beworben als auch als vorausgefüllter Eingabewert verwendet - der tatsächliche Ollama-Standardspeicherort kam nie zum Zug. prompt_ollama_models_path() unterscheidet jetzt zwischen dem echten Ollama-Standardpfad (/usr/share/ollama/.ollama/models, verwendet vom offiziellen Installationsskript / systemd-Dienst) und dem in OLLAMA_MODELS_DEFAULT konfigurierten Pfadvorschlag. Letzterer wird nur noch als Vorbelegung im Eingabefeld angezeigt, nachdem der Standardpfad explizit abgelehnt wurde. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017WMUd2fGsPCtTCVQkSS5TA
This commit is contained in:
@@ -24,6 +24,8 @@ GRUB_TIMEOUT_STYLE="menu"
|
|||||||
DEFAULT_SHELL="zsh"
|
DEFAULT_SHELL="zsh"
|
||||||
|
|
||||||
# Ollama AI Configuration
|
# Ollama AI Configuration
|
||||||
|
# Suggested custom models path, pre-filled only if the user declines
|
||||||
|
# Ollama's own default storage location (/usr/share/ollama/.ollama/models).
|
||||||
OLLAMA_MODELS_DEFAULT="/mnt/Data/Software/ollama/models"
|
OLLAMA_MODELS_DEFAULT="/mnt/Data/Software/ollama/models"
|
||||||
OLLAMA_FLASH_ATTENTION="1"
|
OLLAMA_FLASH_ATTENTION="1"
|
||||||
OLLAMA_KV_CACHE_TYPE="q8_0"
|
OLLAMA_KV_CACHE_TYPE="q8_0"
|
||||||
|
|||||||
+20
-15
@@ -255,7 +255,12 @@ prompt_ollama_models_path() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local default_path="${OLLAMA_MODELS_DEFAULT:-/mnt/Data/Software/ollama/models}"
|
# Ollama's own default storage location (used by the official install
|
||||||
|
# script / systemd service, which runs as the "ollama" user).
|
||||||
|
local ollama_default_path="/usr/share/ollama/.ollama/models"
|
||||||
|
# Suggested custom path, only ever pre-filled once the user has
|
||||||
|
# explicitly declined the Ollama default above.
|
||||||
|
local custom_path_suggestion="${OLLAMA_MODELS_DEFAULT:-/mnt/Data/Software/ollama/models}"
|
||||||
local chosen=""
|
local chosen=""
|
||||||
local is_interactive=0
|
local is_interactive=0
|
||||||
if { [[ -t 0 ]] || has_tty; } && [[ "${DEBIAN_FRONTEND:-}" != "noninteractive" && "${CI:-}" != "1" && "${AUTO_CONFIRM:-}" != "1" ]]; then
|
if { [[ -t 0 ]] || has_tty; } && [[ "${DEBIAN_FRONTEND:-}" != "noninteractive" && "${CI:-}" != "1" && "${AUTO_CONFIRM:-}" != "1" ]]; then
|
||||||
@@ -271,20 +276,20 @@ prompt_ollama_models_path() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# If whiptail is available and running on an active terminal, first ask
|
# If whiptail is available and running on an active terminal, first ask
|
||||||
# whether the configured default path should be used, and only show
|
# whether Ollama's own default path should be used, and only show the
|
||||||
# the free-text path dialog (pre-filled with that default) if not.
|
# free-text path dialog (pre-filled with the custom suggestion) if not.
|
||||||
if command_exists whiptail && has_tty; then
|
if command_exists whiptail && has_tty; then
|
||||||
local yesno_status=0
|
local yesno_status=0
|
||||||
run_whiptail --title "Ollama KI-Modelle Speicherort" \
|
run_whiptail --title "Ollama KI-Modelle Speicherort" \
|
||||||
--yes-button "Standard verwenden" --no-button "Eigenen Pfad angeben" \
|
--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?" \
|
--yesno "Standard-Speicherort für Ollama-Modelle:\n\n$ollama_default_path\n\nMöchtest du diesen Speicherort verwenden?" \
|
||||||
12 70 || yesno_status=$?
|
12 70 || yesno_status=$?
|
||||||
if [[ "$yesno_status" -eq 0 || "$yesno_status" -eq 255 ]]; then
|
if [[ "$yesno_status" -eq 0 || "$yesno_status" -eq 255 ]]; then
|
||||||
# Yes, or ESC/Cancel (255) - use the configured default,
|
# Yes, or ESC/Cancel (255) - use the Ollama default,
|
||||||
# consistent with the inputbox fallback below where an
|
# consistent with the inputbox fallback below where an
|
||||||
# empty or cancelled dialog also keeps the default instead
|
# empty or cancelled dialog also keeps its own default
|
||||||
# of asking again.
|
# instead of asking again.
|
||||||
chosen="$default_path"
|
chosen="$ollama_default_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$chosen" ]]; then
|
if [[ -z "$chosen" ]]; then
|
||||||
@@ -292,34 +297,34 @@ prompt_ollama_models_path() {
|
|||||||
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" \
|
||||||
--inputbox "Bitte gib den Speicherort für die Ollama KI-Modelle an:" \
|
--inputbox "Bitte gib den Speicherort für die Ollama KI-Modelle an:" \
|
||||||
10 70 "$default_path" \
|
10 70 "$custom_path_suggestion" \
|
||||||
3> "$tui_tmp"; then
|
3> "$tui_tmp"; then
|
||||||
chosen="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' < "$tui_tmp")"
|
chosen="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' < "$tui_tmp")"
|
||||||
fi
|
fi
|
||||||
rm -f "$tui_tmp"
|
rm -f "$tui_tmp"
|
||||||
[[ -z "$chosen" ]] && chosen="$default_path"
|
[[ -z "$chosen" ]] && chosen="$custom_path_suggestion"
|
||||||
fi
|
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}" "$ollama_default_path" "${CLR_RESET}" > "$tty_out"
|
||||||
if confirm_yes_no "Standard-Speicherort verwenden? [J/n]: " "j" "$tty_in" "$tty_out"; then
|
if confirm_yes_no "Standard-Speicherort verwenden? [J/n]: " "j" "$tty_in" "$tty_out"; then
|
||||||
chosen="$default_path"
|
chosen="$ollama_default_path"
|
||||||
else
|
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 [$custom_path_suggestion]: " 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:]]*$//')"
|
||||||
if [[ -n "$input_path" ]]; then
|
if [[ -n "$input_path" ]]; then
|
||||||
chosen="$input_path"
|
chosen="$input_path"
|
||||||
else
|
else
|
||||||
chosen="$default_path"
|
chosen="$custom_path_suggestion"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
chosen="$default_path"
|
chosen="$ollama_default_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export OLLAMA_MODELS="$chosen"
|
export OLLAMA_MODELS="$chosen"
|
||||||
|
|||||||
Reference in New Issue
Block a user