Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FrecentEntry ¶
type FrecentEntry struct {
Text string `json:"text"`
Score float64 `json:"score"`
LastUsed time.Time `json:"last_used"`
UseCount int `json:"use_count"`
}
FrecentEntry is a single history entry with scoring metadata.
type FrecentHistory ¶
type FrecentHistory struct {
// contains filtered or unexported fields
}
FrecentHistory tracks prompt history by frecency (frequency + recency). Entries are persisted as JSON in the user's session directory.
func NewFrecentHistory ¶
func NewFrecentHistory(filePath string) *FrecentHistory
NewFrecentHistory creates a FrecentHistory backed by the given file path. If the file exists it is loaded immediately; otherwise an empty history is created.
func (*FrecentHistory) Save ¶
func (fh *FrecentHistory) Save() error
Save persists the history to disk.
func (*FrecentHistory) Search ¶
func (fh *FrecentHistory) Search(query string, limit int) []FrecentEntry
Search returns entries matching the query, sorted by most recently used first.
func (*FrecentHistory) Upsert ¶
func (fh *FrecentHistory) Upsert(text string)
Upsert adds or updates an entry in the history.
Click to show internal directories.
Click to hide internal directories.