diff --git a/scripts/install.sh b/scripts/install.sh index 356231a..6abb500 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -344,18 +344,18 @@ else # Whisper backend is offline-only; no auto-install here. fi - # Seed whisper.cpp model from bundled offline assets (base model) - whisper_model_src="$(cd "$(dirname "$0")/.." && pwd)/vendor/whisper/ggml-base.bin" + # Seed whisper.cpp model from bundled offline assets (small model) + whisper_model_src="$(cd "$(dirname "$0")/.." && pwd)/vendor/whisper/ggml-small.bin" whisper_model_dir="$HOME/.local/share/whisper.cpp/models" if [ -f "$whisper_model_src" ]; then mkdir -p "$whisper_model_dir" - if [ ! -f "$whisper_model_dir/ggml-base.bin" ]; then - cp "$whisper_model_src" "$whisper_model_dir/ggml-base.bin" - echo -e "${GREEN}[OK]${NC} Whisper base model installed to $whisper_model_dir" + if [ ! -f "$whisper_model_dir/ggml-small.bin" ]; then + cp "$whisper_model_src" "$whisper_model_dir/ggml-small.bin" + echo -e "${GREEN}[OK]${NC} Whisper small model installed to $whisper_model_dir" fi else - echo -e "${RED}[ERROR]${NC} Offline Whisper model not found at vendor/whisper/ggml-base.bin" - echo "Place ggml-base.bin there to keep installs fully offline." + echo -e "${RED}[ERROR]${NC} Offline Whisper model not found at vendor/whisper/ggml-small.bin" + echo "Place ggml-small.bin there to keep installs fully offline." exit 1 fi diff --git a/subtitles_module.go b/subtitles_module.go index 18dc933..4ea05b1 100644 --- a/subtitles_module.go +++ b/subtitles_module.go @@ -1021,15 +1021,18 @@ func detectWhisperBackend() string { func detectWhisperModel() string { preferred := []string{ - filepath.Join("models", "ggml-base.bin"), filepath.Join("models", "ggml-small.bin"), + filepath.Join("models", "ggml-base.bin"), filepath.Join("models", "ggml-medium.bin"), filepath.Join("models", "ggml-large.bin"), + filepath.Join("vendor", "whisper", "ggml-small.bin"), filepath.Join("vendor", "whisper", "ggml-base.bin"), } if exe, err := os.Executable(); err == nil { dir := filepath.Dir(exe) + preferred = append(preferred, filepath.Join(dir, "vendor", "whisper", "ggml-small.bin")) preferred = append(preferred, filepath.Join(dir, "vendor", "whisper", "ggml-base.bin")) + preferred = append(preferred, filepath.Join(dir, "models", "ggml-small.bin")) preferred = append(preferred, filepath.Join(dir, "models", "ggml-base.bin")) } for _, candidate := range preferred { @@ -1058,6 +1061,12 @@ func detectWhisperModel() string { if len(matches) == 0 { continue } + for _, match := range matches { + base := filepath.Base(match) + if base == "ggml-small.bin" { + return match + } + } for _, match := range matches { base := filepath.Base(match) if base == "ggml-base.bin" {