chatbox

package
v0.0.0-...-22dc404 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	User   = Identity("user")
	System = Identity("system")
)

Variables

View Source
var ErrCloseChat = errors.New("close chat")

Functions

This section is empty.

Types

type ChatBackend

type ChatBackend interface {
	HandleInput(ctx context.Context, in string, out chan<- *Message) error
}

HandleInputFunc should process `in`, closing `out` once all processing has completed. The input handler is responsible for echoing the input into `out` if desired. If the handler decides the chat UI should be closed, the handler should return ErrCloseChat The chatbox will notify the handler of any cancellation via the ctx.

type ChatBox

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

func NewChatbox

func NewChatbox(app *tview.Application, handler ChatBackend, opts ChatBoxOpts) *ChatBox

func (*ChatBox) Done

func (cb *ChatBox) Done() <-chan bool

func (*ChatBox) HandleInput

func (cb *ChatBox) HandleInput(ctx context.Context, in string)

func (*ChatBox) Widget

func (cb *ChatBox) Widget() modal.InputCaptureable

type ChatBoxOpts

type ChatBoxOpts struct {
	InputHeader string
	Welcome     string
}

type Identity

type Identity string

type Message

type Message struct {
	Who     Identity
	Content string
}

Jump to

Keyboard shortcuts

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