Documentation
¶
Index ¶
- func ExtractTextFromContent(content sdk.MessageContent, images []domain.ImageAttachment) string
- func FormatCost(cost float64) string
- func FormatDisabled() string
- func FormatEnabled() string
- func FormatError(message string) string
- func FormatErrorCLI(message string) string
- func FormatMessage(msgType MessageType, message string) string
- func FormatResponsiveCodeBlock(code string, terminalWidth int) string
- func FormatResponsiveMessage(content string, width int) string
- func FormatSuccess(message string) string
- func FormatToolCall(toolName string, args map[string]any) string
- func FormatToolCallWithOptions(toolName string, args map[string]any, expanded bool) string
- func FormatWarning(message string) string
- func GetResponsiveWidth(terminalWidth int) int
- func TruncateText(text string, maxLength int) string
- func WrapText(text string, width int) string
- type ConversationLineFormatter
- type MessageType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTextFromContent ¶
func ExtractTextFromContent(content sdk.MessageContent, images []domain.ImageAttachment) string
ExtractTextFromContent extracts text from potentially multimodal message content
func FormatCost ¶ added in v0.87.0
FormatCost formats cost with adaptive precision based on magnitude Returns "-" for zero cost, and uses 2-4 decimal places based on the amount
func FormatError ¶
FormatError creates a properly formatted error message without duplicate symbols
func FormatErrorCLI ¶
FormatErrorCLI creates an error message with red color for CLI output
func FormatMessage ¶
func FormatMessage(msgType MessageType, message string) string
FormatMessage formats a message with appropriate icons and styling
func FormatResponsiveCodeBlock ¶
FormatResponsiveCodeBlock formats code blocks with responsive width
func FormatResponsiveMessage ¶
FormatResponsiveMessage formats a message with responsive text wrapping
func FormatSuccess ¶
FormatSuccess creates a properly formatted success message
func FormatToolCall ¶
FormatToolCall formats a tool call for consistent display across the application
func FormatToolCallWithOptions ¶
FormatToolCallWithOptions formats a tool call with options for expansion
func FormatWarning ¶
FormatWarning creates a properly formatted warning message
func GetResponsiveWidth ¶
GetResponsiveWidth calculates appropriate width based on terminal size
func TruncateText ¶
TruncateText truncates text to fit within maxLength, adding "..." if needed
Types ¶
type ConversationLineFormatter ¶
type ConversationLineFormatter struct {
// contains filtered or unexported fields
}
ConversationLineFormatter converts conversation entries to text lines
func NewConversationLineFormatter ¶
func NewConversationLineFormatter(width int, toolFormatter domain.ToolFormatter) *ConversationLineFormatter
NewConversationLineFormatter creates a new conversation line formatter
func (*ConversationLineFormatter) FormatConversationToLines ¶
func (f *ConversationLineFormatter) FormatConversationToLines(conversation []domain.ConversationEntry) []string
FormatConversationToLines converts conversation entries to plain text lines
func (*ConversationLineFormatter) SetWidth ¶
func (f *ConversationLineFormatter) SetWidth(width int)
SetWidth updates the formatter width
type MessageType ¶
type MessageType int
MessageType represents different types of messages
const ( MessageSuccess MessageType = iota MessageError MessageWarning MessageInfo MessageProgress )