chat

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package chat provides chat channel integration using omnichat.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelInfo

type ChannelInfo struct {
	ProviderName string `json:"provider_name"`
	Status       string `json:"status"`
}

ChannelInfo describes a chat channel.

type ChatSession

type ChatSession struct {
	ID           string
	ProviderName string
	ChatID       string
	StartTime    time.Time
	Messages     []provider.IncomingMessage
	// contains filtered or unexported fields
}

ChatSession represents an active chat session.

func (*ChatSession) AddMessage

func (cs *ChatSession) AddMessage(msg provider.IncomingMessage)

AddMessage adds a message to the session.

func (*ChatSession) RecentMessages

func (cs *ChatSession) RecentMessages(n int) []provider.IncomingMessage

RecentMessages returns the last n messages.

type Manager

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

Manager orchestrates chat channels using the omnichat stack.

func New

func New(cfg *config.Config, logger *slog.Logger) (*Manager, error)

New creates a new chat manager.

func (*Manager) Close

func (m *Manager) Close() error

Close shuts down the chat manager.

func (*Manager) GetMessages

func (m *Manager) GetMessages(providerName, chatID string, limit int) ([]MessageInfo, error)

GetMessages returns recent messages from a session.

func (*Manager) GetSession

func (m *Manager) GetSession(providerName, chatID string) *ChatSession

GetSession returns a chat session by provider and chat ID.

func (*Manager) Initialize

func (m *Manager) Initialize(ctx context.Context) error

Initialize sets up the chat providers based on configuration.

func (*Manager) ListChannels

func (m *Manager) ListChannels() []ChannelInfo

ListChannels returns all available chat channels.

func (*Manager) SendMessage

func (m *Manager) SendMessage(ctx context.Context, providerName, chatID, content string) error

SendMessage sends a message to a chat channel.

func (*Manager) SendMessageWithReply

func (m *Manager) SendMessageWithReply(ctx context.Context, providerName, chatID, content, replyTo string) error

SendMessageWithReply sends a message as a reply.

type MessageInfo

type MessageInfo struct {
	ID         string    `json:"id"`
	SenderID   string    `json:"sender_id"`
	SenderName string    `json:"sender_name"`
	Content    string    `json:"content"`
	Timestamp  time.Time `json:"timestamp"`
}

MessageInfo describes a chat message.

Jump to

Keyboard shortcuts

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