client

package
v0.4.18 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatClient

type ChatClient struct {
	ID           string
	MessageChan  chan string
	DisconnectCh chan struct{}
	// contains filtered or unexported fields
}

ChatClient represents a connected SSE client

func NewChatClient

func NewChatClient(id string, router *events.EventRouter, options ...ChatClientOption) *ChatClient

NewChatClient creates a new SSE client

func (*ChatClient) EventToHTML

func (c *ChatClient) EventToHTML(e chat.Event) (string, error)

EventToHTML converts a chat event to HTML

func (*ChatClient) GetConversation

func (c *ChatClient) GetConversation() []*conversation.Message

GetConversation returns the current conversation

func (*ChatClient) SendUserMessage

func (c *ChatClient) SendUserMessage(ctx context.Context, message string) error

SendUserMessage sends a user message to the conversation and starts a chat step

type ChatClientOption

type ChatClientOption func(*ChatClient) error

func WithStep

func WithStep(step chat.Step) ChatClientOption

Jump to

Keyboard shortcuts

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