chat

package
v0.0.0-...-b6bcde8 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Unlicense Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Esc

func Esc(code ...int) string

Types

type Chat

type Chat struct {
	Model        string
	PromptReader io.Reader
	Interactive  bool
	Messages     []api.Message

	Display io.Writer
	// contains filtered or unexported fields
}

func New

func New(client *api.Client, messages []api.Message) (*Chat, error)

func (*Chat) Confirmf

func (c *Chat) Confirmf(format string, args ...any) (bool, string, error)

func (*Chat) GetPrompt

func (c *Chat) GetPrompt() (string, error)

func (*Chat) Run

func (c *Chat) Run(ctx context.Context) error

Run starts the prompting loop for the chat, reading from the prompt source until inputs are exhausted.

func (*Chat) Send

func (c *Chat) Send(ctx context.Context, prompt string) (io.ReadCloser, error)

Jump to

Keyboard shortcuts

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