refactor: replace Git LFS with runtime model download from Hugging Face

Remove ~170MB of model files from the repository (LFS + committed).
Models are now downloaded at runtime from Hugging Face on first use
and cached to the OS cache directory with progress reporting and retries.

- Add internal/models/download.go: runtime downloader with retry, progress bar, checksums
- Remove go:embed for ONNX models (keep tokenizers embedded)
- Use file-based ONNX session loading instead of byte-slice
- Add scripts/download-models.sh for dev/CI model setup
- Update Makefile with setup-models target
- Update workflow-prepare.sh to download models in CI
- Set lfs: false in all CI workflows
- SHA256: bge=828e14..., cross-encoder=5d3e70...
This commit is contained in:
2026-05-26 17:53:30 +01:00
parent c8b462aaec
commit 1a4fea5c17
15 changed files with 431 additions and 53 deletions
+10 -4
View File
@@ -23,6 +23,10 @@ all: build
setup-libs:
@./scripts/download-onnx-libs.sh all
# Download ONNX models from Hugging Face (for local dev, skips if present)
setup-models:
@./scripts/download-models.sh
# Update version in committed plugin metadata
update-version:
@if [ -f .claude-plugin/plugin.json ]; then \
@@ -182,12 +186,14 @@ uninstall: stop-worker
@echo "Uninstallation complete!"
# Run tests (with FTS5 support)
test: setup-libs
go test $(BUILD_TAGS) -v -race ./...
# CLAUDE_MNEMONIC_MODEL_DIR points to a common model directory for tests.
# Run setup-models first to download models from Hugging Face.
test: setup-libs setup-models
CLAUDE_MNEMONIC_MODEL_DIR=$$(pwd)/testdata/models go test $(BUILD_TAGS) -v -race ./...
# Run tests with coverage (with FTS5 support)
test-coverage: setup-libs
go test $(BUILD_TAGS) -v -race -coverprofile=coverage.out ./...
test-coverage: setup-libs setup-models
CLAUDE_MNEMONIC_MODEL_DIR=$$(pwd)/testdata/models go test $(BUILD_TAGS) -v -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@go tool cover -func=coverage.out | tail -1