Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OllamaPullProgress ¶
type OllamaPullProgress struct {
Status string `json:"status"`
Digest string `json:"digest,omitempty"`
Total int64 `json:"total,omitempty"`
Completed int64 `json:"completed,omitempty"`
}
OllamaPullProgress represents the progress information received from Ollama's pull API when downloading model files. It includes status messages, digest information, and download progress counters.
type ProgressModel ¶
type ProgressModel struct {
// contains filtered or unexported fields
}
ProgressModel implements a tea.Model for displaying download progress with a visual progress bar and status messages. It handles progress updates, errors, and completion states for Ollama model downloads.
func NewProgressModel ¶
func NewProgressModel() ProgressModel
NewProgressModel creates and initializes a new ProgressModel with a gradient progress bar and initial "Initializing..." status message.
func (ProgressModel) Init ¶
func (m ProgressModel) Init() tea.Cmd
Init implements the tea.Model interface, returning nil as no initial commands are needed for the progress display.
func (ProgressModel) Update ¶
Update implements the tea.Model interface, handling keyboard input, window resize events, and progress updates. It manages the progress bar state and triggers program exit on completion or cancellation.
func (ProgressModel) View ¶
func (m ProgressModel) View() string
View implements the tea.Model interface, rendering the progress bar with status information and help text. Displays error messages if present or a completion message when the download finishes.
type ProgressReader ¶
type ProgressReader struct {
// contains filtered or unexported fields
}
ProgressReader wraps an io.Reader to intercept and parse Ollama pull operation responses, extracting progress information and updating a visual progress bar. It manages a tea.Program for the UI and handles graceful shutdown.
func NewProgressReader ¶
func NewProgressReader(reader io.Reader) *ProgressReader
NewProgressReader creates and initializes a ProgressReader that wraps the provided io.Reader. It starts a tea.Program in a separate goroutine to display the progress bar UI while reading and parsing Ollama's streaming JSON responses.
func (*ProgressReader) Close ¶
func (pr *ProgressReader) Close() error
Close gracefully shuts down the progress display, sending a completion message and waiting for the tea.Program to exit. If the program doesn't exit within 2 seconds, it is forcefully terminated to prevent hanging.
func (*ProgressReader) Read ¶
func (pr *ProgressReader) Read(p []byte) (n int, err error)
Read implements the io.Reader interface, passing through data from the wrapped reader while parsing JSON lines to extract progress information. Each complete JSON line is processed to update the progress bar display.