Documentation
¶
Index ¶
- Constants
- type MsgAgentSet
- type MsgCompletionLoopDone
- type MsgConversationDeleted
- type MsgConversationListLoaded
- type MsgConversationLoaded
- type MsgConversationPersisted
- type MsgConversationSearchResults
- type MsgMessageAdded
- type MsgMessageUpdated
- type MsgModelSet
- type MsgResponseChunk
- type MsgResponseCompleted
- type MsgResponseStopped
- type MsgTitleGenerated
- type MsgToolsConfirmed
- type SelectionBehavior
- type Service
- func (s *Service) BranchMessage(index int, content string) tea.Cmd
- func (s *Service) ConfirmTools(confirmations []api.ToolConfirmation) tea.Cmd
- func (s *Service) CycleSelection(message *conversation.Message, forward bool, isRoot bool) tea.Cmd
- func (s *Service) DeleteConversation(id uint) tea.Cmd
- func (s *Service) DeleteMessage(index int, withDescendants bool) tea.Cmd
- func (s *Service) GenerateTitle() tea.Cmd
- func (s *Service) LoadConversation(id uint, selectBehavior SelectionBehavior) tea.Cmd
- func (s *Service) LoadConversationList() tea.Cmd
- func (s *Service) LoadThread(id uint) (*conversation.Thread, error)
- func (s *Service) NewConversation() tea.Cmd
- func (s *Service) PersistConversation(next tea.Cmd) tea.Cmd
- func (s *Service) PersistTitle() tea.Cmd
- func (s *Service) SearchConversations(query string) tea.Cmd
- func (s *Service) SendMessage(parts []api.ContentPart) tea.Cmd
- func (s *Service) SetAgent(agent *api.Agent) tea.Cmd
- func (s *Service) SetModel(model *api.Model) tea.Cmd
- func (s *Service) StartCompletionStep() tea.Cmd
- func (s *Service) StopResponse() tea.Cmd
- func (s *Service) UpdateMessage(index int, content string) tea.Cmd
- type Session
- type TUI
Constants ¶
const CONVERSATION_LIST_COUNT = 250
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MsgAgentSet ¶
MsgAgentSet is sent when the agent is set
type MsgCompletionLoopDone ¶
type MsgCompletionLoopDone struct{}
MsgCompletionLoopDone is sent when the completion step has finished
type MsgConversationDeleted ¶
type MsgConversationDeleted struct {
ConversationID uint
}
MsgConversationDeleted is sent when a conversation is deleted
type MsgConversationListLoaded ¶
type MsgConversationListLoaded struct {
Conversations conversation.ConversationList
}
MsgConversationListLoaded is sent when the conversation list is loaded
type MsgConversationLoaded ¶
type MsgConversationLoaded struct {
Thread *conversation.Thread
SelectionBehavior SelectionBehavior
}
MsgConversationLoaded is sent when a conversation is loaded
type MsgConversationPersisted ¶
MsgConversationPersisted is sent when conversation is persisted
type MsgConversationSearchResults ¶
type MsgConversationSearchResults struct {
Conversations conversation.ConversationList
Query string
}
MsgConversationSearchResults is sent when conversation search completes
type MsgMessageAdded ¶
type MsgMessageAdded struct {
Message conversation.Message
Index int
}
MsgMessageAdded is sent when a message is added
type MsgMessageUpdated ¶
type MsgMessageUpdated struct {
Message conversation.Message
Index int
}
MsgMessageUpdated is sent when a message is updated
type MsgModelSet ¶
MsgModelSet is sent when the model is set
type MsgResponseChunk ¶
type MsgResponseChunk struct {
Kind api.ChunkKind
Text string
TokenCount uint
NextEventCmd tea.Cmd
}
MsgResponseChunk is sent for each response chunk
type MsgResponseCompleted ¶
MsgResponseCompleted is sent when response is complete
type MsgResponseStopped ¶
type MsgResponseStopped struct{}
MsgResponseStopped is sent when response is stopped by the user
type MsgTitleGenerated ¶
type MsgTitleGenerated struct {
Title string
}
MsgTitleGenerated is sent when title is generated
type MsgToolsConfirmed ¶ added in v0.6.0
type MsgToolsConfirmed struct {
AllRejected bool
}
MsgToolsConfirmed is sent when tool execution completes successfully
type SelectionBehavior ¶
type SelectionBehavior int
SelectionBehavior controls where the selected message lands after a conversation load
const ( SelectionEnd SelectionBehavior = iota // jump to the last message SelectionStart // jump to the first message SelectionKeep // keep the current selected index )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) BranchMessage ¶
BranchMessage creates a new message with the given content branching off from the same parent as the message at index, without copying descendants. The new message is set as the selected path. Used when editing a message that already has replies.
func (*Service) ConfirmTools ¶ added in v0.6.0
func (s *Service) ConfirmTools(confirmations []api.ToolConfirmation) tea.Cmd
ConfirmTools executes the tool calls in the last message using the given confirmations and appends results to the thread. Runs asynchronously; emits MsgToolsConfirmed on success or MsgError on failure.
func (*Service) CycleSelection ¶
func (*Service) DeleteMessage ¶
func (*Service) GenerateTitle ¶
func (*Service) LoadConversation ¶
func (s *Service) LoadConversation(id uint, selectBehavior SelectionBehavior) tea.Cmd
func (*Service) LoadConversationList ¶
func (*Service) LoadThread ¶
func (s *Service) LoadThread(id uint) (*conversation.Thread, error)
LoadThread fetches a conversation by ID, loads its message thread, and restores the saved agent and workspace. Shared by the sync initial-load path and the async Service.LoadConversation.
func (*Service) NewConversation ¶
func (*Service) PersistTitle ¶
PersistTitle saves only the conversation metadata (e.g. title) to the repo without re-persisting messages. Used after title generation.
func (*Service) SendMessage ¶
func (s *Service) SendMessage(parts []api.ContentPart) tea.Cmd
func (*Service) StartCompletionStep ¶ added in v0.6.0
StartCompletionStep configures the thread and starts a single completion step. Events are emitted as tea.Msg values via the returned command chain.
func (*Service) StopResponse ¶
type Session ¶
type Session struct {
Model *api.Model
Agent *api.Agent
Effort api.ReasoningEffort
Temperature float32
MaxTokens int
// Non-nil when explicitly provided by the user (e.g. via CLI flags).
// When switching models, these values are kept instead of adopting
// the new model's defaults.
TemperatureOverride *float32
MaxTokensOverride *int
}
Session holds the active model and agent configuration.
type TUI ¶
type TUI struct {
Ctx *lmcli.Context
Service Service
Conversations conversation.ConversationList
Thread *conversation.Thread
Session Session
// InitialMessage is an optional message to send immediately when the
// chat view opens. Cleared after being consumed.
InitialMessage string
}
func New ¶
func New(ctx *lmcli.Context, initialConversation *conversation.Conversation, temperatureOverride *float32, maxTokensOverride *int) *TUI