ui

package
v0.32.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 36 Imported by: 1

Documentation

Overview

package ui implements a chat interface for Ollama

Index

Constants

This section is empty.

Variables

View Source
var CORS = envconfig.Bool("OLLAMA_CORS")
View Source
var ErrNetworkOffline = errors.New("network is offline")
View Source
var OllamaDotCom = func() string {
	if url := os.Getenv("OLLAMA_DOT_COM_URL"); url != "" {
		return url
	}
	return "https://ollama.com"
}()

OllamaDotCom returns the URL for ollama.com, allowing override via environment variable

Functions

func WaitForServer added in v0.13.3

func WaitForServer(ctx context.Context, timeout time.Duration) error

WaitForServer waits for the Ollama server to be ready

Types

type Event

type Event string

Event is a string that represents the type of event being sent to the client. It is used in the Server-Sent Events (SSE) protocol to identify the type of data being sent. The client (template) will use this type in the sse event listener to determine how to handle the incoming data. It will also be used in the sse-swap htmx event listener to determine how to handle the incoming data.

const (
	EventChat       Event = "chat"
	EventComplete   Event = "complete"
	EventLoading    Event = "loading"
	EventToolResult Event = "tool_result" // Used for both tool calls and their results
	EventThinking   Event = "thinking"
	EventToolCall   Event = "tool_call"
	EventDownload   Event = "download"
)

type Server

type Server struct {
	Logger       *slog.Logger
	Restart      func()
	Token        string
	Store        *store.Store
	ToolRegistry *tools.Registry
	Tools        bool   // if true, the server will use single-turn tools to fulfill the user's request
	WebSearch    bool   // if true, the server will use single-turn browser tool to fulfill the user's request
	Agent        bool   // if true, the server will use multi-turn tools to fulfill the user's request
	WorkingDir   string // Working directory for all agent operations

	// Dev is true if the server is running in development mode
	Dev bool

	// Updater for checking and downloading updates
	Updater             *updater.Updater
	UpdateAvailableFunc func()
}

func (*Server) Handler

func (s *Server) Handler() http.Handler

func (*Server) UserData

func (s *Server) UserData(ctx context.Context) (*api.UserResponse, error)

UserData fetches user data from ollama.com API for the current ollama key

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL