Documentation
¶
Overview ¶
Package downloads manages model downloads for SpeechKit — HTTP file downloads and Ollama model pulls with progress tracking.
Index ¶
- Variables
- func ApplyStatus(ctx context.Context, cfg *config.Config, items []Item, options StatusOptions)
- func AvailableArtifactModelPath(item Item, cfg *config.Config) (string, bool)
- func FileIsPresent(path string) bool
- func OllamaModelPresent(ctx context.Context, model string) bool
- func ResolveLocalLLMModelsDir(cfg *config.Config) string
- func ResolveWakewordModelsDir(cfg *config.Config) string
- func ResolveWhisperModelsDir(cfg *config.Config) string
- type Item
- type JobView
- type Kind
- type Manager
- type Status
- type StatusOptions
Constants ¶
This section is empty.
Variables ¶
var ( DefaultStatusOptions = StatusOptions{ProbeRuntimes: true, ProbeOllama: true} ReadinessStatusOptions = StatusOptions{ProbeRuntimes: true, ProbeOllama: false} )
var DownloadURLValidation = netsec.ValidationOptions{}
DownloadURLValidation controls which URLs httpDownload accepts. Production default is strict (public https only). Tests relax this to allow loopback.
var OllamaBaseURL = "http://localhost:11434"
OllamaBaseURL is the Ollama REST API endpoint. Override in tests.
Functions ¶
func ApplyStatus ¶ added in v0.24.0
func AvailableArtifactModelPath ¶ added in v0.35.8
AvailableArtifactModelPath returns the first on-disk file backing a catalog item. For whisper.cpp this includes the bundled starter model in addition to the user-writable download directory.
func FileIsPresent ¶
FileIsPresent returns true if the given path exists and is a regular file.
func OllamaModelPresent ¶
OllamaModelPresent quickly checks if Ollama is running and the model is pulled. It uses a short timeout so it never blocks the catalog response significantly.
func ResolveLocalLLMModelsDir ¶ added in v0.22.4
ResolveLocalLLMModelsDir returns the directory where local llama.cpp GGUF files live.
func ResolveWakewordModelsDir ¶ added in v0.34.9
ResolveWakewordModelsDir returns the directory where wake-word ONNX model files live. Mirrors the resolution order used for whisper/LLM models so all on-disk artifacts share one user-configurable directory.
Wake-word models are downloaded on first activation when cfg.Wakeword.Enabled is set and the model path is missing on disk. The catalog entry that drives that download lives in ArtifactCatalog() once a published .onnx URL is available; until then, power-users can place a custom hey_quby.onnx (trained via tools/wakeword-training/hey_quby.yaml) directly into this directory.
func ResolveWhisperModelsDir ¶
ResolveWhisperModelsDir returns the directory where whisper model files live.
Types ¶
type Item ¶
type Item struct {
ID string `json:"id"`
ProfileID string `json:"profileId"`
Name string `json:"name"`
Description string `json:"description"`
SizeLabel string `json:"sizeLabel"`
SizeBytes int64 `json:"sizeBytes"`
Kind Kind `json:"kind"`
URL string `json:"url,omitempty"`
SHA256 string `json:"sha256,omitempty"`
OllamaModel string `json:"ollamaModel,omitempty"`
License string `json:"license"`
Available bool `json:"available"`
Selected bool `json:"selected"`
RuntimeReady bool `json:"runtimeReady,omitempty"`
RuntimeProblem string `json:"runtimeProblem,omitempty"`
Recommended bool `json:"recommended,omitempty"`
}
Item describes a model that can be pulled into SpeechKit.
func ArtifactCatalog ¶ added in v0.24.0
func ArtifactCatalog() []Item
ArtifactCatalog returns static downloadable and pullable model artifacts. Runtime state is resolved separately so catalog consumers can decide which probes are appropriate for their context.
func CatalogWithStatus ¶ added in v0.24.0
type JobView ¶
type JobView struct {
ID string `json:"id"`
ModelID string `json:"modelId"`
ProfileID string `json:"profileId"`
Status Status `json:"status"`
Progress float64 `json:"progress"`
BytesDone int64 `json:"bytesDone"`
TotalBytes int64 `json:"totalBytes"`
StatusText string `json:"statusText"`
Error string `json:"error,omitempty"`
}
JobView is the mutex-free snapshot used for JSON serialization.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager coordinates download jobs.
type StatusOptions ¶ added in v0.24.0
StatusOptions controls which runtime checks are layered onto the static artifact catalog.