session

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	Key      string              `json:"key"`
	Messages []providers.Message `json:"messages"`
	Summary  string              `json:"summary,omitempty"`
	Created  time.Time           `json:"created"`
	Updated  time.Time           `json:"updated"`
}

type SessionManager

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

func NewSessionManager

func NewSessionManager(storage string) *SessionManager

func (*SessionManager) AddFullMessage added in v0.1.1

func (sm *SessionManager) AddFullMessage(sessionKey string, msg providers.Message)

AddFullMessage adds a complete message with tool calls and tool call ID to the session. This is used to save the full conversation flow including tool calls and tool results.

func (*SessionManager) AddMessage

func (sm *SessionManager) AddMessage(sessionKey, role, content string)

func (*SessionManager) GetHistory

func (sm *SessionManager) GetHistory(key string) []providers.Message

func (*SessionManager) GetOrCreate

func (sm *SessionManager) GetOrCreate(key string) *Session

func (*SessionManager) GetSummary added in v0.1.1

func (sm *SessionManager) GetSummary(key string) string

func (*SessionManager) Save

func (sm *SessionManager) Save(key string) error

func (*SessionManager) SetHistory added in v0.1.2

func (sm *SessionManager) SetHistory(key string, history []providers.Message)

SetHistory updates the messages of a session.

func (*SessionManager) SetSummary added in v0.1.1

func (sm *SessionManager) SetSummary(key string, summary string)

func (*SessionManager) TruncateHistory added in v0.1.1

func (sm *SessionManager) TruncateHistory(key string, keepLast int)

Jump to

Keyboard shortcuts

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