Documentation
¶
Index ¶
- Variables
- type ConversationView
- func (cv *ConversationView) AddMessage(msg Message)
- func (cv *ConversationView) AppendToLast(content string)
- func (cv *ConversationView) Blur()
- func (cv *ConversationView) Clear()
- func (cv *ConversationView) Focus()
- func (cv *ConversationView) Focused() bool
- func (cv *ConversationView) GetMessages() []Message
- func (cv *ConversationView) GetSelectionManager() *selection.SelectionManager
- func (cv *ConversationView) Init() tea.Cmd
- func (cv *ConversationView) MessageCount() int
- func (cv *ConversationView) ScrollToBottom()
- func (cv *ConversationView) SetMessageStreaming(id string, streaming bool)
- func (cv *ConversationView) Update(msg tea.Msg) (tui.Component, tea.Cmd)
- func (cv *ConversationView) View() string
- type ConversationViewOption
- func WithConversationAutoScroll(auto bool) ConversationViewOption
- func WithConversationDesignTokens(tokens *design.DesignTokens) ConversationViewOption
- func WithConversationMouseSelection(enabled bool) ConversationViewOption
- func WithConversationSpinner(spinner Spinner) ConversationViewOption
- func WithConversationTheme(theme string) ConversationViewOption
- func WithMaxMessages(max int) ConversationViewOption
- func WithShowTimestamps(show bool) ConversationViewOption
- type Message
- type MessageRole
- type Spinner
Constants ¶
This section is empty.
Variables ¶
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) 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