recommend

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package recommend supplies detail-page related rows. Home and section composition, taste models and caches live in internal/personalize.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterTitles

func FilterTitles(titles []core.Title, user *core.User) []core.Title

FilterTitles drops titles above the user's content-rating limit (by age level, see contentrating.Exceeds), preserving order.

Types

type EventSource

type EventSource interface {
	Subscribe(func(state.Event)) func()
}

EventSource invalidates the model cache on watch-state changes (internal/state.State).

type LLMSource

type LLMSource interface {
	ThemedRows(ctx context.Context, user *core.User, seeds []core.Title, limit int) ([]core.Hub, error)
	MoreLikeThis(ctx context.Context, title *core.Title, limit int) ([]core.Title, error)
}

LLMSource is the optional LLM dependency (internal/llm.Service). ThemedRows must be non-blocking (serve stale/omit while computing).

type Options

type Options struct {
	Catalog       core.Catalog
	State         core.State
	LLM           LLMSource
	Logger        *slog.Logger
	SourceTimeout time.Duration
	Scorer        core.PersonalScorer
}

Options supplies only the dependencies used by related recommendations.

type Recommender

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

func New

func New(o Options) *Recommender

func (*Recommender) Close

func (r *Recommender) Close()

Close is retained for callers which previously managed a model subscription.

func (*Recommender) HomeHubs

func (r *Recommender) HomeHubs(ctx context.Context, u *core.User, limit int) ([]core.Hub, error)

func (*Recommender) Related

func (r *Recommender) Related(ctx context.Context, user *core.User, key core.RatingKey, limit int) ([]core.Hub, error)

func (*Recommender) SectionHubs

func (r *Recommender) SectionHubs(ctx context.Context, u *core.User, typ core.MediaType, limit int) ([]core.Hub, error)

func (*Recommender) SetHomeSource

func (r *Recommender) SetHomeSource(home core.Recommender)

SetHomeSource preserves the core.Recommender contract using the one production Home engine. It does not maintain another model, cache, or event subscription.

func (*Recommender) SetScorer

func (r *Recommender) SetScorer(s core.PersonalScorer)

type TraktHistorySource

type TraktHistorySource interface {
	PullHistory(ctx context.Context, userID int64, limit int) ([]core.HistoryEntry, error)
}

TraktHistorySource is optionally implemented by the TraktSource (internal/trakt.Client does): plays recorded on Trakt from other apps are merged into the local history model as completions.

type TraktSource

type TraktSource interface {
	Recommendations(ctx context.Context, userID int64, limit int) ([]core.Title, error)
	Watchlist(ctx context.Context, userID int64, limit int) ([]core.Title, error)
}

TraktSource is the optional Trakt dependency (internal/trakt.Client). Implementations return (nil, nil) for users who have not connected.

Jump to

Keyboard shortcuts

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