chatbubble

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package chatbubble renders a role-aware speech bubble with width-aware wrap.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bubble

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

Bubble renders one chat message.

func New

func New(t theme.Theme) Bubble

New constructs a bubble using the given theme.

func (Bubble) View

func (b Bubble) View() string

View renders the bubble to a string. Safe to call repeatedly.

func (Bubble) WithLabel

func (b Bubble) WithLabel(s string) Bubble

WithLabel sets the role label printed above the bubble. If empty, no label is rendered.

func (Bubble) WithRole

func (b Bubble) WithRole(r Role) Bubble

WithRole sets the role used for styling.

func (Bubble) WithText

func (b Bubble) WithText(s string) Bubble

WithText sets the body text.

func (Bubble) WithWidth

func (b Bubble) WithWidth(w int) Bubble

WithWidth caps the bubble's content width in cells.

type Role

type Role string

Role drives the bubble's color and alignment.

const (
	RoleUser      Role = "user"
	RoleAssistant Role = "assistant"
	RoleSystem    Role = "system"
	RoleTool      Role = "tool"
)

Jump to

Keyboard shortcuts

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