cli

package
v0.0.0-...-665a2f5 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

cli/cli.go

cli/cli_multimodel.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartGUI

func StartGUI(configPath string)

StartGUI initializes and runs the interactive TUI for single-model chat. It reads configuration from config.json, optionally switches to multimodel mode, and blocks until the UI exits. It logs diagnostic output to debug.log when enabled. StartGUI does not return a value.

func StartMultimodelGUI

func StartMultimodelGUI(cfg *Config) error

StartMultimodelGUI initializes and runs the four-column multimodel chat UI. It accepts a parsed Config, sets up the Bubble Tea program, and blocks until the UI exits. StartMultimodelGUI returns an error if the TUI cannot be run.

Types

type Config

type Config struct {
	// Hosts is the list of language model backends the application can target.
	Hosts []Host `json:"hosts"`
	// Debug enables display of timing metrics and logs additional details.
	Debug bool `json:"debug"`
	// Multimodel toggles the four-column chat interface for multiple models.
	Multimodel bool `json:"multimodel"`
	// JSON enables JSON output mode for CLI interactions.
	JSON bool `json:"json"`
}

Config contains application settings that drive the CLI/TUI behavior. It includes the set of available hosts, debug mode, and multimodel mode.

type Host

type Host struct {
	// Name is a user-friendly label for the host, for example "Local Ollama".
	Name string `json:"name"`
	// URL is the HTTP endpoint of the host, such as "http://localhost:11434".
	URL string `json:"url"`
	// Models lists the model identifiers that are available or desired on the host.
	Models []string `json:"models"`
	// SystemPrompt sets a custom system prompt for all requests; when empty, the model's default is used.
	SystemPrompt string     `json:"systemprompt"`
	Parameters   Parameters `json:"parameters"`
}

Host describes a language model host and its configured models. It is used by the TUI to display selectable hosts and by the network layer to build API requests.

type LLMResponseMeta

type LLMResponseMeta struct {
	// Model is the name of the model that produced the response.
	Model string `json:"model"`
	// CreatedAt is the time when the response metadata was assembled.
	CreatedAt time.Time `json:"created_at"`
	// Done indicates whether the stream has finished.
	Done bool `json:"done"`
	// TotalDuration is the total request time in nanoseconds.
	TotalDuration int64 `json:"total_duration"`
	// LoadDuration is the model load time in nanoseconds.
	LoadDuration int64 `json:"load_duration"`
	// PromptEvalCount is the number of prompt tokens evaluated.
	PromptEvalCount int `json:"prompt_eval_count"`
	// PromptEvalDuration is the prompt evaluation time in nanoseconds.
	PromptEvalDuration int64 `json:"prompt_eval_duration"`
	// EvalCount is the number of tokens generated during response.
	EvalCount int `json:"eval_count"`
	// EvalDuration is the response evaluation time in nanoseconds.
	EvalDuration int64 `json:"eval_duration"`
}

LLMResponseMeta holds timing and tokenization metrics for a model response. The metadata typically arrives on the final chunk of a streaming response and is rendered when debug mode is enabled.

type Parameters

type Parameters struct {
	TopK             *int     `json:"top_k,omitempty"`
	TopP             *float64 `json:"top_p,omitempty"`
	MinP             *float64 `json:"min_p,omitempty"`
	TFSZ             *float64 `json:"tfs_z,omitempty"`
	TypicalP         *float64 `json:"typical_p,omitempty"`
	RepeatLastN      *int     `json:"repeat_last_n,omitempty"`
	Temperature      *float64 `json:"temperature,omitempty"`
	RepeatPenalty    *float64 `json:"repeat_penalty,omitempty"`
	PresencePenalty  *float64 `json:"presence_penalty,omitempty"`
	FrequencyPenalty *float64 `json:"frequency_penalty,omitempty"`
}

Parameters defines generation settings for a host. All fields are optional; zero values imply unset.

Jump to

Keyboard shortcuts

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