Help us shape the future of Go! Take the 2026 Go Developer Survey

session

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages sessions

func NewManager

func NewManager(baseDir string) *Manager

NewManager creates a session manager

func (*Manager) GetOrCreate

func (m *Manager) GetOrCreate(key string) *Session

GetOrCreate gets or creates a session

func (*Manager) Reset added in v0.6.0

func (m *Manager) Reset(key string)

Reset clears a session's history in memory and removes its file from disk.

func (*Manager) Save

func (m *Manager) Save(sess *Session) error

Save persists session to disk

type Message

type Message struct {
	Role      string    `json:"role"`
	Content   string    `json:"content"`
	Timestamp time.Time `json:"timestamp"`
}

Message represents a single message in session

type Session

type Session struct {
	Key      string
	Messages []*Message
	// contains filtered or unexported fields
}

Session represents a conversation session

func (*Session) AddMessage

func (s *Session) AddMessage(role, content string)

AddMessage adds a message to the session

func (*Session) GetHistory

func (s *Session) GetHistory(limit int) []*Message

GetHistory returns the last n messages

Jump to

Keyboard shortcuts

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