formatting

package
v0.86.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

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 FormatDisabled

func FormatDisabled() string

FormatDisabled formats a disabled status

func FormatEnabled

func FormatEnabled() string

FormatEnabled formats an enabled status

func FormatError

func FormatError(message string) string

FormatError creates a properly formatted error message without duplicate symbols

func FormatErrorCLI

func FormatErrorCLI(message string) string

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

func FormatResponsiveCodeBlock(code string, terminalWidth int) string

FormatResponsiveCodeBlock formats code blocks with responsive width

func FormatResponsiveMessage

func FormatResponsiveMessage(content string, width int) string

FormatResponsiveMessage formats a message with responsive text wrapping

func FormatSuccess

func FormatSuccess(message string) string

FormatSuccess creates a properly formatted success message

func FormatToolCall

func FormatToolCall(toolName string, args map[string]any) string

FormatToolCall formats a tool call for consistent display across the application

func FormatToolCallWithOptions

func FormatToolCallWithOptions(toolName string, args map[string]any, expanded bool) string

FormatToolCallWithOptions formats a tool call with options for expansion

func FormatWarning

func FormatWarning(message string) string

FormatWarning creates a properly formatted warning message

func GetResponsiveWidth

func GetResponsiveWidth(terminalWidth int) int

GetResponsiveWidth calculates appropriate width based on terminal size

func TruncateText

func TruncateText(text string, maxLength int) string

TruncateText truncates text to fit within maxLength, adding "..." if needed

func WrapText

func WrapText(text string, width int) string

WrapText wraps text to fit within the specified width using wordwrap

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
)

Jump to

Keyboard shortcuts

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