message

package
v1.128.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ar *animation.Runtime, msg, previous *types.Message) *messageModel

New creates a new message view

Types

type AssistantSegments added in v1.128.0

type AssistantSegments struct {
	Header []string
	Stable []string
	Tail   []string
}

AssistantSegments is a line-oriented active assistant rendering. Header and Stable are retained by the message view and immutable until the next width change; Tail contains only the mutable markdown block.

type Model

type Model interface {
	layout.Model
	layout.Sizeable
	SetMessage(msg *types.Message) tea.Cmd
	AppendContent(content string) tea.Cmd
	SetSelected(selected bool)
	SetHovered(hovered bool)
	CodeBlocks() []markdown.CodeBlock
	// Finalize releases per-message render state that is only needed while the
	// message is actively streaming. The message content and code-block metadata
	// are preserved; calling View() afterwards still produces correct output
	// without retaining a per-view render cache or IncrementalRenderer.
	Finalize()
	// HasLiveRenderState reports whether this view currently retains a
	// populated renderCache or an IncrementalRenderer instance. Used by tests
	// to assert that finalized views have actually released their per-message
	// render state without reaching into unexported fields via reflection.
	HasLiveRenderState() bool
	// RenderedSegments exposes immutable header/stable blocks separately from
	// the mutable tail so transcript follow-tail rendering need not flatten the
	// complete active response on every chunk.
	RenderedSegments(width int) (AssistantSegments, bool)
}

Model represents a view that can render a message

Jump to

Keyboard shortcuts

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