Help us shape the future of Go! Take the 2026 Go Developer Survey

chat

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SpinnerThinking = Spinner{
	Frames: []string{".", "+", "*", "÷", "•"},
}

SpinnerThinking - Codex/Claude-style thinking animation (small to large).

Functions

This section is empty.

Types

type ConversationView

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

ConversationView renders a scrollable transcript.

func NewConversationView

func NewConversationView(opts ...ConversationViewOption) *ConversationView

NewConversationView creates a conversation component.

func (*ConversationView) AddMessage

func (cv *ConversationView) AddMessage(msg Message)

AddMessage appends a new message.

func (*ConversationView) AppendToLast

func (cv *ConversationView) AppendToLast(content string)

AppendToLast appends text to the latest message.

func (*ConversationView) Blur

func (cv *ConversationView) Blur()

Blur marks this component as blurred.

func (*ConversationView) Clear

func (cv *ConversationView) Clear()

Clear removes all messages and resets scroll.

func (*ConversationView) Focus

func (cv *ConversationView) Focus()

Focus marks this component as focused.

func (*ConversationView) Focused

func (cv *ConversationView) Focused() bool

Focused reports focus state.

func (*ConversationView) GetMessages

func (cv *ConversationView) GetMessages() []Message

GetMessages returns a copy of all messages.

func (*ConversationView) GetSelectionManager

func (cv *ConversationView) GetSelectionManager() *selection.SelectionManager

GetSelectionManager returns the conversation selection manager.

func (*ConversationView) Init

func (cv *ConversationView) Init() tea.Cmd

Init initializes the component.

func (*ConversationView) MessageCount

func (cv *ConversationView) MessageCount() int

MessageCount returns number of retained messages.

func (*ConversationView) ScrollToBottom

func (cv *ConversationView) ScrollToBottom()

ScrollToBottom jumps to latest content.

func (*ConversationView) SetMessageStreaming

func (cv *ConversationView) SetMessageStreaming(id string, streaming bool)

SetMessageStreaming updates streaming state for a message by ID.

func (*ConversationView) Update

func (cv *ConversationView) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles Bubble Tea messages.

func (*ConversationView) View

func (cv *ConversationView) View() string

View renders the conversation.

type ConversationViewOption

type ConversationViewOption func(*ConversationView)

ConversationViewOption configures a ConversationView.

func WithConversationAutoScroll

func WithConversationAutoScroll(auto bool) ConversationViewOption

WithConversationAutoScroll controls auto-scroll behavior.

func WithConversationDesignTokens

func WithConversationDesignTokens(tokens *design.DesignTokens) ConversationViewOption

WithConversationDesignTokens applies design-system tokens.

func WithConversationMouseSelection

func WithConversationMouseSelection(enabled bool) ConversationViewOption

WithConversationMouseSelection controls mouse text selection behavior.

func WithConversationSpinner

func WithConversationSpinner(spinner Spinner) ConversationViewOption

WithConversationSpinner sets the streaming spinner.

func WithConversationTheme

func WithConversationTheme(theme string) ConversationViewOption

WithConversationTheme applies a named design-system theme.

func WithMaxMessages

func WithMaxMessages(max int) ConversationViewOption

WithMaxMessages limits retained messages (0 means unlimited).

func WithShowTimestamps

func WithShowTimestamps(show bool) ConversationViewOption

WithShowTimestamps controls timestamp visibility.

type Message

type Message struct {
	ID        string
	Role      MessageRole
	Content   string
	Timestamp time.Time
	Streaming bool
}

Message is a single conversation item.

type MessageRole

type MessageRole int

MessageRole identifies who authored a message.

const (
	RoleUser MessageRole = iota
	RoleAssistant
	RoleSystem
)

func (MessageRole) String

func (r MessageRole) String() string

type Spinner

type Spinner struct {
	Frames []string
}

Spinner defines an animation sequence.

func (Spinner) GetFrame

func (s Spinner) GetFrame(index int) string

GetFrame returns the frame at the given index.

Jump to

Keyboard shortcuts

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