history

package
v0.28.4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageEntry

type MessageEntry struct {
	Timestamp time.Time `json:"timestamp"`
	Role      string    `json:"role"`
	Content   string    `json:"content"`
	Model     string    `json:"model,omitempty"`
}

MessageEntry はタイムスタンプ付きメッセージ

type Session

type Session struct {
	ID           string
	Model        string
	StartTime    time.Time
	LastModified time.Time
	Messages     []MessageEntry
}

Session は会話セッションを表す

func NewSession

func NewSession(model string) *Session

NewSession は新しいセッションを作成

func (*Session) AddMessage

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

AddMessage はメッセージをセッションに追加

func (*Session) ToAPIMessages

func (s *Session) ToAPIMessages() []api.Message

ToAPIMessages はAPI形式に変換

type SessionMetadata

type SessionMetadata struct {
	ID           string    `json:"session_id"`
	Model        string    `json:"model"`
	StartTime    time.Time `json:"start_time"`
	LastModified time.Time `json:"last_modified"`
	MessageCount int       `json:"message_count"`
	Preview      string    `json:"preview"`
}

SessionMetadata はセッション一覧用のメタデータ

type Storage

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

Storage は履歴の永続化を管理

func NewStorage

func NewStorage() (*Storage, error)

NewStorage はストレージインスタンスを作成

func (*Storage) GetLastSession

func (st *Storage) GetLastSession() (string, error)

GetLastSession は最新のセッションIDを返す

func (*Storage) ListSessions

func (st *Storage) ListSessions() ([]SessionMetadata, error)

ListSessions は全セッションを新しい順で返す

func (*Storage) Load

func (st *Storage) Load(sessionID string) (*Session, error)

Load はセッションファイルから読み込み

func (*Storage) Save

func (st *Storage) Save(session *Session) error

Save はメッセージをJSONLファイルに追記

Jump to

Keyboard shortcuts

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