chatcompletion

package
v0.267.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	AgentService     agentdomain.AgentService
	ConversationRepo convdomain.ConversationRepository
	ModelService     convdomain.ModelService
	StateStore       stateStore
}

Options bundles the dependencies needed to construct a Runner.

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner owns the LLM streaming lifecycle for a chat session. Clearing the active tool call indicator is left to the ChatHandler wrappers.

func NewRunner

func NewRunner(opts Options) *Runner

NewRunner creates a new ChatCompletionRunner.

func (*Runner) HandleChatChunk

func (r *Runner) HandleChatChunk(msg agentdomain.ChatChunkEvent) tea.Cmd

HandleChatChunk forwards a streaming content delta to the UI and adjusts chat status if the chunk indicates a thinking → generating transition (or vice versa).

func (*Runner) HandleChatComplete

func (r *Runner) HandleChatComplete(msg agentdomain.ChatCompleteEvent) tea.Cmd

HandleChatComplete restores the pending model (if any), updates chat status, refreshes history, emits tool-call previews, and signals completion.

func (*Runner) HandleChatError

func (r *Runner) HandleChatError(msg agentdomain.ChatErrorEvent) tea.Cmd

HandleChatError tears down session state and emits a sticky error event (with a friendlier message for "timed out" errors).

func (*Runner) HandleChatStart

func (r *Runner) HandleChatStart(_ agentdomain.ChatStartEvent) tea.Cmd

HandleChatStart transitions chat status to Starting and emits the initial "Starting response..." status. Clearing the orchestrator's active-tool indicator is the orchestrator's responsibility (see ChatHandler wrapper).

func (*Runner) HandleOptimizationStatus

func (r *Runner) HandleOptimizationStatus(event agentdomain.OptimizationStatusEvent) tea.Cmd

HandleOptimizationStatus surfaces the "Optimizing conversation..." status transitions emitted by the conversation optimizer.

func (*Runner) SetPendingRestoration

func (r *Runner) SetPendingRestoration(originalModel string)

SetPendingRestoration records that a temporary /model switch is in effect and that originalModel should be restored once the next completion ends.

func (*Runner) Start

Start opens the stream off-loop and returns its result as a message. The handler initializes the session and its listener in Update.

Jump to

Keyboard shortcuts

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